Refactoring file structure for protobufs.
Change-Id: I50daf100d54750f97158304d87813e67861b1422
diff --git a/incubator/protobuf/BUCK b/incubator/protobuf/BUCK
deleted file mode 100644
index 3422455..0000000
--- a/incubator/protobuf/BUCK
+++ /dev/null
@@ -1,25 +0,0 @@
-
-COMPILE_DEPS = [
- '//lib:CORE_DEPS',
- ':onos-incubator-grpc',
- '//lib:protobuf-java-3.2.0',
-]
-
-GRPC_DEPS = [
- '//lib:GRPC_1.3',
- '//lib:protobuf-java-3.2.0',
- '//lib:guava'
-]
-
-grpc_jar(
- name = 'onos-incubator-grpc',
- deps = GRPC_DEPS,
- proto_paths = ["$ONOS_ROOT/incubator/protobuf/src/main/proto"]
-)
-
-osgi_jar_with_tests(
- deps = COMPILE_DEPS,
- visibility = ['PUBLIC'],
-)
-
-
diff --git a/incubator/protobuf/models/BUCK b/incubator/protobuf/models/BUCK
new file mode 100644
index 0000000..6bfac3d
--- /dev/null
+++ b/incubator/protobuf/models/BUCK
@@ -0,0 +1,30 @@
+
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ ':onos-incubator-protobuf-models-proto',
+ '//lib:protobuf-java-3.2.0',
+ '//lib:GRPC_1.3'
+]
+
+GRPC_DEPS = [
+ '//lib:GRPC_1.3',
+ '//lib:protobuf-java-3.2.0',
+ '//lib:guava'
+]
+
+BUNDLES = [
+ ':onos-incubator-protobuf-models',
+ ':onos-incubator-protobuf-models-proto',
+ '//lib:protobuf-java-3.2.0',
+]
+
+grpc_jar(
+ name = 'onos-incubator-protobuf-models-proto',
+ deps = GRPC_DEPS,
+ proto_paths = ["$ONOS_ROOT/incubator/protobuf/models/src/main/proto"]
+)
+
+osgi_jar_with_tests(
+ deps = COMPILE_DEPS,
+ visibility = ['PUBLIC'],
+)
diff --git a/incubator/protobuf/models/pom.xml b/incubator/protobuf/models/pom.xml
new file mode 100644
index 0000000..81521dd
--- /dev/null
+++ b/incubator/protobuf/models/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>onos-incubator-protobuf</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.11.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-incubator-protobuf-models</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS Protobuf object models and translators</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <onos.app.name>org.onosproject.incubator.protobuf.models</onos.app.name>
+ <onos.app.title>ONOS Protocol Buffers models and translators</onos.app.title>
+ </properties>
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>3.0.8</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <!-- TODO This is included to suppress the generation of javadocs for
+ this package. There is a problem when we try to package the
+ auto-generated code's javadoc into a jar. -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>${basedir}/src/main/java/</sourcepath>
+ <excludePackageNames>org.onosproject.incubator.rpc.grpc</excludePackageNames>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.onosproject.grpc.net,org.onosproject.incubator.protobuf.models.utils</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java
new file mode 100644
index 0000000..ff29b27
--- /dev/null
+++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.incubator.protobuf.models;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onlab.packet.ChassisId;
+import org.onosproject.grpc.net.models.DeviceDescriptionProto;
+import org.onosproject.grpc.net.models.DeviceEnums;
+import org.onosproject.grpc.net.models.PortDescriptionProto;
+import org.onosproject.grpc.net.models.PortEnums.PortType;
+import org.onosproject.grpc.net.models.DeviceEnums.DeviceType;
+import org.onosproject.grpc.net.models.PortStatisticsProto;
+import org.onosproject.net.Annotations;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.MastershipRole;
+import org.onosproject.net.Port;
+import org.onosproject.net.Port.Type;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DefaultPortStatistics;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.device.PortStatistics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.Beta;
+
+/**
+ * gRPC message conversion related utilities.
+ */
+@Beta
+public final class ProtobufUtils {
+
+ private static final Logger log = LoggerFactory.getLogger(ProtobufUtils.class);
+
+ /**
+ * Translates gRPC enum MastershipRole to ONOS enum.
+ *
+ * @param role mastership role in gRPC enum
+ * @return equivalent in ONOS enum
+ */
+ public static MastershipRole translate(DeviceEnums.MastershipRole role) {
+ switch (role) {
+ case NONE:
+ return MastershipRole.NONE;
+ case MASTER:
+ return MastershipRole.MASTER;
+ case STANDBY:
+ return MastershipRole.STANDBY;
+ case UNRECOGNIZED:
+ log.warn("Unrecognized MastershipRole gRPC message: {}", role);
+ return MastershipRole.NONE;
+ default:
+ return MastershipRole.NONE;
+ }
+ }
+
+ /**
+ * Translates ONOS enum MastershipRole to gRPC enum.
+ *
+ * @param newRole ONOS' mastership role
+ * @return equivalent in gRPC message enum
+ */
+ public static DeviceEnums.MastershipRole translate(MastershipRole newRole) {
+ switch (newRole) {
+ case MASTER:
+ return DeviceEnums.MastershipRole.MASTER;
+ case STANDBY:
+ return DeviceEnums.MastershipRole.STANDBY;
+ case NONE:
+ default:
+ return DeviceEnums.MastershipRole.NONE;
+ }
+ }
+
+
+ /**
+ * Translates gRPC DeviceDescription to {@link DeviceDescription}.
+ *
+ * @param deviceDescription gRPC message
+ * @return {@link DeviceDescription}
+ */
+ public static DeviceDescription translate(
+ DeviceDescriptionProto.DeviceDescription deviceDescription) {
+ URI uri = URI.create(deviceDescription.getDeviceUri());
+ Device.Type type = translate(deviceDescription.getType());
+ String manufacturer = deviceDescription.getManufacturer();
+ String hwVersion = deviceDescription.getHwVersion();
+ String swVersion = deviceDescription.getSwVersion();
+ String serialNumber = deviceDescription.getSerialNumber();
+ ChassisId chassis = new ChassisId(deviceDescription.getChassisId());
+ boolean defaultAvailable = deviceDescription.getIsDefaultAvailable();
+ return new DefaultDeviceDescription(uri, type, manufacturer,
+ hwVersion, swVersion, serialNumber,
+ chassis,
+ defaultAvailable,
+ asAnnotations(deviceDescription.getAnnotationsMap()));
+ }
+
+ /**
+ * Translates {@link DeviceDescription} to gRPC DeviceDescription message.
+ *
+ * @param deviceDescription {@link DeviceDescription}
+ * @return gRPC DeviceDescription message
+ */
+ public static DeviceDescriptionProto.DeviceDescription translate(
+ DeviceDescription deviceDescription) {
+
+ return DeviceDescriptionProto.DeviceDescription.newBuilder()
+ .setDeviceUri(deviceDescription.deviceUri().toString())
+ .setType(translate(deviceDescription.type()))
+ .setManufacturer(deviceDescription.manufacturer())
+ .setHwVersion(deviceDescription.hwVersion())
+ .setSwVersion(deviceDescription.swVersion())
+ .setSerialNumber(deviceDescription.serialNumber())
+ .setChassisId(deviceDescription.chassisId().toString())
+ .setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
+ .putAllAnnotations(asMap(deviceDescription.annotations()))
+ .build();
+ }
+
+
+ /**
+ * Translates gRPC DeviceType to {@link Device.Type}.
+ *
+ * @param type gRPC message
+ * @return {@link Device.Type}
+ */
+ public static Device.Type translate(DeviceType type) {
+ switch (type) {
+ case BALANCER:
+ return Device.Type.BALANCER;
+ case CONTROLLER:
+ return Device.Type.CONTROLLER;
+ case FIBER_SWITCH:
+ return Device.Type.FIBER_SWITCH;
+ case FIREWALL:
+ return Device.Type.FIREWALL;
+ case IDS:
+ return Device.Type.IDS;
+ case IPS:
+ return Device.Type.IPS;
+ case MICROWAVE:
+ return Device.Type.MICROWAVE;
+ case OTHER:
+ return Device.Type.OTHER;
+ case OTN:
+ return Device.Type.OTN;
+ case ROADM:
+ return Device.Type.ROADM;
+ case ROADM_OTN:
+ return Device.Type.ROADM_OTN;
+ case ROUTER:
+ return Device.Type.ROUTER;
+ case SWITCH:
+ return Device.Type.SWITCH;
+ case VIRTUAL:
+ return Device.Type.VIRTUAL;
+
+ case UNRECOGNIZED:
+ default:
+ log.warn("Unexpected DeviceType: {}", type);
+ return Device.Type.OTHER;
+ }
+ }
+
+ /**
+ * Translates {@link Type} to gRPC DeviceType.
+ *
+ * @param type {@link Type}
+ * @return gRPC message
+ */
+ public static DeviceType translate(Device.Type type) {
+ switch (type) {
+ case BALANCER:
+ return DeviceType.BALANCER;
+ case CONTROLLER:
+ return DeviceType.CONTROLLER;
+ case FIBER_SWITCH:
+ return DeviceType.FIBER_SWITCH;
+ case FIREWALL:
+ return DeviceType.FIREWALL;
+ case IDS:
+ return DeviceType.IDS;
+ case IPS:
+ return DeviceType.IPS;
+ case MICROWAVE:
+ return DeviceType.MICROWAVE;
+ case OTHER:
+ return DeviceType.OTHER;
+ case OTN:
+ return DeviceType.OTN;
+ case ROADM:
+ return DeviceType.ROADM;
+ case ROADM_OTN:
+ return DeviceType.ROADM_OTN;
+ case ROUTER:
+ return DeviceType.ROUTER;
+ case SWITCH:
+ return DeviceType.SWITCH;
+ case VIRTUAL:
+ return DeviceType.VIRTUAL;
+
+ default:
+ log.warn("Unexpected Device.Type: {}", type);
+ return DeviceType.OTHER;
+ }
+ }
+
+ /**
+ * Translates gRPC PortDescription message to {@link PortDescription}.
+ *
+ * @param portDescription gRPC message
+ * @return {@link PortDescription}
+ */
+ public static PortDescription translate(PortDescriptionProto.PortDescription portDescription) {
+ PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
+ boolean isEnabled = portDescription.getIsEnabled();
+ Port.Type type = translate(portDescription.getType());
+ long portSpeed = portDescription.getPortSpeed();
+ SparseAnnotations annotations = asAnnotations(portDescription.getAnnotationsMap());
+ return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
+ }
+
+ /**
+ * Translates {@link PortDescription} to gRPC PortDescription message.
+ *
+ * @param portDescription {@link PortDescription}
+ * @return gRPC PortDescription message
+ */
+ public static PortDescriptionProto.PortDescription translate(PortDescription portDescription) {
+ return PortDescriptionProto.PortDescription.newBuilder()
+ .setPortNumber(portDescription.portNumber().toString())
+ .setIsEnabled(portDescription.isEnabled())
+ .setType(translate(portDescription.type()))
+ .setPortSpeed(portDescription.portSpeed())
+ .putAllAnnotations(asMap(portDescription.annotations()))
+ .build();
+ }
+
+ /**
+ * Translates gRPC PortType to {@link Port.Type}.
+ *
+ * @param type gRPC message
+ * @return {@link Port.Type}
+ */
+ public static Port.Type translate(org.onosproject.grpc.net.models.PortEnums.PortType type) {
+ switch (type) {
+ case COPPER:
+ return Type.COPPER;
+ case FIBER:
+ return Type.FIBER;
+ case OCH:
+ return Type.OCH;
+ case ODUCLT:
+ return Type.ODUCLT;
+ case OMS:
+ return Type.OMS;
+ case PACKET:
+ return Type.PACKET;
+ case VIRTUAL:
+ return Type.VIRTUAL;
+
+ case UNRECOGNIZED:
+ default:
+ log.warn("Unexpected PortType: {}", type);
+ return Type.COPPER;
+ }
+ }
+
+ /**
+ * Translates {@link Port.Type} to gRPC PortType.
+ *
+ * @param type {@link org.onosproject.net.Port.Type}
+ * @return gRPC message
+ */
+ public static PortType translate(Port.Type type) {
+ switch (type) {
+ case COPPER:
+ return PortType.COPPER;
+ case FIBER:
+ return PortType.FIBER;
+ case OCH:
+ return PortType.OCH;
+ case ODUCLT:
+ return PortType.ODUCLT;
+ case OMS:
+ return PortType.OMS;
+ case PACKET:
+ return PortType.PACKET;
+ case VIRTUAL:
+ return PortType.VIRTUAL;
+
+ default:
+ log.warn("Unexpected Port.Type: {}", type);
+ return PortType.COPPER;
+ }
+ }
+
+ /**
+ * Translates gRPC PortStatistics message to {@link PortStatistics}.
+ *
+ * @param portStatistics gRPC PortStatistics message
+ * @return {@link PortStatistics}
+ */
+ public static PortStatistics translate(PortStatisticsProto.PortStatistics portStatistics) {
+ // TODO implement adding missing fields
+ return DefaultPortStatistics.builder()
+ .setPort(portStatistics.getPort())
+ .setPacketsReceived(portStatistics.getPacketsReceived())
+ .setPacketsSent(portStatistics.getPacketsSent())
+ .build();
+ }
+
+ /**
+ * Translates {@link PortStatistics} to gRPC PortStatistics message.
+ *
+ * @param portStatistics {@link PortStatistics}
+ * @return gRPC PortStatistics message
+ */
+ public static PortStatisticsProto.PortStatistics translate(PortStatistics portStatistics) {
+ // TODO implement adding missing fields
+ return PortStatisticsProto.PortStatistics.newBuilder()
+ .setPort(portStatistics.port())
+ .setPacketsReceived(portStatistics.packetsReceived())
+ .setPacketsSent(portStatistics.packetsSent())
+ .build();
+ }
+
+ // may be this can be moved to Annotation itself or AnnotationsUtils
+ /**
+ * Converts Annotations to Map of Strings.
+ *
+ * @param annotations {@link Annotations}
+ * @return Map of annotation key and values
+ */
+ public static Map<String, String> asMap(Annotations annotations) {
+ if (annotations instanceof DefaultAnnotations) {
+ return ((DefaultAnnotations) annotations).asMap();
+ }
+ Map<String, String> map = new HashMap<>();
+ annotations.keys()
+ .forEach(k -> map.put(k, annotations.value(k)));
+
+ return map;
+ }
+
+ // may be this can be moved to Annotation itself or AnnotationsUtils
+ /**
+ * Converts Map of Strings to {@link SparseAnnotations}.
+ *
+ * @param annotations Map of annotation key and values
+ * @return {@link SparseAnnotations}
+ */
+ public static SparseAnnotations asAnnotations(Map<String, String> annotations) {
+ DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
+ annotations.entrySet().forEach(e -> {
+ if (e.getValue() != null) {
+ builder.set(e.getKey(), e.getValue());
+ } else {
+ builder.remove(e.getKey());
+ }
+ });
+ return builder.build();
+ }
+
+ // Utility class not intended for instantiation.
+ private ProtobufUtils() {}
+}
diff --git a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/package-info.java
similarity index 85%
rename from incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
rename to incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/package-info.java
index aa17131..ee6eb33 100644
--- a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
+++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,4 +16,4 @@
/**
* Utilities to handle ProtoBuf version of ONOS network models.
*/
-package org.onosproject.incubator.protobuf.net;
+package org.onosproject.incubator.protobuf.models;
diff --git a/incubator/protobuf/models/src/main/proto/ConnectPointProto.proto b/incubator/protobuf/models/src/main/proto/ConnectPointProto.proto
new file mode 100644
index 0000000..ecc1362
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/ConnectPointProto.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package ConnectPoint;
+
+message ConnectPoint {
+ oneof element_id {
+ // DeviceID as String DeviceId#toString
+ string device_id = 1;
+
+ // TODO add support to other element_id if required
+ }
+ // PortNumber as String PortNumber#toString
+ string port_number = 2;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto
new file mode 100644
index 0000000..b620bfa
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Device;
+
+import "DeviceEnums.proto";
+
+message DeviceDescription {
+ string device_Uri = 1;
+ Device.DeviceType type = 2;
+ string manufacturer = 3;
+ string hw_version = 4;
+ string sw_version = 5;
+ string serial_number = 6;
+ string chassis_id = 7;
+ map<string, string> annotations = 8;
+ bool is_default_available = 9;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceEnums.proto b/incubator/protobuf/models/src/main/proto/DeviceEnums.proto
new file mode 100644
index 0000000..7fb1f08
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/DeviceEnums.proto
@@ -0,0 +1,39 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Device;
+
+enum MastershipRole {
+ NONE = 0;
+ MASTER = 1;
+ STANDBY = 2;
+}
+
+enum DeviceType {
+ OTHER = 0;
+ SWITCH = 1;
+ ROUTER = 2;
+ ROADM = 3;
+ OTN = 4;
+ ROADM_OTN = 5;
+ FIREWALL = 6;
+ BALANCER = 7;
+ IPS = 8;
+ IDS = 9;
+ CONTROLLER = 10;
+ VIRTUAL = 11;
+ FIBER_SWITCH = 12;
+ MICROWAVE = 13;
+}
+
+enum DeviceEventType {
+ DEVICE_ADDED = 0;
+ DEVICE_UPDATED = 1;
+ DEVICE_REMOVED = 2;
+ DEVICE_SUSPENDED = 3;
+ DEVICE_AVAILABILITY_CHANGED = 4;
+ PORT_ADDED = 5;
+ PORT_UPDATED = 6;
+ PORT_REMOVED = 7;
+ PORT_STATS_UPDATED = 8;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto b/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto
new file mode 100644
index 0000000..9cbbf60
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+
+import "DeviceProto.proto";
+import "DeviceEnums.proto";
+import "PortProto.proto";
+
+package Device;
+
+// Corresponds to org.onosproject.net.device.DeviceEvent.
+message DeviceNotification {
+ Device.DeviceProto device = 1;
+ Device.DeviceEventType deviceEventType = 2;
+ Port.PortProto port = 3;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceProto.proto b/incubator/protobuf/models/src/main/proto/DeviceProto.proto
new file mode 100644
index 0000000..f4a81d1
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/DeviceProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Device;
+
+import "DeviceEnums.proto";
+
+// Corresponds to org.onosproject.net.Device.
+message DeviceProto {
+ string deviceId = 1;
+ Device.DeviceType type = 2;
+ string manufacturer = 3;
+ string hw_version = 4;
+ string sw_version = 5;
+ string serial_number = 6;
+ string chassis_id = 7;
+ map<string, string> annotations = 8;
+}
diff --git a/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto
new file mode 100644
index 0000000..16fe534
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Link;
+
+import "ConnectPointProto.proto";
+import "LinkEnums.proto";
+
+message LinkDescription {
+ ConnectPoint.ConnectPoint src = 1;
+ ConnectPoint.ConnectPoint dst = 2;
+ Link.LinkType type = 3;
+ map<string, string> annotations = 4;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkEnums.proto b/incubator/protobuf/models/src/main/proto/LinkEnums.proto
new file mode 100644
index 0000000..fa5f5ac
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/LinkEnums.proto
@@ -0,0 +1,40 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Link;
+
+enum LinkType {
+ // Signifies that this is a direct single-segment link.
+ DIRECT = 0;
+
+ // Signifies that this link is potentially comprised from multiple
+ // underlying segments or hops, and as such should be used to tag
+ // links traversing optical paths, tunnels or intervening 'dark'
+ // switches.
+ INDIRECT = 1;
+
+ // Signifies that this link is an edge, i.e. host link.
+ EDGE = 2;
+
+ // Signifies that this link represents a logical link backed by
+ // some form of a tunnel, e.g., GRE, MPLS, ODUk, OCH.
+ TUNNEL = 3;
+
+ // Signifies that this link is realized by fiber (either single channel or WDM).
+ OPTICAL = 4;
+
+ // Signifies that this link is a virtual link or a pseudo-wire.
+ VIRTUAL = 5;
+}
+
+enum LinkState {
+ ACTIVE = 0;
+ INACTIVE = 1;
+}
+
+// Link Event Types
+enum LinkEventType {
+ LINK_ADDED = 0;
+ LINK_UPDATED = 1;
+ LINK_REMOVED = 2;
+}
diff --git a/incubator/protobuf/models/src/main/proto/LinkEventProto.proto b/incubator/protobuf/models/src/main/proto/LinkEventProto.proto
new file mode 100644
index 0000000..be1ee41
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/LinkEventProto.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Link;
+
+import "LinkProto.proto";
+import "LinkEnums.proto";
+
+// Corresponds to org.onosproject.net.link.LinkEvent.
+message LinkNotification {
+ Link.LinkEventType linkEventType = 2;
+ Link.LinkProto link = 3;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkProto.proto b/incubator/protobuf/models/src/main/proto/LinkProto.proto
new file mode 100644
index 0000000..2355618
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/LinkProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Link;
+
+import "LinkEnums.proto";
+import "ConnectPointProto.proto";
+
+// Corresponds to org.onosproject.net.Link.
+message LinkProto {
+ Link.LinkState state = 1;
+ ConnectPoint.ConnectPoint src = 2;
+ ConnectPoint.ConnectPoint dst = 3;
+ Link.LinkType type = 4;
+ map<string, string> annotations = 5;
+}
+
+
diff --git a/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto
new file mode 100644
index 0000000..065ef67
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Port;
+
+import "PortEnums.proto";
+
+message PortDescription {
+ // PortNumber as String PortNumber#toString
+ string port_number = 1;
+ bool is_enabled = 2;
+ Port.PortType type = 3;
+ int64 port_speed = 4;
+ map<string, string> annotations = 8;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/PortEnums.proto b/incubator/protobuf/models/src/main/proto/PortEnums.proto
new file mode 100644
index 0000000..b05efc4
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/PortEnums.proto
@@ -0,0 +1,23 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Port;
+
+enum PortType {
+ // Signifies copper-based connectivity.
+ COPPER = 0;
+ // Signifies optical fiber-based connectivity.
+ FIBER = 1;
+ // Signifies optical fiber-based packet port.
+ PACKET = 2;
+ // Signifies optical fiber-based optical tributary port (called T-port).
+ //The signal from the client side will be formed into a ITU G.709 (OTN) frame.
+ ODUCLT = 3;
+ // Signifies optical fiber-based Line-side port (called L-port).
+ OCH = 4;
+ // Signifies optical fiber-based WDM port (called W-port).
+ //Optical Multiplexing Section (See ITU G.709).
+ OMS = 5;
+ // Signifies virtual port.
+ VIRTUAL = 6;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/PortProto.proto b/incubator/protobuf/models/src/main/proto/PortProto.proto
new file mode 100644
index 0000000..309e50b
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/PortProto.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Port;
+
+import "PortEnums.proto";
+
+// Corresponds to org.onosproject.net.Port.
+message PortProto {
+ string port_number = 1;
+ bool is_enabled = 2;
+ Port.PortType type = 3;
+ int64 port_speed = 4;
+ map<string, string> annotations = 5;
+}
+
diff --git a/incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto b/incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto
new file mode 100644
index 0000000..964d47c
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto
@@ -0,0 +1,20 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package Port;
+
+message PortStatistics {
+ int32 port = 1;
+ int64 packets_received = 2;
+ int64 packets_sent = 3;
+ int64 bytes_received = 4;
+ int64 bytes_sent = 5;
+ int64 packets_rx_dropped = 6;
+ int64 packets_tx_dropped = 7;
+ int64 packets_rx_errors = 8;
+ int64 packets_tx_errors = 9;
+ int64 duration_sec = 10;
+ int64 duration_nano = 11;
+ bool is_zero = 12;
+ // TODO add all other fields
+}
diff --git a/incubator/protobuf/pom.xml b/incubator/protobuf/pom.xml
index 25f36bd..48c9984 100644
--- a/incubator/protobuf/pom.xml
+++ b/incubator/protobuf/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright 2016-present Open Networking Laboratory
+ ~ Copyright 2017-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -17,16 +17,16 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>onos-incubator-protobuf-dependencies</artifactId>
+ <artifactId>onos-incubator-grpc-dependencies</artifactId>
<groupId>org.onosproject</groupId>
<version>1.11.0-SNAPSHOT</version>
- <relativePath>../protobuf-dependencies/pom.xml</relativePath>
+ <relativePath>../grpc-dependencies/pom.xml</relativePath>
</parent>
<artifactId>onos-incubator-protobuf</artifactId>
- <packaging>bundle</packaging>
+ <packaging>pom</packaging>
- <description>ONOS ProtoBuf models</description>
+ <description>ONOS ProtoBuf and gRPC functionality root</description>
<url>http://onosproject.org</url>
<properties>
@@ -56,69 +56,9 @@
</dependencies>
- <build>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.karaf.tooling</groupId>
- <artifactId>karaf-maven-plugin</artifactId>
- <version>3.0.8</version>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </pluginManagement>
-
- <plugins>
- <!-- TODO This is included to suppress the generation of javadocs for
- this package. There is a problem when we try to package the
- auto-generated code's javadoc into a jar. -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <sourcepath>${basedir}/src/main/java/</sourcepath>
- <excludePackageNames>org.onosproject.incubator.rpc.grpc</excludePackageNames>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Export-Package>org.onosproject.grpc.net,org.onosproject.incubator.protobuf.net</Export-Package>
- </instructions>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.xolstice.maven.plugins</groupId>
- <artifactId>protobuf-maven-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-maven-plugin</artifactId>
- </plugin>
-
- </plugins>
- </build>
+ <modules>
+ <module>models</module>
+ <module>services</module>
+ </modules>
</project>
diff --git a/incubator/protobuf/services/nb/BUCK b/incubator/protobuf/services/nb/BUCK
new file mode 100644
index 0000000..4d9c789
--- /dev/null
+++ b/incubator/protobuf/services/nb/BUCK
@@ -0,0 +1,54 @@
+
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ ':onos-incubator-protobuf-services-nb-proto',
+ '//incubator/protobuf/models:onos-incubator-protobuf-models-proto',
+ '//incubator/protobuf/models:onos-incubator-protobuf-models',
+ '//lib:protobuf-java-3.2.0',
+ '//lib:GRPC_1.3'
+]
+
+GRPC_DEPS = [
+ '//lib:GRPC_1.3',
+ '//incubator/protobuf/models:onos-incubator-protobuf-models-proto',
+ '//lib:protobuf-java-3.2.0',
+ '//lib:guava'
+]
+
+BUNDLES = [
+ '//incubator/protobuf/models:onos-incubator-protobuf-models',
+ '//incubator/protobuf/models:onos-incubator-protobuf-models-proto',
+ ':onos-incubator-protobuf-services-nb',
+ ':onos-incubator-protobuf-services-nb-proto',
+ '//lib:protobuf-java-3.2.0',
+ '//lib:guava',
+ '//lib:grpc-core-1.3.0',
+ '//lib:grpc-protobuf-1.3.0',
+ '//lib:grpc-stub-1.3.0',
+ '//lib:grpc-netty-1.3.0',
+ '//lib:grpc-auth-1.3.0',
+ '//lib:grpc-context-1.3.0',
+ '//lib:google-truth-0.28',
+ '//core/api:onos-api',
+ '//lib:netty-transport',
+ '//lib:netty-buffer',
+ '//lib:netty-resolver',
+ '//lib:netty-common',
+ '//lib:netty-codec',
+ '//lib:netty-handler',
+ '//lib:netty-codec-http2',
+ '//lib:netty-codec-http',
+ "//lib:google-instrumentation-0.3.0",
+]
+
+grpc_jar(
+ name = 'onos-incubator-protobuf-services-nb-proto',
+ deps = GRPC_DEPS,
+ proto_paths = ["$ONOS_ROOT/incubator/protobuf/services/nb/src/main/proto",
+ "$ONOS_ROOT/incubator/protobuf/models/src/main/proto"]
+)
+
+osgi_jar_with_tests(
+ deps = COMPILE_DEPS,
+ visibility = ['PUBLIC'],
+)
\ No newline at end of file
diff --git a/incubator/protobuf/services/nb/pom.xml b/incubator/protobuf/services/nb/pom.xml
new file mode 100644
index 0000000..5e658e8
--- /dev/null
+++ b/incubator/protobuf/services/nb/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>onos-incubator-protobuf-services</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.11.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-incubator-protobuf-services-nb</artifactId>
+ <packaging>bundle</packaging>
+
+ <description>ONOS northbound gRPC services</description>
+ <url>http://onosproject.org</url>
+
+ <properties>
+ <onos.app.name>org.onosproject.incubator.protobuf.services.nb</onos.app.name>
+ <onos.app.title>ONOS gRPC Northbound Services</onos.app.title>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-protobuf-models</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>3.0.8</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <!-- TODO This is included to suppress the generation of javadocs for
+ this package. There is a problem when we try to package the
+ auto-generated code's javadoc into a jar. -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <sourcepath>${basedir}/src/main/java/</sourcepath>
+ <excludePackageNames>org.onosproject.incubator.rpc.grpc</excludePackageNames>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.onosproject.grpc.net,org.onosproject.incubator.protobuf.services.nb</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.xolstice.maven.plugins</groupId>
+ <artifactId>protobuf-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/DeleteMe.java
similarity index 63%
copy from incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
copy to incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/DeleteMe.java
index aa17131..69f61c4 100644
--- a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
+++ b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/DeleteMe.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,7 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+package org.onosproject.incubator.protobuf.services.nb;
+
/**
- * Utilities to handle ProtoBuf version of ONOS network models.
+ * Delete this file. It is just a placeholder for structure.
*/
-package org.onosproject.incubator.protobuf.net;
+public class DeleteMe {
+ public DeleteMe() {
+ throw new RuntimeException("This is not a class that should be instantiated.");
+ }
+}
diff --git a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
similarity index 77%
copy from incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
copy to incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
index aa17131..f3b12c8 100644
--- a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/package-info.java
+++ b/incubator/protobuf/services/nb/src/main/java/org/onosproject/incubator/protobuf/services/nb/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,6 @@
* limitations under the License.
*/
/**
- * Utilities to handle ProtoBuf version of ONOS network models.
+ * gRPC server implementations for northbound services.
*/
-package org.onosproject.incubator.protobuf.net;
+package org.onosproject.incubator.protobuf.services.nb;
diff --git a/incubator/protobuf/services/nb/src/main/proto/PlaceHolderToDelete.proto b/incubator/protobuf/services/nb/src/main/proto/PlaceHolderToDelete.proto
new file mode 100644
index 0000000..d1207dd
--- /dev/null
+++ b/incubator/protobuf/services/nb/src/main/proto/PlaceHolderToDelete.proto
@@ -0,0 +1,6 @@
+syntax="proto3";
+option java_package = "org.onosproject.grpc.net.services.nb";
+
+message ToDelete{
+
+}
\ No newline at end of file
diff --git a/incubator/protobuf/services/pom.xml b/incubator/protobuf/services/pom.xml
new file mode 100644
index 0000000..cd83218
--- /dev/null
+++ b/incubator/protobuf/services/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2017-present Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>onos-incubator-protobuf</artifactId>
+ <groupId>org.onosproject</groupId>
+ <version>1.11.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>onos-incubator-protobuf-services</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>nb</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-protobuf-models</artifactId>
+ <version>1.11.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-api</artifactId>
+ <version>1.11.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-osgi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-junit</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <description>ONOS ProtoBuf service models and implementations</description>
+ <url>http://onosproject.org</url>
+
+</project>
diff --git a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/ProtobufUtils.java b/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/ProtobufUtils.java
deleted file mode 100644
index 30410d6..0000000
--- a/incubator/protobuf/src/main/java/org/onosproject/incubator/protobuf/net/ProtobufUtils.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.incubator.protobuf.net;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.onlab.packet.ChassisId;
-import org.onosproject.grpc.net.Device.DeviceType;
-import org.onosproject.grpc.net.Port.PortType;
-import org.onosproject.net.Annotations;
-import org.onosproject.net.DefaultAnnotations;
-import org.onosproject.net.Device;
-import org.onosproject.net.MastershipRole;
-import org.onosproject.net.Port;
-import org.onosproject.net.Port.Type;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.device.DefaultDeviceDescription;
-import org.onosproject.net.device.DefaultPortDescription;
-import org.onosproject.net.device.DefaultPortStatistics;
-import org.onosproject.net.device.DeviceDescription;
-import org.onosproject.net.device.PortDescription;
-import org.onosproject.net.device.PortStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.annotations.Beta;
-
-
-/**
- * gRPC message conversion related utilities.
- */
-@Beta
-public final class ProtobufUtils {
-
- private static final Logger log = LoggerFactory.getLogger(ProtobufUtils.class);
-
- /**
- * Translates gRPC enum MastershipRole to ONOS enum.
- *
- * @param role mastership role in gRPC enum
- * @return equivalent in ONOS enum
- */
- public static MastershipRole translate(org.onosproject.grpc.net.Device.MastershipRole role) {
- switch (role) {
- case NONE:
- return MastershipRole.NONE;
- case MASTER:
- return MastershipRole.MASTER;
- case STANDBY:
- return MastershipRole.STANDBY;
- case UNRECOGNIZED:
- log.warn("Unrecognized MastershipRole gRPC message: {}", role);
- return MastershipRole.NONE;
- default:
- return MastershipRole.NONE;
- }
- }
-
- /**
- * Translates ONOS enum MastershipRole to gRPC enum.
- *
- * @param newRole ONOS' mastership role
- * @return equivalent in gRPC message enum
- */
- public static org.onosproject.grpc.net.Device.MastershipRole translate(MastershipRole newRole) {
- switch (newRole) {
- case MASTER:
- return org.onosproject.grpc.net.Device.MastershipRole.MASTER;
- case STANDBY:
- return org.onosproject.grpc.net.Device.MastershipRole.STANDBY;
- case NONE:
- default:
- return org.onosproject.grpc.net.Device.MastershipRole.NONE;
- }
- }
-
-
- /**
- * Translates gRPC DeviceDescription to {@link DeviceDescription}.
- *
- * @param deviceDescription gRPC message
- * @return {@link DeviceDescription}
- */
- public static DeviceDescription translate(org.onosproject.grpc.net.Device.DeviceDescription deviceDescription) {
- URI uri = URI.create(deviceDescription.getDeviceUri());
- Device.Type type = translate(deviceDescription.getType());
- String manufacturer = deviceDescription.getManufacturer();
- String hwVersion = deviceDescription.getHwVersion();
- String swVersion = deviceDescription.getSwVersion();
- String serialNumber = deviceDescription.getSerialNumber();
- ChassisId chassis = new ChassisId(deviceDescription.getChassisId());
- boolean defaultAvailable = deviceDescription.getIsDefaultAvailable();
- return new DefaultDeviceDescription(uri, type, manufacturer,
- hwVersion, swVersion, serialNumber,
- chassis,
- defaultAvailable,
- asAnnotations(deviceDescription.getAnnotationsMap()));
- }
-
- /**
- * Translates {@link DeviceDescription} to gRPC DeviceDescription message.
- *
- * @param deviceDescription {@link DeviceDescription}
- * @return gRPC DeviceDescription message
- */
- public static org.onosproject.grpc.net.Device.DeviceDescription translate(DeviceDescription deviceDescription) {
-
- return org.onosproject.grpc.net.Device.DeviceDescription.newBuilder()
- .setDeviceUri(deviceDescription.deviceUri().toString())
- .setType(translate(deviceDescription.type()))
- .setManufacturer(deviceDescription.manufacturer())
- .setHwVersion(deviceDescription.hwVersion())
- .setSwVersion(deviceDescription.swVersion())
- .setSerialNumber(deviceDescription.serialNumber())
- .setChassisId(deviceDescription.chassisId().toString())
- .setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
- .putAllAnnotations(asMap(deviceDescription.annotations()))
- .build();
- }
-
-
- /**
- * Translates gRPC DeviceType to {@link Device.Type}.
- *
- * @param type gRPC message
- * @return {@link Device.Type}
- */
- public static Device.Type translate(org.onosproject.grpc.net.Device.DeviceType type) {
- switch (type) {
- case BALANCER:
- return Device.Type.BALANCER;
- case CONTROLLER:
- return Device.Type.CONTROLLER;
- case FIBER_SWITCH:
- return Device.Type.FIBER_SWITCH;
- case FIREWALL:
- return Device.Type.FIREWALL;
- case IDS:
- return Device.Type.IDS;
- case IPS:
- return Device.Type.IPS;
- case MICROWAVE:
- return Device.Type.MICROWAVE;
- case OTHER:
- return Device.Type.OTHER;
- case OTN:
- return Device.Type.OTN;
- case ROADM:
- return Device.Type.ROADM;
- case ROADM_OTN:
- return Device.Type.ROADM_OTN;
- case ROUTER:
- return Device.Type.ROUTER;
- case SWITCH:
- return Device.Type.SWITCH;
- case VIRTUAL:
- return Device.Type.VIRTUAL;
-
- case UNRECOGNIZED:
- default:
- log.warn("Unexpected DeviceType: {}", type);
- return Device.Type.OTHER;
- }
- }
-
- /**
- * Translates {@link Type} to gRPC DeviceType.
- *
- * @param type {@link Type}
- * @return gRPC message
- */
- public static DeviceType translate(Device.Type type) {
- switch (type) {
- case BALANCER:
- return DeviceType.BALANCER;
- case CONTROLLER:
- return DeviceType.CONTROLLER;
- case FIBER_SWITCH:
- return DeviceType.FIBER_SWITCH;
- case FIREWALL:
- return DeviceType.FIREWALL;
- case IDS:
- return DeviceType.IDS;
- case IPS:
- return DeviceType.IPS;
- case MICROWAVE:
- return DeviceType.MICROWAVE;
- case OTHER:
- return DeviceType.OTHER;
- case OTN:
- return DeviceType.OTN;
- case ROADM:
- return DeviceType.ROADM;
- case ROADM_OTN:
- return DeviceType.ROADM_OTN;
- case ROUTER:
- return DeviceType.ROUTER;
- case SWITCH:
- return DeviceType.SWITCH;
- case VIRTUAL:
- return DeviceType.VIRTUAL;
-
- default:
- log.warn("Unexpected Device.Type: {}", type);
- return DeviceType.OTHER;
- }
- }
-
- /**
- * Translates gRPC PortDescription message to {@link PortDescription}.
- *
- * @param portDescription gRPC message
- * @return {@link PortDescription}
- */
- public static PortDescription translate(org.onosproject.grpc.net.Port.PortDescription portDescription) {
- PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
- boolean isEnabled = portDescription.getIsEnabled();
- Port.Type type = translate(portDescription.getType());
- long portSpeed = portDescription.getPortSpeed();
- SparseAnnotations annotations = asAnnotations(portDescription.getAnnotationsMap());
- // TODO How to deal with more specific Port...
- return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
- }
-
- /**
- * Translates {@link PortDescription} to gRPC PortDescription message.
- *
- * @param portDescription {@link PortDescription}
- * @return gRPC PortDescription message
- */
- public static org.onosproject.grpc.net.Port.PortDescription translate(PortDescription portDescription) {
- return org.onosproject.grpc.net.Port.PortDescription.newBuilder()
- .setPortNumber(portDescription.portNumber().toString())
- .setIsEnabled(portDescription.isEnabled())
- .setType(translate(portDescription.type()))
- .setPortSpeed(portDescription.portSpeed())
- .putAllAnnotations(asMap(portDescription.annotations()))
- .build();
- }
-
- /**
- * Translates gRPC PortType to {@link Port.Type}.
- *
- * @param type gRPC message
- * @return {@link Port.Type}
- */
- public static Port.Type translate(PortType type) {
- switch (type) {
- case COPPER:
- return Type.COPPER;
- case FIBER:
- return Type.FIBER;
- case OCH:
- return Type.OCH;
- case ODUCLT:
- return Type.ODUCLT;
- case OMS:
- return Type.OMS;
- case PACKET:
- return Type.PACKET;
- case VIRTUAL:
- return Type.VIRTUAL;
-
- case UNRECOGNIZED:
- default:
- log.warn("Unexpected PortType: {}", type);
- return Type.COPPER;
- }
- }
-
- /**
- * Translates {@link Port.Type} to gRPC PortType.
- *
- * @param type {@link Port.Type}
- * @return gRPC message
- */
- public static PortType translate(Port.Type type) {
- switch (type) {
- case COPPER:
- return PortType.COPPER;
- case FIBER:
- return PortType.FIBER;
- case OCH:
- return PortType.OCH;
- case ODUCLT:
- return PortType.ODUCLT;
- case OMS:
- return PortType.OMS;
- case PACKET:
- return PortType.PACKET;
- case VIRTUAL:
- return PortType.VIRTUAL;
-
- default:
- log.warn("Unexpected Port.Type: {}", type);
- return PortType.COPPER;
- }
- }
-
- /**
- * Translates gRPC PortStatistics message to {@link PortStatistics}.
- *
- * @param portStatistics gRPC PortStatistics message
- * @return {@link PortStatistics}
- */
- public static PortStatistics translate(org.onosproject.grpc.net.Port.PortStatistics portStatistics) {
- // TODO implement adding missing fields
- return DefaultPortStatistics.builder()
- .setPort(portStatistics.getPort())
- .setPacketsReceived(portStatistics.getPacketsReceived())
- .setPacketsSent(portStatistics.getPacketsSent())
- .build();
- }
-
- /**
- * Translates {@link PortStatistics} to gRPC PortStatistics message.
- *
- * @param portStatistics {@link PortStatistics}
- * @return gRPC PortStatistics message
- */
- public static org.onosproject.grpc.net.Port.PortStatistics translate(PortStatistics portStatistics) {
- // TODO implement adding missing fields
- return org.onosproject.grpc.net.Port.PortStatistics.newBuilder()
- .setPort(portStatistics.port())
- .setPacketsReceived(portStatistics.packetsReceived())
- .setPacketsSent(portStatistics.packetsSent())
- .build();
- }
-
- // may be this can be moved to Annotation itself or AnnotationsUtils
- /**
- * Converts Annotations to Map of Strings.
- *
- * @param annotations {@link Annotations}
- * @return Map of annotation key and values
- */
- public static Map<String, String> asMap(Annotations annotations) {
- if (annotations instanceof DefaultAnnotations) {
- return ((DefaultAnnotations) annotations).asMap();
- }
- Map<String, String> map = new HashMap<>();
- annotations.keys()
- .forEach(k -> map.put(k, annotations.value(k)));
-
- return map;
- }
-
- // may be this can be moved to Annotation itself or AnnotationsUtils
- /**
- * Converts Map of Strings to {@link SparseAnnotations}.
- *
- * @param annotations Map of annotation key and values
- * @return {@link SparseAnnotations}
- */
- public static SparseAnnotations asAnnotations(Map<String, String> annotations) {
- DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
- annotations.entrySet().forEach(e -> {
- if (e.getValue() != null) {
- builder.set(e.getKey(), e.getValue());
- } else {
- builder.remove(e.getKey());
- }
- });
- return builder.build();
- }
-
- // Utility class not intended for instantiation.
- private ProtobufUtils() {}
-}
diff --git a/incubator/protobuf/src/main/proto/models/Device.proto b/incubator/protobuf/src/main/proto/models/Device.proto
deleted file mode 100644
index 75cf0f5..0000000
--- a/incubator/protobuf/src/main/proto/models/Device.proto
+++ /dev/null
@@ -1,51 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net";
-
-package Device;
-
-message DeviceDescription {
- string device_Uri = 1;
- DeviceType type = 2;
- string manufacturer = 3;
- string hw_version = 4;
- string sw_version = 5;
- string serial_number = 6;
- string chassis_id = 7;
- map<string, string> annotations = 8;
- bool is_default_available = 9;
-}
-
-enum MastershipRole {
- NONE = 0;
- MASTER = 1;
- STANDBY = 2;
-}
-
-enum DeviceType {
- OTHER = 0;
- SWITCH = 1;
- ROUTER = 2;
- ROADM = 3;
- OTN = 4;
- ROADM_OTN = 5;
- FIREWALL = 6;
- BALANCER = 7;
- IPS = 8;
- IDS = 9;
- CONTROLLER = 10;
- VIRTUAL = 11;
- FIBER_SWITCH = 12;
- MICROWAVE = 13;
-}
-
-// Corresponds to org.onosproject.net.Device.
-message DeviceCore {
- string deviceId = 1;
- DeviceType type = 2;
- string manufacturer = 3;
- string hw_version = 4;
- string sw_version = 5;
- string serial_number = 6;
- string chassis_id = 7;
- map<string, string> annotations = 8;
-}
diff --git a/incubator/protobuf/src/main/proto/models/DeviceEvent.proto b/incubator/protobuf/src/main/proto/models/DeviceEvent.proto
deleted file mode 100644
index f834aa1..0000000
--- a/incubator/protobuf/src/main/proto/models/DeviceEvent.proto
+++ /dev/null
@@ -1,28 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net";
-
-
-import "models/Device.proto";
-import "models/Port.proto";
-
-package DeviceEvent;
-
-// Corresponds to org.onosproject.net.device.DeviceEvent.
-message DeviceNotification {
- Device.DeviceCore device = 1;
- DeviceEventType deviceEventType = 2;
- Port.PortCore port = 3;
-}
-
-enum DeviceEventType {
- DEVICE_ADDED = 0;
- DEVICE_UPDATED = 1;
- DEVICE_REMOVED = 2;
- DEVICE_SUSPENDED = 3;
- DEVICE_AVAILABILITY_CHANGED = 4;
- PORT_ADDED = 5;
- PORT_UPDATED = 6;
- PORT_REMOVED = 7;
- PORT_STATS_UPDATED = 8;
-}
-
diff --git a/incubator/protobuf/src/main/proto/models/Link.proto b/incubator/protobuf/src/main/proto/models/Link.proto
deleted file mode 100644
index a1ae8ff..0000000
--- a/incubator/protobuf/src/main/proto/models/Link.proto
+++ /dev/null
@@ -1,60 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net";
-
-package Link;
-
-enum LinkType {
- // Signifies that this is a direct single-segment link.
- DIRECT = 0;
-
- // Signifies that this link is potentially comprised from multiple
- // underlying segments or hops, and as such should be used to tag
- // links traversing optical paths, tunnels or intervening 'dark'
- // switches.
- INDIRECT = 1;
-
- // Signifies that this link is an edge, i.e. host link.
- EDGE = 2;
-
- // Signifies that this link represents a logical link backed by
- // some form of a tunnel, e.g., GRE, MPLS, ODUk, OCH.
- TUNNEL = 3;
-
- // Signifies that this link is realized by fiber (either single channel or WDM).
- OPTICAL = 4;
-
- // Signifies that this link is a virtual link or a pseudo-wire.
- VIRTUAL = 5;
-}
-
-message ConnectPoint {
- oneof element_id {
- // DeviceID as String DeviceId#toString
- string device_id = 1;
-
- // TODO add support to other element_id if required
- }
- // PortNumber as String PortNumber#toString
- string port_number = 2;
-}
-
-enum LinkState {
- ACTIVE = 0;
- INACTIVE = 1;
-}
-
-// Corresponds to org.onosproject.net.Link.
-message LinkCore {
- LinkState state = 1;
- ConnectPoint src = 2;
- ConnectPoint dst = 3;
- LinkType type = 4;
- map<string, string> annotations = 5;
-}
-
-message LinkDescription {
- ConnectPoint src = 1;
- ConnectPoint dst = 2;
- LinkType type = 3;
- map<string, string> annotations = 4;
-}
diff --git a/incubator/protobuf/src/main/proto/models/LinkEvent.proto b/incubator/protobuf/src/main/proto/models/LinkEvent.proto
deleted file mode 100644
index fcd13fb..0000000
--- a/incubator/protobuf/src/main/proto/models/LinkEvent.proto
+++ /dev/null
@@ -1,19 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net";
-
-package LinkEvent;
-
-import "models/Link.proto";
-
-// Corresponds to org.onosproject.net.link.LinkEvent.
-message LinkNotification {
- LinkEventType linkEventType = 2;
- Link.LinkCore link = 3;
-}
-
-// Link Event Types
-enum LinkEventType {
- LINK_ADDED = 0;
- LINK_UPDATED = 1;
- LINK_REMOVED = 2;
-}
diff --git a/incubator/protobuf/src/main/proto/models/Port.proto b/incubator/protobuf/src/main/proto/models/Port.proto
deleted file mode 100644
index a3fd34d..0000000
--- a/incubator/protobuf/src/main/proto/models/Port.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net";
-
-package Port;
-
-enum PortType {
- // Signifies copper-based connectivity.
- COPPER = 0;
- // Signifies optical fiber-based connectivity.
- FIBER = 1;
- // Signifies optical fiber-based packet port.
- PACKET = 2;
- // Signifies optical fiber-based optical tributary port (called T-port).
- //The signal from the client side will be formed into a ITU G.709 (OTN) frame.
- ODUCLT = 3;
- // Signifies optical fiber-based Line-side port (called L-port).
- OCH = 4;
- // Signifies optical fiber-based WDM port (called W-port).
- //Optical Multiplexing Section (See ITU G.709).
- OMS = 5;
- // Signifies virtual port.
- VIRTUAL = 6;
-}
-
-message PortDescription {
- // PortNumber as String PortNumber#toString
- string port_number = 1;
- bool is_enabled = 2;
- PortType type = 3;
- int64 port_speed = 4;
- map<string, string> annotations = 8;
-}
-
-// Corresponds to org.onosproject.net.Port.
-message PortCore {
- string port_number = 1;
- bool is_enabled = 2;
- PortType type = 3;
- int64 port_speed = 4;
- map<string, string> annotations = 5;
-}
-
-message PortStatistics {
- int32 port = 1;
- int64 packets_received = 2;
- int64 packets_sent = 3;
- // TODO add all other fields
-}
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
index bd133ad..4f41835 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
@@ -17,7 +17,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.stream.Collectors.toList;
-import static org.onosproject.incubator.protobuf.net.ProtobufUtils.translate;
+import static org.onosproject.incubator.protobuf.models.ProtobufUtils.translate;
import static org.onosproject.net.DeviceId.deviceId;
import java.util.Collection;
@@ -31,7 +31,7 @@
import org.onosproject.grpc.net.device.DeviceService.IsReachableRequest;
import org.onosproject.grpc.net.device.DeviceService.RoleChanged;
import org.onosproject.grpc.net.device.DeviceService.TriggerProbe;
-import org.onosproject.incubator.protobuf.net.ProtobufUtils;
+import org.onosproject.incubator.protobuf.models.ProtobufUtils;
import org.onosproject.net.DeviceId;
import org.onosproject.net.MastershipRole;
import org.onosproject.net.device.DeviceDescription;
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java
index 2604d09..2f5be39 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java
@@ -18,7 +18,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.concurrent.Executors.newScheduledThreadPool;
import static java.util.stream.Collectors.toList;
-import static org.onosproject.incubator.protobuf.net.ProtobufUtils.translate;
+import static org.onosproject.incubator.protobuf.models.ProtobufUtils.translate;
import static org.onosproject.net.DeviceId.deviceId;
import java.io.IOException;
@@ -50,7 +50,7 @@
import org.onosproject.grpc.net.device.DeviceService.RegisterProvider;
import org.onosproject.grpc.net.device.DeviceService.UpdatePortStatistics;
import org.onosproject.grpc.net.device.DeviceService.UpdatePorts;
-import org.onosproject.incubator.protobuf.net.ProtobufUtils;
+import org.onosproject.incubator.protobuf.models.ProtobufUtils;
import org.onosproject.net.DeviceId;
import org.onosproject.net.MastershipRole;
import org.onosproject.net.PortNumber;
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
index 0a8918e..78f9f37 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
@@ -15,7 +15,7 @@
*/
package org.onosproject.incubator.rpc.grpc;
-import static org.onosproject.incubator.protobuf.net.ProtobufUtils.asMap;
+import static org.onosproject.incubator.protobuf.models.ProtobufUtils.asMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
index 26210f6..69f9cfd 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
@@ -31,7 +31,7 @@
import org.onosproject.grpc.net.link.LinkService.LinkDetectedMsg;
import org.onosproject.grpc.net.link.LinkService.LinkVanishedMsg;
import org.onosproject.grpc.net.link.LinkService.Void;
-import org.onosproject.incubator.protobuf.net.ProtobufUtils;
+import org.onosproject.incubator.protobuf.models.ProtobufUtils;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link;