Yuta HIGUCHI
Committed by Gerrit Code Review

ONOS-4801 add default available field to gRPC model

- replace deprecated methods with new Protobuf 3 API
- cosmetic changes

Change-Id: I4655fc0fd76c8de83ea03615fc876c5aa9445367
......@@ -105,10 +105,12 @@ public final class ProtobufUtils {
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 @@ public final class ProtobufUtils {
.setSwVersion(deviceDescription.swVersion())
.setSerialNumber(deviceDescription.serialNumber())
.setChassisId(deviceDescription.chassisId().toString())
.setIsDefaultAvailable(deviceDescription.isDefaultAvailable())
.putAllAnnotations(asMap(deviceDescription.annotations()))
.build();
}
......@@ -230,7 +233,7 @@ public final class ProtobufUtils {
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 @@ public final class ProtobufUtils {
* @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())
......
......@@ -12,6 +12,7 @@ message DeviceDescription {
string serial_number = 6;
string chassis_id = 7;
map<string, string> annotations = 8;
bool is_default_available = 9;
}
enum MastershipRole {
......
......@@ -26,5 +26,3 @@ enum DeviceEventType {
PORT_STATS_UPDATED = 8;
}
......
......@@ -8,7 +8,7 @@ enum LinkType {
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;
......