mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-15 17:31:31 +02:00
Refactoring file structure for protobufs.
Change-Id: I50daf100d54750f97158304d87813e67861b1422
This commit is contained in:
parent
60aded229b
commit
9f95f99a0e
@ -66,7 +66,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.onosproject</groupId>
|
||||
<artifactId>onos-incubator-protobuf</artifactId>
|
||||
<artifactId>onos-incubator-protobuf-models</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
@ -18,12 +18,12 @@ package org.onosproject.kafkaintegration.converter;
|
||||
import com.google.protobuf.GeneratedMessageV3;
|
||||
|
||||
import org.onosproject.event.Event;
|
||||
import org.onosproject.grpc.net.Device.DeviceCore;
|
||||
import org.onosproject.grpc.net.Device.DeviceType;
|
||||
import org.onosproject.grpc.net.DeviceEvent.DeviceEventType;
|
||||
import org.onosproject.grpc.net.DeviceEvent.DeviceNotification;
|
||||
import org.onosproject.grpc.net.Port.PortCore;
|
||||
import org.onosproject.grpc.net.Port.PortType;
|
||||
import org.onosproject.grpc.net.models.DeviceProtoOuterClass.DeviceProto;
|
||||
import org.onosproject.grpc.net.models.DeviceEnums.DeviceType;
|
||||
import org.onosproject.grpc.net.models.DeviceEnums.DeviceEventType;
|
||||
import org.onosproject.grpc.net.models.DeviceEventProto.DeviceNotification;
|
||||
import org.onosproject.grpc.net.models.PortEnums.PortType;
|
||||
import org.onosproject.grpc.net.models.PortProtoOuterClass;
|
||||
import org.onosproject.net.device.DeviceEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -42,7 +42,7 @@ public class DeviceEventConverter implements EventConverter {
|
||||
|
||||
if (!deviceEventTypeSupported(deviceEvent)) {
|
||||
log.error("Unsupported Onos Device Event {}. There is no matching"
|
||||
+ "proto Device Event type", deviceEvent.type().toString());
|
||||
+ "proto Device Event type", deviceEvent.type().toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ public class DeviceEventConverter implements EventConverter {
|
||||
DeviceNotification.Builder notificationBuilder =
|
||||
DeviceNotification.newBuilder();
|
||||
|
||||
DeviceCore deviceCore =
|
||||
DeviceCore.newBuilder()
|
||||
DeviceProto deviceCore =
|
||||
DeviceProto.newBuilder()
|
||||
.setChassisId(deviceEvent.subject().chassisId().id()
|
||||
.toString())
|
||||
.setDeviceId(deviceEvent.subject().id().toString())
|
||||
@ -83,10 +83,10 @@ public class DeviceEventConverter implements EventConverter {
|
||||
.valueOf(deviceEvent.subject().type().name()))
|
||||
.build();
|
||||
|
||||
PortCore portCore = null;
|
||||
PortProtoOuterClass.PortProto portProto = null;
|
||||
if (deviceEvent.port() != null) {
|
||||
portCore =
|
||||
PortCore.newBuilder()
|
||||
portProto =
|
||||
PortProtoOuterClass.PortProto.newBuilder()
|
||||
.setIsEnabled(deviceEvent.port().isEnabled())
|
||||
.setPortNumber(deviceEvent.port().number()
|
||||
.toString())
|
||||
@ -95,7 +95,7 @@ public class DeviceEventConverter implements EventConverter {
|
||||
.valueOf(deviceEvent.port().type().name()))
|
||||
.build();
|
||||
|
||||
notificationBuilder.setPort(portCore);
|
||||
notificationBuilder.setPort(portProto);
|
||||
}
|
||||
|
||||
notificationBuilder.setDeviceEventType(getProtoType(deviceEvent))
|
||||
|
@ -16,12 +16,12 @@
|
||||
package org.onosproject.kafkaintegration.converter;
|
||||
|
||||
import org.onosproject.event.Event;
|
||||
import org.onosproject.grpc.net.Link.ConnectPoint;
|
||||
import org.onosproject.grpc.net.Link.LinkCore;
|
||||
import org.onosproject.grpc.net.Link.LinkState;
|
||||
import org.onosproject.grpc.net.Link.LinkType;
|
||||
import org.onosproject.grpc.net.LinkEvent.LinkEventType;
|
||||
import org.onosproject.grpc.net.LinkEvent.LinkNotification;
|
||||
import org.onosproject.grpc.net.models.ConnectPointProto.ConnectPoint;
|
||||
import org.onosproject.grpc.net.models.LinkProtoOuterClass.LinkProto;
|
||||
import org.onosproject.grpc.net.models.LinkEnums.LinkState;
|
||||
import org.onosproject.grpc.net.models.LinkEnums.LinkType;
|
||||
import org.onosproject.grpc.net.models.LinkEnums.LinkEventType;
|
||||
import org.onosproject.grpc.net.models.LinkEventProto.LinkNotification;
|
||||
import org.onosproject.net.link.LinkEvent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -42,7 +42,7 @@ public class LinkEventConverter implements EventConverter {
|
||||
|
||||
if (!linkEventTypeSupported(linkEvent)) {
|
||||
log.error("Unsupported Onos Event {}. There is no matching "
|
||||
+ "proto Event type", linkEvent.type().toString());
|
||||
+ "proto Event type", linkEvent.type().toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -62,20 +62,20 @@ public class LinkEventConverter implements EventConverter {
|
||||
private LinkNotification buildDeviceProtoMessage(LinkEvent linkEvent) {
|
||||
LinkNotification notification = LinkNotification.newBuilder()
|
||||
.setLinkEventType(getProtoType(linkEvent))
|
||||
.setLink(LinkCore.newBuilder()
|
||||
.setState(LinkState
|
||||
.valueOf(linkEvent.subject().state().name()))
|
||||
.setType(LinkType.valueOf(linkEvent.subject().type().name()))
|
||||
.setDst(ConnectPoint.newBuilder()
|
||||
.setDeviceId(linkEvent.subject().dst()
|
||||
.deviceId().toString())
|
||||
.setPortNumber(linkEvent.subject().dst().port()
|
||||
.toString()))
|
||||
.setSrc(ConnectPoint.newBuilder()
|
||||
.setDeviceId(linkEvent.subject().src()
|
||||
.deviceId().toString())
|
||||
.setPortNumber(linkEvent.subject().src().port()
|
||||
.toString())))
|
||||
.setLink(LinkProto.newBuilder()
|
||||
.setState(LinkState
|
||||
.valueOf(linkEvent.subject().state().name()))
|
||||
.setType(LinkType.valueOf(linkEvent.subject().type().name()))
|
||||
.setDst(ConnectPoint.newBuilder()
|
||||
.setDeviceId(linkEvent.subject().dst()
|
||||
.deviceId().toString())
|
||||
.setPortNumber(linkEvent.subject().dst().port()
|
||||
.toString()))
|
||||
.setSrc(ConnectPoint.newBuilder()
|
||||
.setDeviceId(linkEvent.subject().src()
|
||||
.deviceId().toString())
|
||||
.setPortNumber(linkEvent.subject().src().port()
|
||||
.toString())))
|
||||
.build();
|
||||
|
||||
return notification;
|
||||
|
@ -52,7 +52,7 @@ def fetch_protoc_binary(
|
||||
|
||||
def fetch_grpc_plugin_binary(
|
||||
grpc_plugin_version = GRPC_PLUGIN_VERSION
|
||||
):
|
||||
):
|
||||
file_name = "protoc-gen-grpc-java-%s-%s.exe" % (grpc_plugin_version, get_system_arch())
|
||||
if file_name not in GRPC_JAVA_SHA1S:
|
||||
raise Exception('Cannot download %s, architecture not supported' % file_name)
|
||||
@ -79,10 +79,10 @@ def grpc_jar(
|
||||
name = None,
|
||||
deps = [],
|
||||
#NOTE: if targeting a directory also built with maven this path MUST end in
|
||||
# /proto because maven plugin interprets imports relative to the proto
|
||||
# directory and BUCK interprets imports relative to the last directory
|
||||
# listed in the first listed proto_path which contains the specified
|
||||
# file
|
||||
# /proto because maven plugin interprets imports relative to the proto
|
||||
# directory and BUCK interprets imports relative to the last directory
|
||||
# listed in the first listed proto_path which contains the specified
|
||||
# file
|
||||
proto_paths = [],
|
||||
proto_match_patterns = [ "**/proto/**/*.proto" ],
|
||||
protoc_version = PROTOC_VERSION,
|
||||
@ -112,7 +112,7 @@ def grpc_jar(
|
||||
+ '$SRCS',
|
||||
)
|
||||
|
||||
osgi_jar_with_tests(
|
||||
osgi_jar(
|
||||
name = name,
|
||||
srcs = [ ':' + protoc ],
|
||||
deps = deps + [ ':' + protoc ],
|
||||
|
@ -32,6 +32,8 @@
|
||||
<bundle>mvn:io.netty/netty-codec/4.1.8.Final</bundle>
|
||||
<bundle>mvn:io.netty/netty-transport-native-epoll/4.1.8.Final</bundle>
|
||||
<bundle>mvn:io.netty/netty-resolver/4.1.8.Final</bundle>
|
||||
<bundle>mvn:io.netty/netty-codec-http2/4.1.8.Final</bundle>
|
||||
<bundle>mvn:io.netty/netty-codec-http/4.1.8.Final</bundle>
|
||||
<bundle>mvn:commons-pool/commons-pool/1.6</bundle>
|
||||
<bundle>mvn:org.apache.commons/commons-math3/3.6.1</bundle>
|
||||
|
||||
|
@ -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'],
|
||||
)
|
||||
|
||||
|
30
incubator/protobuf/models/BUCK
Normal file
30
incubator/protobuf/models/BUCK
Normal file
@ -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'],
|
||||
)
|
102
incubator/protobuf/models/pom.xml
Normal file
102
incubator/protobuf/models/pom.xml
Normal file
@ -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>
|
@ -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,15 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.onosproject.incubator.protobuf.net;
|
||||
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.Device.DeviceType;
|
||||
import org.onosproject.grpc.net.Port.PortType;
|
||||
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;
|
||||
@ -41,7 +45,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
|
||||
|
||||
/**
|
||||
* gRPC message conversion related utilities.
|
||||
*/
|
||||
@ -56,19 +59,19 @@ public final class ProtobufUtils {
|
||||
* @param role mastership role in gRPC enum
|
||||
* @return equivalent in ONOS enum
|
||||
*/
|
||||
public static MastershipRole translate(org.onosproject.grpc.net.Device.MastershipRole role) {
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,15 +81,15 @@ public final class ProtobufUtils {
|
||||
* @param newRole ONOS' mastership role
|
||||
* @return equivalent in gRPC message enum
|
||||
*/
|
||||
public static org.onosproject.grpc.net.Device.MastershipRole translate(MastershipRole newRole) {
|
||||
public static DeviceEnums.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;
|
||||
case MASTER:
|
||||
return DeviceEnums.MastershipRole.MASTER;
|
||||
case STANDBY:
|
||||
return DeviceEnums.MastershipRole.STANDBY;
|
||||
case NONE:
|
||||
default:
|
||||
return DeviceEnums.MastershipRole.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +100,8 @@ public final class ProtobufUtils {
|
||||
* @param deviceDescription gRPC message
|
||||
* @return {@link DeviceDescription}
|
||||
*/
|
||||
public static DeviceDescription translate(org.onosproject.grpc.net.Device.DeviceDescription deviceDescription) {
|
||||
public static DeviceDescription translate(
|
||||
DeviceDescriptionProto.DeviceDescription deviceDescription) {
|
||||
URI uri = URI.create(deviceDescription.getDeviceUri());
|
||||
Device.Type type = translate(deviceDescription.getType());
|
||||
String manufacturer = deviceDescription.getManufacturer();
|
||||
@ -119,19 +123,20 @@ public final class ProtobufUtils {
|
||||
* @param deviceDescription {@link DeviceDescription}
|
||||
* @return gRPC DeviceDescription message
|
||||
*/
|
||||
public static org.onosproject.grpc.net.Device.DeviceDescription translate(DeviceDescription deviceDescription) {
|
||||
public static DeviceDescriptionProto.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();
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -141,41 +146,41 @@ public final class ProtobufUtils {
|
||||
* @param type gRPC message
|
||||
* @return {@link Device.Type}
|
||||
*/
|
||||
public static Device.Type translate(org.onosproject.grpc.net.Device.DeviceType 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 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;
|
||||
case UNRECOGNIZED:
|
||||
default:
|
||||
log.warn("Unexpected DeviceType: {}", type);
|
||||
return Device.Type.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,38 +192,38 @@ public final class ProtobufUtils {
|
||||
*/
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
log.warn("Unexpected Device.Type: {}", type);
|
||||
return DeviceType.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,13 +233,12 @@ public final class ProtobufUtils {
|
||||
* @param portDescription gRPC message
|
||||
* @return {@link PortDescription}
|
||||
*/
|
||||
public static PortDescription translate(org.onosproject.grpc.net.Port.PortDescription 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());
|
||||
// TODO How to deal with more specific Port...
|
||||
return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
|
||||
}
|
||||
|
||||
@ -244,8 +248,8 @@ public final class ProtobufUtils {
|
||||
* @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()
|
||||
public static PortDescriptionProto.PortDescription translate(PortDescription portDescription) {
|
||||
return PortDescriptionProto.PortDescription.newBuilder()
|
||||
.setPortNumber(portDescription.portNumber().toString())
|
||||
.setIsEnabled(portDescription.isEnabled())
|
||||
.setType(translate(portDescription.type()))
|
||||
@ -260,56 +264,56 @@ public final class ProtobufUtils {
|
||||
* @param type gRPC message
|
||||
* @return {@link Port.Type}
|
||||
*/
|
||||
public static Port.Type translate(PortType 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 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;
|
||||
case UNRECOGNIZED:
|
||||
default:
|
||||
log.warn("Unexpected PortType: {}", type);
|
||||
return Type.COPPER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates {@link Port.Type} to gRPC PortType.
|
||||
*
|
||||
* @param type {@link Port.Type}
|
||||
* @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;
|
||||
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;
|
||||
default:
|
||||
log.warn("Unexpected Port.Type: {}", type);
|
||||
return PortType.COPPER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +323,7 @@ public final class ProtobufUtils {
|
||||
* @param portStatistics gRPC PortStatistics message
|
||||
* @return {@link PortStatistics}
|
||||
*/
|
||||
public static PortStatistics translate(org.onosproject.grpc.net.Port.PortStatistics portStatistics) {
|
||||
public static PortStatistics translate(PortStatisticsProto.PortStatistics portStatistics) {
|
||||
// TODO implement adding missing fields
|
||||
return DefaultPortStatistics.builder()
|
||||
.setPort(portStatistics.getPort())
|
||||
@ -334,9 +338,9 @@ public final class ProtobufUtils {
|
||||
* @param portStatistics {@link PortStatistics}
|
||||
* @return gRPC PortStatistics message
|
||||
*/
|
||||
public static org.onosproject.grpc.net.Port.PortStatistics translate(PortStatistics portStatistics) {
|
||||
public static PortStatisticsProto.PortStatistics translate(PortStatistics portStatistics) {
|
||||
// TODO implement adding missing fields
|
||||
return org.onosproject.grpc.net.Port.PortStatistics.newBuilder()
|
||||
return PortStatisticsProto.PortStatistics.newBuilder()
|
||||
.setPort(portStatistics.port())
|
||||
.setPacketsReceived(portStatistics.packetsReceived())
|
||||
.setPacketsSent(portStatistics.packetsSent())
|
||||
@ -356,7 +360,7 @@ public final class ProtobufUtils {
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
annotations.keys()
|
||||
.forEach(k -> map.put(k, annotations.value(k)));
|
||||
.forEach(k -> map.put(k, annotations.value(k)));
|
||||
|
||||
return map;
|
||||
}
|
||||
@ -371,12 +375,12 @@ public final class ProtobufUtils {
|
||||
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());
|
||||
}
|
||||
});
|
||||
if (e.getValue() != null) {
|
||||
builder.set(e.getKey(), e.getValue());
|
||||
} else {
|
||||
builder.remove(e.getKey());
|
||||
}
|
||||
});
|
||||
return builder.build();
|
||||
}
|
||||
|
@ -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;
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
39
incubator/protobuf/models/src/main/proto/DeviceEnums.proto
Normal file
39
incubator/protobuf/models/src/main/proto/DeviceEnums.proto
Normal file
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
18
incubator/protobuf/models/src/main/proto/DeviceProto.proto
Normal file
18
incubator/protobuf/models/src/main/proto/DeviceProto.proto
Normal file
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
40
incubator/protobuf/models/src/main/proto/LinkEnums.proto
Normal file
40
incubator/protobuf/models/src/main/proto/LinkEnums.proto
Normal file
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
18
incubator/protobuf/models/src/main/proto/LinkProto.proto
Normal file
18
incubator/protobuf/models/src/main/proto/LinkProto.proto
Normal file
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
23
incubator/protobuf/models/src/main/proto/PortEnums.proto
Normal file
23
incubator/protobuf/models/src/main/proto/PortEnums.proto
Normal file
@ -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;
|
||||
}
|
16
incubator/protobuf/models/src/main/proto/PortProto.proto
Normal file
16
incubator/protobuf/models/src/main/proto/PortProto.proto
Normal file
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
}
|
@ -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>
|
||||
|
54
incubator/protobuf/services/nb/BUCK
Normal file
54
incubator/protobuf/services/nb/BUCK
Normal file
@ -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'],
|
||||
)
|
112
incubator/protobuf/services/nb/pom.xml
Normal file
112
incubator/protobuf/services/nb/pom.xml
Normal file
@ -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>
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.services.nb;
|
||||
|
||||
/**
|
||||
* Delete this file. It is just a placeholder for structure.
|
||||
*/
|
||||
public class DeleteMe {
|
||||
public DeleteMe() {
|
||||
throw new RuntimeException("This is not a class that should be instantiated.");
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* gRPC server implementations for northbound services.
|
||||
*/
|
||||
package org.onosproject.incubator.protobuf.services.nb;
|
@ -0,0 +1,6 @@
|
||||
syntax="proto3";
|
||||
option java_package = "org.onosproject.grpc.net.services.nb";
|
||||
|
||||
message ToDelete{
|
||||
|
||||
}
|
80
incubator/protobuf/services/pom.xml
Normal file
80
incubator/protobuf/services/pom.xml
Normal file
@ -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>
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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
|
||||
}
|
@ -17,7 +17,7 @@ package org.onosproject.incubator.rpc.grpc;
|
||||
|
||||
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.DeviceProviderServiceMsg;
|
||||
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;
|
||||
|
@ -18,7 +18,7 @@ package org.onosproject.incubator.rpc.grpc;
|
||||
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.ReceivedRoleReply;
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -31,7 +31,7 @@ import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc.LinkProviderServ
|
||||
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;
|
||||
|
116
lib/BUCK
116
lib/BUCK
@ -1,4 +1,4 @@
|
||||
# ***** This file was auto-generated at Wed, 14 Jun 2017 22:44:38 GMT. Do not edit this file manually. *****
|
||||
# ***** This file was auto-generated at Fri, 23 Jun 2017 05:52:13 GMT. Do not edit this file manually. *****
|
||||
# ***** Use onos-lib-gen *****
|
||||
|
||||
pass_thru_pom(
|
||||
@ -130,6 +130,22 @@ osgi_feature_group(
|
||||
':grpc-stub-1.3.0',
|
||||
':grpc-netty-1.3.0',
|
||||
':grpc-auth-1.3.0',
|
||||
':grpc-context-1.3.0',
|
||||
':google-truth-0.28',
|
||||
],
|
||||
)
|
||||
|
||||
osgi_feature_group(
|
||||
name = 'GRPC_TEST_1.3',
|
||||
visibility = ['PUBLIC'],
|
||||
exported_deps = [
|
||||
':grpc-testing-1.3.0',
|
||||
':grpc-testing-proto-1.3.0',
|
||||
':google-code-findbugs-3.0.0',
|
||||
':google-errorprone-2.0.19',
|
||||
':google-instrumentation-0.3.0',
|
||||
':junit-dep',
|
||||
':objenesis',
|
||||
],
|
||||
)
|
||||
|
||||
@ -315,10 +331,10 @@ remote_jar (
|
||||
|
||||
remote_jar (
|
||||
name = 'gson',
|
||||
out = 'gson-2.6.2.jar',
|
||||
url = 'mvn:com.google.code.gson:gson:jar:2.6.2',
|
||||
sha1 = 'f1bc476cc167b18e66c297df599b2377131a8947',
|
||||
maven_coords = 'com.google.code.gson:gson:2.6.2',
|
||||
out = 'gson-2.7.jar',
|
||||
url = 'mvn:com.google.code.gson:gson:jar:2.7',
|
||||
sha1 = '751f548c85fa49f330cecbb1875893f971b33c4e',
|
||||
maven_coords = 'com.google.code.gson:gson:2.7',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
@ -682,6 +698,15 @@ remote_jar (
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'junit-dep',
|
||||
out = 'junit-4.10.jar',
|
||||
url = 'mvn:junit:junit:jar:4.10',
|
||||
sha1 = 'e4f1766ce7404a08f45d859fb9c226fc9e41a861',
|
||||
maven_coords = 'junit:junit:jar:NON-OSGI:4.10',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'kryo',
|
||||
out = 'kryo-4.0.0.jar',
|
||||
@ -835,6 +860,24 @@ remote_jar (
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'netty-codec-http2',
|
||||
out = 'netty-codec-http2-4.1.8.Final.jar',
|
||||
url = 'mvn:io.netty:netty-codec-http2:jar:4.1.8.Final',
|
||||
sha1 = '105a99ee5767463370ccc3d2e16800bd99f5648e',
|
||||
maven_coords = 'io.netty:netty-codec-http2:4.1.8.Final',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'netty-codec-http',
|
||||
out = 'netty-codec-http-4.1.8.Final.jar',
|
||||
url = 'mvn:io.netty:netty-codec-http:jar:4.1.8.Final',
|
||||
sha1 = '1e88617c4a6c88da7e86fdbbd9494d22a250c879',
|
||||
maven_coords = 'io.netty:netty-codec-http:4.1.8.Final',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'catalyst-concurrent',
|
||||
out = 'catalyst-concurrent-1.2.1.jar',
|
||||
@ -1337,3 +1380,66 @@ remote_jar (
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'grpc-testing-1.3.0',
|
||||
out = 'grpc-testing-1.3.0.jar',
|
||||
url = 'mvn:io.grpc:grpc-testing:jar:1.3.0',
|
||||
sha1 = '2828c4bbab639470b9a017f521426490ba919803',
|
||||
maven_coords = 'io.grpc:grpc-testing:jar:NON-OSGI:1.3.0',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'grpc-testing-proto-1.3.0',
|
||||
out = 'grpc-testing-proto-1.3.0.jar',
|
||||
url = 'mvn:io.grpc:grpc-testing-proto:jar:1.3.0',
|
||||
sha1 = '6e707eb79bb892abd22dae80d5799156e614393d',
|
||||
maven_coords = 'io.grpc:grpc-testing-proto:jar:NON-OSGI:1.3.0',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'grpc-context-1.3.0',
|
||||
out = 'grpc-context-1.3.0.jar',
|
||||
url = 'mvn:io.grpc:grpc-context:jar:1.3.0',
|
||||
sha1 = '2a924ad1897dd1b768e1859943e2d0408789150a',
|
||||
maven_coords = 'io.grpc:grpc-context:jar:NON-OSGI:1.3.0',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'google-truth-0.28',
|
||||
out = 'truth-0.28.jar',
|
||||
url = 'mvn:com.google.truth:truth:jar:0.28',
|
||||
sha1 = '0a388c7877c845ff4b8e19689dda5ac9d34622c4',
|
||||
maven_coords = 'com.google.truth:truth:jar:NON-OSGI:0.28',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'google-code-findbugs-3.0.0',
|
||||
out = 'jsr305-3.0.0.jar',
|
||||
url = 'mvn:com.google.code.findbugs:jsr305:jar:3.0.0',
|
||||
sha1 = '5871fb60dc68d67da54a663c3fd636a10a532948',
|
||||
maven_coords = 'com.google.code.findbugs:jsr305:jar:NON-OSGI:3.0.0',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'google-errorprone-2.0.19',
|
||||
out = 'error_prone_annotations-2.0.19.jar',
|
||||
url = 'mvn:com.google.errorprone:error_prone_annotations:jar:2.0.19',
|
||||
sha1 = 'c3754a0bdd545b00ddc26884f9e7624f8b6a14de',
|
||||
maven_coords = 'com.google.errorprone:error_prone_annotations:jar:NON-OSGI:2.0.19',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
remote_jar (
|
||||
name = 'google-instrumentation-0.3.0',
|
||||
out = 'instrumentation-api-0.3.0.jar',
|
||||
url = 'mvn:com.google.instrumentation:instrumentation-api:jar:0.3.0',
|
||||
sha1 = 'a2e145e7a7567c6372738f5c5a6f3ba6407ac354',
|
||||
maven_coords = 'com.google.instrumentation:instrumentation-api:jar:NON-OSGI:0.3.0',
|
||||
visibility = [ 'PUBLIC' ],
|
||||
)
|
||||
|
||||
|
@ -93,7 +93,18 @@
|
||||
"grpc-protobuf-1.3.0",
|
||||
"grpc-stub-1.3.0",
|
||||
"grpc-netty-1.3.0",
|
||||
"grpc-auth-1.3.0"
|
||||
"grpc-auth-1.3.0",
|
||||
"grpc-context-1.3.0",
|
||||
"google-truth-0.28"
|
||||
],
|
||||
"GRPC_TEST_1.3": [
|
||||
"grpc-testing-1.3.0",
|
||||
"grpc-testing-proto-1.3.0",
|
||||
"google-code-findbugs-3.0.0",
|
||||
"google-errorprone-2.0.19",
|
||||
"google-instrumentation-0.3.0",
|
||||
"junit-dep",
|
||||
"objenesis"
|
||||
]
|
||||
},
|
||||
|
||||
@ -159,6 +170,7 @@
|
||||
"jsch": "mvn:com.jcraft:jsch:0.1.53",
|
||||
"jsr305": "mvn:com.google.code.findbugs:jsr305:3.0.1",
|
||||
"junit": "mvn:junit:junit:4.12",
|
||||
"junit-dep": "mvn:junit:junit:4.10",
|
||||
"kryo": "mvn:com.esotericsoftware:kryo:4.0.0",
|
||||
"mapdb": "mvn:org.mapdb:mapdb:1.0.9",
|
||||
"metrics-core": "mvn:io.dropwizard.metrics:metrics-core:3.2.2",
|
||||
@ -176,6 +188,8 @@
|
||||
"netty-transport": "mvn:io.netty:netty-transport:4.1.8.Final",
|
||||
"netty-transport-native-epoll": "mvn:io.netty:netty-transport-native-epoll:4.1.8.Final",
|
||||
"netty-resolver": "mvn:io.netty:netty-resolver:4.1.8.Final",
|
||||
"netty-codec-http2": "mvn:io.netty:netty-codec-http2:4.1.8.Final",
|
||||
"netty-codec-http": "mvn:io.netty:netty-codec-http:4.1.8.Final",
|
||||
"catalyst-concurrent": "mvn:io.atomix.catalyst:catalyst-concurrent:1.2.1",
|
||||
"catalyst-netty": "mvn:io.atomix.catalyst:catalyst-netty:1.2.1",
|
||||
"catalyst-transport": "mvn:io.atomix.catalyst:catalyst-transport:1.2.1",
|
||||
@ -235,6 +249,14 @@
|
||||
"grpc-netty-1.3.0": "mvn:io.grpc:grpc-netty:1.3.0",
|
||||
"grpc-auth-1.3.0": "mvn:io.grpc:grpc-auth:1.3.0",
|
||||
"protobuf-java-3.3.0": "mvn:com.google.protobuf:protobuf-java:3.3.0",
|
||||
"protobuf-java-3.2.0": "mvn:com.google.protobuf:protobuf-java:3.2.0"
|
||||
"protobuf-java-3.2.0": "mvn:com.google.protobuf:protobuf-java:3.2.0",
|
||||
"grpc-testing-1.3.0": "mvn:io.grpc:grpc-testing:1.3.0",
|
||||
"grpc-testing-proto-1.3.0": "mvn:io.grpc:grpc-testing-proto:1.3.0",
|
||||
"grpc-context-1.3.0": "mvn:io.grpc:grpc-context:1.3.0",
|
||||
"google-truth-0.28": "mvn:com.google.truth:truth:0.28",
|
||||
"google-code-findbugs-3.0.0": "mvn:com.google.code.findbugs:jsr305:3.0.0",
|
||||
"google-errorprone-2.0.19": "mvn:com.google.errorprone:error_prone_annotations:2.0.19",
|
||||
"google-instrumentation-0.3.0": "mvn:com.google.instrumentation:instrumentation-api:0.3.0",
|
||||
"gson": "mvn:com.google.code.gson:gson:2.7"
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ UTILS = [
|
||||
API = [
|
||||
'//core/api:onos-api',
|
||||
'//incubator/api:onos-incubator-api',
|
||||
'//incubator/protobuf:onos-incubator-grpc',
|
||||
]
|
||||
|
||||
CORE = UTILS + API + [
|
||||
@ -81,6 +80,9 @@ CORE = UTILS + API + [
|
||||
|
||||
'//web/api:onos-rest',
|
||||
'//web/gui:onos-gui',
|
||||
|
||||
'//incubator/protobuf/models:onos-incubator-protobuf-models',
|
||||
'//incubator/protobuf/services/nb:onos-incubator-protobuf-services-nb',
|
||||
]
|
||||
|
||||
ONOS_DRIVERS = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user