ONOS-4801 add default available field to gRPC model
- replace deprecated methods with new Protobuf 3 API
- cosmetic changes
Change-Id: I4655fc0fd76c8de83ea03615fc876c5aa9445367
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
index 0f2e3be..3cef0d4 100644
--- 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
@@ -105,10 +105,12 @@
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,
- asAnnotations(deviceDescription.getAnnotations()));
+ defaultAvailable,
+ asAnnotations(deviceDescription.getAnnotationsMap()));
}
/**
@@ -127,6 +129,7 @@
.setSwVersion(deviceDescription.swVersion())
.setSerialNumber(deviceDescription.serialNumber())
.setChassisId(deviceDescription.chassisId().toString())
+ .setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
.putAllAnnotations(asMap(deviceDescription.annotations()))
.build();
}
@@ -230,7 +233,7 @@
boolean isEnabled = portDescription.getIsEnabled();
Port.Type type = translate(portDescription.getType());
long portSpeed = portDescription.getPortSpeed();
- SparseAnnotations annotations = asAnnotations(portDescription.getAnnotations());
+ SparseAnnotations annotations = asAnnotations(portDescription.getAnnotationsMap());
// TODO How to deal with more specific Port...
return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations);
}
@@ -242,7 +245,6 @@
* @return gRPC PortDescription message
*/
public static org.onosproject.grpc.net.Port.PortDescription translate(PortDescription portDescription) {
- // TODO How to deal with more specific Port...
return org.onosproject.grpc.net.Port.PortDescription.newBuilder()
.setPortNumber(portDescription.portNumber().toString())
.setIsEnabled(portDescription.isEnabled())
diff --git a/incubator/protobuf/src/main/proto/Device.proto b/incubator/protobuf/src/main/proto/Device.proto
index a01790e..75cf0f5 100644
--- a/incubator/protobuf/src/main/proto/Device.proto
+++ b/incubator/protobuf/src/main/proto/Device.proto
@@ -12,6 +12,7 @@
string serial_number = 6;
string chassis_id = 7;
map<string, string> annotations = 8;
+ bool is_default_available = 9;
}
enum MastershipRole {
@@ -47,4 +48,4 @@
string serial_number = 6;
string chassis_id = 7;
map<string, string> annotations = 8;
-}
\ No newline at end of file
+}
diff --git a/incubator/protobuf/src/main/proto/DeviceEvent.proto b/incubator/protobuf/src/main/proto/DeviceEvent.proto
index 9bf7a2f..6a88768 100644
--- a/incubator/protobuf/src/main/proto/DeviceEvent.proto
+++ b/incubator/protobuf/src/main/proto/DeviceEvent.proto
@@ -26,5 +26,3 @@
PORT_STATS_UPDATED = 8;
}
-
-
diff --git a/incubator/protobuf/src/main/proto/Link.proto b/incubator/protobuf/src/main/proto/Link.proto
index b5fcbfc..a1ae8ff 100644
--- a/incubator/protobuf/src/main/proto/Link.proto
+++ b/incubator/protobuf/src/main/proto/Link.proto
@@ -8,7 +8,7 @@
DIRECT = 0;
// Signifies that this link is potentially comprised from multiple
- //underlying segments or hops, and as such should be used to tag
+ // underlying segments or hops, and as such should be used to tag
// links traversing optical paths, tunnels or intervening 'dark'
// switches.
INDIRECT = 1;