Committed by
Yuta HIGUCHI
[ONOS-4520] Separate model messages from service messages in ProtoBuf IDL.
- move ProtoBuf generated code in a package similar to ONOS models. Change-Id: I5deb591094c2b8af2b22041da935567fc8dacd87
Showing
10 changed files
with
189 additions
and
178 deletions
| ... | @@ -24,13 +24,13 @@ import java.util.Collection; | ... | @@ -24,13 +24,13 @@ import java.util.Collection; |
| 24 | import java.util.List; | 24 | import java.util.List; |
| 25 | import java.util.concurrent.atomic.AtomicBoolean; | 25 | import java.util.concurrent.atomic.AtomicBoolean; |
| 26 | 26 | ||
| 27 | -import org.onosproject.grpc.Device.DeviceProviderMsg; | 27 | +import org.onosproject.grpc.net.device.DeviceProviderRegistryRpcGrpc; |
| 28 | -import org.onosproject.grpc.Device.DeviceProviderServiceMsg; | 28 | +import org.onosproject.grpc.net.device.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpcStub; |
| 29 | -import org.onosproject.grpc.Device.IsReachableRequest; | 29 | +import org.onosproject.grpc.net.device.DeviceService.DeviceProviderMsg; |
| 30 | -import org.onosproject.grpc.Device.RoleChanged; | 30 | +import org.onosproject.grpc.net.device.DeviceService.DeviceProviderServiceMsg; |
| 31 | -import org.onosproject.grpc.Device.TriggerProbe; | 31 | +import org.onosproject.grpc.net.device.DeviceService.IsReachableRequest; |
| 32 | -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc; | 32 | +import org.onosproject.grpc.net.device.DeviceService.RoleChanged; |
| 33 | -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpcStub; | 33 | +import org.onosproject.grpc.net.device.DeviceService.TriggerProbe; |
| 34 | import org.onosproject.net.DeviceId; | 34 | import org.onosproject.net.DeviceId; |
| 35 | import org.onosproject.net.MastershipRole; | 35 | import org.onosproject.net.MastershipRole; |
| 36 | import org.onosproject.net.device.DeviceDescription; | 36 | import org.onosproject.net.device.DeviceDescription; |
| ... | @@ -112,7 +112,7 @@ final class DeviceProviderServiceClientProxy | ... | @@ -112,7 +112,7 @@ final class DeviceProviderServiceClientProxy |
| 112 | checkValidity(); | 112 | checkValidity(); |
| 113 | 113 | ||
| 114 | DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); | 114 | DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); |
| 115 | - List<org.onosproject.grpc.Port.PortDescription> portDescs = | 115 | + List<org.onosproject.grpc.net.Port.PortDescription> portDescs = |
| 116 | portDescriptions.stream() | 116 | portDescriptions.stream() |
| 117 | .map(GrpcDeviceUtils::translate) | 117 | .map(GrpcDeviceUtils::translate) |
| 118 | .collect(toList()); | 118 | .collect(toList()); |
| ... | @@ -160,7 +160,7 @@ final class DeviceProviderServiceClientProxy | ... | @@ -160,7 +160,7 @@ final class DeviceProviderServiceClientProxy |
| 160 | checkValidity(); | 160 | checkValidity(); |
| 161 | 161 | ||
| 162 | DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); | 162 | DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); |
| 163 | - List<org.onosproject.grpc.Port.PortStatistics> portStats = | 163 | + List<org.onosproject.grpc.net.Port.PortStatistics> portStats = |
| 164 | portStatistics.stream() | 164 | portStatistics.stream() |
| 165 | .map(GrpcDeviceUtils::translate) | 165 | .map(GrpcDeviceUtils::translate) |
| 166 | .collect(toList()); | 166 | .collect(toList()); | ... | ... |
| ... | @@ -20,8 +20,8 @@ import java.util.HashMap; | ... | @@ -20,8 +20,8 @@ import java.util.HashMap; |
| 20 | import java.util.Map; | 20 | import java.util.Map; |
| 21 | 21 | ||
| 22 | import org.onlab.packet.ChassisId; | 22 | import org.onlab.packet.ChassisId; |
| 23 | -import org.onosproject.grpc.Device.DeviceType; | 23 | +import org.onosproject.grpc.net.Device.DeviceType; |
| 24 | -import org.onosproject.grpc.Port.PortType; | 24 | +import org.onosproject.grpc.net.Port.PortType; |
| 25 | import org.onosproject.net.Annotations; | 25 | import org.onosproject.net.Annotations; |
| 26 | import org.onosproject.net.DefaultAnnotations; | 26 | import org.onosproject.net.DefaultAnnotations; |
| 27 | import org.onosproject.net.Device; | 27 | import org.onosproject.net.Device; |
| ... | @@ -55,7 +55,7 @@ public final class GrpcDeviceUtils { | ... | @@ -55,7 +55,7 @@ public final class GrpcDeviceUtils { |
| 55 | * @param role mastership role in gRPC enum | 55 | * @param role mastership role in gRPC enum |
| 56 | * @return equivalent in ONOS enum | 56 | * @return equivalent in ONOS enum |
| 57 | */ | 57 | */ |
| 58 | - public static MastershipRole translate(org.onosproject.grpc.Device.MastershipRole role) { | 58 | + public static MastershipRole translate(org.onosproject.grpc.net.Device.MastershipRole role) { |
| 59 | switch (role) { | 59 | switch (role) { |
| 60 | case NONE: | 60 | case NONE: |
| 61 | return MastershipRole.NONE; | 61 | return MastershipRole.NONE; |
| ... | @@ -77,15 +77,15 @@ public final class GrpcDeviceUtils { | ... | @@ -77,15 +77,15 @@ public final class GrpcDeviceUtils { |
| 77 | * @param newRole ONOS' mastership role | 77 | * @param newRole ONOS' mastership role |
| 78 | * @return equivalent in gRPC message enum | 78 | * @return equivalent in gRPC message enum |
| 79 | */ | 79 | */ |
| 80 | - public static org.onosproject.grpc.Device.MastershipRole translate(MastershipRole newRole) { | 80 | + public static org.onosproject.grpc.net.Device.MastershipRole translate(MastershipRole newRole) { |
| 81 | switch (newRole) { | 81 | switch (newRole) { |
| 82 | case MASTER: | 82 | case MASTER: |
| 83 | - return org.onosproject.grpc.Device.MastershipRole.MASTER; | 83 | + return org.onosproject.grpc.net.Device.MastershipRole.MASTER; |
| 84 | case STANDBY: | 84 | case STANDBY: |
| 85 | - return org.onosproject.grpc.Device.MastershipRole.STANDBY; | 85 | + return org.onosproject.grpc.net.Device.MastershipRole.STANDBY; |
| 86 | case NONE: | 86 | case NONE: |
| 87 | default: | 87 | default: |
| 88 | - return org.onosproject.grpc.Device.MastershipRole.NONE; | 88 | + return org.onosproject.grpc.net.Device.MastershipRole.NONE; |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | 91 | ||
| ... | @@ -96,7 +96,7 @@ public final class GrpcDeviceUtils { | ... | @@ -96,7 +96,7 @@ public final class GrpcDeviceUtils { |
| 96 | * @param deviceDescription gRPC message | 96 | * @param deviceDescription gRPC message |
| 97 | * @return {@link DeviceDescription} | 97 | * @return {@link DeviceDescription} |
| 98 | */ | 98 | */ |
| 99 | - public static DeviceDescription translate(org.onosproject.grpc.Device.DeviceDescription deviceDescription) { | 99 | + public static DeviceDescription translate(org.onosproject.grpc.net.Device.DeviceDescription deviceDescription) { |
| 100 | URI uri = URI.create(deviceDescription.getDeviceUri()); | 100 | URI uri = URI.create(deviceDescription.getDeviceUri()); |
| 101 | Device.Type type = translate(deviceDescription.getType()); | 101 | Device.Type type = translate(deviceDescription.getType()); |
| 102 | String manufacturer = deviceDescription.getManufacturer(); | 102 | String manufacturer = deviceDescription.getManufacturer(); |
| ... | @@ -116,9 +116,9 @@ public final class GrpcDeviceUtils { | ... | @@ -116,9 +116,9 @@ public final class GrpcDeviceUtils { |
| 116 | * @param deviceDescription {@link DeviceDescription} | 116 | * @param deviceDescription {@link DeviceDescription} |
| 117 | * @return gRPC DeviceDescription message | 117 | * @return gRPC DeviceDescription message |
| 118 | */ | 118 | */ |
| 119 | - public static org.onosproject.grpc.Device.DeviceDescription translate(DeviceDescription deviceDescription) { | 119 | + public static org.onosproject.grpc.net.Device.DeviceDescription translate(DeviceDescription deviceDescription) { |
| 120 | 120 | ||
| 121 | - return org.onosproject.grpc.Device.DeviceDescription.newBuilder() | 121 | + return org.onosproject.grpc.net.Device.DeviceDescription.newBuilder() |
| 122 | .setDeviceUri(deviceDescription.deviceUri().toString()) | 122 | .setDeviceUri(deviceDescription.deviceUri().toString()) |
| 123 | .setType(translate(deviceDescription.type())) | 123 | .setType(translate(deviceDescription.type())) |
| 124 | .setManufacturer(deviceDescription.manufacturer()) | 124 | .setManufacturer(deviceDescription.manufacturer()) |
| ... | @@ -137,7 +137,7 @@ public final class GrpcDeviceUtils { | ... | @@ -137,7 +137,7 @@ public final class GrpcDeviceUtils { |
| 137 | * @param type gRPC message | 137 | * @param type gRPC message |
| 138 | * @return {@link Device.Type} | 138 | * @return {@link Device.Type} |
| 139 | */ | 139 | */ |
| 140 | - public static Device.Type translate(org.onosproject.grpc.Device.DeviceType type) { | 140 | + public static Device.Type translate(org.onosproject.grpc.net.Device.DeviceType type) { |
| 141 | switch (type) { | 141 | switch (type) { |
| 142 | case BALANCER: | 142 | case BALANCER: |
| 143 | return Device.Type.BALANCER; | 143 | return Device.Type.BALANCER; |
| ... | @@ -224,7 +224,7 @@ public final class GrpcDeviceUtils { | ... | @@ -224,7 +224,7 @@ public final class GrpcDeviceUtils { |
| 224 | * @param portDescription gRPC message | 224 | * @param portDescription gRPC message |
| 225 | * @return {@link PortDescription} | 225 | * @return {@link PortDescription} |
| 226 | */ | 226 | */ |
| 227 | - public static PortDescription translate(org.onosproject.grpc.Port.PortDescription portDescription) { | 227 | + public static PortDescription translate(org.onosproject.grpc.net.Port.PortDescription portDescription) { |
| 228 | PortNumber number = PortNumber.fromString(portDescription.getPortNumber()); | 228 | PortNumber number = PortNumber.fromString(portDescription.getPortNumber()); |
| 229 | boolean isEnabled = portDescription.getIsEnabled(); | 229 | boolean isEnabled = portDescription.getIsEnabled(); |
| 230 | Port.Type type = translate(portDescription.getType()); | 230 | Port.Type type = translate(portDescription.getType()); |
| ... | @@ -240,9 +240,9 @@ public final class GrpcDeviceUtils { | ... | @@ -240,9 +240,9 @@ public final class GrpcDeviceUtils { |
| 240 | * @param portDescription {@link PortDescription} | 240 | * @param portDescription {@link PortDescription} |
| 241 | * @return gRPC PortDescription message | 241 | * @return gRPC PortDescription message |
| 242 | */ | 242 | */ |
| 243 | - public static org.onosproject.grpc.Port.PortDescription translate(PortDescription portDescription) { | 243 | + public static org.onosproject.grpc.net.Port.PortDescription translate(PortDescription portDescription) { |
| 244 | // TODO How to deal with more specific Port... | 244 | // TODO How to deal with more specific Port... |
| 245 | - return org.onosproject.grpc.Port.PortDescription.newBuilder() | 245 | + return org.onosproject.grpc.net.Port.PortDescription.newBuilder() |
| 246 | .setPortNumber(portDescription.portNumber().toString()) | 246 | .setPortNumber(portDescription.portNumber().toString()) |
| 247 | .setIsEnabled(portDescription.isEnabled()) | 247 | .setIsEnabled(portDescription.isEnabled()) |
| 248 | .setType(translate(portDescription.type())) | 248 | .setType(translate(portDescription.type())) |
| ... | @@ -316,7 +316,7 @@ public final class GrpcDeviceUtils { | ... | @@ -316,7 +316,7 @@ public final class GrpcDeviceUtils { |
| 316 | * @param portStatistics gRPC PortStatistics message | 316 | * @param portStatistics gRPC PortStatistics message |
| 317 | * @return {@link PortStatistics} | 317 | * @return {@link PortStatistics} |
| 318 | */ | 318 | */ |
| 319 | - public static PortStatistics translate(org.onosproject.grpc.Port.PortStatistics portStatistics) { | 319 | + public static PortStatistics translate(org.onosproject.grpc.net.Port.PortStatistics portStatistics) { |
| 320 | // TODO implement adding missing fields | 320 | // TODO implement adding missing fields |
| 321 | return DefaultPortStatistics.builder() | 321 | return DefaultPortStatistics.builder() |
| 322 | .setPort(portStatistics.getPort()) | 322 | .setPort(portStatistics.getPort()) |
| ... | @@ -331,9 +331,9 @@ public final class GrpcDeviceUtils { | ... | @@ -331,9 +331,9 @@ public final class GrpcDeviceUtils { |
| 331 | * @param portStatistics {@link PortStatistics} | 331 | * @param portStatistics {@link PortStatistics} |
| 332 | * @return gRPC PortStatistics message | 332 | * @return gRPC PortStatistics message |
| 333 | */ | 333 | */ |
| 334 | - public static org.onosproject.grpc.Port.PortStatistics translate(PortStatistics portStatistics) { | 334 | + public static org.onosproject.grpc.net.Port.PortStatistics translate(PortStatistics portStatistics) { |
| 335 | // TODO implement adding missing fields | 335 | // TODO implement adding missing fields |
| 336 | - return org.onosproject.grpc.Port.PortStatistics.newBuilder() | 336 | + return org.onosproject.grpc.net.Port.PortStatistics.newBuilder() |
| 337 | .setPort(portStatistics.port()) | 337 | .setPort(portStatistics.port()) |
| 338 | .setPacketsReceived(portStatistics.packetsReceived()) | 338 | .setPacketsReceived(portStatistics.packetsReceived()) |
| 339 | .setPacketsSent(portStatistics.packetsSent()) | 339 | .setPacketsSent(portStatistics.packetsSent()) | ... | ... |
| ... | @@ -36,19 +36,19 @@ import org.apache.felix.scr.annotations.Modified; | ... | @@ -36,19 +36,19 @@ import org.apache.felix.scr.annotations.Modified; |
| 36 | import org.apache.felix.scr.annotations.Property; | 36 | import org.apache.felix.scr.annotations.Property; |
| 37 | import org.apache.felix.scr.annotations.Reference; | 37 | import org.apache.felix.scr.annotations.Reference; |
| 38 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 38 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 39 | -import org.onosproject.grpc.Device.DeviceConnected; | 39 | +import org.onosproject.grpc.net.device.DeviceProviderRegistryRpcGrpc; |
| 40 | -import org.onosproject.grpc.Device.DeviceDisconnected; | 40 | +import org.onosproject.grpc.net.device.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpc; |
| 41 | -import org.onosproject.grpc.Device.DeviceProviderMsg; | 41 | +import org.onosproject.grpc.net.device.DeviceService.DeviceConnected; |
| 42 | -import org.onosproject.grpc.Device.DeviceProviderServiceMsg; | 42 | +import org.onosproject.grpc.net.device.DeviceService.DeviceDisconnected; |
| 43 | -import org.onosproject.grpc.Device.IsReachableResponse; | 43 | +import org.onosproject.grpc.net.device.DeviceService.DeviceProviderMsg; |
| 44 | -import org.onosproject.grpc.Device.PortStatusChanged; | 44 | +import org.onosproject.grpc.net.device.DeviceService.DeviceProviderServiceMsg; |
| 45 | -import org.onosproject.grpc.Device.ReceivedRoleReply; | 45 | +import org.onosproject.grpc.net.device.DeviceService.IsReachableResponse; |
| 46 | -import org.onosproject.grpc.Device.RegisterProvider; | 46 | +import org.onosproject.grpc.net.device.DeviceService.PortStatusChanged; |
| 47 | -import org.onosproject.grpc.Device.UpdatePortStatistics; | 47 | +import org.onosproject.grpc.net.device.DeviceService.ReceivedRoleReply; |
| 48 | -import org.onosproject.grpc.Device.UpdatePorts; | 48 | +import org.onosproject.grpc.net.device.DeviceService.RegisterProvider; |
| 49 | -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc; | 49 | +import org.onosproject.grpc.net.device.DeviceService.UpdatePortStatistics; |
| 50 | -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpc; | 50 | +import org.onosproject.grpc.net.device.DeviceService.UpdatePorts; |
| 51 | -import org.onosproject.grpc.LinkProviderServiceRpcGrpc; | 51 | +import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc; |
| 52 | import org.onosproject.net.DeviceId; | 52 | import org.onosproject.net.DeviceId; |
| 53 | import org.onosproject.net.MastershipRole; | 53 | import org.onosproject.net.MastershipRole; |
| 54 | import org.onosproject.net.PortNumber; | 54 | import org.onosproject.net.PortNumber; | ... | ... |
| ... | @@ -21,12 +21,12 @@ import java.util.concurrent.ExecutionException; | ... | @@ -21,12 +21,12 @@ import java.util.concurrent.ExecutionException; |
| 21 | import java.util.concurrent.TimeUnit; | 21 | import java.util.concurrent.TimeUnit; |
| 22 | import java.util.concurrent.TimeoutException; | 22 | import java.util.concurrent.TimeoutException; |
| 23 | 23 | ||
| 24 | -import org.onosproject.grpc.Link.LinkDetectedMsg; | 24 | +import org.onosproject.grpc.net.Link.LinkType; |
| 25 | -import org.onosproject.grpc.Link.LinkType; | 25 | +import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc; |
| 26 | -import org.onosproject.grpc.Link.LinkVanishedMsg; | 26 | +import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc.LinkProviderServiceRpcFutureStub; |
| 27 | -import org.onosproject.grpc.Link.Void; | 27 | +import org.onosproject.grpc.net.link.LinkService.LinkDetectedMsg; |
| 28 | -import org.onosproject.grpc.LinkProviderServiceRpcGrpc; | 28 | +import org.onosproject.grpc.net.link.LinkService.LinkVanishedMsg; |
| 29 | -import org.onosproject.grpc.LinkProviderServiceRpcGrpc.LinkProviderServiceRpcFutureStub; | 29 | +import org.onosproject.grpc.net.link.LinkService.Void; |
| 30 | import org.onosproject.net.ConnectPoint; | 30 | import org.onosproject.net.ConnectPoint; |
| 31 | import org.onosproject.net.DeviceId; | 31 | import org.onosproject.net.DeviceId; |
| 32 | import org.onosproject.net.Link.Type; | 32 | import org.onosproject.net.Link.Type; |
| ... | @@ -237,7 +237,7 @@ class LinkProviderServiceClientProxy | ... | @@ -237,7 +237,7 @@ class LinkProviderServiceClientProxy |
| 237 | /** | 237 | /** |
| 238 | * Translates ONOS object to gRPC message. | 238 | * Translates ONOS object to gRPC message. |
| 239 | * | 239 | * |
| 240 | - * @param type {@link Link.Type} | 240 | + * @param type {@link org.onosproject.net.Link.Type Link.Type} |
| 241 | * @return gRPC LinkType | 241 | * @return gRPC LinkType |
| 242 | */ | 242 | */ |
| 243 | private LinkType translate(Type type) { | 243 | private LinkType translate(Type type) { |
| ... | @@ -267,8 +267,8 @@ class LinkProviderServiceClientProxy | ... | @@ -267,8 +267,8 @@ class LinkProviderServiceClientProxy |
| 267 | * @param cp {@link ConnectPoint} | 267 | * @param cp {@link ConnectPoint} |
| 268 | * @return gRPC ConnectPoint | 268 | * @return gRPC ConnectPoint |
| 269 | */ | 269 | */ |
| 270 | - private org.onosproject.grpc.Link.ConnectPoint translate(ConnectPoint cp) { | 270 | + private org.onosproject.grpc.net.Link.ConnectPoint translate(ConnectPoint cp) { |
| 271 | - return org.onosproject.grpc.Link.ConnectPoint.newBuilder() | 271 | + return org.onosproject.grpc.net.Link.ConnectPoint.newBuilder() |
| 272 | .setDeviceId(cp.deviceId().toString()) | 272 | .setDeviceId(cp.deviceId().toString()) |
| 273 | .setPortNumber(cp.port().toString()) | 273 | .setPortNumber(cp.port().toString()) |
| 274 | .build(); | 274 | .build(); | ... | ... |
| ... | @@ -19,12 +19,12 @@ import static com.google.common.base.Preconditions.checkArgument; | ... | @@ -19,12 +19,12 @@ import static com.google.common.base.Preconditions.checkArgument; |
| 19 | import static com.google.common.base.Preconditions.checkNotNull; | 19 | import static com.google.common.base.Preconditions.checkNotNull; |
| 20 | import static org.onosproject.net.DeviceId.deviceId; | 20 | import static org.onosproject.net.DeviceId.deviceId; |
| 21 | 21 | ||
| 22 | -import org.onosproject.grpc.Link.LinkDetectedMsg; | 22 | +import org.onosproject.grpc.net.Link.ConnectPoint.ElementIdCase; |
| 23 | -import org.onosproject.grpc.Link.LinkType; | 23 | +import org.onosproject.grpc.net.Link.LinkType; |
| 24 | -import org.onosproject.grpc.Link.LinkVanishedMsg; | 24 | +import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc.LinkProviderServiceRpc; |
| 25 | -import org.onosproject.grpc.Link.Void; | 25 | +import org.onosproject.grpc.net.link.LinkService.LinkDetectedMsg; |
| 26 | -import org.onosproject.grpc.Link.ConnectPoint.ElementIdCase; | 26 | +import org.onosproject.grpc.net.link.LinkService.LinkVanishedMsg; |
| 27 | -import org.onosproject.grpc.LinkProviderServiceRpcGrpc.LinkProviderServiceRpc; | 27 | +import org.onosproject.grpc.net.link.LinkService.Void; |
| 28 | import org.onosproject.net.ConnectPoint; | 28 | import org.onosproject.net.ConnectPoint; |
| 29 | import org.onosproject.net.DeviceId; | 29 | import org.onosproject.net.DeviceId; |
| 30 | import org.onosproject.net.Link; | 30 | import org.onosproject.net.Link; |
| ... | @@ -136,7 +136,7 @@ final class LinkProviderServiceServerProxy | ... | @@ -136,7 +136,7 @@ final class LinkProviderServiceServerProxy |
| 136 | * @param connectPoint gRPC message. | 136 | * @param connectPoint gRPC message. |
| 137 | * @return {@link ConnectPoint} | 137 | * @return {@link ConnectPoint} |
| 138 | */ | 138 | */ |
| 139 | - private ConnectPoint translate(org.onosproject.grpc.Link.ConnectPoint connectPoint) { | 139 | + private ConnectPoint translate(org.onosproject.grpc.net.Link.ConnectPoint connectPoint) { |
| 140 | checkArgument(connectPoint.getElementIdCase() == ElementIdCase.DEVICE_ID, | 140 | checkArgument(connectPoint.getElementIdCase() == ElementIdCase.DEVICE_ID, |
| 141 | "Only DeviceId supported."); | 141 | "Only DeviceId supported."); |
| 142 | return new ConnectPoint(deviceId(connectPoint.getDeviceId()), | 142 | return new ConnectPoint(deviceId(connectPoint.getDeviceId()), |
| ... | @@ -149,7 +149,7 @@ final class LinkProviderServiceServerProxy | ... | @@ -149,7 +149,7 @@ final class LinkProviderServiceServerProxy |
| 149 | * @param linkDescription gRPC message | 149 | * @param linkDescription gRPC message |
| 150 | * @return {@link LinkDescription} | 150 | * @return {@link LinkDescription} |
| 151 | */ | 151 | */ |
| 152 | - private LinkDescription translate(org.onosproject.grpc.Link.LinkDescription linkDescription) { | 152 | + private LinkDescription translate(org.onosproject.grpc.net.Link.LinkDescription linkDescription) { |
| 153 | ConnectPoint src = translate(linkDescription.getSrc()); | 153 | ConnectPoint src = translate(linkDescription.getSrc()); |
| 154 | ConnectPoint dst = translate(linkDescription.getDst()); | 154 | ConnectPoint dst = translate(linkDescription.getDst()); |
| 155 | Link.Type type = translate(linkDescription.getType()); | 155 | Link.Type type = translate(linkDescription.getType()); |
| ... | @@ -161,7 +161,7 @@ final class LinkProviderServiceServerProxy | ... | @@ -161,7 +161,7 @@ final class LinkProviderServiceServerProxy |
| 161 | * Translates gRPC message to corresponding ONOS object. | 161 | * Translates gRPC message to corresponding ONOS object. |
| 162 | * | 162 | * |
| 163 | * @param type gRPC message enum | 163 | * @param type gRPC message enum |
| 164 | - * @return {@link Type} | 164 | + * @return {@link org.onosproject.net.Link.Type Link.Type} |
| 165 | */ | 165 | */ |
| 166 | private Link.Type translate(LinkType type) { | 166 | private Link.Type translate(LinkType type) { |
| 167 | switch (type) { | 167 | switch (type) { | ... | ... |
| 1 | syntax = "proto3"; | 1 | syntax = "proto3"; |
| 2 | -option java_package = "org.onosproject.grpc"; | 2 | +option java_package = "org.onosproject.grpc.net"; |
| 3 | 3 | ||
| 4 | -import "Port.proto"; | ||
| 5 | package Device; | 4 | package Device; |
| 6 | 5 | ||
| 7 | enum DeviceType { | 6 | enum DeviceType { |
| ... | @@ -37,95 +36,3 @@ enum MastershipRole { | ... | @@ -37,95 +36,3 @@ enum MastershipRole { |
| 37 | MASTER = 1; | 36 | MASTER = 1; |
| 38 | STANDBY = 2; | 37 | STANDBY = 2; |
| 39 | } | 38 | } |
| 40 | - | ||
| 41 | -message DeviceConnected { | ||
| 42 | - // DeviceID as String DeviceId#toString | ||
| 43 | - string device_id = 1; | ||
| 44 | - DeviceDescription device_description = 2; | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -message DeviceDisconnected { | ||
| 48 | - // DeviceID as String DeviceId#toString | ||
| 49 | - string device_id = 1; | ||
| 50 | -} | ||
| 51 | - | ||
| 52 | -message UpdatePorts { | ||
| 53 | - // DeviceID as String DeviceId#toString | ||
| 54 | - string device_id = 1; | ||
| 55 | - repeated Port.PortDescription port_descriptions= 2; | ||
| 56 | -} | ||
| 57 | - | ||
| 58 | -message PortStatusChanged { | ||
| 59 | - // DeviceID as String DeviceId#toString | ||
| 60 | - string device_id = 1; | ||
| 61 | - Port.PortDescription port_description= 2; | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | -message ReceivedRoleReply { | ||
| 65 | - // DeviceID as String DeviceId#toString | ||
| 66 | - string device_id = 1; | ||
| 67 | - MastershipRole requested = 2; | ||
| 68 | - MastershipRole response = 3; | ||
| 69 | -} | ||
| 70 | - | ||
| 71 | -message UpdatePortStatistics { | ||
| 72 | - // DeviceID as String DeviceId#toString | ||
| 73 | - string device_id = 1; | ||
| 74 | - repeated Port.PortStatistics port_statistics = 2; | ||
| 75 | -} | ||
| 76 | - | ||
| 77 | -message RegisterProvider { | ||
| 78 | - // DeviceProvider's ProviderId scheme | ||
| 79 | - string provider_scheme = 1; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -message DeviceProviderServiceMsg { | ||
| 83 | - oneof method { | ||
| 84 | - DeviceConnected device_connected= 1; | ||
| 85 | - DeviceDisconnected device_disconnected = 2; | ||
| 86 | - UpdatePorts update_ports= 3; | ||
| 87 | - PortStatusChanged port_status_changed = 4; | ||
| 88 | - ReceivedRoleReply received_role_reply = 5; | ||
| 89 | - UpdatePortStatistics update_port_statistics = 6; | ||
| 90 | - | ||
| 91 | - // This message is for return value of DeviceProvider#isReachable | ||
| 92 | - IsReachableResponse is_reachable_response = 7; | ||
| 93 | - | ||
| 94 | - // This MUST be the 1st message over the stream | ||
| 95 | - RegisterProvider register_provider = 8; | ||
| 96 | - } | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -message TriggerProbe { | ||
| 100 | - // DeviceID as String DeviceId#toString | ||
| 101 | - string device_id = 1; | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -message RoleChanged { | ||
| 105 | - // DeviceID as String DeviceId#toString | ||
| 106 | - string device_id = 1; | ||
| 107 | - MastershipRole new_role = 2; | ||
| 108 | -} | ||
| 109 | - | ||
| 110 | -message IsReachableRequest { | ||
| 111 | - int32 xid = 1; | ||
| 112 | - // DeviceID as String DeviceId#toString | ||
| 113 | - string device_id = 2; | ||
| 114 | -} | ||
| 115 | - | ||
| 116 | -message IsReachableResponse { | ||
| 117 | - int32 xid = 1; | ||
| 118 | - bool is_reachable = 2; | ||
| 119 | -} | ||
| 120 | - | ||
| 121 | -message DeviceProviderMsg { | ||
| 122 | - oneof method { | ||
| 123 | - TriggerProbe trigger_probe = 1; | ||
| 124 | - RoleChanged role_changed = 2; | ||
| 125 | - IsReachableRequest is_reachable_request= 3; | ||
| 126 | - } | ||
| 127 | -} | ||
| 128 | - | ||
| 129 | -service DeviceProviderRegistryRpc { | ||
| 130 | - rpc Register(stream DeviceProviderServiceMsg) returns (stream DeviceProviderMsg); | ||
| 131 | -} | ... | ... |
| 1 | +syntax = "proto3"; | ||
| 2 | +option java_package = "org.onosproject.grpc.net.device"; | ||
| 3 | + | ||
| 4 | +import "Device.proto"; | ||
| 5 | +import "Port.proto"; | ||
| 6 | + | ||
| 7 | +package Device; | ||
| 8 | + | ||
| 9 | +message DeviceConnected { | ||
| 10 | + // DeviceID as String DeviceId#toString | ||
| 11 | + string device_id = 1; | ||
| 12 | + DeviceDescription device_description = 2; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +message DeviceDisconnected { | ||
| 16 | + // DeviceID as String DeviceId#toString | ||
| 17 | + string device_id = 1; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +message UpdatePorts { | ||
| 21 | + // DeviceID as String DeviceId#toString | ||
| 22 | + string device_id = 1; | ||
| 23 | + repeated Port.PortDescription port_descriptions= 2; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +message PortStatusChanged { | ||
| 27 | + // DeviceID as String DeviceId#toString | ||
| 28 | + string device_id = 1; | ||
| 29 | + Port.PortDescription port_description= 2; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +message ReceivedRoleReply { | ||
| 33 | + // DeviceID as String DeviceId#toString | ||
| 34 | + string device_id = 1; | ||
| 35 | + MastershipRole requested = 2; | ||
| 36 | + MastershipRole response = 3; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +message UpdatePortStatistics { | ||
| 40 | + // DeviceID as String DeviceId#toString | ||
| 41 | + string device_id = 1; | ||
| 42 | + repeated Port.PortStatistics port_statistics = 2; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +message RegisterProvider { | ||
| 46 | + // DeviceProvider's ProviderId scheme | ||
| 47 | + string provider_scheme = 1; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +message DeviceProviderServiceMsg { | ||
| 51 | + oneof method { | ||
| 52 | + DeviceConnected device_connected= 1; | ||
| 53 | + DeviceDisconnected device_disconnected = 2; | ||
| 54 | + UpdatePorts update_ports= 3; | ||
| 55 | + PortStatusChanged port_status_changed = 4; | ||
| 56 | + ReceivedRoleReply received_role_reply = 5; | ||
| 57 | + UpdatePortStatistics update_port_statistics = 6; | ||
| 58 | + | ||
| 59 | + // This message is for return value of DeviceProvider#isReachable | ||
| 60 | + IsReachableResponse is_reachable_response = 7; | ||
| 61 | + | ||
| 62 | + // This MUST be the 1st message over the stream | ||
| 63 | + RegisterProvider register_provider = 8; | ||
| 64 | + } | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +message TriggerProbe { | ||
| 68 | + // DeviceID as String DeviceId#toString | ||
| 69 | + string device_id = 1; | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +message RoleChanged { | ||
| 73 | + // DeviceID as String DeviceId#toString | ||
| 74 | + string device_id = 1; | ||
| 75 | + MastershipRole new_role = 2; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +message IsReachableRequest { | ||
| 79 | + int32 xid = 1; | ||
| 80 | + // DeviceID as String DeviceId#toString | ||
| 81 | + string device_id = 2; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +message IsReachableResponse { | ||
| 85 | + int32 xid = 1; | ||
| 86 | + bool is_reachable = 2; | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +message DeviceProviderMsg { | ||
| 90 | + oneof method { | ||
| 91 | + TriggerProbe trigger_probe = 1; | ||
| 92 | + RoleChanged role_changed = 2; | ||
| 93 | + IsReachableRequest is_reachable_request= 3; | ||
| 94 | + } | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +service DeviceProviderRegistryRpc { | ||
| 98 | + rpc Register(stream DeviceProviderServiceMsg) returns (stream DeviceProviderMsg); | ||
| 99 | +} |
| 1 | syntax = "proto3"; | 1 | syntax = "proto3"; |
| 2 | -option java_package = "org.onosproject.grpc"; | 2 | +option java_package = "org.onosproject.grpc.net"; |
| 3 | 3 | ||
| 4 | package Link; | 4 | package Link; |
| 5 | 5 | ||
| ... | @@ -44,27 +44,3 @@ message LinkDescription { | ... | @@ -44,27 +44,3 @@ message LinkDescription { |
| 44 | LinkType type = 3; | 44 | LinkType type = 3; |
| 45 | map<string, string> annotations = 4; | 45 | map<string, string> annotations = 4; |
| 46 | } | 46 | } |
| 47 | - | ||
| 48 | -// Message te represent no return value | ||
| 49 | -message Void {} | ||
| 50 | - | ||
| 51 | -message LinkDetectedMsg { | ||
| 52 | - // ProviderId scheme only | ||
| 53 | - string provider_id = 1; | ||
| 54 | - LinkDescription link_description = 2; | ||
| 55 | -} | ||
| 56 | - | ||
| 57 | -message LinkVanishedMsg { | ||
| 58 | - // ProviderId scheme only | ||
| 59 | - string provider_id = 1; | ||
| 60 | - oneof subject { | ||
| 61 | - LinkDescription link_description = 2; | ||
| 62 | - ConnectPoint connect_point = 3; | ||
| 63 | - string device_id = 4; | ||
| 64 | - } | ||
| 65 | -} | ||
| 66 | - | ||
| 67 | -service LinkProviderServiceRpc { | ||
| 68 | - rpc LinkDetected(LinkDetectedMsg) returns (Void); | ||
| 69 | - rpc LinkVanished(LinkVanishedMsg) returns (Void); | ||
| 70 | -} | ... | ... |
| 1 | +syntax = "proto3"; | ||
| 2 | +option java_package = "org.onosproject.grpc.net.link"; | ||
| 3 | + | ||
| 4 | +import "Link.proto"; | ||
| 5 | + | ||
| 6 | +package Link; | ||
| 7 | + | ||
| 8 | +// Message to represent no return value | ||
| 9 | +message Void {} | ||
| 10 | + | ||
| 11 | +message LinkDetectedMsg { | ||
| 12 | + // ProviderId scheme only | ||
| 13 | + string provider_id = 1; | ||
| 14 | + LinkDescription link_description = 2; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +message LinkVanishedMsg { | ||
| 18 | + // ProviderId scheme only | ||
| 19 | + string provider_id = 1; | ||
| 20 | + oneof subject { | ||
| 21 | + LinkDescription link_description = 2; | ||
| 22 | + ConnectPoint connect_point = 3; | ||
| 23 | + string device_id = 4; | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +service LinkProviderServiceRpc { | ||
| 28 | + rpc LinkDetected(LinkDetectedMsg) returns (Void); | ||
| 29 | + rpc LinkVanished(LinkVanishedMsg) returns (Void); | ||
| 30 | +} |
| 1 | syntax = "proto3"; | 1 | syntax = "proto3"; |
| 2 | -option java_package = "org.onosproject.grpc"; | 2 | +option java_package = "org.onosproject.grpc.net"; |
| 3 | 3 | ||
| 4 | package Port; | 4 | package Port; |
| 5 | 5 | ||
| ... | @@ -22,7 +22,6 @@ enum PortType { | ... | @@ -22,7 +22,6 @@ enum PortType { |
| 22 | VIRTUAL = 6; | 22 | VIRTUAL = 6; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | -// TODO What are we going to do with more specific PortDescription ... | ||
| 26 | message PortDescription { | 25 | message PortDescription { |
| 27 | // PortNumber as String PortNumber#toString | 26 | // PortNumber as String PortNumber#toString |
| 28 | string port_number = 1; | 27 | string port_number = 1; | ... | ... |
-
Please register or login to post a comment