From b731e2f1dd0972409b136aebc7b463dd72c9cfad Mon Sep 17 00:00:00 2001 From: CNlucius Date: Tue, 13 Sep 2016 11:40:12 +0800 Subject: ONOSFW-171 O/S-SFC-ONOS scenario documentation Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365 Signed-off-by: CNlucius --- framework/src/onos/incubator/api/pom.xml | 49 -- .../incubator/net/PortStatisticsService.java | 36 -- .../net/config/basics/ConfigException.java | 45 -- .../net/config/basics/ExtraSubjectFactories.java | 40 -- .../net/config/basics/InterfaceConfig.java | 142 ------ .../incubator/net/config/basics/package-info.java | 20 - .../incubator/net/domain/DomainEdge.java | 75 --- .../incubator/net/domain/DomainIntentResource.java | 84 ---- .../incubator/net/domain/DomainVertex.java | 88 ---- .../incubator/net/domain/IntentDomain.java | 124 ----- .../net/domain/IntentDomainAdminService.java | 53 -- .../incubator/net/domain/IntentDomainConfig.java | 115 ----- .../incubator/net/domain/IntentDomainId.java | 79 --- .../incubator/net/domain/IntentDomainListener.java | 27 - .../incubator/net/domain/IntentDomainProvider.java | 84 ---- .../incubator/net/domain/IntentDomainService.java | 79 --- .../incubator/net/domain/IntentPrimitive.java | 41 -- .../incubator/net/domain/IntentResource.java | 88 ---- .../net/domain/NetworkIntentResource.java | 70 --- .../incubator/net/domain/TunnelPrimitive.java | 53 -- .../incubator/net/domain/package-info.java | 20 - .../incubator/net/faultmanagement/alarm/Alarm.java | 211 -------- .../net/faultmanagement/alarm/AlarmEntityId.java | 75 --- .../net/faultmanagement/alarm/AlarmEvent.java | 65 --- .../net/faultmanagement/alarm/AlarmId.java | 84 ---- .../net/faultmanagement/alarm/AlarmListener.java | 25 - .../net/faultmanagement/alarm/AlarmProvider.java | 37 -- .../alarm/AlarmProviderRegistry.java | 25 - .../alarm/AlarmProviderService.java | 37 -- .../net/faultmanagement/alarm/AlarmService.java | 121 ----- .../net/faultmanagement/alarm/DefaultAlarm.java | 309 ------------ .../net/faultmanagement/alarm/package-info.java | 20 - .../onosproject/incubator/net/intf/Interface.java | 153 ------ .../incubator/net/intf/InterfaceAdminService.java | 40 -- .../incubator/net/intf/InterfaceService.java | 71 --- .../incubator/net/intf/package-info.java | 20 - .../onosproject/incubator/net/package-info.java | 20 - .../net/resource/label/DefaultLabelResource.java | 98 ---- .../net/resource/label/LabelResource.java | 41 -- .../resource/label/LabelResourceAdminService.java | 66 --- .../net/resource/label/LabelResourceDelegate.java | 27 - .../net/resource/label/LabelResourceEvent.java | 55 --- .../net/resource/label/LabelResourceId.java | 63 --- .../net/resource/label/LabelResourceListener.java | 27 - .../net/resource/label/LabelResourcePool.java | 191 ------- .../net/resource/label/LabelResourceProvider.java | 28 -- .../label/LabelResourceProviderRegistry.java | 28 -- .../label/LabelResourceProviderService.java | 43 -- .../net/resource/label/LabelResourceRequest.java | 119 ----- .../net/resource/label/LabelResourceService.java | 115 ----- .../net/resource/label/LabelResourceStore.java | 154 ------ .../incubator/net/resource/label/package-info.java | 20 - .../net/tunnel/DefaultOpticalTunnelEndPoint.java | 131 ----- .../incubator/net/tunnel/DefaultTunnel.java | 178 ------- .../net/tunnel/DefaultTunnelDescription.java | 130 ----- .../net/tunnel/DefaultTunnelStatistics.java | 169 ------- .../incubator/net/tunnel/DomainTunnelId.java | 92 ---- .../incubator/net/tunnel/IpTunnelEndPoint.java | 80 --- .../incubator/net/tunnel/NetworkTunnelId.java | 89 ---- .../incubator/net/tunnel/OpticalLogicId.java | 81 --- .../net/tunnel/OpticalTunnelEndPoint.java | 90 ---- .../onosproject/incubator/net/tunnel/Tunnel.java | 155 ------ .../incubator/net/tunnel/TunnelAdminService.java | 65 --- .../incubator/net/tunnel/TunnelDescription.java | 87 ---- .../incubator/net/tunnel/TunnelEndPoint.java | 28 -- .../net/tunnel/TunnelEndPointFormatter.java | 50 -- .../incubator/net/tunnel/TunnelEvent.java | 70 --- .../onosproject/incubator/net/tunnel/TunnelId.java | 89 ---- .../incubator/net/tunnel/TunnelListener.java | 27 - .../incubator/net/tunnel/TunnelName.java | 79 --- .../incubator/net/tunnel/TunnelProvider.java | 115 ----- .../net/tunnel/TunnelProviderRegistry.java | 28 -- .../net/tunnel/TunnelProviderService.java | 58 --- .../incubator/net/tunnel/TunnelService.java | 201 -------- .../incubator/net/tunnel/TunnelStatistics.java | 64 --- .../incubator/net/tunnel/TunnelStore.java | 229 --------- .../incubator/net/tunnel/TunnelStoreDelegate.java | 27 - .../incubator/net/tunnel/TunnelSubscription.java | 156 ------ .../incubator/net/tunnel/package-info.java | 20 - .../net/virtual/DefaultVirtualDevice.java | 75 --- .../net/virtual/DefaultVirtualNetwork.java | 76 --- .../incubator/net/virtual/NetworkId.java | 84 ---- .../incubator/net/virtual/TenantId.java | 83 ---- .../incubator/net/virtual/VirtualDevice.java | 26 - .../incubator/net/virtual/VirtualElement.java | 32 -- .../incubator/net/virtual/VirtualHost.java | 26 - .../incubator/net/virtual/VirtualLink.java | 26 - .../incubator/net/virtual/VirtualNetwork.java | 40 -- .../net/virtual/VirtualNetworkAdminService.java | 143 ------ .../incubator/net/virtual/VirtualNetworkEvent.java | 72 --- .../net/virtual/VirtualNetworkListener.java | 24 - .../net/virtual/VirtualNetworkProvider.java | 32 -- .../virtual/VirtualNetworkProviderRegistry.java | 25 - .../net/virtual/VirtualNetworkProviderService.java | 11 - .../net/virtual/VirtualNetworkService.java | 92 ---- .../incubator/net/virtual/VirtualNetworkStore.java | 161 ------ .../net/virtual/VirtualNetworkStoreDelegate.java | 24 - .../incubator/net/virtual/VirtualPort.java | 34 -- .../incubator/net/virtual/package-info.java | 20 - .../org/onosproject/incubator/package-info.java | 21 - .../incubator/rpc/RemoteServiceContext.java | 40 -- .../rpc/RemoteServiceContextProvider.java | 38 -- .../rpc/RemoteServiceContextProviderService.java | 28 -- .../incubator/rpc/RemoteServiceDirectory.java | 40 -- .../rpc/RemoteServiceProviderRegistry.java | 30 -- .../onosproject/incubator/rpc/package-info.java | 20 - .../net/config/basics/OpticalPortConfigTest.java | 157 ------ .../faultmanagement/alarm/AlarmEntityIdTest.java | 74 --- .../net/faultmanagement/alarm/AlarmIdTest.java | 98 ---- .../faultmanagement/alarm/DefaultAlarmTest.java | 47 -- .../resource/label/DefaultLabelResourceTest.java | 46 -- .../net/resource/label/LabelResourcePoolTest.java | 38 -- .../resource/label/LabelResourceRequestTest.java | 59 --- .../incubator/net/tunnel/DefaultTunnelTest.java | 62 --- .../incubator/net/tunnel/TunnelEventTest.java | 61 --- .../incubator/net/tunnel/TunnelIdTest.java | 66 --- .../incubator/net/tunnel/TunnelNameTest.java | 64 --- .../net/tunnel/TunnelSubscriptionTest.java | 58 --- framework/src/onos/incubator/net/pom.xml | 101 ---- .../net/config/impl/ExtraNetworkConfigs.java | 69 --- .../incubator/net/config/impl/package-info.java | 20 - .../net/domain/impl/IntentDomainManager.java | 210 -------- .../incubator/net/domain/impl/package-info.java | 20 - .../incubator/net/impl/PortStatisticsManager.java | 162 ------ .../incubator/net/impl/package-info.java | 20 - .../incubator/net/intf/impl/InterfaceManager.java | 269 ---------- .../incubator/net/intf/impl/package-info.java | 20 - .../incubator/net/mcast/impl/MulticastData.java | 85 ---- .../net/mcast/impl/MulticastRouteManager.java | 174 ------- .../incubator/net/mcast/impl/package-info.java | 20 - .../incubator/net/meter/impl/MeterManager.java | 248 ---------- .../incubator/net/meter/impl/package-info.java | 20 - .../resource/label/impl/LabelResourceManager.java | 236 --------- .../net/resource/label/impl/package-info.java | 20 - .../incubator/net/tunnel/impl/TunnelManager.java | 366 -------------- .../incubator/net/tunnel/impl/package-info.java | 20 - .../net/virtual/impl/VirtualNetworkManager.java | 223 --------- .../incubator/net/virtual/impl/package-info.java | 20 - .../net/intf/impl/InterfaceManagerTest.java | 287 ----------- .../net/mcast/impl/MulticastRouteManagerTest.java | 171 ------- .../incubator/net/meter/impl/MeterManagerTest.java | 243 --------- .../net/src/test/resources/domain-config.json | 36 -- .../src/test/resources/fractal-domain-config.json | 28 -- framework/src/onos/incubator/pom.xml | 87 ---- framework/src/onos/incubator/rpc-grpc/features.xml | 37 -- framework/src/onos/incubator/rpc-grpc/pom.xml | 280 ----------- .../grpc/DeviceProviderRegistryClientProxy.java | 77 --- .../rpc/grpc/DeviceProviderServiceClientProxy.java | 295 ----------- .../incubator/rpc/grpc/GrpcDeviceUtils.java | 381 -------------- .../rpc/grpc/GrpcRemoteServiceContext.java | 75 --- .../rpc/grpc/GrpcRemoteServiceProvider.java | 119 ----- .../rpc/grpc/GrpcRemoteServiceServer.java | 385 --------------- .../incubator/rpc/grpc/package-info.java | 20 - .../incubator/rpc-grpc/src/main/proto/Device.proto | 131 ----- .../incubator/rpc-grpc/src/main/proto/Port.proto | 40 -- .../incubator/rpc/grpc/GrpcRemoteServiceTest.java | 398 --------------- framework/src/onos/incubator/rpc/pom.xml | 135 ----- .../rpc/impl/AbstractProviderRegistry.java | 73 --- .../rpc/impl/LocalRemoteServiceProvider.java | 124 ----- .../incubator/rpc/impl/RemoteServiceManager.java | 80 --- .../incubator/rpc/impl/package-info.java | 20 - .../rpc/impl/RemoteServiceManagerTest.java | 71 --- framework/src/onos/incubator/store/pom.xml | 89 ---- .../incubator/store/impl/package-info.java | 20 - .../store/meter/impl/DistributedMeterStore.java | 267 ---------- .../incubator/store/meter/impl/MeterData.java | 52 -- .../incubator/store/meter/impl/package-info.java | 21 - .../impl/DistributedLabelResourceStore.java | 547 --------------------- .../impl/LabelResourceMessageSubjects.java | 32 -- .../store/resource/impl/package-info.java | 20 - .../store/tunnel/impl/DistributedTunnelStore.java | 533 -------------------- .../incubator/store/tunnel/impl/package-info.java | 20 - .../impl/DistributedVirtualNetworkStore.java | 147 ------ .../incubator/store/virtual/impl/package-info.java | 20 - 174 files changed, 16225 deletions(-) delete mode 100644 framework/src/onos/incubator/api/pom.xml delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java delete mode 100755 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java delete mode 100755 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java delete mode 100755 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java delete mode 100755 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java delete mode 100644 framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java delete mode 100644 framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java delete mode 100644 framework/src/onos/incubator/net/pom.xml delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/ExtraNetworkConfigs.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/IntentDomainManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastData.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/MeterManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java delete mode 100644 framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/package-info.java delete mode 100644 framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/intf/impl/InterfaceManagerTest.java delete mode 100644 framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManagerTest.java delete mode 100644 framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/meter/impl/MeterManagerTest.java delete mode 100644 framework/src/onos/incubator/net/src/test/resources/domain-config.json delete mode 100644 framework/src/onos/incubator/net/src/test/resources/fractal-domain-config.json delete mode 100644 framework/src/onos/incubator/pom.xml delete mode 100644 framework/src/onos/incubator/rpc-grpc/features.xml delete mode 100644 framework/src/onos/incubator/rpc-grpc/pom.xml delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderRegistryClientProxy.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcDeviceUtils.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceContext.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/package-info.java delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/proto/Device.proto delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/main/proto/Port.proto delete mode 100644 framework/src/onos/incubator/rpc-grpc/src/test/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceTest.java delete mode 100644 framework/src/onos/incubator/rpc/pom.xml delete mode 100644 framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/AbstractProviderRegistry.java delete mode 100644 framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/LocalRemoteServiceProvider.java delete mode 100644 framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/RemoteServiceManager.java delete mode 100644 framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/package-info.java delete mode 100644 framework/src/onos/incubator/rpc/src/test/java/org/onosproject/incubator/rpc/impl/RemoteServiceManagerTest.java delete mode 100644 framework/src/onos/incubator/store/pom.xml delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/impl/package-info.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/DistributedMeterStore.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/MeterData.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/package-info.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/LabelResourceMessageSubjects.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/package-info.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/package-info.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java delete mode 100644 framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java (limited to 'framework/src/onos/incubator') diff --git a/framework/src/onos/incubator/api/pom.xml b/framework/src/onos/incubator/api/pom.xml deleted file mode 100644 index cbb69dc0..00000000 --- a/framework/src/onos/incubator/api/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - 4.0.0 - - - org.onosproject - onos-incubator - 1.4.0-rc1 - ../pom.xml - - - onos-incubator-api - bundle - - ONOS incubating core API - - - - com.google.guava - guava-testlib - test - - - org.easymock - easymock - test - - - - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java deleted file mode 100644 index 746961e6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/PortStatisticsService.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 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.net; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.statistic.Load; - -/** - * Service for obtaining statistic information about device ports. - */ -@Beta -public interface PortStatisticsService { - - /** - * Obtain the egress load for the given port. - * - * @param connectPoint the port to query - * @return egress traffic load - */ - Load load(ConnectPoint connectPoint); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java deleted file mode 100644 index deeac765..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ConfigException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 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.net.config.basics; - -import com.google.common.annotations.Beta; - -/** - * Signals that an error was encountered while reading/writing configuration. - */ -@Beta -public class ConfigException extends Exception { - - /** - * Constructs a new ConfigException with the given message. - * - * @param message message - */ - public ConfigException(String message) { - super(message); - } - - /** - * Constructs a new ConfigException with the given message and cause. - * - * @param message message - * @param cause cause - */ - public ConfigException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java deleted file mode 100644 index 260d0af4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/ExtraSubjectFactories.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 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.net.config.basics; - -import com.google.common.annotations.Beta; -import org.onosproject.incubator.net.domain.IntentDomainId; -import org.onosproject.net.config.SubjectFactory; - -/** - * Set of subject factories for potential configuration subjects. - */ -@Beta -public final class ExtraSubjectFactories { - - // Construction forbidden - private ExtraSubjectFactories() { - } - - public static final SubjectFactory INTENT_DOMAIN_SUBJECT_FACTORY = - new SubjectFactory(IntentDomainId.class, "domains") { - @Override - public IntentDomainId createSubject(String key) { - return IntentDomainId.valueOf(key); - } - }; - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java deleted file mode 100644 index 5246f313..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/InterfaceConfig.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2015 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.net.config.basics; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.annotations.Beta; -import com.google.common.collect.Sets; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.Config; -import org.onosproject.net.host.InterfaceIpAddress; - -import java.util.Iterator; -import java.util.Set; - -/** - * Configuration for interfaces. - */ -@Beta -public class InterfaceConfig extends Config { - public static final String NAME = "name"; - public static final String IPS = "ips"; - public static final String MAC = "mac"; - public static final String VLAN = "vlan"; - - public static final String CONFIG_VALUE_ERROR = "Error parsing config value"; - - /** - * Retrieves all interfaces configured on this port. - * - * @return set of interfaces - * @throws ConfigException if there is any error in the JSON config - */ - public Set getInterfaces() throws ConfigException { - Set interfaces = Sets.newHashSet(); - - try { - for (JsonNode intfNode : array) { - String name = intfNode.path(NAME).asText(null); - - Set ips = getIps(intfNode); - - String mac = intfNode.path(MAC).asText(); - MacAddress macAddr = mac.isEmpty() ? null : MacAddress.valueOf(mac); - - VlanId vlan = getVlan(intfNode); - - interfaces.add(new Interface(name, subject, ips, macAddr, vlan)); - } - } catch (IllegalArgumentException e) { - throw new ConfigException(CONFIG_VALUE_ERROR, e); - } - - return interfaces; - } - - /** - * Adds an interface to the config. - * - * @param intf interface to add - */ - public void addInterface(Interface intf) { - ObjectNode intfNode = array.addObject(); - - intfNode.put(NAME, intf.name()); - - if (intf.mac() != null) { - intfNode.put(MAC, intf.mac().toString()); - } - - if (!intf.ipAddresses().isEmpty()) { - intfNode.set(IPS, putIps(intf.ipAddresses())); - } - - if (!intf.vlan().equals(VlanId.NONE)) { - intfNode.put(VLAN, intf.vlan().toString()); - } - } - - /** - * Removes an interface from the config. - * - * @param name name of the interface to remove - */ - public void removeInterface(String name) { - Iterator it = array.iterator(); - while (it.hasNext()) { - JsonNode node = it.next(); - if (node.path(NAME).asText().equals(name)) { - it.remove(); - break; - } - } - } - - private VlanId getVlan(JsonNode node) { - VlanId vlan = VlanId.NONE; - if (!node.path(VLAN).isMissingNode()) { - vlan = VlanId.vlanId(Short.valueOf(node.path(VLAN).asText())); - } - return vlan; - } - - private Set getIps(JsonNode node) { - Set ips = Sets.newHashSet(); - - JsonNode ipsNode = node.get(IPS); - if (ipsNode != null) { - ipsNode.forEach(jsonNode -> - ips.add(InterfaceIpAddress.valueOf(jsonNode.asText()))); - } - - return ips; - } - - private ArrayNode putIps(Set intfIpAddresses) { - ArrayNode ipArray = mapper.createArrayNode(); - - intfIpAddresses.forEach(i -> ipArray.add(i.toString())); - - return ipArray; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java deleted file mode 100644 index 506f1fc1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/config/basics/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Various basic builtin network configurations. - */ -package org.onosproject.incubator.net.config.basics; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java deleted file mode 100644 index ad5e5d18..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import org.onlab.graph.AbstractEdge; -import org.onosproject.net.ConnectPoint; - -import java.util.Objects; - -/** - * Representation of a connection between an intent domain and a device. This - * must happen using a connect point that is part of both the domain and the - * device. - */ -@Beta -public class DomainEdge extends AbstractEdge { - - ConnectPoint connectPoint; - - public DomainEdge(DomainVertex src, DomainVertex dst, ConnectPoint connectPoint) { - super(src, dst); - this.connectPoint = connectPoint; - } - - @Override - public int hashCode() { - return 43 * super.hashCode() + connectPoint.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DomainEdge) { - final DomainEdge other = (DomainEdge) obj; - return super.equals(other) && - Objects.equals(this.connectPoint, other.connectPoint); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("src", src()) - .add("dst", dst()) - .add("connectPoint", connectPoint) - .toString(); - } - - /** - * Returns the connect point associated with the domain edge. - * - * @return this edges connect point - */ - public ConnectPoint connectPoint() { - return connectPoint; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java deleted file mode 100644 index ea1660e7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainIntentResource.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.DomainTunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.Path; - -/** - * A variant of intent resource specialized for use on the intra-domain level. It contains a lower level path. - */ -public class DomainIntentResource extends IntentResource { - - private final Path domainPath; - - private final DomainTunnelId domainTunnelId; - - private final IntentDomainId intentDomainId; - - /** - * Constructor for a domain intent resource. - * - * @param primitive the primitive associated with this resource - * @param domainTunnelId the id of this tunnel (used as a sorting mechanism) - * @param domainId the ID of the intent domain containing this tunnel - * @param appId the id of the application which created this tunnel - * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param path the path followed through the domain - */ - public DomainIntentResource(IntentPrimitive primitive, DomainTunnelId domainTunnelId, IntentDomainId domainId, - ApplicationId appId, ConnectPoint ingress, ConnectPoint egress, Path path) { - super(primitive, appId, ingress, egress); - - this.domainPath = path; - this.domainTunnelId = domainTunnelId; - this.intentDomainId = domainId; - } - - /** - * Returns the domain path associated with this resource at creation. - * - * @return this resource's domain level path or if this resource backs a network tunnel then null. - */ - public Path path() { - return domainPath; - } - - /** - * Returns the tunnel ID associated with this domain at creation. - * - * @return this resource's tunnel ID. - */ - public DomainTunnelId tunnelId() { - return domainTunnelId; - } - - /** - * Returns the domain ID associated with this resource at creation. - * - * @return this resource's domain ID. - */ - public IntentDomainId domainId() { - return intentDomainId; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java deleted file mode 100644 index 7d11a76c..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainVertex.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import org.onlab.graph.Vertex; -import org.onosproject.net.DeviceId; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Representation of the intent domain or a device that is part of the intent - * domain graph. - */ -@Beta -public class DomainVertex implements Vertex { - // FIXME we will want to add a type enum or subclasses for the two different types - - // A domain vertex is either an intent domain or a device: - private final IntentDomainId domainId; - // ----- or ----- - - private final DeviceId deviceId; - - // Serialization constructor - private DomainVertex() { - this.domainId = null; - this.deviceId = null; - } - - public DomainVertex(IntentDomainId id) { - this.domainId = checkNotNull(id, "Intent domain ID cannot be null."); - this.deviceId = null; - } - - public DomainVertex(DeviceId id) { - this.domainId = null; - this.deviceId = checkNotNull(id, "Device ID cannot be null."); - } - - @Override - public String toString() { - if (domainId != null) { - return MoreObjects.toStringHelper(this) - .add("domainId", domainId) - .toString(); - } else if (deviceId != null) { - return MoreObjects.toStringHelper(this) - .add("deviceId", deviceId) - .toString(); - } else { - return MoreObjects.toStringHelper(this) - .toString(); - } - } - - /** - * Returns the device ID of this vertex if it is a device, returns null if it is a domain. - * - * @return the device ID of this vertex if applicable, else null - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns the domain ID of this vertex if it is a domain, returns null if it is a device. - * - * @return the domain ID of this vertex if applicable, else null - */ - public IntentDomainId domainId() { - return domainId; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java deleted file mode 100644 index a52dce69..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomain.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Representation of an intent domain which includes the set of internal devices, - * the set of edge ports, and the implementation of the domain provider. - */ -@Beta -public class IntentDomain { - - private final IntentDomainId id; - private String name; - - private Set internalDevices; - private Set edgePorts; - - private IntentDomainProvider provider; - - public IntentDomain(IntentDomainId id, String name, - Set internalDevices, - Set edgePorts) { - this.id = id; - this.name = name; - this.internalDevices = internalDevices; - this.edgePorts = edgePorts; - } - - /** - * Returns the id for the intent domain. - * - * @return intent domain id - */ - public IntentDomainId id() { - return id; - } - - /** - * Returns the friendly name for the intent domain. - * - * @return intent domain name - */ - public String name() { - return name; - } - - /** - * Returns the set of internal devices for the intent domain (devices under - * exclusive control of the intent domain). - * - * @return set of internal devices - */ - public Set internalDevices() { - return internalDevices; - } - - /** - * Returns the set of edge ports for the intent domain. - * - * @return set of edge ports - */ - public Set edgePorts() { - return edgePorts; - } - - /** - * Returns the provider for the intent domain. - * - * @return intent domain provider - */ - public IntentDomainProvider provider() { - return provider; - } - - /** - * Returns the status of the intent domain. An intent domain is active if it - * has an intent domain provider bound, and it is inactive if one is not bound. - * - * @return true if active; false otherwise - */ - public boolean isActive() { - return provider != null; - } - - /** - * Sets the provider for the intent domain if one is not already set. - * - * @param provider new intent domain provider - */ - public void setProvider(IntentDomainProvider provider) { - // TODO consider checkState depending on caller - if (this.provider == null) { - this.provider = provider; - } - } - - /** - * Unsets the provider for the intent domain. - */ - public void unsetProvider() { - this.provider = null; - } - - //TODO add remaining setters (we will probably want to link this to the network config) -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java deleted file mode 100644 index f5ceaa9f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainAdminService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; - -/** - * Administrative interface for the intent domain service. - */ -@Beta -public interface IntentDomainAdminService extends IntentDomainService { - - /** - * Register an application that provides intent domain service. - * - * @param applicationId application id - * @param provider intent domain provider - */ - void registerApplication(ApplicationId applicationId, IntentDomainProvider provider); - - /** - * Unregisters an application that provides intent domain service. - * - * @param applicationId application id - */ - void unregisterApplication(ApplicationId applicationId); - - /* TODO we may be able to accomplish the following through network config: - void createDomain(String domainId); - void removeDomain(String domainId); - - void addInternalDeviceToDomain(IntentDomain domain, DeviceId deviceId); - void addPortToDomain(IntentDomain domain, ConnectPoint port); - - void bindApplicationToDomain(String domain, IntentDomain implementation); - void unbindApplicationToDomain(String domain, IntentDomain implementation); - */ -} - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java deleted file mode 100644 index e903c324..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainConfig.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableSet; -import org.onosproject.net.config.Config; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Configuration for an intent domain including a name, set of internal devices, - * set of edge ports, and the application bound to control the domain. - */ -@Beta -public class IntentDomainConfig extends Config { - - private static final String DOMAIN_NAME = "name"; - private static final String APPLICATION_NAME = "applicationName"; - private static final String INTERNAL_DEVICES = "internalDevices"; - private static final String EDGE_PORTS = "edgePorts"; - - - /** - * Returns the friendly name for the domain. - * - * @return domain name - */ - public String domainName() { - return get(DOMAIN_NAME, subject.toString()); - } - - /** - * Sets the friendly name for the domain. - * - * @param domainName new name for the domain; null to clear - * @return self - */ - public IntentDomainConfig domainName(String domainName) { - return (IntentDomainConfig) setOrClear(DOMAIN_NAME, domainName); - } - - /** - * Returns the friendly name for the domain. - * - * @return domain name - */ - public String applicationName() { - return get(APPLICATION_NAME, "FIXME"); //TODO maybe not null? - } - - /** - * Sets the friendly name for the domain. - * - * @param applicationName new name for the domain; null to clear - * @return self - */ - public IntentDomainConfig applicationName(String applicationName) { - return (IntentDomainConfig) setOrClear(APPLICATION_NAME, applicationName); - } - - /** - * Returns the set of internal devices. - * - * @return set of internal devices - */ - public Set internalDevices() { - return ImmutableSet.copyOf(getList(INTERNAL_DEVICES, DeviceId::deviceId)); - } - - /** - * Sets the set of internal devices. - * - * @param devices set of devices; null to clear - * @return self - */ - public IntentDomainConfig internalDevices(Set devices) { - return (IntentDomainConfig) setOrClear(INTERNAL_DEVICES, devices); - } - - /** - * Returns the set of edge ports. - * - * @return set of edge ports - */ - public Set edgePorts() { - return ImmutableSet.copyOf(getList(EDGE_PORTS, ConnectPoint::deviceConnectPoint)); - } - - /** - * Sets the set of edge ports. - * - * @param connectPoints set of edge ports; null to clear - * @return self - */ - public IntentDomainConfig edgePorts(Set connectPoints) { - return (IntentDomainConfig) setOrClear(EDGE_PORTS, connectPoints); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java deleted file mode 100644 index 554702a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainId.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Intent domain identifier. - */ -@Beta -public class IntentDomainId { - - private final String id; - - /** - * Creates an intent domain identifier from the specified string representation. - * - * @param value string value - * @return intent identifier - */ - public static IntentDomainId valueOf(String value) { - return new IntentDomainId(value); - } - - /** - * Constructor for serializer. - */ - IntentDomainId() { - this.id = null; - } - - /** - * Constructs the ID corresponding to a given string value. - * - * @param value the underlying value of this ID - */ - IntentDomainId(String value) { - this.id = checkNotNull(value, "Intent domain ID cannot be null."); - } - - @Override - public int hashCode() { - return id.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof IntentDomainId)) { - return false; - } - IntentDomainId that = (IntentDomainId) obj; - return Objects.equals(this.id, that.id); - } - - @Override - public String toString() { - return id; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java deleted file mode 100644 index 04080b20..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; - -/** - * Listener for intent domain events. - */ -@Beta -public interface IntentDomainListener { - //TODO create event types - //extends EventListener -} \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java deleted file mode 100644 index a19add60..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainProvider.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; - -import java.util.List; -import java.util.Set; - -/** - * FIXME. - */ -@Beta -public interface IntentDomainProvider { - - /** - * Requests that the provider attempt to satisfy the intent primitive. - * The application must apply the context before the intent resource - * can be used. Request contexts can be explictly cancelled, or they will - * eventually time out so that resources can be reused. - * - * @param domain intent domain for the request - * @param primitive intent primitive - * @return intent resources that specify paths that satisfy the request. - */ - //TODO Consider an iterable and/or holds (only hold one or two reservation(s) at a time) - List request(IntentDomain domain, IntentPrimitive primitive); - - /** - * Request that the provider attempt to modify an existing resource to satisfy - * a new intent primitive. The application must apply the context before - * the intent resource can be used. - * - * @param oldResource the resource to be replaced - * @param newResource the resource to be applied - * @return request contexts that contain resources to satisfy the intent - */ - DomainIntentResource modify(DomainIntentResource oldResource, DomainIntentResource newResource); - - /** - * Requests that the provider release an intent resource. - * - * @param resource intent resource - */ - void release(DomainIntentResource resource); - - /** - * Requests that the provider apply the path from the intent resource. - * - * @param domainIntentResource request context - * @return intent resource that satisfies the intent - */ - DomainIntentResource apply(DomainIntentResource domainIntentResource); - - /** - * Requests that the provider cancel the path. Requests that are not applied - * will be eventually timed out by the provider. - * - * @param domainIntentResource the intent resource whose path should be cancelled. - */ - void cancel(DomainIntentResource domainIntentResource); - - /** - * Returns all intent resources held by the provider. - * - * @return set of intent resources - */ - Set getResources(); -} - - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java deleted file mode 100644 index 41508ad3..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentDomainService.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onlab.graph.Graph; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Service for that maintains a graph of intent domains and a registry of intent - * domain providers. - */ -@Beta -public interface IntentDomainService { - - /** - * Returns the intent domain for the given id. - * - * @param id id to look up - * @return the intent domain; null if none found - */ - IntentDomain getDomain(IntentDomainId id); - - /** - * Returns a set of all intent domains. - * - * @return set of intent domains - */ - Set getDomains(); - - /** - * Returns any network domains associated with the given device id. - * - * @param deviceId device id to look up - * @return set of intent domain - */ - Set getDomains(DeviceId deviceId); - - /** - * Returns the graph of intent domains and connection devices. - * - * @return graph of network domains - */ - Graph getDomainGraph(); - - /** - * Adds the specified listener for intent domain events. - * - * @param listener listener to be added - */ - void addListener(IntentDomainListener listener); - - /** - * Removes the specified listener for intent domain events. - * - * @param listener listener to be removed - */ - void removeListener(IntentDomainListener listener); -} - - - - - diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java deleted file mode 100644 index ad3081a2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentPrimitive.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; - -/** - * Abstract base class for intent primitives. - */ -@Beta -public abstract class IntentPrimitive { - - private final ApplicationId appId; - - public IntentPrimitive(ApplicationId appId) { - this.appId = appId; - } - - /** - * The getter for the application ID associated with the intent primitive upon creation. - * - * @return the application ID associated with the intent primitive - */ - public ApplicationId appId() { - return appId; - } -} \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java deleted file mode 100644 index 627c863f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/IntentResource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.ConnectPoint; - - -/** - * The abstract base class for the resource that satisfies an intent primitive. - */ -@Beta -public abstract class IntentResource { - - private final IntentPrimitive primitive; - - private final ApplicationId appId; - private final ConnectPoint ingress; - private final ConnectPoint egress; - - //* QUESTIONABLE ADDITIONS *// - - // TODO add other common fields - //String ingressTag; - //String egressTag; - //etc. - - public IntentResource(IntentPrimitive primitive, ApplicationId appId, - ConnectPoint ingress, ConnectPoint egress) { - this.appId = appId; - this.ingress = ingress; - this.egress = egress; - this.primitive = primitive; - } - - //TODO when is same package tunnelID should be of type tunnelID and netTunnelId not long. - - - /** - * Returns the intent primitive associated with this resource at creation. - * - * @return this resource's intent primitive. - */ - public IntentPrimitive primitive() { - return primitive; - } - - /** - * Returns the application ID associated with this resource at creation. - * - * @return this resource's application ID. - */ - public ApplicationId appId() { - return appId; - } - - /** - * Returns the ingress connect point associated with this resource at creation. - * - * @return this resource's ingress connect point. - */ - public ConnectPoint ingress() { - return ingress; - } - - /** - * Returns the egress connect point associated with this resource at creation. - * - * @return this resource's connect point. - */ - public ConnectPoint egress() { - return egress; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java deleted file mode 100644 index ac4445b4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/NetworkIntentResource.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.NetworkTunnelId; -import org.onosproject.net.ConnectPoint; - -/** - * A variant of intent resource specialized for use on the inter-domain level. It contains a higher level path. - */ -public class NetworkIntentResource extends IntentResource { - - private final org.onlab.graph.Path netPath; - - private NetworkTunnelId networkTunnelId; - - /** - * Constructor for a network intent resource. - * - * @param primitive the primitive associated with this resource - * @param networkTunnelId the id of this tunnel (used as a sorting mechanism) - * @param appId the id of the application which created this tunnel - * @param ingress the fist connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param egress the second connect point associated with this tunnel (order is irrelevant as long as it is - * consistent with the path) - * @param path the path followed through the graph of domain vertices and domain edges - */ - public NetworkIntentResource(IntentPrimitive primitive, NetworkTunnelId networkTunnelId, ApplicationId appId, - ConnectPoint ingress, ConnectPoint egress, - org.onlab.graph.Path path) { - super(primitive, appId, ingress, egress); - - this.networkTunnelId = networkTunnelId; - this.netPath = path; - } - - /** - * Returns the network path associated with this resource at creation. - * - * @return this resource's network lever path or if this resource backs a domain level tunnel then null. - */ - public org.onlab.graph.Path path() { - return netPath; - } - - /** - * Returns ths network ID associated with this network tunnel at creation. - * - * @return thsi resource's tunnel ID. - */ - public NetworkTunnelId tunnelId() { - return this.networkTunnelId; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java deleted file mode 100644 index 2abaab5f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/TunnelPrimitive.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2015 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.net.domain; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.ConnectPoint; - -/** - * Provides connectivity through a domain. - */ -@Beta -public class TunnelPrimitive extends IntentPrimitive { - - private final ConnectPoint one; - private final ConnectPoint two; - - public TunnelPrimitive(ApplicationId appId, ConnectPoint one, ConnectPoint two) { - super(appId); - this.one = one; - this.two = two; - } - - /** - * The getter for the first connection point associated with a tunnel. - * - * @return the first connection point - */ - public ConnectPoint one() { - return one; - } - - /** - * The getter for the second connection point associated with a tunnel. - * @return the second connection point - */ - public ConnectPoint two() { - return two; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java deleted file mode 100644 index b8340e01..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/domain/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Subsystem for network intent domains. - */ -package org.onosproject.incubator.net.domain; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java deleted file mode 100644 index 765fbfef..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/Alarm.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright 2014-2015 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.net.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; - -/** - * Representation of an Alarm. At a given instant there can be only one alarm - * with the same deviceId + description + source combination. - */ -public interface Alarm { - - /** - * Returns the unique alarm id within this ONOS instance. - * - * @return alarm identifier - */ - AlarmId id(); - - /** - * The device to which this alarm is related. - * - * @return a device id - */ - DeviceId deviceId(); - - /** - * Returns a description of alarm. - *

- * It may encapsulate Event Type as described by ITU Recommendation X.736 - * ITU, Quoting https://tools.ietf.org/html/rfc3877 these include: other, - * communicationsAlarm, qualityOfServiceAlarm, processingErrorAlarm, - * equipmentAlarm, environmentalAlarm, integrityViolation, - * operationalViolation, physicalViolation, - * securityServiceOrMechanismViolation, timeDomainViolation - *

- * It may encapsulate Probable Cause as described by ITU Recommendation - * X.736 ITU, Quoting - * https://www.iana.org/assignments/ianaitualarmtc-mib/ianaitualarmtc-mib - * these include : aIS, callSetUpFailure, degradedSignal, - * farEndReceiverFailure, framingError, and hundreds more constants. - *

- * It may encapsulate a vendor-specific description of the underlying fault. - * - * @return description of alarm - */ - String description(); - - /** - * Returns an entity within the context of this alarm's device. It may be - * null if deviceId sufficiently identifies the location. As an example, the - * source may indicate a port number - * - * @return source of alarm within the alarm's referenced Device. - */ - AlarmEntityId source(); - - /** - * Returns the time when raised. - * - * @return time when raised, in milliseconds since start of epoch - */ - long timeRaised(); - - /** - * Returns time at which the alarm was updated most recently, due to some - * change in the device, or ONOS. If the alarm has been cleared, this is the - * time at which the alarm was cleared. - * - * @return time when last updated, in milliseconds since start of epoch - */ - long timeUpdated(); - - /** - * Returns the time when cleared. Null indicated no clear time, i.e. the - * alarm is still active. - * - * @return time when cleared, in milliseconds since start of epoch or null - * if uncleared. - */ - Long timeCleared(); - - /** - * Returns the severity. Note, that cleared alarms may have EITHER - * SeverityLevel = CLEARED, or may be not present; both scenarios should be - * handled. - * - * @return severity of the alarm - */ - SeverityLevel severity(); - - /** - * Returns true if alarm is service affecting Note: Whilst X.733 combines - * service-affecting state with severity (where severities of critical and - * major are deemed service-affecting) ONOS keeps these attributes separate. - * - * @return whether service affecting (true indicates it is) - */ - boolean serviceAffecting(); - - /** - * Returns a flag to indicate if this alarm has been acknowledged. All - * alarms are unacknowledged until and unless an ONOS user takes action to - * indicate so. - * - * @return whether alarm is currently acknowledged (true indicates it is) - */ - boolean acknowledged(); - - /** - * Returns a flag to indicate if this alarm is manually-cleared by a user action within ONOS. Some stateless events - * e.g. backup-failure or upgrade-failure, may be mapped by ONOS to alarms, and these may be deemed manually- - * clearable. The more typical case is that an alarm represents a persistent fault on or related to a device and - * such alarms are never manually clearable, i.e. a configuration or operational state must occur for the alarm to - * clear. - * - * @return whether it may be cleared by a user action (true indicates it is) - */ - boolean manuallyClearable(); - - /** - * Returns the user to whom this alarm is assigned; this is for future use - * and always returns null in this release. It is anticipated that in future ONOS - * releases, the existing JAAS user/key/role configuration will be extended - * to include a mechanism whereby some groups of users may allocate alarms - * to other users for bookkeeping and administrative purposes, and that ONOS - * will additionally provide a REST based mechanism, to retrieve from JAAS, - * the set of users to whom alarm assignment is possible for the current - * user. - * - * @return the assigned user; always null in this release. - */ - String assignedUser(); - - /** - * Represents the severity level on an alarm, as per ITU-T X.733 - * specifications. - *

- * The precedence is as follows for : Critical > Major > Minor > Warning. - */ - enum SeverityLevel { - - /** - * From X.733: This indicates the clearing of one or more previously - * reported alarms. This alarm clears all alarms for this managed object - * that have the same Alarm type, Probable cause and Specific problems - * (if given). Multiple associated notifications may be cleared by using - * the Correlated notifications parameter (defined below). This - * Recommendation | International Standard does not require that the - * clearing of previously reported alarms be reported. Therefore, a - * managing system cannot assume that the absence of an alarm with the - * Cleared severity level means that the condition that caused the - * generation of previous alarms is still present. Managed object - * definers shall state if, and under which conditions, the Cleared - * severity level is used. - */ - CLEARED, - /** - * From X.733: This indicates that the severity level cannot be - * determined. - */ - INDETERMINATE, - /** - * From X.733: This indicates that a service affecting condition has - * occurred and an immediate corrective action is required. Such a - * severity can be reported, for example, when a managed object becomes - * totally out of service and its capability must be restored. - */ - CRITICAL, - /** - * X.733 definition: This indicates that a service affecting condition - * has developed and an urgent corrective action is required. Such a - * severity can be reported, for example, when there is a severe - * degradation in the capability of the managed object and its full - * capability must be restored. - */ - MAJOR, - /** - * From X.733: This indicates the existence of a non-service affecting - * fault condition and that corrective action should be taken in order - * to prevent a more serious (for example, service affecting) fault. - * Such a severity can be reported, for example, when the detected alarm - * condition is not currently degrading the capacity of the managed - * object. - */ - MINOR, - /** - * From X.733: This indicates the detection of a potential or impending - * service affecting fault, before any significant effects have been - * felt. Action should be taken to further diagnose (if necessary) and - * correct the problem in order to prevent it from becoming a more - * serious service affecting fault. - */ - WARNING; - - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java deleted file mode 100644 index 5bf86749..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityId.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2014-2015 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.net.faultmanagement.alarm; - -import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.collect.ImmutableSet; -import java.net.URI; -import java.util.Objects; -import java.util.Set; - -/** - * Immutable representation of a alarm source. It is meaningful within the - * context of a device. - */ -public final class AlarmEntityId { - - public static final AlarmEntityId NONE = new AlarmEntityId(URI.create("none:none")); - public static final Set SCHEMES = ImmutableSet.of("none", "port", "och", "other"); - - private final URI uri; - - private AlarmEntityId(final URI uri) { - this.uri = uri; - } - - protected AlarmEntityId() { - uri = NONE.uri; - } - - public static AlarmEntityId alarmEntityId(final String string) { - return alarmEntityId(URI.create(string)); - } - - public static AlarmEntityId alarmEntityId(final URI uri) { - checkArgument(SCHEMES.contains(uri.getScheme()), "Unexpected scheme"); - return new AlarmEntityId(uri); - } - - @Override - public String toString() { - return uri.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(uri); - - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof AlarmEntityId) { - final AlarmEntityId other = (AlarmEntityId) obj; - return Objects.equals(this.uri, other.uri); - } - return false; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java deleted file mode 100644 index bbbd993e..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import org.onosproject.event.AbstractEvent; - -/** - * Entity that represents Alarm events. - */ -public class AlarmEvent extends AbstractEvent { - - - /** - * Creates an event of a given type and for the specified alarm and the - * current time. - * - * @param type topology event type - * @param alarm the alarm - */ - public AlarmEvent(Type type, Alarm alarm) { - super(type, alarm); - } - - /** - * Creates an event of a given type and for the specified alarm and time. - * - * @param type link event type - * @param alarm the alarm - * @param time occurrence time - */ - public AlarmEvent(Type type, Alarm alarm, - long time) { - super(type, alarm, time); - } - - /** - * Type of alarm events. - */ - public enum Type { - /** - * A Raised Alarm. - */ - RAISE, - - /** - * A Cleared Alarm. - */ - CLEAR - } - - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java deleted file mode 100644 index e0107f87..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmId.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Alarm identifier suitable as an external key. - *

- * This class is immutable.

- */ -@Beta -public final class AlarmId { - - private final long id; - - /** - * Instantiates a new Alarm id. - * - * @param id the id - */ - public AlarmId(final long id) { - this.id = id; - } - - /** - * Creates an alarm identifier from the specified long representation. - * - * @param value long value - * @return intent identifier - */ - public static AlarmId valueOf(final long value) { - return new AlarmId(value); - } - - /** - * Returns the backing integer index. - * - * @return backing integer index - */ - public long fingerprint() { - return id; - } - - @Override - public int hashCode() { - return Objects.hash(id); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof AlarmId) { - final AlarmId other = (AlarmId) obj; - return Objects.equals(this.id, other.id); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("id", id).toString(); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java deleted file mode 100644 index c5e82ba5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import org.onosproject.event.EventListener; - - -/** - * Entity capable of receiving Alarm related events. - */ -public interface AlarmListener extends EventListener { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java deleted file mode 100644 index 82bcda2a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of a Alarm provider. - */ -public interface AlarmProvider extends Provider { - - /** - * Triggers an asynchronous discovery of the alarms on the specified device, - * intended to refresh internal alarm model for the device. An indirect - * result of this should be invocation of - * {@link org.onosproject.incubator.net.faultmanagement.alarm.AlarmProviderService#updateAlarmList} )} - * at some later point in time. - * - * @param deviceId ID of device to be probed - */ - void triggerProbe(DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java deleted file mode 100644 index 618298c0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of a alarm provider registry. - */ -public interface AlarmProviderRegistry extends ProviderRegistry { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java deleted file mode 100644 index 727aa281..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmProviderService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - - -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -import java.util.Collection; - -/** - * The interface Alarm provider service. - */ -public interface AlarmProviderService extends ProviderService { - - /** - * Sends active alarm list for a device. - * - * @param deviceId identity of the device - * @param alarms list of device alarms - */ - void updateAlarmList(DeviceId deviceId, Collection alarms); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java deleted file mode 100644 index 03c0c7b1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmService.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2014-2015 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.net.faultmanagement.alarm; - -import com.google.common.annotations.Beta; -//import org.onosproject.event.ListenerService; - -import java.util.Set; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; - -/** - * Service for interacting with the alarm handling of devices. Unless stated - * otherwise method return active AND recently-cleared alarms. - */ -@Beta -public interface AlarmService { -// extends ListenerService { - - /** - * Alarm should be updated in ONOS's internal representation; only - * administration/book-keeping fields may be updated. Attempting to update - * fields which are mapped directly from device is prohibited. - * - * @param replacement alarm with updated book-keeping fields - * @return updated alarm (including any recent device derived changes) - - * @throws java.lang.IllegalStateException if attempt to update not allowed - * fields. - */ - Alarm update(Alarm replacement); - - /** - * Returns the number of ACTIVE alarms on a device. - * - * @param deviceId the device - * @return number of alarms - */ - int getActiveAlarmCount(DeviceId deviceId); - - /** - * Returns the alarm with the specified identifier. - * - * @param alarmId alarm identifier - * @return alarm or null if one with the given identifier is not known - */ - Alarm getAlarm(AlarmId alarmId); - - /** - * Returns all of the alarms. - * - * @return the alarms - */ - Set getAlarms(); - - /** - * Returns all of the ACTIVE alarms. Recently cleared alarms excluded. - * - * @return the alarms - */ - Set getActiveAlarms(); - - /** - * Returns the alarms with the specified severity. - * - * @param severity the alarm severity - * @return the active alarms with a particular severity - */ - Set getAlarms(Alarm.SeverityLevel severity); - - /** - * Returns the alarm for a given device, regardless of source within that - * device. - * - * @param deviceId the device - * @return the alarms - */ - Set getAlarms(DeviceId deviceId); - - /** - * Returns the alarm for a given device and source. - * - * @param deviceId the device - * @param source the source within the device - * @return the alarms - */ - Set getAlarms(DeviceId deviceId, AlarmEntityId source); - - /** - * Returns the alarm affecting a given link. - * - * @param src one end of the link - * @param dst one end of the link - * @return the alarms - */ - Set getAlarmsForLink(ConnectPoint src, ConnectPoint dst); - - /** - * Returns the alarm affecting a given flow. - * - * @param deviceId the device - * @param flowId the flow - * @return the alarms - */ - Set getAlarmsForFlow(DeviceId deviceId, long flowId); - -// Support retrieving alarms affecting other ONOS entity types may be added in future release -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java deleted file mode 100644 index afa366ad..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarm.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright 2014-2015 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.net.faultmanagement.alarm; - -import org.onosproject.net.DeviceId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Default implementation of an alarm. - */ -public final class DefaultAlarm implements Alarm { - - private final AlarmId id; - - private final DeviceId deviceId; - private final String description; - private final AlarmEntityId source; - private final long timeRaised; - private final long timeUpdated; - private final Long timeCleared; - private final SeverityLevel severity; - private final boolean isServiceAffecting; - private final boolean isAcknowledged; - private final boolean isManuallyClearable; - private final String assignedUser; - - /** - * Instantiates a new Default alarm. - * - * @param id the id - * @param deviceId the device id - * @param description the description - * @param source the source, null indicates none. - * @param timeRaised the time raised. - * @param timeUpdated the time last updated. - * @param timeCleared the time cleared, null indicates uncleared. - * @param severity the severity - * @param isServiceAffecting the service affecting - * @param isAcknowledged the acknowledged - * @param isManuallyClearable the manually clearable - * @param assignedUser the assigned user, `null` indicates none. - */ - private DefaultAlarm(final AlarmId id, - final DeviceId deviceId, - final String description, - final AlarmEntityId source, - final long timeRaised, - final long timeUpdated, - final Long timeCleared, - final SeverityLevel severity, - final boolean isServiceAffecting, - final boolean isAcknowledged, - final boolean isManuallyClearable, - final String assignedUser) { - this.id = id; - this.deviceId = deviceId; - this.description = description; - this.source = source; - this.timeRaised = timeRaised; - this.timeUpdated = timeUpdated; - this.timeCleared = timeCleared; - this.severity = severity; - this.isServiceAffecting = isServiceAffecting; - this.isAcknowledged = isAcknowledged; - this.isManuallyClearable = isManuallyClearable; - this.assignedUser = assignedUser; - } - - @Override - public AlarmId id() { - return id; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public String description() { - return description; - } - - @Override - public AlarmEntityId source() { - return source; - } - - @Override - public long timeRaised() { - return timeRaised; - } - - @Override - public long timeUpdated() { - return timeUpdated; - } - - @Override - public Long timeCleared() { - return timeCleared; - } - - @Override - public SeverityLevel severity() { - return severity; - } - - @Override - public boolean serviceAffecting() { - return isServiceAffecting; - } - - @Override - public boolean acknowledged() { - return isAcknowledged; - } - - @Override - public boolean manuallyClearable() { - return isManuallyClearable; - } - - @Override - public String assignedUser() { - return assignedUser; - } - - @Override - public int hashCode() { - return Objects.hash(id, deviceId, description, - source, timeRaised, timeUpdated, timeCleared, severity, - isServiceAffecting, isAcknowledged, - isManuallyClearable, assignedUser); - } - - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final DefaultAlarm other = (DefaultAlarm) obj; - if (!Objects.equals(this.id, other.id)) { - return false; - } - if (!Objects.equals(this.deviceId, other.deviceId)) { - return false; - } - if (!Objects.equals(this.description, other.description)) { - return false; - } - if (!Objects.equals(this.source, other.source)) { - return false; - } - if (this.timeRaised != other.timeRaised) { - return false; - } - if (this.timeUpdated != other.timeUpdated) { - return false; - } - if (!Objects.equals(this.timeCleared, other.timeCleared)) { - return false; - } - if (this.severity != other.severity) { - return false; - } - if (this.isServiceAffecting != other.isServiceAffecting) { - return false; - } - if (this.isAcknowledged != other.isAcknowledged) { - return false; - } - if (this.isManuallyClearable != other.isManuallyClearable) { - return false; - } - if (!Objects.equals(this.assignedUser, other.assignedUser)) { - return false; - } - return true; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("id", id) - .add("deviceId", deviceId) - .add("description", description) - .add("source", source) - .add("timeRaised", timeRaised) - .add("timeUpdated", timeUpdated) - .add("timeCleared", timeCleared) - .add("severity", severity) - .add("serviceAffecting", isServiceAffecting) - .add("acknowledged", isAcknowledged) - .add("manuallyClearable", isManuallyClearable) - .add("assignedUser", assignedUser) - .toString(); - } - - public static class Builder { - - // Manadatory fields .. - private final AlarmId id; - private final DeviceId deviceId; - private final String description; - private final SeverityLevel severity; - private final long timeRaised; - - // Optional fields .. - private AlarmEntityId source = AlarmEntityId.NONE; - private long timeUpdated; - private Long timeCleared = null; - private boolean isServiceAffecting = false; - private boolean isAcknowledged = false; - private boolean isManuallyClearable = false; - private String assignedUser = null; - - public Builder(final Alarm alarm) { - this(alarm.id(), alarm.deviceId(), alarm.description(), alarm.severity(), alarm.timeRaised()); - this.source = AlarmEntityId.NONE; - this.timeUpdated = alarm.timeUpdated(); - this.timeCleared = alarm.timeCleared(); - this.isServiceAffecting = alarm.serviceAffecting(); - this.isAcknowledged = alarm.acknowledged(); - this.isManuallyClearable = alarm.manuallyClearable(); - this.assignedUser = alarm.assignedUser(); - - } - - public Builder(final AlarmId id, final DeviceId deviceId, - final String description, final SeverityLevel severity, final long timeRaised) { - super(); - this.id = id; - this.deviceId = deviceId; - this.description = description; - this.severity = severity; - this.timeRaised = timeRaised; - // Unless specified time-updated is same as raised. - this.timeUpdated = timeRaised; - } - - public Builder forSource(final AlarmEntityId source) { - this.source = source; - return this; - } - - public Builder withTimeUpdated(final long timeUpdated) { - this.timeUpdated = timeUpdated; - return this; - } - - public Builder withTimeCleared(final Long timeCleared) { - this.timeCleared = timeCleared; - return this; - } - - public Builder withServiceAffecting(final boolean isServiceAffecting) { - this.isServiceAffecting = isServiceAffecting; - return this; - } - - public Builder withAcknowledged(final boolean isAcknowledged) { - this.isAcknowledged = isAcknowledged; - return this; - } - - public Builder withManuallyClearable(final boolean isManuallyClearable) { - this.isManuallyClearable = isManuallyClearable; - return this; - } - - public Builder withAssignedUser(final String assignedUser) { - this.assignedUser = assignedUser; - return this; - } - - public DefaultAlarm build() { - checkNotNull(id, "Must specify an alarm id"); - checkNotNull(deviceId, "Must specify a device"); - checkNotNull(description, "Must specify a description"); - checkNotNull(timeRaised, "Must specify a time raised"); - checkNotNull(timeUpdated, "Must specify a time updated"); - checkNotNull(severity, "Must specify a severity"); - - return new DefaultAlarm(id, deviceId, description, source, timeRaised, timeUpdated, timeCleared, - severity, isServiceAffecting, isAcknowledged, isManuallyClearable, assignedUser); - } - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java deleted file mode 100644 index b2b8ec9f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/faultmanagement/alarm/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ -/** - * Abstractions for interacting with alarms. An alarm is a persistent indication - * of a fault that clears only when the triggering condition has been resolved. - */ -package org.onosproject.incubator.net.faultmanagement.alarm; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java deleted file mode 100644 index e2109689..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/Interface.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2014-2015 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.net.intf; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import com.google.common.collect.Sets; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.host.InterfaceIpAddress; - -import java.util.Objects; -import java.util.Set; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * An Interface maps network configuration information (such as addresses and - * vlans) to a port in the network. - */ -@Beta -public class Interface { - public static final String NO_INTERFACE_NAME = ""; - - private final String name; - private final ConnectPoint connectPoint; - private final Set ipAddresses; - private final MacAddress macAddress; - private final VlanId vlan; - - /** - * Creates new Interface with the provided configuration. - * - * @param name name of the interface - * @param connectPoint the connect point this interface maps to - * @param ipAddresses Set of IP addresses - * @param macAddress MAC address - * @param vlan VLAN ID - */ - public Interface(String name, ConnectPoint connectPoint, - Set ipAddresses, - MacAddress macAddress, VlanId vlan) { - this.name = name == null ? NO_INTERFACE_NAME : name; - this.connectPoint = checkNotNull(connectPoint); - this.ipAddresses = ipAddresses == null ? Sets.newHashSet() : ipAddresses; - this.macAddress = macAddress == null ? MacAddress.NONE : macAddress; - this.vlan = vlan == null ? VlanId.NONE : vlan; - } - - /** - * Creates new Interface with the provided configuration. - * - * @param connectPoint the connect point this interface maps to - * @param ipAddresses Set of IP addresses - * @param macAddress MAC address - * @param vlan VLAN ID - */ - public Interface(ConnectPoint connectPoint, - Set ipAddresses, - MacAddress macAddress, VlanId vlan) { - this(NO_INTERFACE_NAME, connectPoint, ipAddresses, macAddress, vlan); - } - - /** - * Retrieves the name of the interface. - * - * @return name - */ - public String name() { - return name; - } - - /** - * Retrieves the connection point that this interface maps to. - * - * @return the connection point - */ - public ConnectPoint connectPoint() { - return connectPoint; - } - - /** - * Retrieves the set of IP addresses that are assigned to the interface. - * - * @return the set of interface IP addresses - */ - public Set ipAddresses() { - return ipAddresses; - } - - /** - * Retrieves the MAC address that is assigned to the interface. - * - * @return the MAC address - */ - public MacAddress mac() { - return macAddress; - } - - /** - * Retrieves the VLAN ID that is assigned to the interface. - * - * @return the VLAN ID - */ - public VlanId vlan() { - return vlan; - } - - @Override - public boolean equals(Object other) { - if (!(other instanceof Interface)) { - return false; - } - - Interface otherInterface = (Interface) other; - - return Objects.equals(name, otherInterface.name) && - Objects.equals(connectPoint, otherInterface.connectPoint) && - Objects.equals(ipAddresses, otherInterface.ipAddresses) && - Objects.equals(macAddress, otherInterface.macAddress) && - Objects.equals(vlan, otherInterface.vlan); - } - - @Override - public int hashCode() { - return Objects.hash(connectPoint, name, ipAddresses, macAddress, vlan); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()) - .add("name", name) - .add("connectPoint", connectPoint) - .add("ipAddresses", ipAddresses) - .add("macAddress", macAddress) - .add("vlan", vlan) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java deleted file mode 100644 index 32d480d6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceAdminService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 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.net.intf; - -import org.onosproject.net.ConnectPoint; - -/** - * Provides a means to modify the interfaces configuration. - */ -public interface InterfaceAdminService { - - /** - * Adds a new interface configuration to the system. - * - * @param intf interface to add - */ - void add(Interface intf); - - /** - * Removes an interface configuration from the system. - * - * @param connectPoint connect point of the interface - * @param name name of the interface - */ - boolean remove(ConnectPoint connectPoint, String name); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java deleted file mode 100644 index b164df93..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/InterfaceService.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2015 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.net.intf; - -import com.google.common.annotations.Beta; -import org.onlab.packet.IpAddress; -import org.onlab.packet.VlanId; -import org.onosproject.net.ConnectPoint; - -import java.util.Set; - -/** - * Service for interacting with interfaces. - */ -@Beta -public interface InterfaceService { - - /** - * Returns the set of all interfaces in the system. - * - * @return set of interfaces - */ - Set getInterfaces(); - - /** - * Returns the set of interfaces configured on the given port. - * - * @param port connect point - * @return set of interfaces - */ - Set getInterfacesByPort(ConnectPoint port); - - /** - * Returns the set of interfaces with the given IP address. - * - * @param ip IP address - * @return set of interfaces - */ - Set getInterfacesByIp(IpAddress ip); - - /** - * Returns the set of interfaces in the given VLAN. - * - * @param vlan VLAN ID of the interfaces - * @return set of interfaces - */ - Set getInterfacesByVlan(VlanId vlan); - - /** - * Returns an interface that has an address that is in the same subnet as - * the given IP address. - * - * @param ip IP address to find matching subnet interface for - * @return interface - */ - Interface getMatchingInterface(IpAddress ip); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java deleted file mode 100644 index 6cea24d1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/intf/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Interface Service. - */ -package org.onosproject.incubator.net.intf; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java deleted file mode 100644 index 868eec7a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Incubating network model abstractions and APIs. - */ -package org.onosproject.incubator.net; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java deleted file mode 100644 index 1065503a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/DefaultLabelResource.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderId; -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * the implementation of a label resource of a device. - */ -@Beta -public final class DefaultLabelResource implements LabelResource { - - private DeviceId deviceId; - - private LabelResourceId labelResourceId; - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(String deviceId, long labelResourceId) { - this.deviceId = DeviceId.deviceId(deviceId); - this.labelResourceId = LabelResourceId.labelResourceId(labelResourceId); - } - - /** - * Initialize a label resource object. - * @param deviceId device identifier - * @param labelResourceId label resource id - */ - public DefaultLabelResource(DeviceId deviceId, - LabelResourceId labelResourceId) { - this.deviceId = deviceId; - this.labelResourceId = labelResourceId; - } - - @Override - public DeviceId deviceId() { - return deviceId; - } - - @Override - public LabelResourceId labelResourceId() { - return labelResourceId; - } - - @Override - public Annotations annotations() { - return null; - } - - @Override - public ProviderId providerId() { - return null; - } - - @Override - public int hashCode() { - return Objects.hash(deviceId, labelResourceId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof DefaultLabelResource) { - DefaultLabelResource that = (DefaultLabelResource) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.labelResourceId, - that.labelResourceId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("deviceId", deviceId) - .add("labelResourceId", labelResourceId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java deleted file mode 100644 index 6d5a90be..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResource.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotated; -import org.onosproject.net.DeviceId; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Provided; - -/** - * Representation of label resource. - */ -@Beta -public interface LabelResource extends Annotated, Provided, NetworkResource { - /** - * Returns device id. - * @return DeviceId - */ - DeviceId deviceId(); - - /** - * Returns label resource identifier. - * - * @return resource id - */ - LabelResourceId labelResourceId(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java deleted file mode 100644 index a6108bb6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceAdminService.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -/** - * Service for managing label resource. - */ -@Beta -public interface LabelResourceAdminService { - /** - * Creates the only label resource of some device id from begin label to end - * label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the only global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java deleted file mode 100644 index ae88be57..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Label resource store delegate. - */ -@Beta -public interface LabelResourceDelegate extends StoreDelegate { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java deleted file mode 100644 index dd02ae21..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceEvent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes label resource event. - */ -@Beta -public final class LabelResourceEvent - extends AbstractEvent { - - /** - * Type of label resource event. - */ - public enum Type { - /** - * Signifies that a new pool has been administratively created. - */ - POOL_CREATED, - /** - * Signifies that a new pool has been administratively destroyed. - */ - POOL_DESTROYED, - /** - * Signifies that a new pool has been administratively changed. - */ - POOL_CAPACITY_CHANGED - } - - /** - * Creates an event of a given type and the given LabelResourcePool. - * - * @param type event type - * @param subject pool - */ - public LabelResourceEvent(Type type, LabelResourcePool subject) { - super(type, subject); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java deleted file mode 100644 index 6fe7067d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceId.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.resource.ResourceId; - -import java.util.Objects; - -/** - * Representation of a label. - */ -@Beta -public final class LabelResourceId implements ResourceId { - - private long labelId; - - public static LabelResourceId labelResourceId(long labelResourceId) { - return new LabelResourceId(labelResourceId); - } - - // Public construction is prohibited - private LabelResourceId(long labelId) { - this.labelId = labelId; - } - - public long labelId() { - return labelId; - } - - @Override - public int hashCode() { - return Objects.hashCode(labelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceId) { - LabelResourceId that = (LabelResourceId) obj; - return Objects.equals(this.labelId, that.labelId); - } - return false; - } - - @Override - public String toString() { - return String.valueOf(this.labelId); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java deleted file mode 100644 index b7f907c6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving label resource related events. - */ -@Beta -public interface LabelResourceListener extends EventListener { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java deleted file mode 100644 index 75916af0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourcePool.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.util.Collections; -import java.util.Objects; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Abstraction of the capacity of device label resource or global label - * resource. It's contiguous range of label resource. When a application apply - * some labels of some device, first catch from Set that store - * available labels, if the size of the Set less than the apply number, then get - * labels by calculating with three attributes, beginLabel,endLabel and - * currentUsedMaxLabelId. - */ -@Beta -public class LabelResourcePool { - - private final DeviceId deviceId; - private final LabelResourceId beginLabel; - private final LabelResourceId endLabel; - private final long totalNum; // capacity of label resource pool - private final long usedNum; // have used label number - private final LabelResourceId currentUsedMaxLabelId; // the maximal label - // number id - private ImmutableSet releaseLabelId; // Set of released label - - /** - * Creates a pool by device id,begin label id,end label id. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel) { - this(deviceId, beginLabel, endLabel, endLabel - beginLabel + 1, 0L, - beginLabel, ImmutableSet.copyOf(Collections.emptySet())); - } - - /** - * Creates a pool by device id,begin label id,end label id. - * Used to update a pool in the store. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * resource pool - * @param endLabel represents for the last label id in the range of label - * resource pool - * @param totalNum capacity of label resource pool - * @param usedNum have used label number - * @param currentUsedMaxLabelId the maximal label number id - * @param releaseLabelId Set of released label - */ - public LabelResourcePool(String deviceId, long beginLabel, long endLabel, - long totalNum, long usedNum, - long currentUsedMaxLabelId, - ImmutableSet releaseLabelId) { - checkArgument(endLabel >= beginLabel, - "endLabel %s must be greater than or equal to beginLabel %s", - endLabel, beginLabel); - this.deviceId = DeviceId.deviceId(deviceId); - this.beginLabel = LabelResourceId.labelResourceId(beginLabel); - this.endLabel = LabelResourceId.labelResourceId(endLabel); - this.totalNum = totalNum; - this.usedNum = usedNum; - this.currentUsedMaxLabelId = LabelResourceId - .labelResourceId(currentUsedMaxLabelId); - this.releaseLabelId = releaseLabelId; - } - - /** - * Returns a device id. - * - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns a begin Label id. - * - * @return begin Label id - */ - public LabelResourceId beginLabel() { - return beginLabel; - } - - /** - * Returns an end Label id. - * - * @return end Label id - */ - public LabelResourceId endLabel() { - return endLabel; - } - - /** - * Returns a begin Label id. - * - * @return current Used Maximal Label Id - */ - public LabelResourceId currentUsedMaxLabelId() { - return currentUsedMaxLabelId; - } - - /** - * Returns total number. - * - * @return the total label number - */ - public long totalNum() { - return totalNum; - } - - /** - * Returns used number. - * - * @return the used label number - */ - public long usedNum() { - return usedNum; - } - - /** - * Returns the Set of released label before. - * - * @return the Set of LabelResource - */ - public Set releaseLabelId() { - return releaseLabelId; - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.beginLabel, this.endLabel, - this.totalNum, this.usedNum, - this.currentUsedMaxLabelId, this.releaseLabelId); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourcePool) { - LabelResourcePool that = (LabelResourcePool) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.beginLabel, that.beginLabel) - && Objects.equals(this.endLabel, that.endLabel) - && Objects.equals(this.totalNum, that.totalNum) - && Objects.equals(this.usedNum, that.usedNum) - && Objects.equals(this.currentUsedMaxLabelId, - that.currentUsedMaxLabelId) - && Objects.equals(this.releaseLabelId, that.releaseLabelId); - } - return false; - } - - @Override - public String toString() { - // TODO Auto-generated method stub - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("beginLabel", this.beginLabel) - .add("endLabel", this.endLabel).add("totalNum", this.totalNum) - .add("usedNum", this.usedNum) - .add("currentUsedMaxLabelId", this.currentUsedMaxLabelId) - .add("releaseLabelId", this.releaseLabelId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java deleted file mode 100644 index 821177a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of an entity providing information about label resource - * to the core. - */ -@Beta -public interface LabelResourceProvider extends Provider { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java deleted file mode 100644 index e6234974..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an label resource provider registry. - */ -@Beta -public interface LabelResourceProviderRegistry - extends ProviderRegistry { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java deleted file mode 100644 index 9a1472d6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceProviderService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderService; - -/** - * Means for injecting label information into the core. - */ -@Beta -public interface LabelResourceProviderService extends ProviderService { - - /** - * Signals that a device label resource pool has been detected. - * @param deviceId device identifier - * @param beginLabel the begin label number of resource - * @param endLabel the end label number of resource - */ - void deviceLabelResourcePoolDetected(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Signals that an label resource pool has been destroyed. - * @param deviceId device identifier - */ - void deviceLabelResourcePoolDestroyed(DeviceId deviceId); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java deleted file mode 100644 index 9ff6a587..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceRequest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import java.util.Collection; -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Represents for a label request. - */ -@Beta -public class LabelResourceRequest { - - private final DeviceId deviceId; - private final Type type; - private final long applyNum; - private ImmutableSet releaseCollection; - - /** - * Creates LabelResourceRequest object. - * @param deviceId device identifier - * @param type request type - * @param applyNum apply the number of labels - * @param releaseCollection Set of released label - */ - public LabelResourceRequest(DeviceId deviceId, - Type type, - long applyNum, - ImmutableSet releaseCollection) { - this.deviceId = deviceId; - this.type = type; - this.applyNum = applyNum; - this.releaseCollection = releaseCollection; - } - /** - * Returns a device id. - * @return DeviceId - */ - public DeviceId deviceId() { - return deviceId; - } - - /** - * Returns request type. - * @return Type - */ - public Type type() { - return type; - } - - /** - * Returns apply label number. - * @return label number - */ - public long applyNum() { - return applyNum; - } - - /** - * Returns the collection of release labels. - * @return Collection of DefaultLabelResource - */ - public Collection releaseCollection() { - return releaseCollection; - } - - /** - * Request type. - */ - public enum Type { - APPLY, //apple label request - RELEASE //release label request - } - - @Override - public int hashCode() { - return Objects.hash(this.deviceId, this.applyNum, this.type, - this.releaseCollection); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof LabelResourceRequest) { - LabelResourceRequest that = (LabelResourceRequest) obj; - return Objects.equals(this.deviceId, that.deviceId) - && Objects.equals(this.applyNum, that.applyNum) - && Objects.equals(this.type, that.type) - && Objects.equals(this.releaseCollection, - that.releaseCollection); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this).add("deviceId", this.deviceId) - .add("applyNum", this.applyNum).add("type", this.type) - .add("releaseCollection", this.releaseCollection).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java deleted file mode 100644 index bb86d475..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceService.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.event.ListenerService; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.Multimap; - -/** - * Service for providing label resource allocation. - */ -@Beta -public interface LabelResourceService - extends ListenerService { - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused label number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool of a label resource by a specific device - * id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java deleted file mode 100644 index 5322d013..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/LabelResourceStore.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import java.util.Collection; -import java.util.Set; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; -import org.onosproject.store.Store; - -import com.google.common.collect.Multimap; - -/** - * Manages inventory of label; not intended for direct use. - * - */ -@Beta -public interface LabelResourceStore - extends Store { - - /** - * Creates a label resource of some device id from begin label to end label. - * - * @param deviceId device identifier - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createDevicePool(DeviceId deviceId, LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Creates the global label resource pool. - * - * @param beginLabel represents for the first label id in the range of label - * pool - * @param endLabel represents for the last label id in the range of label - * pool - * @return success or fail - */ - boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel); - - /** - * Destroys a label resource pool of a specific device id. - * - * @param deviceId device identifier - * @return success or fail - */ - boolean destroyDevicePool(DeviceId deviceId); - - /** - * Destroys a the global label resource pool. - * - * @return success or fail - */ - boolean destroyGlobalPool(); - - /** - * Returns labels from resource pool by a specific device id. - * - * @param deviceId device identifier - * @param applyNum the applying number - * @return collection of applying labels - */ - Collection applyFromDevicePool(DeviceId deviceId, - long applyNum); - - /** - * Returns labels from the global label resource pool. - * - * @param applyNum apply the number of labels - * @return collection of labels - */ - Collection applyFromGlobalPool(long applyNum); - - /** - * Releases unused labels to device pools . - * - * @param release the collection of releasing labels - * @return success or fail - */ - boolean releaseToDevicePool(Multimap release); - - /** - * Releases unused labels to the global resource pool. - * - * @param release release the collection of releasing labels - * @return success or fail - */ - boolean releaseToGlobalPool(Set release); - - /** - * Judges if the pool of a specific device id is full. - * - * @param deviceId device identifier - * @return yes or no - */ - boolean isDevicePoolFull(DeviceId deviceId); - - /** - * Judges if the global resource pool is full. - * - * @return yes or no - */ - boolean isGlobalPoolFull(); - - /** - * Returns the unused label number of a label resource pool by a specific device - * id. - * - * @param deviceId device identifier - * @return number of unused labels - */ - long getFreeNumOfDevicePool(DeviceId deviceId); - - /** - * Returns the unused number of a global label resource pool. - * - * @return number of unused labels - */ - long getFreeNumOfGlobalPool(); - - /** - * Returns the label resource pool by a specific device id. - * - * @param deviceId device identifier - * @return the device label resource pool - */ - LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId); - - /** - * Returns the global label resource pool. - * - * @return the global label resource pool - */ - LabelResourcePool getGlobalLabelResourcePool(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java deleted file mode 100644 index 9df466e9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/resource/label/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Service for reserving labels as network resources. - */ -package org.onosproject.incubator.net.resource.label; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java deleted file mode 100644 index ae0f5148..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultOpticalTunnelEndPoint.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; -import java.util.Optional; - -import com.google.common.annotations.Beta; -import org.onosproject.net.AbstractModel; -import org.onosproject.net.Annotations; -import org.onosproject.net.ElementId; -import org.onosproject.net.PortNumber; -import org.onosproject.net.provider.ProviderId; - -/** - * Default optical tunnel point model implementation. - */ -@Beta -public class DefaultOpticalTunnelEndPoint extends AbstractModel implements OpticalTunnelEndPoint { - private final Optional elementId; - private final Optional portNumber; - private final Optional parentPoint; - private final Type type; - private final OpticalLogicId id; - private final boolean isGlobal; - - /** - * Creates a optical tunnel point attributed to the specified provider (may be null). - * if provider is null, which means the optical tunnel point is not managed by the SB. - * - * @param providerId tunnelProvider Id - * @param elementId parent network element - * @param number port number - * @param parentPoint parent port or parent label - * @param type port type - * @param id LabelId - * @param isGlobal indicator whether the label is global significant or not - * @param annotations optional key/value annotations - */ - public DefaultOpticalTunnelEndPoint(ProviderId providerId, Optional elementId, - Optional number, Optional parentPoint, - Type type, OpticalLogicId id, boolean isGlobal, Annotations... annotations) { - super(providerId, annotations); - this.elementId = elementId; - this.portNumber = number; - this.parentPoint = parentPoint; - this.id = id; - this.type = type; - this.isGlobal = isGlobal; - } - - @Override - public OpticalLogicId id() { - return id; - } - - @Override - public Optional elementId() { - return elementId; - } - - @Override - public Optional portNumber() { - return portNumber; - } - - @Override - public Optional parentPoint() { - return parentPoint; - } - - @Override - public boolean isGlobal() { - return isGlobal; - } - - @Override - public Type type() { - return type; - } - - @Override - public int hashCode() { - return Objects.hash(elementId, portNumber, parentPoint, id); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultOpticalTunnelEndPoint) { - final DefaultOpticalTunnelEndPoint other = (DefaultOpticalTunnelEndPoint) obj; - return Objects.equals(this.id, other.id) && - Objects.equals(this.type, other.type) && - Objects.equals(this.isGlobal, other.isGlobal) && - Objects.equals(this.elementId, other.elementId) && - Objects.equals(this.portNumber, other.portNumber) && - Objects.equals(this.parentPoint, other.parentPoint); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("elementId", elementId) - .add("portNumber", portNumber) - .add("parentPoint", parentPoint) - .add("type", type) - .add("id", id) - .add("isGlobal", isGlobal) - .toString(); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java deleted file mode 100755 index 86a790f4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnel.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2014-2015 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.net.tunnel; - -import static com.google.common.base.MoreObjects.toStringHelper; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.AbstractModel; -import org.onosproject.net.Annotations; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * The default implementation of an network tunnel. supports for creating a - * tunnel by connect point ,IP address, MAC address, device and so on. - */ -@Beta -public final class DefaultTunnel extends AbstractModel implements Tunnel { - - private final TunnelEndPoint src; // a source point of tunnel. - private final TunnelEndPoint dst; // a destination point of tunnel. - private final State state; - private final Type type; // tunnel type - private final DefaultGroupId groupId; // represent for a group flow table - // which a tunnel match up - // tunnel producer - private final TunnelId tunnelId; // tunnel identify generated by - // ONOS as primary key - private final TunnelName tunnelName; // name of a tunnel - private final Path path; - - /** - * Creates an active infrastructure tunnel using the supplied information. - * - * @param producerName provider identity - * @param src tunnel source - * @param dst tunnel destination - * @param type tunnel type - * @param groupId groupId - * @param tunnelId tunnelId - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnel(ProviderId producerName, TunnelEndPoint src, - TunnelEndPoint dst, Type type, DefaultGroupId groupId, - TunnelId tunnelId, TunnelName tunnelName, Path path, - Annotations... annotations) { - this(producerName, src, dst, type, Tunnel.State.ACTIVE, groupId, - tunnelId, tunnelName, path, annotations); - } - - /** - * Creates an tunnel using the supplied information. - * - * @param producerName provider identity - * @param src tunnel source - * @param dst tunnel destination - * @param type tunnel type - * @param state tunnel state - * @param groupId groupId - * @param tunnelId tunnelId - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnel(ProviderId producerName, TunnelEndPoint src, - TunnelEndPoint dst, Type type, State state, - DefaultGroupId groupId, TunnelId tunnelId, - TunnelName tunnelName, Path path, Annotations... annotations) { - super(producerName, annotations); - this.src = src; - this.dst = dst; - this.type = type; - this.state = state; - this.groupId = groupId; - this.tunnelId = tunnelId; - this.tunnelName = tunnelName; - this.path = path; - } - - @Override - public TunnelEndPoint src() { - return src; - } - - @Override - public TunnelEndPoint dst() { - return dst; - } - - @Override - public Type type() { - return type; - } - - @Override - public State state() { - return state; - } - - @Override - public NetworkResource resource() { - return null; - } - - @Override - public TunnelId tunnelId() { - return tunnelId; - } - - @Override - public DefaultGroupId groupId() { - return groupId; - } - - @Override - public TunnelName tunnelName() { - return tunnelName; - } - - - @Override - public Path path() { - return path; - } - - @Override - public int hashCode() { - return Objects.hash(src, dst, type, groupId, tunnelId, tunnelName, - state, path); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultTunnel) { - final DefaultTunnel other = (DefaultTunnel) obj; - return Objects.equals(this.src, other.src) - && Objects.equals(this.dst, other.dst) - && Objects.equals(this.type, other.type) - && Objects.equals(this.groupId, other.groupId) - && Objects.equals(this.tunnelId, other.tunnelId) - && Objects.equals(this.tunnelName, other.tunnelName) - && Objects.equals(this.state, other.state) - && Objects.equals(this.path, other.path); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("src", src).add("dst", dst) - .add("type", type).add("state", state).add("groupId", groupId) - .add("producerTunnelId", tunnelId) - .add("tunnelName", tunnelName) - .add("path", path).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java deleted file mode 100755 index 055934a0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelDescription.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.AbstractDescription; -import org.onosproject.net.Path; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.base.MoreObjects; - -/** - * Default implementation of immutable tunnel description entity. - */ -@Beta -public class DefaultTunnelDescription extends AbstractDescription - implements TunnelDescription { - - private final TunnelId tunnelId; - private final TunnelEndPoint src; - private final TunnelEndPoint dst; - private final Tunnel.Type type; - private final DefaultGroupId groupId; // represent for a group flow table - // which a tunnel match up - // tunnel producer - private final ProviderId producerName; // tunnel producer name - private final TunnelName tunnelName; // name of a tunnel - private final Path path; - - /** - * Creates a tunnel description using the supplied information. - * - * @param id TunnelId - * @param src TunnelPoint source - * @param dst TunnelPoint destination - * @param type tunnel type - * @param groupId groupId - * @param producerName tunnel producer - * @param tunnelName tunnel name - * @param path the path of tunnel - * @param annotations optional key/value annotations - */ - public DefaultTunnelDescription(TunnelId id, TunnelEndPoint src, - TunnelEndPoint dst, Tunnel.Type type, - DefaultGroupId groupId, - ProviderId producerName, - TunnelName tunnelName, - Path path, - SparseAnnotations... annotations) { - super(annotations); - this.tunnelId = id; - this.src = src; - this.dst = dst; - this.type = type; - this.groupId = groupId; - this.producerName = producerName; - this.tunnelName = tunnelName; - this.path = path; - } - - @Override - public TunnelId id() { - return tunnelId; - } - - @Override - public TunnelEndPoint src() { - return src; - } - - @Override - public TunnelEndPoint dst() { - return dst; - } - - @Override - public Tunnel.Type type() { - return type; - } - - @Override - public DefaultGroupId groupId() { - return groupId; - } - - @Override - public ProviderId producerName() { - return producerName; - } - - @Override - public TunnelName tunnelName() { - return tunnelName; - } - - - @Override - public Path path() { - return path; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("tunnelId", id()) - .add("src", src()) - .add("dst", dst()) - .add("type", type()) - .add("tunnelName", tunnelName()) - .add("producerName", producerName()) - .add("groupId", groupId()) - .add("path", path) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java deleted file mode 100644 index cab9ae43..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DefaultTunnelStatistics.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -import java.time.Duration; -import java.util.List; - -/** - * Default implementation of immutable tunnel statistics. - */ -@Beta -public final class DefaultTunnelStatistics implements TunnelStatistics { - private final TunnelId tunnelId; - private final double bwUtilization; - private final double packetLossRatio; - private final Duration flowDelay; - private final List alarms; - - private DefaultTunnelStatistics(TunnelId tunnelId, - double bwUtilization, - double packetLossRatio, - Duration flowDelay, - List alarms) { - this.tunnelId = tunnelId; - this.bwUtilization = bwUtilization; - this.packetLossRatio = packetLossRatio; - this.flowDelay = flowDelay; - this.alarms = alarms; - } - - private DefaultTunnelStatistics() { - this.tunnelId = null; - this.bwUtilization = 0; - this.packetLossRatio = 0; - this.flowDelay = null; - this.alarms = null; - } - - - @Override - public TunnelId id() { - return this.tunnelId; - } - - @Override - public double bandwidthUtilization() { - return this.bwUtilization; - } - - @Override - public double packetLossRate() { - return this.packetLossRatio; - } - - @Override - public Duration flowDelay() { - return this.flowDelay; - } - - - @Override - public List alarms() { - return this.alarms; - } - - /** - * Builder for tunnelStatistics. - */ - public static final class Builder { - TunnelId tunnelId; - double bwUtilization; - double packetLossRatio; - Duration flowDelay; - List alarms; - - public Builder() { - - } - - /** - * Set tunnel id. - * - * @param tunnelId tunnel id - * @return builder object - */ - public Builder setTunnelId(TunnelId tunnelId) { - this.tunnelId = tunnelId; - - return this; - } - - /** - * set bandwidth utilization. - * - * @param bwUtilization bandwidth utilization - * @return builder object - */ - public Builder setBwUtilization(double bwUtilization) { - this.bwUtilization = bwUtilization; - - return this; - } - - /** - * Set packet loss ratio. - * - * @param packetLossRatio packet loss ratio - * @return builder object - */ - public Builder setPacketLossRatio(double packetLossRatio) { - this.packetLossRatio = packetLossRatio; - - return this; - } - - /** - * Set flow delay. - * - * @param flowDelay flow delay - * @return builder object - */ - public Builder setFlowDelay(Duration flowDelay) { - this.flowDelay = flowDelay; - - return this; - } - - /** - * Set alarms. - * - * @param alarms alarms of a tunnel - * @return builder object - */ - public Builder setAlarms(List alarms) { - this.alarms = alarms; - - return this; - } - - /** - * Creates a TunnelStatistics object. - * - * @return DefaultTunnelStatistics - */ - public DefaultTunnelStatistics build() { - return new DefaultTunnelStatistics(tunnelId, - bwUtilization, - packetLossRatio, - flowDelay, - alarms); - } - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java deleted file mode 100644 index 430823ca..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/DomainTunnelId.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -/** - * A wrapper class for a long used to identify domain level tunnels. - */ -public final class DomainTunnelId { - - private final long value; - - /** - * Creates a tunnel identifier from the specified tunnel. - * - * @param value long value - * @return domain tunnel identifier - */ - public static DomainTunnelId valueOf(long value) { - return new DomainTunnelId(value); - } - - /** - * Creates a tunnel identifier from the specified tunnel. - * - * @param value long value as a string - * @return domain tunnel identifier - */ - public static DomainTunnelId valueOf(String value) { - return new DomainTunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - protected DomainTunnelId() { - this.value = 0; - } - - /** - * Constructs the Domain ID corresponding to a given long value. - * - * @param value the underlying value of this domain ID - */ - public DomainTunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value of this domain ID. - * - * @return the long value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof DomainTunnelId)) { - return false; - } - DomainTunnelId that = (DomainTunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java deleted file mode 100644 index ad41adf6..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/IpTunnelEndPoint.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onlab.packet.IpAddress; - -import com.google.common.base.MoreObjects; - -/** - * Represent for a tunnel point using ip address. - */ -@Beta -public final class IpTunnelEndPoint implements TunnelEndPoint { - - private final IpAddress ip; - - /** - * Public construction is prohibited. - * @param ip ip address - */ - private IpTunnelEndPoint(IpAddress ip) { - this.ip = ip; - } - - /** - * Create a IP tunnel end point. - * @param ip IP address - * @return IpTunnelEndPoint - */ - public static IpTunnelEndPoint ipTunnelPoint(IpAddress ip) { - return new IpTunnelEndPoint(ip); - } - - /** - * Returns IP address. - * @return IP address - */ - public IpAddress ip() { - return ip; - } - - @Override - public int hashCode() { - return Objects.hash(ip); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof IpTunnelEndPoint) { - final IpTunnelEndPoint other = (IpTunnelEndPoint) obj; - return Objects.equals(this.ip, other.ip); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()).add("ip", ip).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java deleted file mode 100644 index a3de7883..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/NetworkTunnelId.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Representation of a Network Tunnel Id. - */ -@Beta -public final class NetworkTunnelId { - private final long value; - - /** - * Creates an tunnel identifier from the specified tunnel. - * - * @param value long value - * @return tunnel identifier - */ - public static NetworkTunnelId valueOf(long value) { - return new NetworkTunnelId(value); - } - - public static NetworkTunnelId valueOf(String value) { - return new NetworkTunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - NetworkTunnelId() { - this.value = 0; - } - - /** - * Constructs the ID corresponding to a given long value. - * - * @param value the underlying value of this ID - */ - public NetworkTunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value. - * - * @return the value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof NetworkTunnelId)) { - return false; - } - NetworkTunnelId that = (NetworkTunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java deleted file mode 100644 index d5994863..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import com.google.common.primitives.UnsignedLongs; - -/** - * Representation of a label Id, a logical port identifier. - */ -@Beta -public final class OpticalLogicId { - /** - * Represents a logical Id. - */ - private final long logicId; - - /** - * Constructor, public creation is prohibited. - */ - private OpticalLogicId(long id) { - this.logicId = id; - } - - /** - * Returns the LabelId representing the specified long value. - * - * @param id identifier as long value - * @return LabelId - */ - public static OpticalLogicId logicId(long id) { - return new OpticalLogicId(id); - } - - public static OpticalLogicId logicId(String string) { - return new OpticalLogicId(UnsignedLongs.decode(string)); - } - - public long toLong() { - return logicId; - } - - @Override - public String toString() { - return UnsignedLongs.toString(logicId); - } - - @Override - public int hashCode() { - return Objects.hashCode(logicId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof OpticalLogicId) { - final OpticalLogicId other = (OpticalLogicId) obj; - return this.logicId == other.logicId; - } - return false; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java deleted file mode 100644 index 7d72398d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalTunnelEndPoint.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import java.util.Optional; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Annotated; -import org.onosproject.net.ElementId; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.PortNumber; -import org.onosproject.net.Provided; - -/** - * Generic representation of a logical port entity in a consistent way, - * it is used to identify e.g., ODUk timeSlot, WDM lambda, etc. - * It supports nested case. - */ -@Beta -public interface OpticalTunnelEndPoint extends TunnelEndPoint, Annotated, Provided, NetworkResource { - - /** Represents coarse tunnel point type classification. */ - public enum Type { - /** - * Signifies optical data unit-based tunnel point. - */ - TIMESLOT, - - /** - * Signifies optical wavelength-based tunnel point. - */ - LAMBDA - } - - /** - * Returns the identifier. - * - * @return identifier - */ - OpticalLogicId id(); - - /** - * Returns the parent network element to which this tunnel point belongs. - * - * @return parent network element - */ - Optional elementId(); - - /** - * Returns the parent network port to which this tunnel point belongs, can not be be null. - * - * @return port number - */ - Optional portNumber(); - - /** - * Returns the parent tunnel point to which this tunnel point belongs, optional. - * - * @return parent tunnel point, if it is null, the parent is a physical port - */ - Optional parentPoint(); - - /** - * Indicates whether or not the port is global significant. - * - * @return true if the port is global significant - */ - boolean isGlobal(); - - /** - * Returns the tunnel point type. - * - * @return tunnel point type - */ - Type type(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java deleted file mode 100755 index 33af106d..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/Tunnel.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.Annotated; -import org.onosproject.net.NetworkResource; -import org.onosproject.net.Path; -import org.onosproject.net.Provided; - -/** - * Abstraction of a generalized Tunnel entity (bandwidth pipe) for either L3/L2 - * networks or L1/L0 networks, representation of e.g., VLAN, GRE tunnel, MPLS - * LSP, L1 ODUk connection, WDM OCH, etc.. Each Tunnel is associated with at - * least two tunnel end point objects that model the logical ports essentially. - * Note that it supports nested case. - */ -@Beta -public interface Tunnel extends Annotated, Provided, NetworkResource { - - /** - * Tunnel technology type. - */ - enum Type { - /** - * Signifies that this is a MPLS tunnel. - */ - MPLS, - /** - * Signifies that this is a L2 tunnel. - */ - VLAN, - /** - * Signifies that this is a DC L2 extension tunnel. - */ - VXLAN, - /** - * Signifies that this is a L3 tunnel. - */ - GRE, - /** - * Signifies that this is a L1 OTN tunnel. - */ - ODUK, - /** - * Signifies that this is a L0 OCH tunnel. - */ - OCH - } - - /** - * Representation of the tunnel state. - */ - public enum State { - /** - * Signifies that a tunnel is currently in a initialized state. - */ - INIT, - /** - * Signifies that a tunnel is currently established but no traffic. - */ - ESTABLISHED, - /** - * Signifies that a tunnel is currently active. This state means that - * this tunnel is available. It can be borrowed by consumer. - */ - ACTIVE, - /** - * Signifies that a tunnel is currently out of service. - */ - FAILED, - /** - * Signifies that a tunnel is currently inactive. This state means that - * this tunnel can not be borrowed by consumer. - */ - INACTIVE - } - - /** - * Returns the tunnel state. - * - * @return tunnel state - */ - State state(); - - /** - * the origin of a tunnel. - * - * @return the origin of a tunnel - */ - TunnelEndPoint src(); - - /** - * the terminal of a tunnel. - * - * @return the terminal of a tunnel - */ - TunnelEndPoint dst(); - - /** - * Returns the tunnel type. - * - * @return tunnel type - */ - Type type(); - - /** - * Returns group flow table id which a tunnel match up. - * - * @return OpenFlowGroupId - */ - DefaultGroupId groupId(); - - /** - * Returns tunnel identify generated by ONOS as primary key. - * - * @return TunnelId - */ - TunnelId tunnelId(); - - /** - * Return the name of a tunnel. - * - * @return Tunnel Name - */ - TunnelName tunnelName(); - - /** - * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag. - * - * @return backing resource - */ - NetworkResource resource(); - - /** - * Returns the path of the tunnel. - * - * @return the path of the tunnel - */ - Path path(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java deleted file mode 100644 index 5165a68e..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelAdminService.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * Service for administering the inventory of provisioned tunnels. - */ -@Beta -public interface TunnelAdminService { - - /** - * Removes the provisioned tunnel. - * - * @param tunnelId tunnel ID - */ - void removeTunnel(TunnelId tunnelId); - - /** - * Removes the provisioned tunnel leading to and from the - * specified labels. - * - * @param src source label - * @param dst destination label - * @param producerName producer name - */ - void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, ProviderId producerName); - - /** - * Removes all provisioned tunnels leading to and from the - * specified connection point. - * - * @param src source connection point - * @param dst destination connection point - * @param type tunnel type - * @param producerName producer name - */ - void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, Tunnel.Type type, ProviderId producerName); - - /** - * Invokes the core to update a tunnel based on specified tunnel parameters. - * - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for the tunnel - */ - void updateTunnel(Tunnel tunnel, Path path); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java deleted file mode 100755 index a8408bef..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelDescription.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotated; -import org.onosproject.net.Description; -import org.onosproject.net.Path; -import org.onosproject.net.provider.ProviderId; - -/** - * Describes a tunnel. - */ -@Beta -public interface TunnelDescription extends Description, Annotated { - - /** - * Returns the tunnel id. - * - * @return tunnelId - */ - TunnelId id(); - - /** - * Returns the connection point source. - * - * @return tunnel source ConnectionPoint - */ - TunnelEndPoint src(); - - /** - * Returns the connection point destination. - * - * @return tunnel destination - */ - TunnelEndPoint dst(); - - /** - * Returns the tunnel type. - * - * @return tunnel type - */ - Type type(); - - /** - * Returns group flow table id which a tunnel match up. - * - * @return OpenFlowGroupId - */ - DefaultGroupId groupId(); - - /** - * Returns tunnel producer name. - * - * @return producer name - */ - ProviderId producerName(); - - /** - * Return the name of a tunnel. - * - * @return Tunnel Name - */ - TunnelName tunnelName(); - - /** - * Returns the path of the tunnel. - * - * @return the path of the tunnel - */ - Path path(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java deleted file mode 100644 index 55890289..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPoint.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Represents for source end point or destination end point of a tunnel. Maybe a tunnel - * based on ConnectPoint, IpAddress, MacAddress and so on is built. - */ -@Beta -public interface TunnelEndPoint { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java deleted file mode 100644 index 57af670c..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEndPointFormatter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - - -import com.google.common.annotations.Beta; -import org.onosproject.ui.table.CellFormatter; -import org.onosproject.ui.table.cell.AbstractCellFormatter; - -/** - * Formats a optical tunnel endpoint as "(type)/(element-id)/(port)". - * Formats a ip tunnel endpoint as "ip". - */ -@Beta -public final class TunnelEndPointFormatter extends AbstractCellFormatter { - //non-instantiable - private TunnelEndPointFormatter() { - } - - @Override - protected String nonNullFormat(Object value) { - - if (value instanceof DefaultOpticalTunnelEndPoint) { - DefaultOpticalTunnelEndPoint cp = (DefaultOpticalTunnelEndPoint) value; - return cp.type() + "/" + cp.elementId().get() + "/" + cp.portNumber().get(); - } else if (value instanceof IpTunnelEndPoint) { - IpTunnelEndPoint cp = (IpTunnelEndPoint) value; - return cp.ip().toString(); - } - return ""; - } - - /** - * An instance of this class. - */ - public static final CellFormatter INSTANCE = new TunnelEndPointFormatter(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java deleted file mode 100644 index 18044ee7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes tunnel events. - */ -@Beta -public final class TunnelEvent extends AbstractEvent { - - /** - * Type of tunnel events. - */ - public enum Type { - /** - * Signifies that a new tunnel has been added. - */ - TUNNEL_ADDED, - - /** - * Signifies that a tunnel has been updated or changed state. - */ - TUNNEL_UPDATED, - - /** - * Signifies that a tunnel has been removed. - */ - TUNNEL_REMOVED - } - - /** - * Creates an event of a given type and for the specified tunnel. - * - * @param type tunnel event type - * @param tunnel event tunnel subject - */ - public TunnelEvent(Type type, Tunnel tunnel) { - super(type, tunnel); - } - - /** - * Creates an event of a given type and for the specified link and - * the current time. - * - * @param type tunnel event type - * @param tunnel event tunnel subject - * @param time occurrence time - */ - public TunnelEvent(Type type, Tunnel tunnel, long time) { - super(type, tunnel, time); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java deleted file mode 100644 index 5a3f97f2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelId.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -/** - * Representation of a Tunnel Id. - */ -@Beta -public final class TunnelId { - private final long value; - - /** - * Creates an tunnel identifier from the specified tunnel. - * - * @param value long value - * @return tunnel identifier - */ - public static TunnelId valueOf(long value) { - return new TunnelId(value); - } - - public static TunnelId valueOf(String value) { - return new TunnelId(Long.parseLong(value)); - } - - /** - * Constructor for serializer. - */ - TunnelId() { - this.value = 0; - } - - /** - * Constructs the ID corresponding to a given long value. - * - * @param value the underlying value of this ID - */ - TunnelId(long value) { - this.value = value; - } - - /** - * Returns the backing value. - * - * @return the value - */ - public long id() { - return value; - } - - @Override - public int hashCode() { - return Long.hashCode(value); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof TunnelId)) { - return false; - } - TunnelId that = (TunnelId) obj; - return this.value == that.value; - } - - @Override - public String toString() { - return "0x" + Long.toHexString(value); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java deleted file mode 100644 index b3a69fd4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving tunnel related events. - */ -@Beta -public interface TunnelListener extends EventListener { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java deleted file mode 100644 index 77a8c8e8..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelName.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -/** - * Represents for a unique tunnel name. TunnelId is generated by ONOS while - * TunnelName is given by producer. The consumer can borrow tunnels with - * TunnelId or TunnelName. - */ -@Beta -public final class TunnelName { - private final String str; - - // Default constructor for serialization - private TunnelName(String tunnelName) { - this.str = tunnelName; - } - - - /** - * Creates a tunnel name using the supplied URI string. - * - * @param tunnelName tunnel name string - * @return tunnel name object - */ - public static TunnelName tunnelName(String tunnelName) { - return new TunnelName(tunnelName); - } - - /** - * The string of tunnel name. - * - * @return the string of tunnel name - */ - public String value() { - return str; - } - - @Override - public int hashCode() { - return Objects.hash(str); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelName) { - final TunnelName that = (TunnelName) obj; - return this.getClass() == that.getClass() - && Objects.equals(this.str, that.str); - } - return false; - } - - @Override - public String toString() { - return str; - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java deleted file mode 100644 index 5677901f..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProvider.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.ElementId; -import org.onosproject.net.Path; -import org.onosproject.net.provider.Provider; - -/** - * Abstraction of an entity providing tunnel setup/release services to the core. - */ -@Beta -public interface TunnelProvider extends Provider { - - /** - * Instructs the provider to setup a tunnel. It's used by consumers. - * - * @param tunnel Tunnel - * @param path explicit route or null for the tunnel - */ - void setupTunnel(Tunnel tunnel, Path path); - - /** - * Instructs the provider to setup a tunnel given the respective device. - * It's used by consumers. - * - * @param srcElement device - * @param tunnel Tunnel - * @param path explicit route (not null) for the tunnel - */ - void setupTunnel(ElementId srcElement, Tunnel tunnel, Path path); - - /** - * Instructs the provider to release a tunnel. It's used by consumers. - * - * @param tunnel Tunnel - */ - void releaseTunnel(Tunnel tunnel); - - /** - * Instructs the provider to release a tunnel given the respective device. - * It's used by consumers. - * - * @param srcElement device - * @param tunnel Tunnel - */ - void releaseTunnel(ElementId srcElement, Tunnel tunnel); - - /** - * Instructs the provider to update a tunnel. It's used by consumers. Maybe - * some consumers enable to update a tunnel. - * - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for - * the tunnel - */ - void updateTunnel(Tunnel tunnel, Path path); - - /** - * Instructs the provider to update a tunnel given the respective device. - * It's used by consumers. Maybe some consumers enable to update a tunnel. - * - * @param srcElement device - * @param tunnel Tunnel - * @param path explicit route (path changed) or null (path not changed) for - * the tunnel - */ - void updateTunnel(ElementId srcElement, Tunnel tunnel, Path path); - - /** - * Signals that the provider has added a tunnel. It's used by producers. - * - * @param tunnel tunnel information - * @return tunnel identity - */ - TunnelId tunnelAdded(TunnelDescription tunnel); - - /** - * Signals that the provider has removed a tunnel. It's used by producers. - * - * @param tunnel tunnel information - */ - void tunnelRemoved(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was changed (e.g., sensing changes of - * tunnel).It's used by producers. - * - * @param tunnel tunnel information - */ - void tunnelUpdated(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was queried. - * It's used by producers. - * @param tunnelId tunnel identity - * @return tunnel entity - */ - Tunnel tunnelQueryById(TunnelId tunnelId); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java deleted file mode 100644 index 069455ac..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderRegistry.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of an tunnel provider registry. - */ -@Beta -public interface TunnelProviderRegistry - extends ProviderRegistry { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java deleted file mode 100644 index bb158bfa..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelProviderService.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.net.provider.ProviderService; - -/** - * APIs for tunnel provider to notify the tunnel subSystem. - */ -@Beta -public interface TunnelProviderService extends ProviderService { - - /** - * Signals that the provider has added a tunnel. - * - * @param tunnel tunnel information - * @return tunnel identity - */ - TunnelId tunnelAdded(TunnelDescription tunnel); - - /** - * Signals that the provider has removed a tunnel. - * - * @param tunnel tunnel information - */ - void tunnelRemoved(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was changed (e.g., sensing changes of tunnel). - * - * @param tunnel tunnel information - */ - void tunnelUpdated(TunnelDescription tunnel); - - /** - * Signals that the a tunnel was queried. - * - * @param tunnelId tunnel identity - * @return tunnel entity - */ - Tunnel tunnelQueryById(TunnelId tunnelId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java deleted file mode 100644 index 2a10a4c1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelService.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import java.util.Collection; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.event.ListenerService; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; - -/** - * Service for interacting with the inventory of tunnels. - */ -@Beta -public interface TunnelService - extends ListenerService { - - /** - * Borrows a specific tunnel. Annotations parameter is reserved.If there - * is no tunnel in the store, returns a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by onos - * @param annotations Annotations - * @return Tunnel subscribed tunnel - */ - Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Borrows a specific tunnel by tunnelName. Annotations parameter is reserved.If there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return collection of subscribed Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Borrows all tunnels between source and destination. Annotations - * parameter is reserved.If there is no any tunnel in the store, return a - * empty collection,and record the tunnel subscription. Where tunnel is created, ONOS - * notifies this consumer actively. Otherwise ONOS core returns all the - * tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param annotations Annotations - * @return collection of subscribed Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Borrows all specified type tunnels between source and destination. - * Annotations parameter is reserved.If there is no any tunnel in the store, - * return a empty collection, and record the tunnel subscription. Where tunnel is - * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns - * all available tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return collection of available Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns back a specific tunnel to store. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by ONOS - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns all specific name tunnel back store. Annotations parameter is reserved.if there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return boolean - */ - boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all specific type tunnels between source and destination back - * store. Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination back the store. - * Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns a tunnel by a specific tunnel identity. - * - * @param tunnelId tunnel identify generated by tunnel producer - * @return Tunnel - */ - Tunnel queryTunnel(TunnelId tunnelId); - - /** - * Returns all tunnel subscription record by consumer. - * - * @param consumerId consumer identity - * @return Collection of TunnelSubscription - */ - Collection queryTunnelSubscription(ApplicationId consumerId); - - /** - * Returns all specified type tunnels. - * - * @param type tunnel type - * @return Collection of tunnels - */ - Collection queryTunnel(Type type); - - /** - * Returns all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @return Collection of tunnels - */ - Collection queryTunnel(TunnelEndPoint src, TunnelEndPoint dst); - - /** - * Returns all tunnels. - * - * @return Collection of tunnels - */ - Collection queryAllTunnels(); - - /** - * Returns all tunnels. - * - * @return all tunnels - */ - int tunnelCount(); - - /** - * Returns the collection of tunnels applied on the specified device. - * - * @param deviceId device identifier - * @return collection of tunnels - */ - Iterable getTunnels(DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java deleted file mode 100644 index c7c9fd96..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStatistics.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; - -import java.time.Duration; -import java.util.List; - -/** - * Statistics of a tunnel. - */ -@Beta -public interface TunnelStatistics { - - /** - * Returns the tunnel id. - * - * @return tunnelId id of tunnel - */ - TunnelId id(); - - /** - * Returns the bandwidth utilization of a tunnel. - * - * @return bandwidth utilization - */ - double bandwidthUtilization(); - - /** - * Returns the packet loss ratio of a tunnel. - * - * @return tunnel packet loss ratio - */ - double packetLossRate(); - - /** - * Returns the end-to-end traffic flow delay of a tunnel. - * - * @return tunnel flow delay - */ - Duration flowDelay(); - - /** - * Returns the alarms on a tunnel. - * - * @return tunnel alarms - */ - List alarms(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java deleted file mode 100644 index 00ed5776..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStore.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import java.util.Collection; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.net.Annotations; -import org.onosproject.net.provider.ProviderId; -import org.onosproject.store.Store; - -/** - * Manages inventory of tunnel; not intended for direct use. - */ -@Beta -public interface TunnelStore extends Store { - /** - * Creates or updates a tunnel. - * - * @param tunnel tunnel - * @return tunnel identity - */ - TunnelId createOrUpdateTunnel(Tunnel tunnel); - - /** - * Deletes a tunnel by a specific tunnel identifier. - * - * @param tunnelId tunnel unique identifier generated by ONOS - */ - void deleteTunnel(TunnelId tunnelId); - - /** - * Deletes all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param producerName producerName - */ - void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, - ProviderId producerName); - - /** - * Deletes all specific type tunnels between source point and destination - * point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param type tunnel type - * @param producerName producerName - */ - void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, - Tunnel.Type type, ProviderId producerName); - - /** - * Returns a specific tunnel. Annotations parameter is reserved. If there - * is no tunnel in the store, return a "null" object, and record the tunnel subscription. - * Where tunnel is created, ONOS notifies this consumer actively. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by onos - * @param annotations parameter - * @return Tunnel subscribed tunnel - */ - Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns a specific tunnel by tunnelName. Annotations parameter is - * reserved. If there is no tunnel in the store, return a "null" object,and - * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer - * actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations parameter - * @return collection of subscribed Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, - TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination. Annotations - * parameter is reserved. If there is no any tunnel in the store, return a - * empty collection, and record the tunnel subscription. Where tunnel is created, ONOS - * notifies this consumer actively. Otherwise ONOS core returns all the - * tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param annotations parameter - * @return collection of subscribed Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns all specified type tunnels between source and destination. - * Annotations parameter is reserved. If there is no any tunnel in the store, - * return a empty collection, and record the tunnel subscription. Where tunnel is - * created, ONOS notifies this consumer actively. Otherwise,ONOS core returns - * all available tunnels, consumer determined which one to use. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return collection of available Tunnels - */ - Collection borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns back a specific tunnel to store. - * - * @param consumerId a tunnel consumer - * @param tunnelId tunnel identify generated by ONOS - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations); - - /** - * Returns all specific name tunnel back store. Annotations parameter is - * reserved.If there is no tunnel in the store, return a "null" object,and - * record the tunnel subscription. Where tunnel is created, ONOS notifies this consumer - * actively. - * - * @param consumerId a tunnel consumer - * @param tunnelName tunnel name - * @param annotations Annotations - * @return boolean - */ - boolean returnTunnel(ApplicationId consumerId, TunnelName tunnelName, - Annotations... annotations); - - /** - * Returns all specific type tunnels between source and destination back - * store. Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel - * @param type tunnel type - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations); - - /** - * Returns all tunnels between source and destination back the store. - * Annotations parameter is reserved. - * - * @param consumerId a tunnel consumer - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @param annotations Annotations - * @return success or fail - */ - boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations); - - /** - * Returns a tunnel by a specific tunnel identity. - * - * @param tunnelId tunnel identify generated by tunnel producer - * @return Tunnel - */ - Tunnel queryTunnel(TunnelId tunnelId); - - /** - * Returns all tunnel subscription record by consumer. - * - * @param consumerId consumer identity - * @return Collection of TunnelSubscription - */ - Collection queryTunnelSubscription(ApplicationId consumerId); - - /** - * Returns all specified type tunnels. - * - * @param type tunnel type - * @return Collection of tunnels - */ - Collection queryTunnel(Type type); - - /** - * Returns all tunnels between source point and destination point. - * - * @param src a source point of tunnel. - * @param dst a destination point of tunnel. - * @return Collection of tunnels - */ - Collection queryTunnel(TunnelEndPoint src, TunnelEndPoint dst); - - /** - * Returns all tunnels. - * - * @return Collection of tunnels - */ - Collection queryAllTunnels(); - - /** - * Returns all tunnels. - * @return all tunnels - */ - int tunnelCount(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java deleted file mode 100644 index dfbc6ec0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelStoreDelegate.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Tunnel store delegate abstraction. - */ -@Beta -public interface TunnelStoreDelegate extends StoreDelegate { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java deleted file mode 100644 index 336789b1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/TunnelSubscription.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Objects; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.AbstractAnnotated; -import org.onosproject.net.Annotations; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; - -import com.google.common.base.MoreObjects; - -/** - * Represents for a order that consumer subscribe tunnel. ONOS maintains request - * information, it means ONOS knows how much resource echo consumer uses in the - * ONOS. Although there is no a tunnel that consumer want to use, when producer - * creates a new tunnel, ONOS will notify the consumers that want to use it. - */ -@Beta -public final class TunnelSubscription extends AbstractAnnotated { - private final ApplicationId consumerId; - private final TunnelEndPoint src; - private final TunnelEndPoint dst; - private final Type type; - private final TunnelId tunnelId; - private final TunnelName tunnelName; - - /** - * Creates a TunnelSubscription. - * - * @param consumerId consumer identity - * @param src source tunnel end point of tunnel - * @param dst destination tunnel end point of tunnel - * @param tunnelId tunnel identity - * @param type tunnel type - * @param tunnelName the name of a tunnel - * @param annotations parameter - */ - public TunnelSubscription(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, TunnelId tunnelId, Type type, - TunnelName tunnelName, Annotations... annotations) { - super(annotations); - checkNotNull(consumerId, "consumerId cannot be null"); - this.consumerId = consumerId; - this.src = src; - this.dst = dst; - this.type = type; - this.tunnelId = tunnelId; - this.tunnelName = tunnelName; - } - - /** - * Returns consumer identity. - * - * @return consumerId consumer id - */ - public ApplicationId consumerId() { - return consumerId; - } - - /** - * Returns source point of tunnel. - * - * @return source point - */ - public TunnelEndPoint src() { - return src; - } - - /** - * Returns destination point of tunnel. - * - * @return destination point - */ - public TunnelEndPoint dst() { - return dst; - } - - /** - * Returns tunnel type. - * - * @return tunnel type - */ - public Type type() { - return type; - } - - /** - * Returns tunnel identity. - * - * @return tunnel id - */ - public TunnelId tunnelId() { - return tunnelId; - } - - /** - * Returns tunnel name. - * - * @return tunnel name - */ - public TunnelName tunnelName() { - return tunnelName; - } - - @Override - public int hashCode() { - return Objects.hash(consumerId, src, dst, type, tunnelId, tunnelName); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelSubscription) { - final TunnelSubscription other = (TunnelSubscription) obj; - return Objects.equals(this.src, other.src) - && Objects.equals(this.dst, other.dst) - && Objects.equals(this.consumerId, other.consumerId) - && Objects.equals(this.type, other.type) - && Objects.equals(this.tunnelId, other.tunnelId) - && Objects.equals(this.tunnelName, other.tunnelName); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()) - .add("src", src) - .add("dst", dst) - .add("consumerId", consumerId) - .add("type", type) - .add("tunnelId", tunnelId) - .add("tunnelName", tunnelName).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java deleted file mode 100644 index d31aab55..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Tunnel model related services and providers API definitions. - */ -package org.onosproject.incubator.net.tunnel; diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java deleted file mode 100644 index e3339a9a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import org.onlab.packet.ChassisId; -import org.onosproject.net.DefaultDevice; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.ProviderId; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.*; - -/** - * Default representation of a virtual device. - */ -public class DefaultVirtualDevice extends DefaultDevice implements VirtualDevice { - - private static final String VIRTUAL = "virtual"; - private static final ProviderId PID = new ProviderId(VIRTUAL, VIRTUAL); - - private final NetworkId networkId; - - /** - * Creates a network element attributed to the specified provider. - * - * @param networkId network identifier - * @param id device identifier - */ - public DefaultVirtualDevice(NetworkId networkId, DeviceId id) { - super(PID, id, Type.VIRTUAL, VIRTUAL, VIRTUAL, VIRTUAL, VIRTUAL, - new ChassisId(0)); - this.networkId = networkId; - } - - @Override - public NetworkId networkId() { - return networkId; - } - - @Override - public int hashCode() { - return 31 * super.hashCode() + networkId.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultVirtualDevice) { - DefaultVirtualDevice that = (DefaultVirtualDevice) obj; - return super.equals(that) && Objects.equals(this.networkId, that.networkId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this).add("networkId", networkId).toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java deleted file mode 100644 index c1141912..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualNetwork.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import java.util.Objects; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Default implementation of the virtual network descriptor. - */ -public class DefaultVirtualNetwork implements VirtualNetwork { - - private final NetworkId id; - private final TenantId tenantId; - - /** - * Creates a new virtual network descriptor. - * - * @param id network identifier - * @param tenantId tenant identifier - */ - public DefaultVirtualNetwork(NetworkId id, TenantId tenantId) { - this.id = id; - this.tenantId = tenantId; - } - - @Override - public NetworkId id() { - return id; - } - - @Override - public TenantId tenantId() { - return tenantId; - } - - @Override - public int hashCode() { - return Objects.hash(id, tenantId); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof DefaultVirtualNetwork) { - DefaultVirtualNetwork that = (DefaultVirtualNetwork) obj; - return Objects.equals(this.id, that.id) - && Objects.equals(this.tenantId, that.tenantId); - } - return false; - } - - @Override - public String toString() { - return toStringHelper(this) - .add("id", id) - .add("tenantId", tenantId) - .toString(); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java deleted file mode 100644 index 27123287..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/NetworkId.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -/** - * Representation of network identity. - */ -@Beta -public final class NetworkId { - - /** - * Represents no network, or an unspecified network. - */ - public static final NetworkId NONE = networkId(-1L); - - /** - * Represents the underlying physical network. - */ - public static final NetworkId PHYSICAL = networkId(0L); - - - private final long id; - - // Public construction is prohibited - private NetworkId(long id) { - this.id = id; - } - - - // Default constructor for serialization - protected NetworkId() { - this.id = -1; - } - - /** - * Creates a network id using the supplied backing id. - * - * @param id network id - * @return network identifier - */ - public static NetworkId networkId(long id) { - return new NetworkId(id); - } - - @Override - public int hashCode() { - return Objects.hash(id); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof NetworkId) { - final NetworkId that = (NetworkId) obj; - return this.getClass() == that.getClass() && this.id == that.id; - } - return false; - } - - @Override - public String toString() { - return Long.toString(id); - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java deleted file mode 100644 index 196c17d4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkArgument; - -/** - * Representation of network tenant. - */ -@Beta -public final class TenantId { - - /** - * Represents no tenant, or an unspecified tenant. - */ - public static final TenantId NONE = new TenantId(); - - - private final String id; - - // Public construction is prohibited - private TenantId(String id) { - checkArgument(id != null && id.length() > 0, "Tenant ID cannot be null or empty"); - this.id = id; - } - - - // Default constructor for serialization - protected TenantId() { - this.id = ""; - } - - /** - * Creates a tenant id using the supplied backing id. - * - * @param id network id - * @return network identifier - */ - public static TenantId tenantId(String id) { - return new TenantId(id); - } - - @Override - public int hashCode() { - return id.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TenantId) { - final TenantId that = (TenantId) obj; - return this.getClass() == that.getClass() && - Objects.equals(this.id, that.id); - } - return false; - } - - @Override - public String toString() { - return id; - } - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java deleted file mode 100644 index 59e781a3..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualDevice.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Device; - -/** - * Abstraction of a virtual device. - */ -@Beta -public interface VirtualDevice extends VirtualElement, Device { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java deleted file mode 100644 index 791b8e24..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; - -/** - * Abstraction of a virtual element. - */ -@Beta -public interface VirtualElement { - - /** - * Returns the network identifier to which this virtual element belongs. - * - * @return network identifier - */ - NetworkId networkId(); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java deleted file mode 100644 index fdea8b61..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualHost.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Host; - -/** - * Abstraction of a virtual end-station host. - */ -@Beta -public interface VirtualHost extends VirtualElement, Host { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java deleted file mode 100644 index ac0063fe..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualLink.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Link; - -/** - * Abstraction of a virtual link. - */ -@Beta -public interface VirtualLink extends VirtualElement, Link { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java deleted file mode 100644 index b28a5d3a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetwork.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; - -/** - * Representation of a virtual network. - */ -@Beta -public interface VirtualNetwork { - - /** - * Returns the network identifier. - * - * @return network id - */ - NetworkId id(); - - /** - * Returns the identifier of the tenant to which this virtual network belongs. - * - * @return tenant identifier - */ - TenantId tenantId(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java deleted file mode 100644 index 07c399c0..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkAdminService.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; - -import java.util.Set; - -/** - * Service for managing the inventory of virtual networks. - */ -@Beta -public interface VirtualNetworkAdminService extends VirtualNetworkService { - - /** - * Registers the specified, externally generated tenant identifier. - * - * @param tenantId tenant identifier - */ - void registerTenantId(TenantId tenantId); - - /** - * Unregisters the specified, externally generated tenant identifier. - * - * @param tenantId tenant identifier - * @throws IllegalStateException if there are networks still owned by this tenant - */ - void unregisterTenantId(TenantId tenantId); - - /** - * Returns the set of tenant identifiers known to the system. - * - * @return set of known tenant identifiers - */ - Set getTenantIds(); - - - /** - * Creates a new virtual network for the specified tenant. - * - * @param tenantId tenant identifier - * @return newly created virtual network - */ - VirtualNetwork createVirtualNetwork(TenantId tenantId); - - /** - * Removes the specified virtual network and all its devices and links. - * - * @param networkId network identifier - */ - void removeVirtualNetwork(NetworkId networkId); - - - /** - * Creates a new virtual device within the specified network. The device id - * must be unique within the bounds of the network. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return newly created device - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId); - - /** - * Removes the specified virtual device and all its ports and affiliated links. - * - * @param networkId network identifier - * @param deviceId device identifier - * @throws org.onlab.util.ItemNotFoundException if no such network or device found - */ - void removeVirtualDevice(NetworkId networkId, DeviceId deviceId); - - - /** - * Creates a new virtual link within the specified network. - * - * @param networkId network identifier - * @param src source connection point - * @param dst destination connection point - * @param realizedBy identifier of the tunnel using which this link is realized - * @return newly created virtual link - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - VirtualLink createVirtualLink(NetworkId networkId, - ConnectPoint src, ConnectPoint dst, - TunnelId realizedBy); - - // TODO: Discuss whether we should provide an alternate createVirtualLink - // which is backed by a Path instead; I'm leaning towards not doing that. - - /** - * Removes the specified virtual link. - * - * @param networkId network identifier - * @param src source connection point - * @param dst destination connection point - * @throws org.onlab.util.ItemNotFoundException if no such network or link found - */ - void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); - - /** - * Creates a new virtual port on the specified device. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - * @param realizedBy underlying port using which this virtual port is realized - * @return newly created port - * @throws org.onlab.util.ItemNotFoundException if no such network or device found - */ - VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId, - PortNumber portNumber, Port realizedBy); - - /** - * Removes the specified virtual port. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - * @throws org.onlab.util.ItemNotFoundException if no such network or port found - */ - void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java deleted file mode 100644 index 7e076e09..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import org.onosproject.event.AbstractEvent; - -/** - * Describes virtual network event. - */ -public class VirtualNetworkEvent extends AbstractEvent { - - /** - * Type of virtual network events. - */ - public enum Type { - /** - * Signifies that a new tenant identifier was registered. - */ - TENANT_REGISTERED, - /** - * Signifies that a tenant identifier was unregistered. - */ - TENANT_UNREGISTERED, - /** - * Signifies that a new virtual network was added. - */ - NETWORK_ADDED, - /** - * Signifies that a virtual network was updated. - */ - NETWORK_UPDATED, - /** - * Signifies that a virtual network was removed. - */ - NETWORK_REMOVED - } - - /** - * Creates an event of a given type and for the specified subject and the - * current time. - * - * @param type event type - * @param subject event subject - */ - public VirtualNetworkEvent(Type type, NetworkId subject) { - super(type, subject); - } - - /** - * Creates an event of a given type and for the specified subject and time. - * - * @param type device event type - * @param subject event subject - * @param time occurrence time - */ - public VirtualNetworkEvent(Type type, NetworkId subject, long time) { - super(type, subject, time); - } -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java deleted file mode 100644 index 707ca8a7..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import org.onosproject.event.EventListener; - -/** - * Represents entity capable of receiving virtual network events. - */ -public interface VirtualNetworkListener extends EventListener { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java deleted file mode 100644 index bf4a4855..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.onosproject.incubator.net.virtual; - -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.provider.Provider; - -/** - * Entity capable of providing traffic isolation constructs for use in - * implementation of virtual devices and virtual links. - */ -public interface VirtualNetworkProvider extends Provider { - - /** - * Creates a network tunnel for all traffic from the specified source - * connection point to the indicated destination connection point. - * - * @param networkId virtual network identifier - * @param src source connection point - * @param dst destination connection point - * @return new tunnel's id - */ - TunnelId createTunnel(NetworkId networkId, ConnectPoint src, ConnectPoint dst); - - /** - * Destroys the specified network tunnel. - * - * @param networkId virtual network identifier - * @param tunnelId tunnel identifier - */ - void destroyTunnel(NetworkId networkId, TunnelId tunnelId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java deleted file mode 100644 index 4e893165..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderRegistry.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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.net.virtual; - -import org.onosproject.net.provider.ProviderRegistry; - -/** - * Abstraction of a virtual network provider registry. - */ -public interface VirtualNetworkProviderRegistry - extends ProviderRegistry { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java deleted file mode 100644 index cba933c9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkProviderService.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.onosproject.incubator.net.virtual; - -import org.onosproject.net.provider.ProviderService; - -/** - * Service through which virtual network providers can inject information into - * the core. - */ -public interface VirtualNetworkProviderService extends ProviderService { - // TODO: Add methods for notification of core about damaged tunnels, etc. -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java deleted file mode 100644 index 01681ef4..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkService.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -import java.util.Set; - -/** - * Service for querying virtual network inventory. - */ -@Beta -public interface VirtualNetworkService { - - /** - * Returns a collection of all virtual networks created on behalf of the - * specified tenant. - * - * @param tenantId tenant identifier - * @return collection of networks - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - Set getVirtualNetworks(TenantId tenantId); - - /** - * Returns a collection of all virtual devices in the specified network. - * - * @param networkId network identifier - * @return collection of devices - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - Set getVirtualDevices(NetworkId networkId); - - /** - * Returns collection of all virtual links in the specified network. - * - * @param networkId network identifier - * @return collection of links - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - Set getVirtualLinks(NetworkId networkId); - - /** - * Returns list of all virtual ports of the specified device. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return list of ports - * @throws org.onlab.util.ItemNotFoundException if no such network found - */ - Set getVirtualPorts(NetworkId networkId, DeviceId deviceId); - - /** - * Returns implementation of the specified service class for operating - * in the context of the given network. - *

- * The following services will be available: - *

    - *
  • {@link org.onosproject.net.device.DeviceService}
  • - *
  • {@link org.onosproject.net.link.LinkService}
  • - *
  • {@link org.onosproject.net.host.HostService}
  • - *
  • {@link org.onosproject.net.topology.TopologyService}
  • - *
  • {@link org.onosproject.net.topology.PathService}
  • - *
  • {@link org.onosproject.net.flow.FlowRuleService}
  • - *
  • {@link org.onosproject.net.flowobjective.FlowObjectiveService}
  • - *
  • {@link org.onosproject.net.intent.IntentService}
  • - *
- * - * @param networkId network identifier - * @param serviceClass service class - * @param type of service - * @return implementation class - * @throws org.onlab.util.ItemNotFoundException if no such network found - * @throws org.onlab.osgi.ServiceNotFoundException if no implementation found - */ - T get(NetworkId networkId, Class serviceClass); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java deleted file mode 100644 index 49ad2f2b..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStore.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; -import org.onosproject.store.Store; - -import java.util.Set; - -/** - * Mechanism for distributing and storing virtual network model information. - */ -public interface VirtualNetworkStore - extends Store { - - /** - * Adds a new tenant ID to the store. - * - * @param tenantId tenant identifier - */ - void addTenantId(TenantId tenantId); - - /** - * Removes the specified tenant ID from the store. - * - * @param tenantId tenant identifier - */ - void removeTenantId(TenantId tenantId); - - /** - * Returns set of registered tenant IDs. - * - * @return set of tenant identifiers - */ - Set getTenantIds(); - - /** - * Adds a new virtual network for the specified tenant to the store. - * - * @param tenantId tenant identifier - * @return the virtual network - */ - VirtualNetwork addNetwork(TenantId tenantId); - - /** - * Removes the specified virtual network from the store. - * - * @param networkId network identifier - */ - void removeNetwork(NetworkId networkId); - - /** - * Adds a new virtual device to the store. This device will have no ports. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return the virtual device - */ - VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId); - - /** - * Renmoves the specified virtual device from the given network. - * - * @param networkId network identifier - * @param deviceId device identifier - */ - void removeDevice(NetworkId networkId, DeviceId deviceId); - - /** - * Adds a new virtual link. - * - * @param networkId network identifier - * @param src source end-point of the link - * @param dst destination end-point of the link - * @param realizedBy underlying tunnel using which this link is realized - * @return the virtual link - */ - VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, - TunnelId realizedBy); - - /** - * Removes the specified link from the store. - * - * @param networkId network identifier - * @param src source connection point - * @param dst destination connection point - */ - void removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst); - - /** - * Adds a new virtual port to the network. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - * @param realizedBy underlying port which realizes the virtual port - * @return the virtual port - */ - VirtualPort addPort(NetworkId networkId, DeviceId deviceId, - PortNumber portNumber, Port realizedBy); - - /** - * Removes the specified port from the given device and network. - * - * @param networkId network identifier - * @param deviceId device identifier - * @param portNumber port number - */ - void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber); - - /** - * Returns the list of networks. - * - * @param tenantId tenant identifier - * @return set of virtual networks - */ - Set getNetworks(TenantId tenantId); - - /** - * Returns the list of devices in the specified virtual network. - * - * @param networkId network identifier - * @return set of virtual devices - */ - Set getDevices(NetworkId networkId); - - /** - * Returns the list of virtual links in the specified virtual network. - * - * @param networkId network identifier - * @return set of virtual links - */ - Set getLinks(NetworkId networkId); - - /** - * Returns the list of ports of the specified virtual device. - * - * @param networkId network identifier - * @param deviceId device identifier - * @return set of virtual networks - */ - Set getPorts(NetworkId networkId, DeviceId deviceId); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java deleted file mode 100644 index e57c3d3a..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualNetworkStoreDelegate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import org.onosproject.store.StoreDelegate; - -/** - * Network configuration store delegate abstraction. - */ -public interface VirtualNetworkStoreDelegate extends StoreDelegate { -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java deleted file mode 100644 index 179bb2c9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/VirtualPort.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2015 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.net.virtual; - -import com.google.common.annotations.Beta; -import org.onosproject.net.Port; - -/** - * Representation of a virtual port. - */ -@Beta -public interface VirtualPort extends Port { - - /** - * Returns the underlying port using which this port is realized. - * - * @return underlying port which realizes this virtual port - */ - Port realizedBy(); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java deleted file mode 100644 index 3a0676a5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Network virtualization data models and services. - */ -package org.onosproject.incubator.net.virtual; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java deleted file mode 100644 index 6aedd3b2..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Incubating abstractions and APIs.  This subsystem is - * experimental and its interfaces will change in the upcoming release. - */ -package org.onosproject.incubator; \ No newline at end of file diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java deleted file mode 100644 index 09c507dd..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContext.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 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.rpc; - -import com.google.common.annotations.Beta; - -// Implementation is expected to be a handler for RPC channel -// and shim-layer to convert Java Service interface calls to/from RPC call -/** - * Context for Remote service. - */ -@Beta -public interface RemoteServiceContext { - - // we may need a method to check connection state? - - /** - * Returns implementation of the specified service class. - * - * @param serviceClass service class - * @param type of service - * @return implementation class - * @throws UnsupportedOperationException if this context does not support it. - */ - T get(Class serviceClass); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java deleted file mode 100644 index 47bbfbc9..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 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.rpc; - -import java.net.URI; - -import org.onosproject.net.provider.Provider; - -import com.google.common.annotations.Beta; - -//Factory to create RemoteServiceContext -/** - * Abstraction of a remote service implementation provider. - */ -@Beta -public interface RemoteServiceContextProvider extends Provider { - - /** - * Returns {@link RemoteServiceContext} for given URI. - * - * @param uri URI for remote end point. - * @return {@link RemoteServiceContext} - */ - RemoteServiceContext get(URI uri); -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java deleted file mode 100644 index 42b976c5..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceContextProviderService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2015 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.rpc; - -import org.onosproject.net.provider.ProviderService; - -import com.google.common.annotations.Beta; - -// Not completely sure if we will make use of this at the moment -// added to follow existing {@link ProviderRegistry} pattern -@Beta -public interface RemoteServiceContextProviderService - extends ProviderService { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java deleted file mode 100644 index 0d2bbc70..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceDirectory.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 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.rpc; - -import java.net.URI; - -import com.google.common.annotations.Beta; - -// This is actually the RPC Service, where consumers get -// RemoteSericeContext (~= RPC Session) for given URI -// expected to be implemented by some Manager class on Lower-side ONOS -/** - * Service for retrieving RPC session handler ({@link RemoteServiceContext}). - */ -@Beta -public interface RemoteServiceDirectory { - - /** - * Returns remote service context. - * - * @param uri URI representing remote end point. e.g., (grpc://hostname:port) - * @return remote service context - * @throws UnsupportedOperationException if URI scheme was not supported. - */ - RemoteServiceContext get(URI uri); - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java deleted file mode 100644 index 3b3c3891..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/RemoteServiceProviderRegistry.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2015 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.rpc; - -import org.onosproject.net.provider.ProviderRegistry; - -import com.google.common.annotations.Beta; - -/** - * Abstraction of a remote service provider registry. - */ -@Beta -public interface RemoteServiceProviderRegistry - extends ProviderRegistry { - -} diff --git a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java b/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java deleted file mode 100644 index 4ec56ae1..00000000 --- a/framework/src/onos/incubator/api/src/main/java/org/onosproject/incubator/rpc/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Incubating inter-cluster RPC APIs. - */ -package org.onosproject.incubator.rpc; diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java deleted file mode 100644 index f2b15b09..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/config/basics/OpticalPortConfigTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2015 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.net.config.basics; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.onosproject.net.config.basics.OpticalPortConfig.TYPE; -import static org.onosproject.net.config.basics.OpticalPortConfig.NAME; -import static org.onosproject.net.config.basics.OpticalPortConfig.PORT; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_LAMBDA; -import static org.onosproject.net.config.basics.OpticalPortConfig.STATIC_PORT; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.onosproject.net.config.Config; -import org.onosproject.net.config.ConfigApplyDelegate; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.collect.Lists; -import org.onosproject.net.config.basics.OpticalPortConfig; - -public class OpticalPortConfigTest { - private static final String FIELD = "ports"; - private static final String KEY = "opc-test"; - - private static final DeviceId DID = DeviceId.deviceId(KEY); - private static final PortNumber PN = PortNumber.portNumber(100); - private static final ConnectPoint CPT = new ConnectPoint(DID, PN); - private static final String DEMOTREE = "{" + - "\"ports\": [" + - // config entity 0 - "{" + - "\"name\": \"1-10-E1_WPORT\"," + - "\"type\": \"OMS\"" + - "}," + - // config entity 1 - "{" + - "\"type\": \"OCH\"," + - "\"speed\": 0," + - "\"port\": 10" + - "}," + - // config entity 2 - "{" + - "\"name\": \"1-1-E1_LPORT\"," + - "\"type\": \"OCH\"," + - "\"annotations\": {" + - "\"staticLambda\": 1," + - "\"staticPort\": \"1-22-E1_WPORT\"" + - "}" + - "}" + - "]" + - "}"; - - private final ConfigApplyDelegate delegate = new MockCfgDelegate(); - private final ObjectMapper mapper = new ObjectMapper(); - - // one OPC per port in DEMOTREE - private List opcl = Lists.newArrayList(); - // JsonNodes representing each port. - private List testNodes = Lists.newArrayList(); - - @Before - public void setUp() { - try { - JsonNode tree = new ObjectMapper().readTree(DEMOTREE); - Iterator pitr = tree.get(FIELD).elements(); - while (pitr.hasNext()) { - // initialize a config entity, add to lists - JsonNode jn = pitr.next(); - OpticalPortConfig opc = new OpticalPortConfig(); - ObjectNode node = JsonNodeFactory.instance.objectNode(); - opc.init(CPT, KEY, node, mapper, delegate); - - testNodes.add(jn); - opcl.add(opc); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Test - public void testBaseAttrs() { - // configs 0 and 1 - port with and without alphanumeric names - OpticalPortConfig op0 = opcl.get(0); - OpticalPortConfig op1 = opcl.get(1); - // config 2 - no name - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn0 = testNodes.get(0); - JsonNode jn1 = testNodes.get(1); - - op0.portType(Port.Type.valueOf(jn0.path(TYPE).asText())) - .portName(jn0.path(NAME).asText()); - op1.portType(Port.Type.valueOf(jn1.path(TYPE).asText())) - .portNumberName(jn1.path(PORT).asLong()); - - assertEquals(Port.Type.OMS, op0.type()); - assertEquals(jn0.path(NAME).asText(), op0.name()); - assertEquals(jn1.path(PORT).asText(), op1.numberName()); - assertEquals("", op1.name()); - assertEquals("", op2.name()); - } - - @Test - public void testAdditionalAttrs() { - // config 1 has no annotations, 2 has predefined ones - OpticalPortConfig op1 = opcl.get(1); - OpticalPortConfig op2 = opcl.get(2); - JsonNode jn2 = testNodes.get(2); - Long sl = 1L; - - // see config entity 2 in DEMOTREE - op2.staticLambda(jn2.path("annotations").path(STATIC_LAMBDA).asLong()); - op2.staticPort(jn2.path("annotations").path(STATIC_PORT).asText()); - - assertEquals(sl, op2.staticLambda().get()); - assertFalse(op1.staticLambda().isPresent()); - assertEquals("1-22-E1_WPORT", op2.staticPort()); - assertEquals("", op1.staticPort()); - - op2.staticLambda(null); - assertFalse(op2.staticLambda().isPresent()); - } - - private class MockCfgDelegate implements ConfigApplyDelegate { - - @Override - public void onApply(@SuppressWarnings("rawtypes") Config config) { - config.apply(); - } - - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java deleted file mode 100644 index 55f052ac..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmEntityIdTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2014-2015 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.net.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import static org.onosproject.incubator.net.faultmanagement.alarm.AlarmEntityId.alarmEntityId; - -/** - * Test of the alarm source identifier. - * - */ -public class AlarmEntityIdTest { - - /** - * Checks that the class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(AlarmEntityId.class); - } - - @Test - public void string() { - assertEquals("och:foo", - alarmEntityId("och:foo").toString()); - } - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup( - alarmEntityId("och:foo"), - alarmEntityId("och:foo")) - .addEqualityGroup(alarmEntityId("och:bar")) - .testEquals(); - - } - - @Test - public void validSchemaPermitted() { - alarmEntityId("none:foo"); - alarmEntityId("port:foo"); - alarmEntityId("och:foo"); - alarmEntityId("other:foo"); - - } - - @Test(expected = IllegalArgumentException.class) - public void verifyUnexpectedSchemaRejected() { - alarmEntityId("junk:foo"); - } - - @Test(expected = IllegalArgumentException.class) - public void verifyCorruptSchemaRejected() { - alarmEntityId("other:"); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java deleted file mode 100644 index 74453a42..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/AlarmIdTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * This class tests the immutability, equality, and non-equality of - * {@link AlarmId}. - */ -public class AlarmIdTest { - private static final long ID_A = 1L; - private static final long ID_B = 2L; - private static final long ID_Z = 987654321L; - - /** - * Tests the immutability of {@link AlarmId}. - */ - @Test - public void intentIdFollowsGuidelineForImmutableObject() { - assertThatClassIsImmutable(AlarmId.class); - } - - /** - * Tests equality of {@link AlarmId}. - */ - @Test - public void testEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_A); - - assertThat(id1, is(id2)); - } - - - /** - * Tests non-equality of {@link AlarmId}. - */ - @Test - public void testNonEquality() { - final AlarmId id1 = new AlarmId(ID_A); - final AlarmId id2 = new AlarmId(ID_B); - - assertThat(id1, is(not(id2))); - } - - @Test - public void valueOf() { - final AlarmId id = new AlarmId(0xdeadbeefL); - assertEquals("incorrect valueOf", id, AlarmId.valueOf(0xdeadbeefL)); - } - - /** - * Tests the equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - final AlarmId id1 = new AlarmId(11111L); - final AlarmId sameAsId1 = new AlarmId(11111L); - final AlarmId id2 = new AlarmId(22222L); - - new EqualsTester() - .addEqualityGroup(id1, sameAsId1) - .addEqualityGroup(id2) - .testEquals(); - } - - /** - * Tests construction of an AlarmId object. - */ - @Test - public void testConstruction() { - final AlarmId id1 = new AlarmId(ID_Z); - assertEquals(id1.fingerprint(), ID_Z); - - // No default constructor so no need to test it ! - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java deleted file mode 100644 index 199ed0d9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/faultmanagement/alarm/DefaultAlarmTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2014 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.net.faultmanagement.alarm; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; -import org.onosproject.net.DeviceId; - -public class DefaultAlarmTest { - - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultAlarm.class); - } - - /** - * Checks the construction of a DefaultAlarm object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final DefaultAlarm a = new DefaultAlarm.Builder(AlarmId.valueOf(4), - DeviceId.NONE, nameValue, Alarm.SeverityLevel.CLEARED, 3).build(); - - assertThat(a, is(notNullValue())); - final DefaultAlarm b = new DefaultAlarm.Builder(a).build(); - - assertEquals(a, b); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java deleted file mode 100644 index 1055dbad..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/DefaultLabelResourceTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of default label resource. - */ -public class DefaultLabelResourceTest extends AbstractEventTest { - - @Test - public void testEquality() { - String deviceId1 = "of:001"; - String deviceId2 = "of:002"; - long labelResourceId1 = 100; - long labelResourceId2 = 200; - DefaultLabelResource h1 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h2 = new DefaultLabelResource(deviceId1, - labelResourceId1); - DefaultLabelResource h3 = new DefaultLabelResource(deviceId2, - labelResourceId2); - DefaultLabelResource h4 = new DefaultLabelResource(deviceId2, - labelResourceId2); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java deleted file mode 100644 index 25ef57f7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourcePoolTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; - -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource pool. - */ -public class LabelResourcePoolTest extends AbstractEventTest { - - @Test - public void testEquality() { - LabelResourcePool h1 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h2 = new LabelResourcePool("of:001", 0, 100); - LabelResourcePool h3 = new LabelResourcePool("of:002", 0, 100); - LabelResourcePool h4 = new LabelResourcePool("of:002", 0, 100); - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java deleted file mode 100644 index f41ad289..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/resource/label/LabelResourceRequestTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label; - -import java.util.Collections; - -import org.junit.Test; -import org.onosproject.event.AbstractEventTest; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.ImmutableSet; -import com.google.common.testing.EqualsTester; - -/** - * Tests of the label resource request. - */ -public class LabelResourceRequestTest extends AbstractEventTest { - - @Test - public void testEquality() { - DeviceId deviceId1 = DeviceId.deviceId("of:0001"); - DeviceId deviceId2 = DeviceId.deviceId("of:0002"); - long apply = 2; - ImmutableSet releaseCollection = ImmutableSet - .copyOf(Collections.emptySet()); - LabelResourceRequest h1 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h2 = new LabelResourceRequest( - deviceId1, - LabelResourceRequest.Type.APPLY, - apply, null); - LabelResourceRequest h3 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - LabelResourceRequest h4 = new LabelResourceRequest( - deviceId2, - LabelResourceRequest.Type.RELEASE, - 0, releaseCollection); - - new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java deleted file mode 100644 index 25ec73d4..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/DefaultTunnelTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of the default tunnel model entity. - */ -public class DefaultTunnelTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultTunnel.class); - } - - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - ProviderId producerName2 = new ProviderId("producer2", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java deleted file mode 100644 index 28669a21..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelEventTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.DefaultGroupId; -import org.onosproject.net.provider.ProviderId; - -/** - * Test of a tunnel event. - */ -public class TunnelEventTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelEvent.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testConstructor() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress - .valueOf(32421)); - DefaultGroupId groupId = new DefaultGroupId(92034); - TunnelName tunnelName = TunnelName.tunnelName("TunnelName"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - ProviderId producerName1 = new ProviderId("producer1", "13"); - Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN, - Tunnel.State.ACTIVE, groupId, tunnelId, - tunnelName, null); - TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1); - assertThat(e1, is(notNullValue())); - assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED)); - assertThat(e1.subject(), is(p1)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java deleted file mode 100644 index f4c109f9..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelIdTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel id class. - */ -public class TunnelIdTest { - - final TunnelId tunnelId1 = TunnelId.valueOf(1); - final TunnelId sameAstunnelId1 = TunnelId.valueOf(1); - final TunnelId tunnelId2 = TunnelId.valueOf(2); - - /** - * Checks that the TunnelId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelId.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(tunnelId1, sameAstunnelId1) - .addEqualityGroup(tunnelId2) - .testEquals(); - } - - /** - * Checks the construction of a FlowId object. - */ - @Test - public void testConstruction() { - final long tunnelIdValue = 7777L; - final TunnelId tunnelId = TunnelId.valueOf(tunnelIdValue); - assertThat(tunnelId, is(notNullValue())); - assertThat(tunnelId.id(), is(tunnelIdValue)); - } -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java deleted file mode 100644 index d0fc49c7..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelNameTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for tunnel name class. - */ -public class TunnelNameTest { - final TunnelName name1 = TunnelName.tunnelName("name1"); - final TunnelName sameAsName1 = TunnelName.tunnelName("name1"); - final TunnelName name2 = TunnelName.tunnelName("name2"); - - /** - * Checks that the TunnelName class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelName.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(name1, sameAsName1) - .addEqualityGroup(name2).testEquals(); - } - - /** - * Checks the construction of a OpenFlowGroupId object. - */ - @Test - public void testConstruction() { - final String nameValue = "name3"; - final TunnelName name = TunnelName.tunnelName(nameValue); - assertThat(name, is(notNullValue())); - assertThat(name.value(), is(nameValue)); - } - -} diff --git a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java b/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java deleted file mode 100644 index 46634c7c..00000000 --- a/framework/src/onos/incubator/api/src/test/java/org/onosproject/incubator/net/tunnel/TunnelSubscriptionTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.DefaultApplicationId; - -import com.google.common.testing.EqualsTester; - -/** - * Test of order model entity. - */ -public class TunnelSubscriptionTest { - /** - * Checks that the Order class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TunnelSubscription.class); - } - - /** - * Checks the operation of equals(), hashCode() and toString() methods. - */ - @Test - public void testEquality() { - TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423)); - TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421)); - ApplicationId appId = new DefaultApplicationId(243, "test"); - ApplicationId appId2 = new DefaultApplicationId(2431, "test1"); - TunnelId tunnelId = TunnelId.valueOf(41654654); - TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN, - null); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} diff --git a/framework/src/onos/incubator/net/pom.xml b/framework/src/onos/incubator/net/pom.xml deleted file mode 100644 index 2ffebe6b..00000000 --- a/framework/src/onos/incubator/net/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - 4.0.0 - - - org.onosproject - onos-incubator - 1.4.0-rc1 - ../pom.xml - - - onos-incubator-net - bundle - - ONOS incubating network control core subsystems - - - - org.onosproject - onos-incubator-api - ${project.version} - - - - org.onosproject - onos-core-common - ${project.version} - tests - test - - - - org.onosproject - onos-core-serializers - ${project.version} - tests - test - - - - org.onosproject - onos-core-common - - - - org.easymock - easymock - test - - - - org.apache.felix - org.apache.felix.scr.annotations - - - - org.apache.karaf.features - org.apache.karaf.features.core - - - - org.apache.karaf.system - org.apache.karaf.system.core - - - - org.onosproject - onos-incubator-store - ${project.version} - test - - - - - - - org.apache.felix - maven-scr-plugin - - - - - diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/ExtraNetworkConfigs.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/ExtraNetworkConfigs.java deleted file mode 100644 index e77e1da0..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/ExtraNetworkConfigs.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 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.net.config.impl; - -import com.google.common.collect.ImmutableSet; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.onosproject.incubator.net.domain.IntentDomainConfig; -import org.onosproject.incubator.net.domain.IntentDomainId; -import org.onosproject.net.config.ConfigFactory; -import org.onosproject.net.config.NetworkConfigRegistry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Set; - -import static org.onosproject.incubator.net.config.basics.ExtraSubjectFactories.INTENT_DOMAIN_SUBJECT_FACTORY; - -/** - * Component for registration of builtin basic network configurations. - */ -@Component(immediate = true) -public class ExtraNetworkConfigs { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final Set factories = ImmutableSet.of( - new ConfigFactory(INTENT_DOMAIN_SUBJECT_FACTORY, - IntentDomainConfig.class, - "basic") { - @Override - public IntentDomainConfig createConfig() { - return new IntentDomainConfig(); - } - } - ); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected NetworkConfigRegistry registry; - - @Activate - public void activate() { - factories.forEach(registry::registerConfigFactory); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - factories.forEach(registry::unregisterConfigFactory); - log.info("Stopped"); - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/package-info.java deleted file mode 100644 index a2375429..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/config/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the network configuration subsystem. - */ -package org.onosproject.incubator.net.config.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/IntentDomainManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/IntentDomainManager.java deleted file mode 100644 index 33c8a3c5..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/IntentDomainManager.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2015 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.net.domain.impl; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; -import com.google.common.collect.Multimaps; -import com.google.common.collect.Sets; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.graph.AdjacencyListsGraph; -import org.onlab.graph.Graph; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.net.config.NetworkConfigEvent; -import org.onosproject.net.config.NetworkConfigListener; -import org.onosproject.net.config.NetworkConfigService; -import org.onosproject.incubator.net.domain.DomainEdge; -import org.onosproject.incubator.net.domain.DomainVertex; -import org.onosproject.incubator.net.domain.IntentDomain; -import org.onosproject.incubator.net.domain.IntentDomainAdminService; -import org.onosproject.incubator.net.domain.IntentDomainConfig; -import org.onosproject.incubator.net.domain.IntentDomainId; -import org.onosproject.incubator.net.domain.IntentDomainListener; -import org.onosproject.incubator.net.domain.IntentDomainProvider; -import org.onosproject.incubator.net.domain.IntentDomainService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentMap; -import java.util.stream.Collectors; - -/** - * Implementation of the intent domain service. - */ -@Component(immediate = true) -@Service -public class IntentDomainManager - implements IntentDomainService, IntentDomainAdminService { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected CoreService coreService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected NetworkConfigService configService; - - private NetworkConfigListener cfgListener = new InternalConfigListener(); - - private final ConcurrentMap domains = Maps.newConcurrentMap(); - - private final Multimap appToDomain = - Multimaps.synchronizedSetMultimap(HashMultimap.create()); - - private Graph graph; - - @Activate - protected void activate() { - configService.addListener(cfgListener); - configService.getSubjects(IntentDomainId.class, IntentDomainConfig.class) - .forEach(this::processConfig); - graph = buildGraph(); - log.debug("Graph: {}", graph); - log.info("Started"); - } - - private void processConfig(IntentDomainId intentDomainId) { - IntentDomainConfig cfg = configService.getConfig(intentDomainId, - IntentDomainConfig.class); - - domains.put(intentDomainId, createDomain(intentDomainId, cfg)); - appToDomain.put(cfg.applicationName(), intentDomainId); - } - - private IntentDomain createDomain(IntentDomainId id, IntentDomainConfig cfg) { - return new IntentDomain(id, cfg.domainName(), cfg.internalDevices(), cfg.edgePorts()); - } - - private Graph buildGraph() { - Set vertices = Sets.newHashSet(); - Set edges = Sets.newHashSet(); - - Map deviceVertices = Maps.newHashMap(); - domains.forEach((id, domain) -> { - DomainVertex domainVertex = new DomainVertex(id); - - // Add vertex for domain - vertices.add(domainVertex); - - // Add vertices for connection devices - domain.edgePorts().stream() - .map(ConnectPoint::deviceId) - .collect(Collectors.toSet()) - .forEach(did -> deviceVertices.putIfAbsent(did, new DomainVertex(did))); - - // Add bi-directional edges between each domain and connection device - domain.edgePorts().forEach(cp -> { - DomainVertex deviceVertex = deviceVertices.get(cp.deviceId()); - edges.add(new DomainEdge(domainVertex, deviceVertex, cp)); - edges.add(new DomainEdge(deviceVertex, domainVertex, cp)); - }); - }); - - vertices.addAll(deviceVertices.values()); - //FIXME verify graph integrity... - return new AdjacencyListsGraph<>(vertices, edges); - } - - @Deactivate - protected void deactivate() { - configService.removeListener(cfgListener); - log.info("Stopped"); - } - - @Override - public IntentDomain getDomain(IntentDomainId id) { - return domains.get(id); - } - - @Override - public Set getDomains() { - return ImmutableSet.copyOf(domains.values()); - } - - @Override - public Set getDomains(DeviceId deviceId) { - return domains.values().stream() - .filter(domain -> - domain.internalDevices().contains(deviceId) || - domain.edgePorts().stream() - .map(ConnectPoint::deviceId) - .anyMatch(d -> d.equals(deviceId))) - .collect(Collectors.toSet()); - } - - @Override - public Graph getDomainGraph() { - return graph; - } - - @Override - public void addListener(IntentDomainListener listener) { - //TODO slide in AbstractListenerManager - } - - @Override - public void removeListener(IntentDomainListener listener) { - //TODO slide in AbstractListenerManager - } - - @Override - public void registerApplication(ApplicationId applicationId, IntentDomainProvider provider) { - appToDomain.get(applicationId.name()).forEach(d -> domains.get(d).setProvider(provider)); - } - - @Override - public void unregisterApplication(ApplicationId applicationId) { - appToDomain.get(applicationId.name()).forEach(d -> domains.get(d).unsetProvider()); - } - - private class InternalConfigListener implements NetworkConfigListener { - @Override - public void event(NetworkConfigEvent event) { - switch (event.type()) { - case CONFIG_ADDED: - case CONFIG_UPDATED: - processConfig((IntentDomainId) event.subject()); - graph = buildGraph(); - log.debug("Graph: {}", graph); - break; - - case CONFIG_REGISTERED: - case CONFIG_UNREGISTERED: - case CONFIG_REMOVED: - default: - //TODO - break; - } - } - - @Override - public boolean isRelevant(NetworkConfigEvent event) { - return event.configClass().equals(IntentDomainConfig.class); - } - } -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/package-info.java deleted file mode 100644 index 8fe3a3c6..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/domain/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the intent domain subsystem. - */ -package org.onosproject.incubator.net.domain.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java deleted file mode 100644 index 1a615481..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/PortStatisticsManager.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2015 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.net.impl; - -import com.google.common.collect.Maps; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.incubator.net.PortStatisticsService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.device.DeviceEvent; -import org.onosproject.net.device.DeviceListener; -import org.onosproject.net.device.DeviceService; -import org.onosproject.net.device.PortStatistics; -import org.onosproject.net.statistic.DefaultLoad; -import org.onosproject.net.statistic.Load; -import org.slf4j.Logger; - -import java.util.Map; -import java.util.stream.Collectors; - -import static org.onosproject.net.PortNumber.portNumber; -import static org.onosproject.net.device.DeviceEvent.Type.*; -import static org.slf4j.LoggerFactory.getLogger; - -/** - * Implementation of the port statistics service. - */ -@Component(immediate = true) -@Service -public class PortStatisticsManager implements PortStatisticsService { - - private final Logger log = getLogger(getClass()); - - private static final long POLL_FREQUENCY = 10_000; // milliseconds - private static final long STALE_LIMIT = (long) (1.5 * POLL_FREQUENCY); - private static final int SECOND = 1_000; // milliseconds - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected DeviceService deviceService; - - private final DeviceListener deviceListener = new InternalDeviceListener(); - - private Map current = Maps.newConcurrentMap(); - private Map previous = Maps.newConcurrentMap(); - - @Activate - public void activate() { - deviceService.addListener(deviceListener); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - deviceService.removeListener(deviceListener); - log.info("Stopped"); - } - - @Override - public Load load(ConnectPoint connectPoint) { - DataPoint c = current.get(connectPoint); - DataPoint p = previous.get(connectPoint); - long now = System.currentTimeMillis(); - - if (c != null && p != null && (now - c.time < STALE_LIMIT)) { - if (c.time > p.time + SECOND) { - //Use max of either Tx or Rx load as the total load of a port - Load load = null; - if (c.stats.bytesSent() >= p.stats.bytesSent()) { - load = new DefaultLoad(c.stats.bytesSent(), p.stats.bytesSent(), - (int) (c.time - p.time) / SECOND); - } - if (c.stats.bytesReceived() >= p.stats.bytesReceived()) { - Load rcvLoad = new DefaultLoad(c.stats.bytesReceived(), p.stats.bytesReceived(), - (int) (c.time - p.time) / SECOND); - load = ((load == null) || (rcvLoad.rate() > load.rate())) ? rcvLoad : load; - } - return load; - } - } - return null; - } - - // Monitors port stats update messages. - private class InternalDeviceListener implements DeviceListener { - @Override - public void event(DeviceEvent event) { - DeviceEvent.Type type = event.type(); - DeviceId deviceId = event.subject().id(); - if (type == PORT_STATS_UPDATED) { - // Update port load - updateDeviceData(deviceId); - - } else if (type == DEVICE_REMOVED || - (type == DEVICE_AVAILABILITY_CHANGED && - !deviceService.isAvailable(deviceId))) { - // Clean-up all port loads - pruneDeviceData(deviceId); - } - } - } - - // Updates the port stats for the specified device - private void updateDeviceData(DeviceId deviceId) { - deviceService.getPortStatistics(deviceId) - .forEach(stats -> updatePortData(deviceId, stats)); - } - - // Updates the port stats for the specified port - private void updatePortData(DeviceId deviceId, PortStatistics stats) { - ConnectPoint cp = new ConnectPoint(deviceId, portNumber(stats.port())); - DataPoint c = current.get(cp); - - // Create a new data point and make it the current one - current.put(cp, new DataPoint(stats)); - - // If we have a current data point, demote it to previous - if (c != null) { - previous.put(cp, c); - } - } - - // Cleans all port loads for the specified device - private void pruneDeviceData(DeviceId deviceId) { - pruneMap(current, deviceId); - pruneMap(previous, deviceId); - } - - private void pruneMap(Map map, DeviceId deviceId) { - map.keySet().stream().filter(cp -> deviceId.equals(cp.deviceId())) - .collect(Collectors.toSet()).forEach(map::remove); - } - - // Auxiliary data point to track when we receive different samples. - private class DataPoint { - long time; - PortStatistics stats; - - DataPoint(PortStatistics stats) { - time = System.currentTimeMillis(); - this.stats = stats; - } - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/package-info.java deleted file mode 100644 index 842a58fb..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementations of incubating core subsystems. - */ -package org.onosproject.incubator.net.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java deleted file mode 100644 index bbd96de0..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/InterfaceManager.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2015 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.net.intf.impl; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.packet.IpAddress; -import org.onlab.packet.VlanId; -import org.onosproject.incubator.net.config.basics.ConfigException; -import org.onosproject.incubator.net.config.basics.InterfaceConfig; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.incubator.net.intf.InterfaceAdminService; -import org.onosproject.incubator.net.intf.InterfaceService; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.NetworkConfigEvent; -import org.onosproject.net.config.NetworkConfigListener; -import org.onosproject.net.config.NetworkConfigService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - -import static java.util.stream.Collectors.collectingAndThen; -import static java.util.stream.Collectors.toSet; - -/** - * Manages the inventory of interfaces in the system. - */ -@Service -@Component(immediate = true) -public class InterfaceManager implements InterfaceService, - InterfaceAdminService { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private static final Class SUBJECT_CLASS = ConnectPoint.class; - private static final Class CONFIG_CLASS = InterfaceConfig.class; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected NetworkConfigService configService; - - private final InternalConfigListener listener = new InternalConfigListener(); - - private final Map> interfaces = Maps.newConcurrentMap(); - - @Activate - public void activate() { - configService.addListener(listener); - - // TODO address concurrency issues here - for (ConnectPoint subject : configService.getSubjects(SUBJECT_CLASS, CONFIG_CLASS)) { - InterfaceConfig config = configService.getConfig(subject, CONFIG_CLASS); - - if (config != null) { - updateInterfaces(config); - } - } - - log.info("Started"); - } - - @Deactivate - public void deactivate() { - configService.removeListener(listener); - - log.info("Stopped"); - } - - @Override - public Set getInterfaces() { - return interfaces.values() - .stream() - .flatMap(set -> set.stream()) - .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); - } - - @Override - public Set getInterfacesByPort(ConnectPoint port) { - Set intfs = interfaces.get(port); - if (intfs == null) { - return Collections.emptySet(); - } - return ImmutableSet.copyOf(intfs); - } - - @Override - public Set getInterfacesByIp(IpAddress ip) { - return interfaces.values() - .stream() - .flatMap(set -> set.stream()) - .filter(intf -> intf.ipAddresses() - .stream() - .anyMatch(ia -> ia.ipAddress().equals(ip))) - .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); - } - - @Override - public Interface getMatchingInterface(IpAddress ip) { - Optional match = interfaces.values() - .stream() - .flatMap(set -> set.stream()) - .filter(intf -> intf.ipAddresses() - .stream() - .anyMatch(intfIp -> intfIp.subnetAddress().contains(ip))) - .findFirst(); - - if (match.isPresent()) { - return match.get(); - } - - return null; - } - - @Override - public Set getInterfacesByVlan(VlanId vlan) { - return interfaces.values() - .stream() - .flatMap(set -> set.stream()) - .filter(intf -> intf.vlan().equals(vlan)) - .collect(collectingAndThen(toSet(), ImmutableSet::copyOf)); - } - - private void updateInterfaces(InterfaceConfig intfConfig) { - try { - interfaces.put(intfConfig.subject(), Sets.newHashSet(intfConfig.getInterfaces())); - } catch (ConfigException e) { - log.error("Error in interface config", e); - } - } - - private void removeInterfaces(ConnectPoint port) { - interfaces.remove(port); - } - - @Override - public void add(Interface intf) { - addInternal(intf); - - InterfaceConfig config = - configService.addConfig(intf.connectPoint(), CONFIG_CLASS); - - config.addInterface(intf); - - configService.applyConfig(intf.connectPoint(), CONFIG_CLASS, config.node()); - } - - private void addInternal(Interface intf) { - interfaces.compute(intf.connectPoint(), (cp, current) -> { - if (current == null) { - return Sets.newHashSet(intf); - } - - Iterator it = current.iterator(); - while (it.hasNext()) { - Interface i = it.next(); - if (i.name().equals(intf.name())) { - it.remove(); - break; - } - } - - current.add(intf); - return current; - }); - } - - @Override - public boolean remove(ConnectPoint connectPoint, String name) { - boolean success = removeInternal(name, connectPoint); - - InterfaceConfig config = configService.addConfig(connectPoint, CONFIG_CLASS); - config.removeInterface(name); - - try { - if (config.getInterfaces().isEmpty()) { - configService.removeConfig(connectPoint, CONFIG_CLASS); - } else { - configService.applyConfig(connectPoint, CONFIG_CLASS, config.node()); - } - } catch (ConfigException e) { - log.error("Error reading interfaces JSON", e); - } - - return success; - } - - public boolean removeInternal(String name, ConnectPoint connectPoint) { - AtomicBoolean removed = new AtomicBoolean(false); - - interfaces.compute(connectPoint, (cp, current) -> { - if (current == null) { - return null; - } - - Iterator it = current.iterator(); - while (it.hasNext()) { - Interface i = it.next(); - if (i.name().equals(name)) { - it.remove(); - removed.set(true); - break; - } - } - - if (current.isEmpty()) { - return null; - } else { - return current; - } - }); - - return removed.get(); - } - - /** - * Listener for network config events. - */ - private class InternalConfigListener implements NetworkConfigListener { - - @Override - public void event(NetworkConfigEvent event) { - switch (event.type()) { - case CONFIG_ADDED: - case CONFIG_UPDATED: - if (event.configClass() == InterfaceConfig.class) { - InterfaceConfig config = - configService.getConfig((ConnectPoint) event.subject(), InterfaceConfig.class); - updateInterfaces(config); - } - break; - case CONFIG_REMOVED: - if (event.configClass() == InterfaceConfig.class) { - removeInterfaces((ConnectPoint) event.subject()); - } - break; - case CONFIG_REGISTERED: - case CONFIG_UNREGISTERED: - default: - break; - } - } - } -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/package-info.java deleted file mode 100644 index abdce5a4..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/intf/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of service for interacting with interfaces. - */ -package org.onosproject.incubator.net.intf.impl; diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastData.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastData.java deleted file mode 100644 index 946d8c6e..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastData.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2015 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.net.mcast.impl; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import org.onosproject.net.ConnectPoint; - -import java.util.Collections; -import java.util.List; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Simple entity maintaining a mapping between a source and a collection of sink - * connect points. - */ -public final class MulticastData { - - private final ConnectPoint source; - private final List sinks; - private final boolean isEmpty; - - private MulticastData() { - this.source = null; - this.sinks = Collections.EMPTY_LIST; - isEmpty = true; - } - - public MulticastData(ConnectPoint source, List sinks) { - this.source = checkNotNull(source, "Multicast source cannot be null."); - this.sinks = checkNotNull(sinks, "List of sinks cannot be null."); - isEmpty = false; - } - - public MulticastData(ConnectPoint source, ConnectPoint sink) { - this.source = checkNotNull(source, "Multicast source cannot be null."); - this.sinks = Lists.newArrayList(checkNotNull(sink, "Sink cannot be null.")); - isEmpty = false; - } - - public MulticastData(ConnectPoint source) { - this.source = checkNotNull(source, "Multicast source cannot be null."); - this.sinks = Lists.newArrayList(); - isEmpty = false; - } - - public ConnectPoint source() { - return source; - } - - public List sinks() { - return ImmutableList.copyOf(sinks); - } - - public void appendSink(ConnectPoint sink) { - sinks.add(sink); - } - - public boolean removeSink(ConnectPoint sink) { - return sinks.remove(sink); - } - - public boolean isEmpty() { - return isEmpty; - } - - public static MulticastData empty() { - return new MulticastData(); - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManager.java deleted file mode 100644 index f73dfe44..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManager.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2015 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.net.mcast.impl; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.packet.IpPrefix; -import org.onlab.util.KryoNamespace; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.event.AbstractListenerManager; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.mcast.McastEvent; -import org.onosproject.net.mcast.McastListener; -import org.onosproject.net.mcast.McastRoute; -import org.onosproject.net.mcast.MulticastRouteService; -import org.onosproject.store.service.ConsistentMap; -import org.onosproject.store.service.Serializer; -import org.onosproject.store.service.StorageService; -import org.onosproject.store.service.Versioned; -import org.slf4j.Logger; - -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; - -import static org.slf4j.LoggerFactory.getLogger; - -/** - * An implementation of a multicast route table. - */ -@Component(immediate = true) -@Service -public class MulticastRouteManager - extends AbstractListenerManager - implements MulticastRouteService { - //TODO: add MulticastRouteAdminService - - private static final String MCASTRIB = "mcast-rib-table"; - - private Logger log = getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - private StorageService storageService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - private CoreService coreService; - - - protected ApplicationId appId; - protected ConsistentMap mcastRoutes; - - @Activate - public void activate() { - - eventDispatcher.addSink(McastEvent.class, listenerRegistry); - - appId = coreService.registerApplication("org.onosproject.mcastrib"); - - mcastRoutes = storageService.consistentMapBuilder() - .withApplicationId(appId) - .withName(MCASTRIB) - .withSerializer(Serializer.using(KryoNamespace.newBuilder().register( - MulticastData.class, - McastRoute.class, - McastRoute.Type.class, - IpPrefix.class, - List.class, - ConnectPoint.class - ).build())).build(); - - log.info("Started"); - } - - @Deactivate - public void deactivate() { - log.info("Stopped"); - } - - @Override - public void add(McastRoute route) { - mcastRoutes.put(route, MulticastData.empty()); - post(new McastEvent(McastEvent.Type.ROUTE_ADDED, route, null, null)); - } - - @Override - public void remove(McastRoute route) { - mcastRoutes.remove(route); - post(new McastEvent(McastEvent.Type.ROUTE_REMOVED, route, null, null)); - } - - @Override - public void addSource(McastRoute route, ConnectPoint connectPoint) { - Versioned d = mcastRoutes.compute(route, (k, v) -> { - if (v.isEmpty()) { - return new MulticastData(connectPoint); - } else { - log.warn("Route {} is already in use.", route); - return v; - } - }); - - if (d != null) { - post(new McastEvent(McastEvent.Type.SOURCE_ADDED, - route, null, connectPoint)); - } - } - - @Override - public void addSink(McastRoute route, ConnectPoint connectPoint) { - AtomicReference source = new AtomicReference<>(); - mcastRoutes.compute(route, (k, v) -> { - if (!v.isEmpty()) { - v.appendSink(connectPoint); - source.set(v.source()); - } else { - log.warn("Route {} does not exist"); - } - return v; - }); - - if (source.get() != null) { - post(new McastEvent(McastEvent.Type.SINK_ADDED, route, - connectPoint, source.get())); - } - } - - - @Override - public void removeSink(McastRoute route, ConnectPoint connectPoint) { - AtomicReference source = new AtomicReference<>(); - mcastRoutes.compute(route, (k, v) -> { - if (v.removeSink(connectPoint)) { - source.set(v.source()); - } - return v; - }); - - if (source.get() != null) { - post(new McastEvent(McastEvent.Type.SINK_REMOVED, route, - connectPoint, source.get())); - } - } - - @Override - public ConnectPoint fetchSource(McastRoute route) { - MulticastData d = mcastRoutes.asJavaMap().getOrDefault(route, - MulticastData.empty()); - return d.source(); - } - - @Override - public List fetchSinks(McastRoute route) { - MulticastData d = mcastRoutes.asJavaMap().getOrDefault(route, - MulticastData.empty()); - return d.sinks(); - } -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/package-info.java deleted file mode 100644 index 464cf701..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/mcast/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * An implementation of a multicast RIB. - */ -package org.onosproject.incubator.net.mcast.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/MeterManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/MeterManager.java deleted file mode 100644 index 5c5c11cd..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/MeterManager.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright 2015 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.net.meter.impl; - -import com.google.common.collect.Maps; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.util.TriConsumer; -import org.onosproject.net.meter.DefaultMeter; -import org.onosproject.net.meter.Meter; -import org.onosproject.net.meter.MeterEvent; -import org.onosproject.net.meter.MeterFailReason; -import org.onosproject.net.meter.MeterId; -import org.onosproject.net.meter.MeterKey; -import org.onosproject.net.meter.MeterListener; -import org.onosproject.net.meter.MeterOperation; -import org.onosproject.net.meter.MeterProvider; -import org.onosproject.net.meter.MeterProviderRegistry; -import org.onosproject.net.meter.MeterProviderService; -import org.onosproject.net.meter.MeterRequest; -import org.onosproject.net.meter.MeterService; -import org.onosproject.net.meter.MeterState; -import org.onosproject.net.meter.MeterStore; -import org.onosproject.net.meter.MeterStoreDelegate; -import org.onosproject.net.meter.MeterStoreResult; -import org.onosproject.net.DeviceId; -import org.onosproject.net.provider.AbstractListenerProviderRegistry; -import org.onosproject.net.provider.AbstractProviderService; -import org.onosproject.store.service.AtomicCounter; -import org.onosproject.store.service.StorageService; -import org.slf4j.Logger; - -import java.util.Collection; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.slf4j.LoggerFactory.getLogger; - - -/** - * Provides implementation of the meter service APIs. - */ -@Component(immediate = true, enabled = true) -@Service -public class MeterManager extends AbstractListenerProviderRegistry - implements MeterService, MeterProviderRegistry { - - private static final String METERCOUNTERIDENTIFIER = "meter-id-counter-%s"; - private final Logger log = getLogger(getClass()); - private final MeterStoreDelegate delegate = new InternalMeterStoreDelegate(); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected StorageService storageService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected MeterStore store; - - private Map meterIdCounters - = Maps.newConcurrentMap(); - - private TriConsumer onComplete; - - @Activate - public void activate() { - - store.setDelegate(delegate); - - onComplete = (request, result, error) -> - { - request.context().ifPresent(c -> { - if (error != null) { - c.onError(request, MeterFailReason.UNKNOWN); - } else { - if (result.reason().isPresent()) { - c.onError(request, result.reason().get()); - } else { - c.onSuccess(request); - } - } - }); - - }; - log.info("Started"); - } - - @Deactivate - public void deactivate() { - store.unsetDelegate(delegate); - log.info("Stopped"); - } - - @Override - protected MeterProviderService createProviderService(MeterProvider provider) { - return new InternalMeterProviderService(provider); - } - - @Override - public Meter submit(MeterRequest request) { - - MeterId id = allocateMeterId(request.deviceId()); - - Meter.Builder mBuilder = DefaultMeter.builder() - .forDevice(request.deviceId()) - .fromApp(request.appId()) - .withBands(request.bands()) - .withId(id) - .withUnit(request.unit()); - - if (request.isBurst()) { - mBuilder.burst(); - } - DefaultMeter m = (DefaultMeter) mBuilder.build(); - m.setState(MeterState.PENDING_ADD); - store.storeMeter(m).whenComplete((result, error) -> - onComplete.accept(request, result, error)); - return m; - } - - @Override - public void withdraw(MeterRequest request, MeterId meterId) { - Meter.Builder mBuilder = DefaultMeter.builder() - .forDevice(request.deviceId()) - .fromApp(request.appId()) - .withBands(request.bands()) - .withId(meterId) - .withUnit(request.unit()); - - if (request.isBurst()) { - mBuilder.burst(); - } - - DefaultMeter m = (DefaultMeter) mBuilder.build(); - m.setState(MeterState.PENDING_REMOVE); - store.deleteMeter(m).whenComplete((result, error) -> - onComplete.accept(request, result, error)); - } - - @Override - public Meter getMeter(DeviceId deviceId, MeterId id) { - MeterKey key = MeterKey.key(deviceId, id); - return store.getMeter(key); - } - - @Override - public Collection getAllMeters() { - return store.getAllMeters(); - } - - private MeterId allocateMeterId(DeviceId deviceId) { - long id = meterIdCounters.compute(deviceId, (k, v) -> { - if (v == null) { - return allocateCounter(k); - } - return v; - }).incrementAndGet(); - - return MeterId.meterId((int) id); - } - - private AtomicCounter allocateCounter(DeviceId deviceId) { - return storageService.atomicCounterBuilder() - .withName(String.format(METERCOUNTERIDENTIFIER, deviceId)) - .build(); - } - - private class InternalMeterProviderService - extends AbstractProviderService - implements MeterProviderService { - - /** - * Creates a provider service on behalf of the specified provider. - * - * @param provider provider to which this service is being issued - */ - protected InternalMeterProviderService(MeterProvider provider) { - super(provider); - } - - @Override - public void meterOperationFailed(MeterOperation operation, - MeterFailReason reason) { - store.failedMeter(operation, reason); - } - - @Override - public void pushMeterMetrics(DeviceId deviceId, Collection meterEntries) { - //FIXME: FOLLOWING CODE CANNOT BE TESTED UNTIL SOMETHING THAT - //FIXME: IMPLEMENTS METERS EXISTS - Map storedMeterMap = store.getAllMeters().stream() - .collect(Collectors.toMap(Meter::id, m -> m)); - - meterEntries.stream() - .filter(m -> storedMeterMap.remove(m.id()) != null) - .forEach(m -> store.updateMeterState(m)); - - storedMeterMap.values().stream().forEach(m -> { - if (m.state() == MeterState.PENDING_ADD) { - provider().performMeterOperation(m.deviceId(), - new MeterOperation(m, - MeterOperation.Type.ADD)); - } else { - store.deleteMeterNow(m); - } - }); - } - } - - private class InternalMeterStoreDelegate implements MeterStoreDelegate { - - @Override - public void notify(MeterEvent event) { - DeviceId deviceId = event.subject().deviceId(); - MeterProvider p = getProvider(event.subject().deviceId()); - switch (event.type()) { - case METER_ADD_REQ: - p.performMeterOperation(deviceId, new MeterOperation(event.subject(), - MeterOperation.Type.ADD)); - break; - case METER_REM_REQ: - p.performMeterOperation(deviceId, new MeterOperation(event.subject(), - MeterOperation.Type.REMOVE)); - break; - default: - log.warn("Unknown meter event {}", event.type()); - } - - } - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/package-info.java deleted file mode 100644 index 5559d90b..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/meter/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Provides implementation of the meter service APIs. - */ -package org.onosproject.incubator.net.meter.impl; diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java deleted file mode 100644 index 8ecf1d29..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/LabelResourceManager.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2015 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.net.resource.label.impl; - -import com.google.common.collect.Multimap; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.net.provider.AbstractListenerProviderRegistry; -import org.onosproject.incubator.net.resource.label.LabelResource; -import org.onosproject.incubator.net.resource.label.LabelResourceAdminService; -import org.onosproject.incubator.net.resource.label.LabelResourceDelegate; -import org.onosproject.incubator.net.resource.label.LabelResourceEvent; -import org.onosproject.incubator.net.resource.label.LabelResourceId; -import org.onosproject.incubator.net.resource.label.LabelResourceListener; -import org.onosproject.incubator.net.resource.label.LabelResourcePool; -import org.onosproject.incubator.net.resource.label.LabelResourceProvider; -import org.onosproject.incubator.net.resource.label.LabelResourceProviderRegistry; -import org.onosproject.incubator.net.resource.label.LabelResourceProviderService; -import org.onosproject.incubator.net.resource.label.LabelResourceService; -import org.onosproject.incubator.net.resource.label.LabelResourceStore; -import org.onosproject.net.Device; -import org.onosproject.net.DeviceId; -import org.onosproject.net.device.DeviceEvent; -import org.onosproject.net.device.DeviceEvent.Type; -import org.onosproject.net.device.DeviceListener; -import org.onosproject.net.device.DeviceService; -import org.onosproject.net.provider.AbstractProviderService; -import org.slf4j.Logger; - -import java.util.Collection; -import java.util.Set; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.slf4j.LoggerFactory.getLogger; - -/** - * provides implementation of the label resource NB & SB APIs. - * - */ -@Component(immediate = true) -@Service -public class LabelResourceManager - extends AbstractListenerProviderRegistry - implements LabelResourceService, LabelResourceAdminService, LabelResourceProviderRegistry { - private final Logger log = getLogger(getClass()); - private final LabelResourceDelegate delegate = new InternalLabelResourceDelegate(); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected LabelResourceStore store; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected DeviceService deviceService; - - private DeviceListener deviceListener = new InternalDeviceListener(); - - @Activate - public void activate() { - store.setDelegate(delegate); - eventDispatcher.addSink(LabelResourceEvent.class, listenerRegistry); - deviceService.addListener(deviceListener); - log.info("Started"); - - } - - @Deactivate - public void deactivate() { - deviceService.removeListener(deviceListener); - store.unsetDelegate(delegate); - eventDispatcher.removeSink(LabelResourceEvent.class); - log.info("Stopped"); - } - - @Override - public boolean createDevicePool(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel) { - checkNotNull(deviceId, "deviceId is not null"); - checkNotNull(beginLabel, "beginLabel is not null"); - checkNotNull(endLabel, "endLabel is not null"); - checkArgument(beginLabel.labelId() >= 0 || endLabel.labelId() >= 0, - "The value of beginLabel and the value of endLabel must be both positive number."); - checkArgument(beginLabel.labelId() < endLabel.labelId(), - "The value of endLabel must be greater than the value of beginLabel."); - return store.createDevicePool(deviceId, beginLabel, endLabel); - } - - @Override - public boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel) { - checkNotNull(beginLabel, "beginLabel is not null"); - checkNotNull(endLabel, "endLabel is not null"); - checkArgument(beginLabel.labelId() >= 0 && endLabel.labelId() >= 0, - "The value of beginLabel and the value of endLabel must be both positive number."); - checkArgument(beginLabel.labelId() < endLabel.labelId(), - "The value of endLabel must be greater than the value of beginLabel."); - return store.createGlobalPool(beginLabel, endLabel); - } - - @Override - public boolean destroyDevicePool(DeviceId deviceId) { - checkNotNull(deviceId, "deviceId is not null"); - return store.destroyDevicePool(deviceId); - } - - @Override - public boolean destroyGlobalPool() { - return store.destroyGlobalPool(); - } - - @Override - public Collection applyFromDevicePool(DeviceId deviceId, - long applyNum) { - checkNotNull(deviceId, "deviceId is not null"); - checkNotNull(applyNum, "applyNum is not null"); - return store.applyFromDevicePool(deviceId, applyNum); - } - - @Override - public Collection applyFromGlobalPool(long applyNum) { - checkNotNull(applyNum, "applyNum is not null"); - return store.applyFromGlobalPool(applyNum); - } - - @Override - public boolean releaseToDevicePool(Multimap release) { - checkNotNull(release, "release is not null"); - return store.releaseToDevicePool(release); - } - - @Override - public boolean releaseToGlobalPool(Set release) { - checkNotNull(release, "release is not null"); - return store.releaseToGlobalPool(release); - } - - @Override - public boolean isDevicePoolFull(DeviceId deviceId) { - checkNotNull(deviceId, "deviceId is not null"); - return store.isDevicePoolFull(deviceId); - } - - @Override - public boolean isGlobalPoolFull() { - return store.isGlobalPoolFull(); - } - - @Override - public long getFreeNumOfDevicePool(DeviceId deviceId) { - checkNotNull(deviceId, "deviceId is not null"); - return store.getFreeNumOfDevicePool(deviceId); - } - - @Override - public long getFreeNumOfGlobalPool() { - return store.getFreeNumOfGlobalPool(); - } - - @Override - public LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId) { - checkNotNull(deviceId, "deviceId is not null"); - return store.getDeviceLabelResourcePool(deviceId); - } - - @Override - public LabelResourcePool getGlobalLabelResourcePool() { - return store.getGlobalLabelResourcePool(); - } - - private class InternalLabelResourceDelegate implements LabelResourceDelegate { - @Override - public void notify(LabelResourceEvent event) { - post(event); - } - - } - - private class InternalDeviceListener implements DeviceListener { - @Override - public void event(DeviceEvent event) { - Device device = event.subject(); - if (Type.DEVICE_REMOVED.equals(event.type())) { - destroyDevicePool(device.id()); - } - } - } - - private class InternalLabelResourceProviderService - extends AbstractProviderService - implements LabelResourceProviderService { - - protected InternalLabelResourceProviderService(LabelResourceProvider provider) { - super(provider); - } - - @Override - public void deviceLabelResourcePoolDetected(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel) { - checkNotNull(deviceId, "deviceId is not null"); - checkNotNull(beginLabel, "beginLabel is not null"); - checkNotNull(endLabel, "endLabel is not null"); - createDevicePool(deviceId, beginLabel, endLabel); - } - - @Override - public void deviceLabelResourcePoolDestroyed(DeviceId deviceId) { - checkNotNull(deviceId, "deviceId is not null"); - destroyDevicePool(deviceId); - } - - } - - @Override - protected LabelResourceProviderService createProviderService(LabelResourceProvider provider) { - return new InternalLabelResourceProviderService(provider); - } -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/package-info.java deleted file mode 100644 index afd31b48..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/resource/label/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the label resource subsystem. - */ -package org.onosproject.incubator.net.resource.label.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java deleted file mode 100644 index d316388f..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/TunnelManager.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright 2015 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.net.tunnel.impl; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.net.provider.AbstractListenerProviderRegistry; -import org.onosproject.core.ApplicationId; -import org.onosproject.incubator.net.tunnel.DefaultTunnel; -import org.onosproject.incubator.net.tunnel.Tunnel; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.incubator.net.tunnel.TunnelAdminService; -import org.onosproject.incubator.net.tunnel.TunnelDescription; -import org.onosproject.incubator.net.tunnel.TunnelEndPoint; -import org.onosproject.incubator.net.tunnel.TunnelEvent; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.tunnel.TunnelListener; -import org.onosproject.incubator.net.tunnel.TunnelName; -import org.onosproject.incubator.net.tunnel.TunnelProvider; -import org.onosproject.incubator.net.tunnel.TunnelProviderRegistry; -import org.onosproject.incubator.net.tunnel.TunnelProviderService; -import org.onosproject.incubator.net.tunnel.TunnelService; -import org.onosproject.incubator.net.tunnel.TunnelStore; -import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate; -import org.onosproject.incubator.net.tunnel.TunnelSubscription; -import org.onosproject.net.Annotations; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Path; -import org.onosproject.net.provider.AbstractProviderService; -import org.onosproject.net.provider.ProviderId; -import org.slf4j.Logger; - -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.slf4j.LoggerFactory.getLogger; - -/** - * Provides implementation of the tunnel NB/SB APIs. - */ -@Component(immediate = true, enabled = true) -@Service -public class TunnelManager - extends AbstractListenerProviderRegistry - implements TunnelService, TunnelAdminService, TunnelProviderRegistry { - - private static final String TUNNNEL_ID_NULL = "Tunnel ID cannot be null"; - - private final Logger log = getLogger(getClass()); - - private final TunnelStoreDelegate delegate = new InternalStoreDelegate(); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected TunnelStore store; - - - @Activate - public void activate() { - store.setDelegate(delegate); - eventDispatcher.addSink(TunnelEvent.class, listenerRegistry); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - store.unsetDelegate(delegate); - eventDispatcher.removeSink(TunnelEvent.class); - log.info("Stopped"); - } - - @Override - public void removeTunnel(TunnelId tunnelId) { - checkNotNull(tunnelId, TUNNNEL_ID_NULL); - store.deleteTunnel(tunnelId); - Tunnel tunnel = store.queryTunnel(tunnelId); - if (tunnel.providerId() != null) { - TunnelProvider provider = getProvider(tunnel.providerId()); - if (provider != null) { - provider.releaseTunnel(tunnel); - } - } else { - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.releaseTunnel(tunnel); - } - } - } - - @Override - public void updateTunnel(Tunnel tunnel, Path path) { - store.createOrUpdateTunnel(tunnel); - if (tunnel.providerId() != null) { - TunnelProvider provider = getProvider(tunnel.providerId()); - if (provider != null) { - provider.updateTunnel(tunnel, path); - } - } else { - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.updateTunnel(tunnel, path); - } - } - } - - @Override - public void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, - ProviderId producerName) { - store.deleteTunnel(src, dst, producerName); - Collection setTunnels = store.queryTunnel(src, dst); - for (Tunnel tunnel : setTunnels) { - if (producerName != null - && !tunnel.providerId().equals(producerName)) { - continue; - } - if (tunnel.providerId() != null) { - TunnelProvider provider = getProvider(tunnel.providerId()); - if (provider != null) { - provider.releaseTunnel(tunnel); - } - } else { - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.releaseTunnel(tunnel); - } - } - } - } - - @Override - public void removeTunnels(TunnelEndPoint src, TunnelEndPoint dst, Type type, - ProviderId producerName) { - store.deleteTunnel(src, dst, type, producerName); - Collection setTunnels = store.queryTunnel(src, dst); - for (Tunnel tunnel : setTunnels) { - if (producerName != null - && !tunnel.providerId().equals(producerName) - || !type.equals(tunnel.type())) { - continue; - } - if (tunnel.providerId() != null) { - TunnelProvider provider = getProvider(tunnel.providerId()); - if (provider != null) { - provider.releaseTunnel(tunnel); - } - } else { - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.releaseTunnel(tunnel); - } - } - } - } - - @Override - public Tunnel borrowTunnel(ApplicationId consumerId, TunnelId tunnelId, - Annotations... annotations) { - return store.borrowTunnel(consumerId, tunnelId, annotations); - } - - @Override - public Collection borrowTunnel(ApplicationId consumerId, - TunnelName tunnelName, - Annotations... annotations) { - return store.borrowTunnel(consumerId, tunnelName, annotations); - } - - @Override - public Collection borrowTunnel(ApplicationId consumerId, - TunnelEndPoint src, TunnelEndPoint dst, - Annotations... annotations) { - Collection tunnels = store.borrowTunnel(consumerId, src, - dst, annotations); - if (tunnels == null || tunnels.size() == 0) { - Tunnel tunnel = new DefaultTunnel(null, src, dst, null, null, null, - null, null, annotations); - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.setupTunnel(tunnel, null); - } - } - return tunnels; - } - - @Override - public Collection borrowTunnel(ApplicationId consumerId, - TunnelEndPoint src, TunnelEndPoint dst, - Type type, Annotations... annotations) { - Collection tunnels = store.borrowTunnel(consumerId, src, - dst, type, - annotations); - if (tunnels == null || tunnels.size() == 0) { - Tunnel tunnel = new DefaultTunnel(null, src, dst, type, null, null, - null, null, annotations); - Set ids = getProviders(); - for (ProviderId providerId : ids) { - TunnelProvider provider = getProvider(providerId); - provider.setupTunnel(tunnel, null); - } - } - return tunnels; - } - - @Override - public boolean returnTunnel(ApplicationId consumerId, - TunnelId tunnelId, Annotations... annotations) { - return store.returnTunnel(consumerId, tunnelId, annotations); - } - - @Override - public boolean returnTunnel(ApplicationId consumerId, - TunnelName tunnelName, - Annotations... annotations) { - return store.returnTunnel(consumerId, tunnelName, annotations); - } - - @Override - public boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations) { - return store.returnTunnel(consumerId, src, dst, type, annotations); - } - - @Override - public boolean returnTunnel(ApplicationId consumerId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations) { - return store.returnTunnel(consumerId, src, dst, annotations); - } - - @Override - public Tunnel queryTunnel(TunnelId tunnelId) { - return store.queryTunnel(tunnelId); - } - - @Override - public Collection queryTunnelSubscription(ApplicationId consumerId) { - return store.queryTunnelSubscription(consumerId); - } - - @Override - public Collection queryTunnel(Type type) { - return store.queryTunnel(type); - } - - @Override - public Collection queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) { - return store.queryTunnel(src, dst); - } - - - @Override - public Collection queryAllTunnels() { - return store.queryAllTunnels(); - } - - @Override - public int tunnelCount() { - return store.tunnelCount(); - } - - @Override - protected TunnelProviderService createProviderService(TunnelProvider provider) { - return new InternalTunnelProviderService(provider); - } - - private class InternalTunnelProviderService - extends AbstractProviderService - implements TunnelProviderService { - protected InternalTunnelProviderService(TunnelProvider provider) { - super(provider); - } - - - @Override - public TunnelId tunnelAdded(TunnelDescription tunnel) { - Tunnel storedTunnel = new DefaultTunnel(provider().id(), - tunnel.src(), tunnel.dst(), - tunnel.type(), - tunnel.groupId(), - tunnel.id(), - tunnel.tunnelName(), - tunnel.path(), - tunnel.annotations()); - return store.createOrUpdateTunnel(storedTunnel); - } - - @Override - public void tunnelUpdated(TunnelDescription tunnel) { - Tunnel storedTunnel = new DefaultTunnel(provider().id(), - tunnel.src(), tunnel.dst(), - tunnel.type(), - tunnel.groupId(), - tunnel.id(), - tunnel.tunnelName(), - tunnel.path(), - tunnel.annotations()); - store.createOrUpdateTunnel(storedTunnel); - } - - @Override - public void tunnelRemoved(TunnelDescription tunnel) { - if (tunnel.id() != null) { - store.deleteTunnel(tunnel.id()); - return; - } - if (tunnel.src() != null && tunnel.dst() != null - && tunnel.type() != null) { - store.deleteTunnel(tunnel.src(), tunnel.dst(), tunnel.type(), - provider().id()); - return; - } - if (tunnel.src() != null && tunnel.dst() != null - && tunnel.type() == null) { - store.deleteTunnel(tunnel.src(), tunnel.dst(), provider().id()); - return; - } - } - - - @Override - public Tunnel tunnelQueryById(TunnelId tunnelId) { - return store.queryTunnel(tunnelId); - } - - - } - - private class InternalStoreDelegate implements TunnelStoreDelegate { - @Override - public void notify(TunnelEvent event) { - if (event != null) { - post(event); - } - } - } - - @Override - public Iterable getTunnels(DeviceId deviceId) { - return Collections.emptyList(); - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/package-info.java deleted file mode 100644 index 6e0de551..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/tunnel/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Core subsystem for tracking global inventory of tunnels. - */ -package org.onosproject.incubator.net.tunnel.impl; diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java deleted file mode 100644 index fe9f8841..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkManager.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2015 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.net.virtual.impl; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.virtual.NetworkId; -import org.onosproject.incubator.net.virtual.TenantId; -import org.onosproject.incubator.net.virtual.VirtualDevice; -import org.onosproject.incubator.net.virtual.VirtualLink; -import org.onosproject.incubator.net.virtual.VirtualNetwork; -import org.onosproject.incubator.net.virtual.VirtualNetworkAdminService; -import org.onosproject.incubator.net.virtual.VirtualNetworkEvent; -import org.onosproject.incubator.net.virtual.VirtualNetworkListener; -import org.onosproject.incubator.net.virtual.VirtualNetworkProvider; -import org.onosproject.incubator.net.virtual.VirtualNetworkProviderRegistry; -import org.onosproject.incubator.net.virtual.VirtualNetworkProviderService; -import org.onosproject.incubator.net.virtual.VirtualNetworkService; -import org.onosproject.incubator.net.virtual.VirtualNetworkStore; -import org.onosproject.incubator.net.virtual.VirtualNetworkStoreDelegate; -import org.onosproject.incubator.net.virtual.VirtualPort; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; -import org.onosproject.net.provider.AbstractListenerProviderRegistry; -import org.onosproject.net.provider.AbstractProviderService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Set; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Implementation of the virtual network service. - */ -@Component(immediate = true) -@Service -public class VirtualNetworkManager - extends AbstractListenerProviderRegistry - implements VirtualNetworkService, VirtualNetworkAdminService, VirtualNetworkProviderRegistry { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private static final String TENANT_NULL = "Tenant ID cannot be null"; - private static final String NETWORK_NULL = "Network ID cannot be null"; - private static final String DEVICE_NULL = "Device ID cannot be null"; - private static final String LINK_POINT_NULL = "Link end-point cannot be null"; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected VirtualNetworkStore store; - - private VirtualNetworkStoreDelegate delegate = new InternalStoreDelegate(); - - // TODO: figure out how to coordinate "implementation" of a virtual network in a cluster - - @Activate - protected void activate() { - store.setDelegate(delegate); - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - store.unsetDelegate(delegate); - log.info("Stopped"); - } - - @Override - public void registerTenantId(TenantId tenantId) { - checkNotNull(tenantId, TENANT_NULL); - store.addTenantId(tenantId); - } - - @Override - public void unregisterTenantId(TenantId tenantId) { - checkNotNull(tenantId, TENANT_NULL); - store.removeTenantId(tenantId); - } - - @Override - public Set getTenantIds() { - return store.getTenantIds(); - } - - @Override - public VirtualNetwork createVirtualNetwork(TenantId tenantId) { - checkNotNull(tenantId, TENANT_NULL); - return store.addNetwork(tenantId); - } - - @Override - public void removeVirtualNetwork(NetworkId networkId) { - checkNotNull(networkId, NETWORK_NULL); - store.removeNetwork(networkId); - } - - @Override - public VirtualDevice createVirtualDevice(NetworkId networkId, DeviceId deviceId) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(deviceId, DEVICE_NULL); - return store.addDevice(networkId, deviceId); - } - - @Override - public void removeVirtualDevice(NetworkId networkId, DeviceId deviceId) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(deviceId, DEVICE_NULL); - store.removeDevice(networkId, deviceId); - } - - @Override - public VirtualLink createVirtualLink(NetworkId networkId, - ConnectPoint src, ConnectPoint dst, - TunnelId realizedBy) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(src, LINK_POINT_NULL); - checkNotNull(dst, LINK_POINT_NULL); - checkNotNull(realizedBy, "Tunnel ID cannot be null"); - return store.addLink(networkId, src, dst, realizedBy); - } - - @Override - public void removeVirtualLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(src, LINK_POINT_NULL); - checkNotNull(dst, LINK_POINT_NULL); - store.removeLink(networkId, src, dst); - } - - @Override - public VirtualPort createVirtualPort(NetworkId networkId, DeviceId deviceId, - PortNumber portNumber, Port realizedBy) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(deviceId, DEVICE_NULL); - checkNotNull(portNumber, "Port description cannot be null"); - return store.addPort(networkId, deviceId, portNumber, realizedBy); - } - - @Override - public void removeVirtualPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(deviceId, DEVICE_NULL); - checkNotNull(portNumber, "Port number cannot be null"); - store.removePort(networkId, deviceId, portNumber); - } - - @Override - public Set getVirtualNetworks(TenantId tenantId) { - checkNotNull(tenantId, TENANT_NULL); - return store.getNetworks(tenantId); - } - - @Override - public Set getVirtualDevices(NetworkId networkId) { - checkNotNull(networkId, NETWORK_NULL); - return store.getDevices(networkId); - } - - @Override - public Set getVirtualLinks(NetworkId networkId) { - checkNotNull(networkId, NETWORK_NULL); - return store.getLinks(networkId); - } - - @Override - public Set getVirtualPorts(NetworkId networkId, DeviceId deviceId) { - checkNotNull(networkId, NETWORK_NULL); - checkNotNull(deviceId, DEVICE_NULL); - return store.getPorts(networkId, deviceId); - } - - @Override - public T get(NetworkId networkId, Class serviceClass) { - checkNotNull(networkId, NETWORK_NULL); - return null; - } - - @Override - protected VirtualNetworkProviderService createProviderService(VirtualNetworkProvider provider) { - return new InternalVirtualNetworkProviderService(provider); - } - - // Service issued to registered virtual network providers so that they - // can interact with the core. - private class InternalVirtualNetworkProviderService - extends AbstractProviderService - implements VirtualNetworkProviderService { - InternalVirtualNetworkProviderService(VirtualNetworkProvider provider) { - super(provider); - } - } - - // Auxiliary store delegate to receive notification about changes in - // the virtual network configuration store state - by the store itself. - private class InternalStoreDelegate implements VirtualNetworkStoreDelegate { - @Override - public void notify(VirtualNetworkEvent event) { - post(event); - } - } - -} diff --git a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/package-info.java b/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/package-info.java deleted file mode 100644 index da4be5aa..00000000 --- a/framework/src/onos/incubator/net/src/main/java/org/onosproject/incubator/net/virtual/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the virtual network subsystem. - */ -package org.onosproject.incubator.net.virtual.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/intf/impl/InterfaceManagerTest.java b/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/intf/impl/InterfaceManagerTest.java deleted file mode 100644 index cc2908bc..00000000 --- a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/intf/impl/InterfaceManagerTest.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright 2015 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.net.intf.impl; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.junit.Before; -import org.junit.Test; -import org.onlab.packet.Ip4Address; -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onlab.packet.VlanId; -import org.onosproject.incubator.net.config.basics.ConfigException; -import org.onosproject.incubator.net.config.basics.InterfaceConfig; -import org.onosproject.incubator.net.intf.Interface; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.config.Config; -import org.onosproject.net.config.NetworkConfigEvent; -import org.onosproject.net.config.NetworkConfigListener; -import org.onosproject.net.config.NetworkConfigServiceAdapter; -import org.onosproject.net.host.InterfaceIpAddress; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import static junit.framework.TestCase.assertEquals; -import static org.junit.Assert.assertNull; - -/** - * Unit tests for InterfaceManager. - */ -public class InterfaceManagerTest { - private static final Class CONFIG_CLASS = InterfaceConfig.class; - - private static final int NUM_INTERFACES = 4; - - private Set subjects = Sets.newHashSet(); - private Map configs = Maps.newHashMap(); - - private Set interfaces = Sets.newHashSet(); - - private NetworkConfigListener listener; - - private InterfaceManager interfaceManager; - - @Before - public void setUp() throws Exception { - for (int i = 0; i < NUM_INTERFACES; i++) { - ConnectPoint cp = createConnectPoint(i); - subjects.add(cp); - - Interface intf = createInterface(i); - - interfaces.add(intf); - - InterfaceConfig ic = new TestInterfaceConfig(cp, Sets.newHashSet(intf)); - - configs.put(cp, ic); - } - - TestNetworkConfigService configService = - new TestNetworkConfigService(subjects, configs); - - interfaceManager = new InterfaceManager(); - interfaceManager.configService = configService; - interfaceManager.activate(); - } - - private Interface createInterface(int i) { - ConnectPoint cp = createConnectPoint(i); - - InterfaceIpAddress ia = InterfaceIpAddress.valueOf("192.168." + i + ".1/24"); - - Interface intf = new Interface(cp, - Sets.newHashSet(ia), - MacAddress.valueOf(i), - VlanId.vlanId((short) i)); - - return intf; - } - - private ConnectPoint createConnectPoint(int i) { - return ConnectPoint.deviceConnectPoint("of:000000000000000" + i + "/1"); - } - - @Test - public void testGetInterfaces() throws Exception { - assertEquals(interfaces, interfaceManager.getInterfaces()); - } - - @Test - public void testGetInterfacesByPort() throws Exception { - ConnectPoint cp = ConnectPoint.deviceConnectPoint("of:0000000000000001/1"); - - Set byPort = Collections.singleton(createInterface(1)); - - assertEquals(byPort, interfaceManager.getInterfacesByPort(cp)); - } - - @Test - public void testGetInterfacesByIp() throws Exception { - IpAddress ip = Ip4Address.valueOf("192.168.2.1"); - - Set byIp = Collections.singleton(createInterface(2)); - - assertEquals(byIp, interfaceManager.getInterfacesByIp(ip)); - } - - @Test - public void testGetMatchingInterface() throws Exception { - IpAddress ip = Ip4Address.valueOf("192.168.1.100"); - - Interface matchingIntf = createInterface(1); - - assertEquals(matchingIntf, interfaceManager.getMatchingInterface(ip)); - - // Searching for an IP with no match should return null - ip = Ip4Address.valueOf("1.1.1.1"); - - assertNull(interfaceManager.getMatchingInterface(ip)); - } - - @Test - public void testGetInterfacesByVlan() throws Exception { - VlanId vlanId = VlanId.vlanId((short) 1); - - Set byVlan = Collections.singleton(createInterface(1)); - - assertEquals(byVlan, interfaceManager.getInterfacesByVlan(vlanId)); - } - - @Test - public void testAddInterface() throws Exception { - // Create a new InterfaceConfig which will get added - VlanId vlanId = VlanId.vlanId((short) 1); - ConnectPoint cp = ConnectPoint.deviceConnectPoint("of:0000000000000001/2"); - Interface newIntf = new Interface(cp, - Collections.emptySet(), - MacAddress.valueOf(100), - vlanId); - - InterfaceConfig ic = new TestInterfaceConfig(cp, Collections.singleton(newIntf)); - - subjects.add(cp); - configs.put(cp, ic); - interfaces.add(newIntf); - - NetworkConfigEvent event = new NetworkConfigEvent( - NetworkConfigEvent.Type.CONFIG_ADDED, cp, CONFIG_CLASS); - - assertEquals(NUM_INTERFACES, interfaceManager.getInterfaces().size()); - - // Send in a config event containing a new interface config - listener.event(event); - - // Check the new interface exists in the InterfaceManager's inventory - assertEquals(interfaces, interfaceManager.getInterfaces()); - assertEquals(NUM_INTERFACES + 1, interfaceManager.getInterfaces().size()); - - // There are now two interfaces with vlan ID 1 - Set byVlan = Sets.newHashSet(createInterface(1), newIntf); - assertEquals(byVlan, interfaceManager.getInterfacesByVlan(vlanId)); - } - - @Test - public void testUpdateInterface() throws Exception { - ConnectPoint cp = createConnectPoint(1); - - // Create an interface that is the same as the existing one, but adds a - // new IP address - Interface intf = createInterface(1); - Set addresses = Sets.newHashSet(intf.ipAddresses()); - addresses.add(InterfaceIpAddress.valueOf("192.168.100.1/24")); - intf = new Interface(intf.connectPoint(), addresses, intf.mac(), intf.vlan()); - - // Create a new interface on the same connect point as the existing one - InterfaceIpAddress newAddr = InterfaceIpAddress.valueOf("192.168.101.1/24"); - Interface newIntf = new Interface(cp, - Collections.singleton(newAddr), - MacAddress.valueOf(101), - VlanId.vlanId((short) 101)); - - Set interfaces = Sets.newHashSet(intf, newIntf); - - // New interface config updates the existing interface and adds a new - // interface to the same connect point - InterfaceConfig ic = new TestInterfaceConfig(cp, interfaces); - - configs.put(cp, ic); - - NetworkConfigEvent event = new NetworkConfigEvent( - NetworkConfigEvent.Type.CONFIG_UPDATED, cp, CONFIG_CLASS); - - // Send in the event signalling the interfaces for this connect point - // have been updated - listener.event(event); - - assertEquals(NUM_INTERFACES + 1, interfaceManager.getInterfaces().size()); - assertEquals(interfaces, interfaceManager.getInterfacesByPort(cp)); - } - - @Test - public void testRemoveInterface() throws Exception { - ConnectPoint cp = createConnectPoint(1); - - NetworkConfigEvent event = new NetworkConfigEvent( - NetworkConfigEvent.Type.CONFIG_REMOVED, cp, CONFIG_CLASS); - - assertEquals(NUM_INTERFACES, interfaceManager.getInterfaces().size()); - - // Send in a config event removing an interface config - listener.event(event); - - assertEquals(NUM_INTERFACES - 1, interfaceManager.getInterfaces().size()); - } - - /** - * Test version of NetworkConfigService which allows us to pass in subjects - * and InterfaceConfigs directly. - */ - private class TestNetworkConfigService extends NetworkConfigServiceAdapter { - private final Set subjects; - private final Map configs; - - public TestNetworkConfigService(Set subjects, - Map configs) { - this.subjects = subjects; - this.configs = configs; - } - - @Override - public > Set getSubjects(Class subjectClass, - Class configClass) { - return (Set) subjects; - } - - @Override - public > C getConfig(S subject, Class configClass) { - return (C) configs.get(subject); - } - - @Override - public void addListener(NetworkConfigListener listener) { - InterfaceManagerTest.this.listener = listener; - } - } - - /** - * Test version of InterfaceConfig where we can inject interfaces directly, - * rather than parsing them from JSON. - */ - private class TestInterfaceConfig extends InterfaceConfig { - private final ConnectPoint subject; - private final Set interfaces; - - @Override - public ConnectPoint subject() { - return subject; - } - - public TestInterfaceConfig(ConnectPoint subject, Set interfaces) { - this.subject = subject; - this.interfaces = interfaces; - } - - @Override - public Set getInterfaces() throws ConfigException { - return interfaces; - } - } - -} diff --git a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManagerTest.java b/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManagerTest.java deleted file mode 100644 index bec9cded..00000000 --- a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/mcast/impl/MulticastRouteManagerTest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2015 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.net.mcast.impl; - -import com.google.common.collect.Lists; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onlab.junit.TestUtils; -import org.onlab.packet.IpPrefix; -import org.onosproject.common.event.impl.TestEventDispatcher; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreServiceAdapter; -import org.onosproject.core.DefaultApplicationId; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.PortNumber; -import org.onosproject.net.mcast.McastEvent; -import org.onosproject.net.mcast.McastListener; -import org.onosproject.net.mcast.McastRoute; -import org.onosproject.store.service.TestStorageService; - -import java.util.List; - -import static junit.framework.Assert.fail; -import static junit.framework.TestCase.assertEquals; -import static org.onosproject.net.NetTestTools.did; -import static org.onosproject.net.NetTestTools.injectEventDispatcher; - -/** - * Tests for the multicast RIB. - */ -public class MulticastRouteManagerTest { - - McastRoute r1 = new McastRoute(IpPrefix.valueOf("1.1.1.1/8"), - IpPrefix.valueOf("1.1.1.2/8"), - McastRoute.Type.IGMP); - - McastRoute r11 = new McastRoute(IpPrefix.valueOf("1.1.1.1/8"), - IpPrefix.valueOf("1.1.1.2/8"), - McastRoute.Type.STATIC); - - McastRoute r2 = new McastRoute(IpPrefix.valueOf("2.2.2.1/8"), - IpPrefix.valueOf("2.2.2.2/8"), - McastRoute.Type.PIM); - - ConnectPoint cp1 = new ConnectPoint(did("1"), PortNumber.portNumber(1)); - - ConnectPoint cp2 = new ConnectPoint(did("2"), PortNumber.portNumber(2)); - - private TestMulticastListener listener = new TestMulticastListener(); - - private MulticastRouteManager manager; - - private List events; - - @Before - public void setUp() throws Exception { - manager = new MulticastRouteManager(); - injectEventDispatcher(manager, new TestEventDispatcher()); - TestUtils.setField(manager, "storageService", new TestStorageService()); - TestUtils.setField(manager, "coreService", new TestCoreService()); - events = Lists.newArrayList(); - manager.activate(); - manager.addListener(listener); - } - - @After - public void tearDown() { - manager.removeListener(listener); - manager.deactivate(); - } - - @Test - public void testAdd() { - manager.add(r1); - - assertEquals("Add failed", manager.mcastRoutes.size(), 1); - validateEvents(McastEvent.Type.ROUTE_ADDED); - } - - @Test - public void testRemove() { - manager.add(r1); - - manager.remove(r1); - - assertEquals("Remove failed", manager.mcastRoutes.size(), 0); - validateEvents(McastEvent.Type.ROUTE_ADDED, McastEvent.Type.ROUTE_REMOVED); - } - - @Test - public void testAddSource() { - manager.add(r1); - - manager.addSource(r1, cp1); - - validateEvents(McastEvent.Type.ROUTE_ADDED, McastEvent.Type.SOURCE_ADDED); - assertEquals("Route is not equal", cp1, manager.fetchSource(r1)); - } - - @Test - public void testAddSink() { - manager.add(r1); - - manager.addSource(r1, cp1); - manager.addSink(r1, cp1); - - validateEvents(McastEvent.Type.ROUTE_ADDED, - McastEvent.Type.SOURCE_ADDED, - McastEvent.Type.SINK_ADDED); - assertEquals("Route is not equal", Lists.newArrayList(cp1), manager.fetchSinks(r1)); - } - - @Test - public void testRemoveSink() { - manager.add(r1); - - manager.addSource(r1, cp1); - manager.addSink(r1, cp1); - manager.addSink(r1, cp2); - manager.removeSink(r1, cp2); - - validateEvents(McastEvent.Type.ROUTE_ADDED, - McastEvent.Type.SOURCE_ADDED, - McastEvent.Type.SINK_ADDED, - McastEvent.Type.SINK_ADDED, - McastEvent.Type.SINK_REMOVED); - assertEquals("Route is not equal", Lists.newArrayList(cp1), manager.fetchSinks(r1)); - } - - private void validateEvents(McastEvent.Type... evs) { - if (events.size() != evs.length) { - fail(String.format("Mismatch number of events# obtained -> %s : expected %s", - events, evs)); - } - - for (int i = 0; i < evs.length; i++) { - if (evs[i] != events.get(i).type()) { - fail(String.format("Mismatched events# obtained -> %s : expected %s", - events, evs)); - } - } - } - - class TestMulticastListener implements McastListener { - @Override - public void event(McastEvent event) { - events.add(event); - } - } - - private class TestCoreService extends CoreServiceAdapter { - @Override - public ApplicationId registerApplication(String name) { - return new DefaultApplicationId(0, name); - } - } -} diff --git a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/meter/impl/MeterManagerTest.java b/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/meter/impl/MeterManagerTest.java deleted file mode 100644 index 76caebcb..00000000 --- a/framework/src/onos/incubator/net/src/test/java/org/onosproject/incubator/net/meter/impl/MeterManagerTest.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright 2015 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.net.meter.impl; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onlab.junit.TestUtils; -import org.onlab.packet.IpAddress; -import org.onosproject.cluster.ClusterServiceAdapter; -import org.onosproject.cluster.ControllerNode; -import org.onosproject.cluster.DefaultControllerNode; -import org.onosproject.cluster.NodeId; -import org.onosproject.common.event.impl.TestEventDispatcher; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.DefaultApplicationId; -import org.onosproject.incubator.store.meter.impl.DistributedMeterStore; -import org.onosproject.mastership.MastershipServiceAdapter; -import org.onosproject.net.DeviceId; -import org.onosproject.net.meter.Band; -import org.onosproject.net.meter.DefaultBand; -import org.onosproject.net.meter.DefaultMeter; -import org.onosproject.net.meter.DefaultMeterRequest; -import org.onosproject.net.meter.Meter; -import org.onosproject.net.meter.MeterId; -import org.onosproject.net.meter.MeterOperation; -import org.onosproject.net.meter.MeterOperations; -import org.onosproject.net.meter.MeterProvider; -import org.onosproject.net.meter.MeterProviderRegistry; -import org.onosproject.net.meter.MeterProviderService; -import org.onosproject.net.meter.MeterRequest; -import org.onosproject.net.meter.MeterService; -import org.onosproject.net.meter.MeterState; -import org.onosproject.net.provider.AbstractProvider; -import org.onosproject.net.provider.ProviderId; -import org.onosproject.store.service.TestStorageService; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.onosproject.net.NetTestTools.APP_ID; -import static org.onosproject.net.NetTestTools.did; -import static org.onosproject.net.NetTestTools.injectEventDispatcher; - -/** - * Meter manager tests. - */ -public class MeterManagerTest { - - private static final ProviderId PID = new ProviderId("of", "foo"); - private static final NodeId NID_LOCAL = new NodeId("local"); - private static final IpAddress LOCALHOST = IpAddress.valueOf("127.0.0.1"); - - private MeterService service; - private MeterManager manager; - private DistributedMeterStore meterStore; - private MeterProviderRegistry registry; - private MeterProviderService providerService; - - private TestProvider provider; - - private ApplicationId appId; - - - private Meter m1; - private Meter m2; - private MeterRequest.Builder m1Request; - private MeterRequest.Builder m2Request; - - private Map meters = Maps.newHashMap(); - - @Before - public void setup() throws Exception { - meterStore = new DistributedMeterStore(); - TestUtils.setField(meterStore, "storageService", new TestStorageService()); - TestUtils.setField(meterStore, "clusterService", new TestClusterService()); - TestUtils.setField(meterStore, "mastershipService", new TestMastershipService()); - meterStore.activate(); - - manager = new MeterManager(); - manager.store = meterStore; - TestUtils.setField(manager, "storageService", new TestStorageService()); - injectEventDispatcher(manager, new TestEventDispatcher()); - service = manager; - registry = manager; - - manager.activate(); - - provider = new TestProvider(PID); - providerService = registry.register(provider); - - appId = new TestApplicationId(0, "MeterManagerTest"); - - assertTrue("provider should be registered", - registry.getProviders().contains(provider.id())); - - Band band = DefaultBand.builder() - .ofType(Band.Type.DROP) - .withRate(500) - .build(); - - m1 = DefaultMeter.builder() - .forDevice(did("1")) - .fromApp(APP_ID) - .withId(MeterId.meterId(1)) - .withUnit(Meter.Unit.KB_PER_SEC) - .withBands(Collections.singletonList(band)) - .build(); - - m2 = DefaultMeter.builder() - .forDevice(did("2")) - .fromApp(APP_ID) - .withId(MeterId.meterId(1)) - .withUnit(Meter.Unit.KB_PER_SEC) - .withBands(Collections.singletonList(band)) - .build(); - - m1Request = DefaultMeterRequest.builder() - .forDevice(did("1")) - .fromApp(APP_ID) - .withUnit(Meter.Unit.KB_PER_SEC) - .withBands(Collections.singletonList(band)); - - m2Request = DefaultMeterRequest.builder() - .forDevice(did("2")) - .fromApp(APP_ID) - .withUnit(Meter.Unit.KB_PER_SEC) - .withBands(Collections.singletonList(band)); - - - } - - @After - public void tearDown() { - registry.unregister(provider); - assertFalse("provider should not be registered", - registry.getProviders().contains(provider.id())); - - manager.deactivate(); - injectEventDispatcher(manager, null); - - } - - @Test - public void testAddition() { - manager.submit(m1Request.add()); - - assertTrue("The meter was not added", manager.getAllMeters().size() == 1); - - assertThat(manager.getMeter(did("1"), MeterId.meterId(1)), is(m1)); - } - - @Test - public void testRemove() { - manager.submit(m1Request.add()); - manager.withdraw(m1Request.remove(), m1.id()); - - assertThat(manager.getMeter(did("1"), MeterId.meterId(1)).state(), - is(MeterState.PENDING_REMOVE)); - - providerService.pushMeterMetrics(m1.deviceId(), Collections.emptyList()); - - assertTrue("The meter was not removed", manager.getAllMeters().size() == 0); - - } - - @Test - public void testMultipleDevice() { - manager.submit(m1Request.add()); - manager.submit(m2Request.add()); - - assertTrue("The meters were not added", manager.getAllMeters().size() == 2); - - assertThat(manager.getMeter(did("1"), MeterId.meterId(1)), is(m1)); - assertThat(manager.getMeter(did("2"), MeterId.meterId(1)), is(m2)); - } - - public class TestApplicationId extends DefaultApplicationId { - public TestApplicationId(int id, String name) { - super(id, name); - } - } - - private class TestProvider extends AbstractProvider implements MeterProvider { - - protected TestProvider(ProviderId id) { - super(PID); - } - - @Override - public void performMeterOperation(DeviceId deviceId, MeterOperations meterOps) { - //Currently unused. - } - - @Override - public void performMeterOperation(DeviceId deviceId, MeterOperation meterOp) { - meters.put(meterOp.meter().id(), meterOp.meter()); - } - } - - private final class TestClusterService extends ClusterServiceAdapter { - - ControllerNode local = new DefaultControllerNode(NID_LOCAL, LOCALHOST); - - @Override - public ControllerNode getLocalNode() { - return local; - } - - @Override - public Set getNodes() { - return Sets.newHashSet(); - } - - } - - private class TestMastershipService extends MastershipServiceAdapter { - @Override - public NodeId getMasterFor(DeviceId deviceId) { - return NID_LOCAL; - } - } -} diff --git a/framework/src/onos/incubator/net/src/test/resources/domain-config.json b/framework/src/onos/incubator/net/src/test/resources/domain-config.json deleted file mode 100644 index beda11aa..00000000 --- a/framework/src/onos/incubator/net/src/test/resources/domain-config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "domains" : { - "cord" : { - "basic" : { - "name" : "Core Fabric", - "applicationName" : "org.onosproject.testdomain", - "internalDevices" : [ "of:1" ], - "edgePorts" : [ "of:12/1", "of:14/1" ] - } - }, - "mpls" : { - "basic" : { - "name" : "MPLS Core", - "applicationName" : "org.onosproject.testdomain", - "internalDevices" : [ "of:2" ], - "edgePorts" : [ "of:12/2", "of:23/2" ] - } - }, - "dc" : { - "basic" : { - "name" : "Data Center Fabric", - "applicationName" : "org.onosproject.testdomain", - "internalDevices" : [ "of:3" ], - "edgePorts" : [ "of:23/3", "of:34/3" ] - } - }, - "optical" : { - "basic" : { - "name" : "Optical Core", - "applicationName" : "org.onosproject.testdomain", - "internalDevices" : [ "of:4" ], - "edgePorts" : [ "of:14/4", "of:34/4" ] - } - } - } -} \ No newline at end of file diff --git a/framework/src/onos/incubator/net/src/test/resources/fractal-domain-config.json b/framework/src/onos/incubator/net/src/test/resources/fractal-domain-config.json deleted file mode 100644 index 521c840b..00000000 --- a/framework/src/onos/incubator/net/src/test/resources/fractal-domain-config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "domains" : { - "domain1" : { - "basic" : { - "name" : "Domain 1", - "applicationName" : "org.onosproject.meshdomain", - "internalDevices" : [ "of:0000000000001001", "of:0000000000001002", "of:0000000000001003" ], - "edgePorts" : [ "of:0000000000010000/1", "of:0000000003010000/2", "of:0000000002010000/1" ] - } - }, - "domain2" : { - "basic" : { - "name" : "Domain 2", - "applicationName" : "org.onosproject.meshdomain", - "internalDevices" : [ "of:0000000000002001", "of:0000000000002002", "of:0000000000002003" ], - "edgePorts" : [ "of:0000000000020000/1", "of:0000000003020000/1", "of:0000000002010000/2" ] - } - }, - "domain3" : { - "basic" : { - "name" : "Domain 3", - "applicationName" : "org.onosproject.meshdomain", - "internalDevices" : [ "of:0000000000003001", "of:0000000000003002", "of:0000000000003003" ], - "edgePorts" : [ "of:0000000000030000/1", "of:0000000003010000/1", "of:0000000003020000/2" ] - } - } - } -} \ No newline at end of file diff --git a/framework/src/onos/incubator/pom.xml b/framework/src/onos/incubator/pom.xml deleted file mode 100644 index a6b0fb19..00000000 --- a/framework/src/onos/incubator/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - 4.0.0 - - - org.onosproject - onos - 1.4.0-rc1 - ../pom.xml - - - onos-incubator - pom - - ONOS Incubator root project - - - api - net - store - rpc - rpc-grpc - - - - - org.onosproject - onos-api - - - - org.onosproject - onos-api - tests - test - - - com.google.guava - guava - - - org.onosproject - onlab-misc - - - org.onosproject - onlab-junit - test - - - org.osgi - org.osgi.compendium - - - - - - - org.apache.felix - maven-bundle-plugin - - - - org.onosproject - onos-maven-plugin - - - - - diff --git a/framework/src/onos/incubator/rpc-grpc/features.xml b/framework/src/onos/incubator/rpc-grpc/features.xml deleted file mode 100644 index df768fbb..00000000 --- a/framework/src/onos/incubator/rpc-grpc/features.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - onos-api - mvn:com.google.protobuf/protobuf-java/3.0.0-beta-1 - mvn:io.netty/netty-common/4.1.0.Beta6 - mvn:io.netty/netty-buffer/4.1.0.Beta6 - mvn:io.netty/netty-transport/4.1.0.Beta6 - mvn:io.netty/netty-handler/4.1.0.Beta6 - mvn:io.netty/netty-codec/4.1.0.Beta6 - mvn:io.netty/netty-codec-http/4.1.0.Beta6 - mvn:io.netty/netty-codec-http2/4.1.0.Beta6 - mvn:io.netty/netty-resolver/4.1.0.Beta6 - mvn:com.twitter/hpack/0.11.0 - - wrap:mvn:com.google.auth/google-auth-library-credentials/0.3.0$Bundle-SymbolicName=com.google.auth.google-auth-library-credentials&Bundle-Version=0.3.0 - wrap:mvn:com.google.auth/google-auth-library-oauth2-http/0.3.0$Bundle-SymbolicName=com.google.auth.google-auth-library-oauth2-http&Bundle-Version=0.3.0 - wrap:mvn:io.grpc/grpc-all/0.9.0$Bundle-SymbolicName=io.grpc.grpc-all&Bundle-Version=0.9.0&Import-Package=io.netty.*;version=4.1.0.Beta6,javax.net.ssl,com.google.protobuf.nano;resolution:=optional,okio;resolution:=optional,* - mvn:${project.groupId}/${project.artifactId}/${project.version} - - diff --git a/framework/src/onos/incubator/rpc-grpc/pom.xml b/framework/src/onos/incubator/rpc-grpc/pom.xml deleted file mode 100644 index e2d16aec..00000000 --- a/framework/src/onos/incubator/rpc-grpc/pom.xml +++ /dev/null @@ -1,280 +0,0 @@ - - - - 4.0.0 - - onos-incubator - org.onosproject - 1.4.0-rc1 - - - onos-incubator-rpc-grpc - bundle - - ONOS inter-cluster RPC based on gRPC - http://onosproject.org - - - org.onosproject.incubator.rpc.grpc - org.onosproject.incubator.rpc - - 0.9.0 - 4.1.0.Beta6 - - - - - protoc-plugin - https://dl.bintray.com/sergei-ivanov/maven/ - - - - - - - org.onosproject - onos-api - - - - org.onosproject - onos-incubator-api - - - - org.onosproject - onlab-osgi - - - - io.grpc - grpc-core - ${grpc.version} - - - io.grpc - grpc-protobuf - ${grpc.version} - - - io.grpc - grpc-stub - ${grpc.version} - - - io.grpc - grpc-netty - ${grpc.version} - - - io.grpc - grpc-auth - ${grpc.version} - - - - junit - junit - test - - - - org.onosproject - onos-api - test - tests - - - - org.apache.felix - org.apache.felix.scr.annotations - provided - - - - - - - kr.motd.maven - os-maven-plugin - 1.4.0.Final - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - ${basedir}/src/main/java/ - org.onosproject.incubator.rpc.grpc - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.apache.felix - maven-scr-plugin - - - generate-scr-srcdescriptor - - scr - - - - - - true - - bundle - war - - - - - org.onosproject - onos-maven-plugin - - - cfg - generate-resources - - cfg - - - - swagger - generate-sources - - swagger - - - - app - package - - app - - - - - - - com.google.protobuf.tools - maven-protoc-plugin - 0.4.2 - - - com.google.protobuf:protoc:3.0.0-beta-1:exe:${os.detected.classifier} - grpc-java - io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} - - - - - compile - compile-custom - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/protobuf/java - ${project.build.directory}/generated-sources/protobuf/grpc-java - - - - - - - - - - - - - io.netty - netty-codec - ${grpc.netty.version} - - - io.netty - netty-transport - ${grpc.netty.version} - - - io.netty - netty-handler - ${grpc.netty.version} - - - io.netty - netty-buffer - ${grpc.netty.version} - - - io.netty - netty-common - ${grpc.netty.version} - - - com.twitter - hpack - - 0.11.0 - - - - - diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderRegistryClientProxy.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderRegistryClientProxy.java deleted file mode 100644 index cad0fbb6..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderRegistryClientProxy.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import java.util.Map; - -import org.onosproject.net.device.DeviceProvider; -import org.onosproject.net.device.DeviceProviderRegistry; -import org.onosproject.net.device.DeviceProviderService; -import org.onosproject.net.provider.AbstractProviderRegistry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.Maps; - -import io.grpc.Channel; -import io.grpc.ManagedChannel; - -// gRPC Client side -/** - * Proxy object to handle DeviceProviderRegistry calls. - * - * RPC wise, this will start/stop bidirectional streaming service sessions. - */ -final class DeviceProviderRegistryClientProxy - extends AbstractProviderRegistry - implements DeviceProviderRegistry { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final Channel channel; - - private final Map pServices; - - DeviceProviderRegistryClientProxy(ManagedChannel channel) { - this.channel = channel; - pServices = Maps.newIdentityHashMap(); - } - - @Override - protected synchronized DeviceProviderService createProviderService(DeviceProvider provider) { - - // Create session - DeviceProviderServiceClientProxy pService = new DeviceProviderServiceClientProxy(provider, channel); - log.debug("Created DeviceProviderServiceClientProxy", pService); - - DeviceProviderServiceClientProxy old = pServices.put(provider, pService); - if (old != null) { - // sanity check, can go away - log.warn("Duplicate registration detected for {}", provider.id()); - } - return pService; - } - - @Override - public synchronized void unregister(DeviceProvider provider) { - DeviceProviderServiceClientProxy pService = pServices.remove(provider); - log.debug("Unregistering DeviceProviderServiceClientProxy", pService); - super.unregister(provider); - if (pService != null) { - pService.shutdown(); - } - } -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java deleted file mode 100644 index 498011f2..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import static com.google.common.base.Preconditions.checkNotNull; -import static java.util.stream.Collectors.toList; -import static org.onosproject.incubator.rpc.grpc.GrpcDeviceUtils.translate; -import static org.onosproject.net.DeviceId.deviceId; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.onosproject.grpc.Device.DeviceProviderMsg; -import org.onosproject.grpc.Device.DeviceProviderServiceMsg; -import org.onosproject.grpc.Device.IsReachableRequest; -import org.onosproject.grpc.Device.RoleChanged; -import org.onosproject.grpc.Device.TriggerProbe; -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc; -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpcStub; -import org.onosproject.net.DeviceId; -import org.onosproject.net.MastershipRole; -import org.onosproject.net.device.DeviceDescription; -import org.onosproject.net.device.DeviceProvider; -import org.onosproject.net.device.DeviceProviderService; -import org.onosproject.net.device.PortDescription; -import org.onosproject.net.device.PortStatistics; -import org.onosproject.net.provider.AbstractProviderService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.MoreObjects; - -import io.grpc.Channel; -import io.grpc.stub.StreamObserver; - -// gRPC Client side -// gRPC wise, this object represents bidirectional streaming service session -// and deals with outgoing message stream -/** - * DeviceProviderService instance associated with given DeviceProvider. - */ -final class DeviceProviderServiceClientProxy - extends AbstractProviderService - implements DeviceProviderService { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final StreamObserver devProvService; - private final AtomicBoolean hasShutdown = new AtomicBoolean(false); - - private final Channel channel; - - DeviceProviderServiceClientProxy(DeviceProvider provider, Channel channel) { - super(provider); - this.channel = channel; - - DeviceProviderRegistryRpcStub stub = DeviceProviderRegistryRpcGrpc.newStub(channel); - log.debug("Calling RPC register({}) against {}", provider.id(), channel.authority()); - devProvService = stub.register(new DeviceProviderClientProxy(provider)); - - // send initialize message - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setRegisterProvider(builder.getRegisterProviderBuilder() - .setProviderScheme(provider.id().scheme()) - .build()); - devProvService.onNext(builder.build()); - } - - @Override - public void deviceConnected(DeviceId deviceId, - DeviceDescription deviceDescription) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setDeviceConnected(builder.getDeviceConnectedBuilder() - .setDeviceId(deviceId.toString()) - .setDeviceDescription(translate(deviceDescription)) - .build()); - - devProvService.onNext(builder.build()); - } - - @Override - public void deviceDisconnected(DeviceId deviceId) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setDeviceDisconnected(builder.getDeviceDisconnectedBuilder() - .setDeviceId(deviceId.toString()) - .build()); - - devProvService.onNext(builder.build()); - } - - @Override - public void updatePorts(DeviceId deviceId, - List portDescriptions) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - List portDescs = - portDescriptions.stream() - .map(GrpcDeviceUtils::translate) - .collect(toList()); - - builder.setUpdatePorts(builder.getUpdatePortsBuilder() - .setDeviceId(deviceId.toString()) - .addAllPortDescriptions(portDescs) - .build()); - - devProvService.onNext(builder.build()); - } - - @Override - public void portStatusChanged(DeviceId deviceId, - PortDescription portDescription) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setPortStatusChanged(builder.getPortStatusChangedBuilder() - .setDeviceId(deviceId.toString()) - .setPortDescription(translate(portDescription)) - .build()); - - devProvService.onNext(builder.build()); - } - - @Override - public void receivedRoleReply(DeviceId deviceId, MastershipRole requested, - MastershipRole response) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setReceivedRoleReply(builder.getReceivedRoleReplyBuilder() - .setDeviceId(deviceId.toString()) - .setRequested(translate(requested)) - .setResponse(translate(response)) - .build()); - - devProvService.onNext(builder.build()); - } - - @Override - public void updatePortStatistics(DeviceId deviceId, - Collection portStatistics) { - checkValidity(); - - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - List portStats = - portStatistics.stream() - .map(GrpcDeviceUtils::translate) - .collect(toList()); - builder.setUpdatePortStatistics(builder.getUpdatePortStatisticsBuilder() - .setDeviceId(deviceId.toString()) - .addAllPortStatistics(portStats) - .build()); - - devProvService.onNext(builder.build()); - } - - /** - * Shutdown this session. - */ - public void shutdown() { - if (hasShutdown.compareAndSet(false, true)) { - log.info("Shutting down session over {}", channel.authority()); - // initiate clean shutdown from client - devProvService.onCompleted(); - invalidate(); - } - } - - /** - * Abnormally terminate this session. - * @param t error details - */ - public void shutdown(Throwable t) { - if (hasShutdown.compareAndSet(false, true)) { - log.error("Shutting down session over {}", channel.authority()); - // initiate abnormal termination from client - devProvService.onError(t); - invalidate(); - } - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("channel", channel.authority()) - .add("hasShutdown", hasShutdown.get()) - .toString(); - } - - // gRPC wise, this object handles incoming message stream - /** - * Translates DeviceProvider instructions received from RPC to Java calls. - */ - private final class DeviceProviderClientProxy - implements StreamObserver { - - private final DeviceProvider provider; - - DeviceProviderClientProxy(DeviceProvider provider) { - this.provider = checkNotNull(provider); - } - - @Override - public void onNext(DeviceProviderMsg msg) { - try { - log.trace("DeviceProviderClientProxy received: {}", msg); - onMethod(msg); - } catch (Exception e) { - log.error("Exception caught handling {} at DeviceProviderClientProxy", msg, e); - // initiate shutdown from client - shutdown(e); - } - } - - /** - * Translates received RPC message to {@link DeviceProvider} method calls. - * @param msg DeviceProvider message - */ - private void onMethod(DeviceProviderMsg msg) { - switch (msg.getMethodCase()) { - case TRIGGER_PROBE: - TriggerProbe triggerProbe = msg.getTriggerProbe(); - provider.triggerProbe(deviceId(triggerProbe.getDeviceId())); - break; - case ROLE_CHANGED: - RoleChanged roleChanged = msg.getRoleChanged(); - provider.roleChanged(deviceId(roleChanged.getDeviceId()), - translate(roleChanged.getNewRole())); - break; - case IS_REACHABLE_REQUEST: - IsReachableRequest isReachableRequest = msg.getIsReachableRequest(); - // check if reachable - boolean reachable = provider.isReachable(deviceId(isReachableRequest.getDeviceId())); - - int xid = isReachableRequest.getXid(); - // send response back DeviceProviderService channel - DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder(); - builder.setIsReachableResponse(builder.getIsReachableResponseBuilder() - .setXid(xid) - .setIsReachable(reachable) - .build()); - devProvService.onNext(builder.build()); - break; - - case METHOD_NOT_SET: - default: - log.warn("Unexpected method, ignoring", msg); - break; - } - } - - @Override - public void onCompleted() { - log.info("DeviceProviderClientProxy completed"); - // session terminated from remote - // TODO unregister...? how? - - //devProvService.onCompleted(); - } - - @Override - public void onError(Throwable t) { - log.error("DeviceProviderClientProxy#onError", t); - // session terminated from remote - // TODO unregister...? how? - //devProvService.onError(t); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("channel", channel.authority()) - .toString(); - } - } -} - diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcDeviceUtils.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcDeviceUtils.java deleted file mode 100644 index 7045b0c2..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcDeviceUtils.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.onlab.packet.ChassisId; -import org.onosproject.grpc.Device.DeviceType; -import org.onosproject.grpc.Port.PortType; -import org.onosproject.net.Annotations; -import org.onosproject.net.DefaultAnnotations; -import org.onosproject.net.Device; -import org.onosproject.net.MastershipRole; -import org.onosproject.net.Port; -import org.onosproject.net.Port.Type; -import org.onosproject.net.PortNumber; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.device.DefaultDeviceDescription; -import org.onosproject.net.device.DefaultPortDescription; -import org.onosproject.net.device.DefaultPortStatistics; -import org.onosproject.net.device.DeviceDescription; -import org.onosproject.net.device.PortDescription; -import org.onosproject.net.device.PortStatistics; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.api.client.repackaged.com.google.common.annotations.Beta; - -/** - * gRPC message conversion related utilities. - */ -@Beta -public final class GrpcDeviceUtils { - - private static final Logger log = LoggerFactory.getLogger(GrpcDeviceUtils.class); - - /** - * Translates gRPC enum MastershipRole to ONOS enum. - * - * @param role mastership role in gRPC enum - * @return equivalent in ONOS enum - */ - public static MastershipRole translate(org.onosproject.grpc.Device.MastershipRole role) { - switch (role) { - case NONE: - return MastershipRole.NONE; - case MASTER: - return MastershipRole.MASTER; - case STANDBY: - return MastershipRole.STANDBY; - case UNRECOGNIZED: - log.warn("Unrecognized MastershipRole gRPC message: {}", role); - default: - return MastershipRole.NONE; - } - } - - /** - * Translates ONOS enum MastershipRole to gRPC enum. - * - * @param newRole ONOS' mastership role - * @return equivalent in gRPC message enum - */ - public static org.onosproject.grpc.Device.MastershipRole translate(MastershipRole newRole) { - switch (newRole) { - case MASTER: - return org.onosproject.grpc.Device.MastershipRole.MASTER; - case STANDBY: - return org.onosproject.grpc.Device.MastershipRole.STANDBY; - case NONE: - default: - return org.onosproject.grpc.Device.MastershipRole.NONE; - } - } - - - /** - * Translates gRPC DeviceDescription to {@link DeviceDescription}. - * - * @param deviceDescription gRPC message - * @return {@link DeviceDescription} - */ - public static DeviceDescription translate(org.onosproject.grpc.Device.DeviceDescription deviceDescription) { - URI uri = URI.create(deviceDescription.getDeviceUri()); - Device.Type type = translate(deviceDescription.getType()); - String manufacturer = deviceDescription.getManufacturer(); - String hwVersion = deviceDescription.getHwVersion(); - String swVersion = deviceDescription.getSwVersion(); - String serialNumber = deviceDescription.getSerialNumber(); - ChassisId chassis = new ChassisId(deviceDescription.getChassisId()); - return new DefaultDeviceDescription(uri, type, manufacturer, - hwVersion, swVersion, serialNumber, - chassis, - asAnnotations(deviceDescription.getAnnotations())); - } - - /** - * Translates {@link DeviceDescription} to gRPC DeviceDescription message. - * - * @param deviceDescription {@link DeviceDescription} - * @return gRPC DeviceDescription message - */ - public static org.onosproject.grpc.Device.DeviceDescription translate(DeviceDescription deviceDescription) { - - return org.onosproject.grpc.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()) - .putAllAnnotations(asMap(deviceDescription.annotations())) - .build(); - } - - - /** - * Translates gRPC DeviceType to {@link Device.Type}. - * - * @param type gRPC message - * @return {@link Device.Type} - */ - public static Device.Type translate(org.onosproject.grpc.Device.DeviceType type) { - switch (type) { - case BALANCER: - return Device.Type.BALANCER; - case CONTROLLER: - return Device.Type.CONTROLLER; - case FIBER_SWITCH: - return Device.Type.FIBER_SWITCH; - case FIREWALL: - return Device.Type.FIREWALL; - case IDS: - return Device.Type.IDS; - case IPS: - return Device.Type.IPS; - case MICROWAVE: - return Device.Type.MICROWAVE; - case OTHER: - return Device.Type.OTHER; - case OTN: - return Device.Type.OTN; - case ROADM: - return Device.Type.ROADM; - case ROADM_OTN: - return Device.Type.ROADM_OTN; - case ROUTER: - return Device.Type.ROUTER; - case SWITCH: - return Device.Type.SWITCH; - case VIRTUAL: - return Device.Type.VIRTUAL; - - case UNRECOGNIZED: - default: - log.warn("Unexpected DeviceType: {}", type); - return Device.Type.OTHER; - } - } - - /** - * Translates {@link Type} to gRPC DeviceType. - * - * @param type {@link Type} - * @return gRPC message - */ - public static DeviceType translate(Device.Type type) { - switch (type) { - case BALANCER: - return DeviceType.BALANCER; - case CONTROLLER: - return DeviceType.CONTROLLER; - case FIBER_SWITCH: - return DeviceType.FIBER_SWITCH; - case FIREWALL: - return DeviceType.FIREWALL; - case IDS: - return DeviceType.IDS; - case IPS: - return DeviceType.IPS; - case MICROWAVE: - return DeviceType.MICROWAVE; - case OTHER: - return DeviceType.OTHER; - case OTN: - return DeviceType.OTN; - case ROADM: - return DeviceType.ROADM; - case ROADM_OTN: - return DeviceType.ROADM_OTN; - case ROUTER: - return DeviceType.ROUTER; - case SWITCH: - return DeviceType.SWITCH; - case VIRTUAL: - return DeviceType.VIRTUAL; - - default: - log.warn("Unexpected Device.Type: {}", type); - return DeviceType.OTHER; - } - } - - /** - * Translates gRPC PortDescription message to {@link PortDescription}. - * - * @param portDescription gRPC message - * @return {@link PortDescription} - */ - public static PortDescription translate(org.onosproject.grpc.Port.PortDescription portDescription) { - PortNumber number = PortNumber.fromString(portDescription.getPortNumber()); - boolean isEnabled = portDescription.getIsEnabled(); - Port.Type type = translate(portDescription.getType()); - long portSpeed = portDescription.getPortSpeed(); - SparseAnnotations annotations = asAnnotations(portDescription.getAnnotations()); - // TODO How to deal with more specific Port... - return new DefaultPortDescription(number, isEnabled, type, portSpeed, annotations); - } - - /** - * Translates {@link PortDescription} to gRPC PortDescription message. - * - * @param portDescription {@link PortDescription} - * @return gRPC PortDescription message - */ - public static org.onosproject.grpc.Port.PortDescription translate(PortDescription portDescription) { - // TODO How to deal with more specific Port... - return org.onosproject.grpc.Port.PortDescription.newBuilder() - .setPortNumber(portDescription.portNumber().toString()) - .setIsEnabled(portDescription.isEnabled()) - .setType(translate(portDescription.type())) - .setPortSpeed(portDescription.portSpeed()) - .putAllAnnotations(asMap(portDescription.annotations())) - .build(); - } - - /** - * Translates gRPC PortType to {@link Port.Type}. - * - * @param type gRPC message - * @return {@link Port.Type} - */ - public static Port.Type translate(PortType type) { - switch (type) { - case COPPER: - return Type.COPPER; - case FIBER: - return Type.FIBER; - case OCH: - return Type.OCH; - case ODUCLT: - return Type.ODUCLT; - case OMS: - return Type.OMS; - case PACKET: - return Type.PACKET; - case VIRTUAL: - return Type.VIRTUAL; - - case UNRECOGNIZED: - default: - log.warn("Unexpected PortType: {}", type); - return Type.COPPER; - } - } - - /** - * Translates {@link Port.Type} to gRPC PortType. - * - * @param type {@link Port.Type} - * @return gRPC message - */ - public static PortType translate(Port.Type type) { - switch (type) { - case COPPER: - return PortType.COPPER; - case FIBER: - return PortType.FIBER; - case OCH: - return PortType.OCH; - case ODUCLT: - return PortType.ODUCLT; - case OMS: - return PortType.OMS; - case PACKET: - return PortType.PACKET; - case VIRTUAL: - return PortType.VIRTUAL; - - default: - log.warn("Unexpected Port.Type: {}", type); - return PortType.COPPER; - } - } - - /** - * Translates gRPC PortStatistics message to {@link PortStatistics}. - * - * @param portStatistics gRPC PortStatistics message - * @return {@link PortStatistics} - */ - public static PortStatistics translate(org.onosproject.grpc.Port.PortStatistics portStatistics) { - // TODO implement adding missing fields - return DefaultPortStatistics.builder() - .setPort(portStatistics.getPort()) - .setPacketsReceived(portStatistics.getPacketsReceived()) - .setPacketsSent(portStatistics.getPacketsSent()) - .build(); - } - - /** - * Translates {@link PortStatistics} to gRPC PortStatistics message. - * - * @param portStatistics {@link PortStatistics} - * @return gRPC PortStatistics message - */ - public static org.onosproject.grpc.Port.PortStatistics translate(PortStatistics portStatistics) { - // TODO implement adding missing fields - return org.onosproject.grpc.Port.PortStatistics.newBuilder() - .setPort(portStatistics.port()) - .setPacketsReceived(portStatistics.packetsReceived()) - .setPacketsSent(portStatistics.packetsSent()) - .build(); - } - - // may be this can be moved to Annotation itself or AnnotationsUtils - /** - * Converts Annotations to Map of Strings. - * - * @param annotations {@link Annotations} - * @return Map of annotation key and values - */ - public static Map asMap(Annotations annotations) { - if (annotations instanceof DefaultAnnotations) { - return ((DefaultAnnotations) annotations).asMap(); - } - Map map = new HashMap<>(); - annotations.keys() - .forEach(k -> map.put(k, annotations.value(k))); - - return map; - } - - // may be this can be moved to Annotation itself or AnnotationsUtils - /** - * Converts Map of Strings to {@link SparseAnnotations}. - * - * @param annotations Map of annotation key and values - * @return {@link SparseAnnotations} - */ - public static SparseAnnotations asAnnotations(Map annotations) { - DefaultAnnotations.Builder builder = DefaultAnnotations.builder(); - annotations.entrySet().forEach(e -> { - if (e.getValue() != null) { - builder.set(e.getKey(), e.getValue()); - } else { - builder.remove(e.getKey()); - } - }); - return builder.build(); - } - - // Utility class not intended for instantiation. - private GrpcDeviceUtils() {} -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceContext.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceContext.java deleted file mode 100644 index b419a346..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceContext.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.concurrent.ConcurrentHashMap; - -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.net.device.DeviceProviderRegistry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.MoreObjects; - -import io.grpc.ManagedChannel; - -// gRPC Client side -// Probably there should be plug-in mechanism in the future. -/** - * RemoteServiceContext based on gRPC. - * - *

- * Currently it supports {@link DeviceProviderRegistry}. - */ -public class GrpcRemoteServiceContext implements RemoteServiceContext { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final Map, Object> services = new ConcurrentHashMap<>(); - - private final ManagedChannel channel; - - public GrpcRemoteServiceContext(ManagedChannel channel) { - this.channel = checkNotNull(channel); - services.put(DeviceProviderRegistry.class, new DeviceProviderRegistryClientProxy(channel)); - } - - - @Override - public T get(Class serviceClass) { - @SuppressWarnings("unchecked") - T service = (T) services.get(serviceClass); - if (service != null) { - return service; - } - log.error("{} not supported", serviceClass); - throw new NoSuchElementException(serviceClass.getTypeName() + " not supported"); - } - - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("services", services.keySet()) - .add("channel", channel.authority()) - .toString(); - } - -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java deleted file mode 100644 index 74962187..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.net.URI; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.incubator.rpc.RemoteServiceContextProvider; -import org.onosproject.incubator.rpc.RemoteServiceContextProviderService; -import org.onosproject.incubator.rpc.RemoteServiceProviderRegistry; -import org.onosproject.net.provider.ProviderId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.grpc.ManagedChannel; -import io.grpc.netty.NegotiationType; -import io.grpc.netty.NettyChannelBuilder; - - -// gRPC Client side -/** - * RemoteServiceContextProvider based on gRPC. - */ -@Component(immediate = true) -public class GrpcRemoteServiceProvider implements RemoteServiceContextProvider { - - public static final String GRPC_SCHEME = "grpc"; - - public static final String RPC_PROVIDER_NAME = "org.onosproject.rpc.provider.grpc"; - - private static final ProviderId PID = new ProviderId(GRPC_SCHEME, RPC_PROVIDER_NAME); - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected RemoteServiceProviderRegistry rpcRegistry; - - private Map channels = new ConcurrentHashMap<>(); - - private RemoteServiceContextProviderService providerService; - - - @Activate - protected void activate() { - providerService = rpcRegistry.register(this); - - // FIXME remove me. test code to see if gRPC loads in karaf - //getChannel(URI.create("grpc://localhost:8080")); - - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - rpcRegistry.unregister(this); - - // shutdown all channels - channels.values().stream() - .forEach(ManagedChannel::shutdown); - // Should we wait for shutdown? How? - channels.clear(); - log.info("Stopped"); - } - - @Override - public ProviderId id() { - return PID; - } - - @Override - public RemoteServiceContext get(URI uri) { - // Create gRPC client - return new GrpcRemoteServiceContext(getChannel(uri)); - } - - private ManagedChannel getChannel(URI uri) { - checkArgument(Objects.equals(GRPC_SCHEME, uri.getScheme()), - "Invalid URI scheme: %s", uri.getScheme()); - - return channels.compute(uri, (u, ch) -> { - if (ch != null && !ch.isShutdown()) { - return ch; - } else { - return createChannel(u); - } - }); - } - - private ManagedChannel createChannel(URI uri) { - log.debug("Creating channel for {}", uri); - return NettyChannelBuilder.forAddress(uri.getHost(), uri.getPort()) - .negotiationType(NegotiationType.PLAINTEXT) - .build(); - } - -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java deleted file mode 100644 index 4f43fa65..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceServer.java +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import static com.google.common.base.Preconditions.checkNotNull; -import static java.util.stream.Collectors.toList; -import static org.onosproject.incubator.rpc.grpc.GrpcDeviceUtils.translate; -import static org.onosproject.net.DeviceId.deviceId; - -import java.io.IOException; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Modified; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.onosproject.grpc.Device.DeviceConnected; -import org.onosproject.grpc.Device.DeviceDisconnected; -import org.onosproject.grpc.Device.DeviceProviderMsg; -import org.onosproject.grpc.Device.DeviceProviderServiceMsg; -import org.onosproject.grpc.Device.IsReachableResponse; -import org.onosproject.grpc.Device.PortStatusChanged; -import org.onosproject.grpc.Device.ReceivedRoleReply; -import org.onosproject.grpc.Device.RegisterProvider; -import org.onosproject.grpc.Device.UpdatePortStatistics; -import org.onosproject.grpc.Device.UpdatePorts; -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc; -import org.onosproject.grpc.DeviceProviderRegistryRpcGrpc.DeviceProviderRegistryRpc; -import org.onosproject.net.DeviceId; -import org.onosproject.net.MastershipRole; -import org.onosproject.net.device.DeviceProvider; -import org.onosproject.net.device.DeviceProviderRegistry; -import org.onosproject.net.device.DeviceProviderService; -import org.onosproject.net.provider.ProviderId; -import org.osgi.service.component.ComponentContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.Sets; - -import io.grpc.Server; -import io.grpc.netty.NettyServerBuilder; -import io.grpc.stub.StreamObserver; - -// gRPC Server on Metro-side -// Translates request received on RPC channel, and calls corresponding Service on -// Metro-ONOS cluster. -/** - * Server side implementation of gRPC based RemoteService. - */ -@Component(immediate = true) -public class GrpcRemoteServiceServer { - - private static final String RPC_PROVIDER_NAME = "org.onosproject.rpc.provider.grpc"; - - // TODO pick a number - public static final int DEFAULT_LISTEN_PORT = 11984; - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected DeviceProviderRegistry deviceProviderRegistry; - - - @Property(name = "listenPort", intValue = DEFAULT_LISTEN_PORT, - label = "Port to listen on") - protected int listenPort = DEFAULT_LISTEN_PORT; - - private Server server; - private final Set registeredProviders = Sets.newConcurrentHashSet(); - - @Activate - protected void activate(ComponentContext context) throws IOException { - modified(context); - - log.debug("Server starting on {}", listenPort); - try { - server = NettyServerBuilder.forPort(listenPort) - .addService(DeviceProviderRegistryRpcGrpc.bindService(new DeviceProviderRegistryServerProxy())) - .build().start(); - } catch (IOException e) { - log.error("Failed to start gRPC server", e); - throw e; - } - - log.info("Started on {}", listenPort); - } - - @Deactivate - protected void deactivate() { - - registeredProviders.stream() - .forEach(deviceProviderRegistry::unregister); - - server.shutdown(); - // Should we wait for shutdown? - log.info("Stopped"); - } - - @Modified - public void modified(ComponentContext context) { - // TODO support dynamic reconfiguration and restarting server? - } - - // RPC Server-side code - // RPC session Factory - /** - * Relays DeviceProviderRegistry calls from RPC client. - */ - class DeviceProviderRegistryServerProxy implements DeviceProviderRegistryRpc { - - @Override - public StreamObserver register(StreamObserver toDeviceProvider) { - log.trace("DeviceProviderRegistryServerProxy#register called!"); - - DeviceProviderServerProxy provider = new DeviceProviderServerProxy(toDeviceProvider); - - return new DeviceProviderServiceServerProxy(provider, toDeviceProvider); - } - } - - // Lower -> Upper Controller message - // RPC Server-side code - // RPC session handler - private final class DeviceProviderServiceServerProxy - implements StreamObserver { - - // intentionally shadowing - private final Logger log = LoggerFactory.getLogger(getClass()); - - private final DeviceProviderServerProxy pairedProvider; - private final StreamObserver toDeviceProvider; - - private final Cache> outstandingIsReachable; - - // wrapped providerService - private DeviceProviderService deviceProviderService; - - - DeviceProviderServiceServerProxy(DeviceProviderServerProxy provider, - StreamObserver toDeviceProvider) { - this.pairedProvider = provider; - this.toDeviceProvider = toDeviceProvider; - outstandingIsReachable = CacheBuilder.newBuilder() - .expireAfterWrite(1, TimeUnit.MINUTES) - .build(); - - // pair RPC session in other direction - provider.pair(this); - } - - @Override - public void onNext(DeviceProviderServiceMsg msg) { - try { - log.trace("DeviceProviderServiceServerProxy received: {}", msg); - onMethod(msg); - } catch (Exception e) { - log.error("Exception thrown handling {}", msg, e); - onError(e); - throw e; - } - } - - /** - * Translates received RPC message to {@link DeviceProviderService} method calls. - * @param msg DeviceProviderService message - */ - private void onMethod(DeviceProviderServiceMsg msg) { - switch (msg.getMethodCase()) { - case REGISTER_PROVIDER: - RegisterProvider registerProvider = msg.getRegisterProvider(); - // TODO Do we care about provider name? - pairedProvider.setProviderId(new ProviderId(registerProvider.getProviderScheme(), RPC_PROVIDER_NAME)); - registeredProviders.add(pairedProvider); - deviceProviderService = deviceProviderRegistry.register(pairedProvider); - break; - - case DEVICE_CONNECTED: - DeviceConnected deviceConnected = msg.getDeviceConnected(); - deviceProviderService.deviceConnected(deviceId(deviceConnected.getDeviceId()), - translate(deviceConnected.getDeviceDescription())); - break; - case DEVICE_DISCONNECTED: - DeviceDisconnected deviceDisconnected = msg.getDeviceDisconnected(); - deviceProviderService.deviceDisconnected(deviceId(deviceDisconnected.getDeviceId())); - break; - case UPDATE_PORTS: - UpdatePorts updatePorts = msg.getUpdatePorts(); - deviceProviderService.updatePorts(deviceId(updatePorts.getDeviceId()), - updatePorts.getPortDescriptionsList() - .stream() - .map(GrpcDeviceUtils::translate) - .collect(toList())); - break; - case PORT_STATUS_CHANGED: - PortStatusChanged portStatusChanged = msg.getPortStatusChanged(); - deviceProviderService.portStatusChanged(deviceId(portStatusChanged.getDeviceId()), - translate(portStatusChanged.getPortDescription())); - break; - case RECEIVED_ROLE_REPLY: - ReceivedRoleReply receivedRoleReply = msg.getReceivedRoleReply(); - deviceProviderService.receivedRoleReply(deviceId(receivedRoleReply.getDeviceId()), - translate(receivedRoleReply.getRequested()), - translate(receivedRoleReply.getResponse())); - break; - case UPDATE_PORT_STATISTICS: - UpdatePortStatistics updatePortStatistics = msg.getUpdatePortStatistics(); - deviceProviderService.updatePortStatistics(deviceId(updatePortStatistics.getDeviceId()), - updatePortStatistics.getPortStatisticsList() - .stream() - .map(GrpcDeviceUtils::translate) - .collect(toList())); - break; - - // return value of DeviceProvider#isReachable - case IS_REACHABLE_RESPONSE: - IsReachableResponse isReachableResponse = msg.getIsReachableResponse(); - int xid = isReachableResponse.getXid(); - boolean isReachable = isReachableResponse.getIsReachable(); - CompletableFuture result = outstandingIsReachable.asMap().remove(xid); - if (result != null) { - result.complete(isReachable); - } - break; - - case METHOD_NOT_SET: - default: - log.warn("Unexpected message received {}", msg); - break; - } - } - - @Override - public void onCompleted() { - log.info("DeviceProviderServiceServerProxy completed"); - deviceProviderRegistry.unregister(pairedProvider); - registeredProviders.remove(pairedProvider); - toDeviceProvider.onCompleted(); - } - - @Override - public void onError(Throwable e) { - log.error("DeviceProviderServiceServerProxy#onError", e); - deviceProviderRegistry.unregister(pairedProvider); - registeredProviders.remove(pairedProvider); - // TODO What is the proper clean up for bi-di stream on error? - // sample suggests no-op - toDeviceProvider.onError(e); - } - - - /** - * Registers Future for {@link DeviceProvider#isReachable(DeviceId)} return value. - * @param xid IsReachable call ID. - * @param reply Future to - */ - void register(int xid, CompletableFuture reply) { - outstandingIsReachable.put(xid, reply); - } - - } - - // Upper -> Lower Controller message - /** - * Relay DeviceProvider calls to RPC client. - */ - private final class DeviceProviderServerProxy - implements DeviceProvider { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - // xid for isReachable calls - private final AtomicInteger xidPool = new AtomicInteger(); - private final StreamObserver toDeviceProvider; - - private DeviceProviderServiceServerProxy deviceProviderServiceProxy = null; - private ProviderId providerId; - - DeviceProviderServerProxy(StreamObserver toDeviceProvider) { - this.toDeviceProvider = toDeviceProvider; - } - - void setProviderId(ProviderId pid) { - this.providerId = pid; - } - - /** - * Registers RPC stream in other direction. - * @param deviceProviderServiceProxy {@link DeviceProviderServiceServerProxy} - */ - void pair(DeviceProviderServiceServerProxy deviceProviderServiceProxy) { - this.deviceProviderServiceProxy = deviceProviderServiceProxy; - } - - @Override - public void triggerProbe(DeviceId deviceId) { - log.trace("triggerProbe({})", deviceId); - DeviceProviderMsg.Builder msgBuilder = DeviceProviderMsg.newBuilder(); - msgBuilder.setTriggerProbe(msgBuilder.getTriggerProbeBuilder() - .setDeviceId(deviceId.toString()) - .build()); - DeviceProviderMsg triggerProbeMsg = msgBuilder.build(); - toDeviceProvider.onNext(triggerProbeMsg); - // TODO Catch Exceptions and call onError() - } - - @Override - public void roleChanged(DeviceId deviceId, MastershipRole newRole) { - log.trace("roleChanged({}, {})", deviceId, newRole); - DeviceProviderMsg.Builder msgBuilder = DeviceProviderMsg.newBuilder(); - msgBuilder.setRoleChanged(msgBuilder.getRoleChangedBuilder() - .setDeviceId(deviceId.toString()) - .setNewRole(translate(newRole)) - .build()); - toDeviceProvider.onNext(msgBuilder.build()); - // TODO Catch Exceptions and call onError() - } - - @Override - public boolean isReachable(DeviceId deviceId) { - log.trace("isReachable({})", deviceId); - CompletableFuture result = new CompletableFuture<>(); - final int xid = xidPool.incrementAndGet(); - - DeviceProviderMsg.Builder msgBuilder = DeviceProviderMsg.newBuilder(); - msgBuilder.setIsReachableRequest(msgBuilder.getIsReachableRequestBuilder() - .setXid(xid) - .setDeviceId(deviceId.toString()) - .build()); - - // Associate xid and register above future some where - // in DeviceProviderService channel to receive reply - if (deviceProviderServiceProxy != null) { - deviceProviderServiceProxy.register(xid, result); - } - - // send message down RPC - toDeviceProvider.onNext(msgBuilder.build()); - - // wait for reply - try { - return result.get(10, TimeUnit.SECONDS); - } catch (InterruptedException e) { - log.debug("isReachable({}) was Interrupted", deviceId, e); - Thread.currentThread().interrupt(); - } catch (TimeoutException e) { - log.warn("isReachable({}) Timed out", deviceId, e); - } catch (ExecutionException e) { - log.error("isReachable({}) Execution failed", deviceId, e); - // close session? - } - return false; - // TODO Catch Exceptions and call onError() - } - - @Override - public ProviderId id() { - return checkNotNull(providerId, "not initialized yet"); - } - - } -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/package-info.java b/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/package-info.java deleted file mode 100644 index d667ea77..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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 based RemoteServiceProvider implementation. - */ -package org.onosproject.incubator.rpc.grpc; diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/proto/Device.proto b/framework/src/onos/incubator/rpc-grpc/src/main/proto/Device.proto deleted file mode 100644 index aae46d96..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/proto/Device.proto +++ /dev/null @@ -1,131 +0,0 @@ -syntax = "proto3"; -option java_package = "org.onosproject.grpc"; - -import "Port.proto"; -package Device; - -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; -} - -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 annotations = 8; -} - -enum MastershipRole { - NONE = 0; - MASTER = 1; - STANDBY = 2; -} - -message DeviceConnected { - // DeviceID as String DeviceId#toString - string device_id = 1; - DeviceDescription device_description = 2; -} - -message DeviceDisconnected { - // DeviceID as String DeviceId#toString - string device_id = 1; -} - -message UpdatePorts { - // DeviceID as String DeviceId#toString - string device_id = 1; - repeated Port.PortDescription port_descriptions= 2; -} - -message PortStatusChanged { - // DeviceID as String DeviceId#toString - string device_id = 1; - Port.PortDescription port_description= 2; -} - -message ReceivedRoleReply { - // DeviceID as String DeviceId#toString - string device_id = 1; - MastershipRole requested = 2; - MastershipRole response = 3; -} - -message UpdatePortStatistics { - // DeviceID as String DeviceId#toString - string device_id = 1; - repeated Port.PortStatistics port_statistics = 2; -} - -message RegisterProvider { - // DeviceProvider's ProviderId scheme - string provider_scheme = 1; -} - -message DeviceProviderServiceMsg { - oneof method { - DeviceConnected device_connected= 1; - DeviceDisconnected device_disconnected = 2; - UpdatePorts update_ports= 3; - PortStatusChanged port_status_changed = 4; - ReceivedRoleReply received_role_reply = 5; - UpdatePortStatistics update_port_statistics = 6; - - // This message is for return value of DeviceProvider#isReachable - IsReachableResponse is_reachable_response = 7; - - // This MUST be the 1st message over the stream - RegisterProvider register_provider = 8; - } -} - -message TriggerProbe { - // DeviceID as String DeviceId#toString - string device_id = 1; -} - -message RoleChanged { - // DeviceID as String DeviceId#toString - string device_id = 1; - MastershipRole new_role = 2; -} - -message IsReachableRequest { - int32 xid = 1; - // DeviceID as String DeviceId#toString - string device_id = 2; -} - -message IsReachableResponse { - int32 xid = 1; - bool is_reachable = 2; -} - -message DeviceProviderMsg { - oneof method { - TriggerProbe trigger_probe = 1; - RoleChanged role_changed = 2; - IsReachableRequest is_reachable_request= 3; - } -} - -service DeviceProviderRegistryRpc { - rpc Register(stream DeviceProviderServiceMsg) returns (stream DeviceProviderMsg); -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/main/proto/Port.proto b/framework/src/onos/incubator/rpc-grpc/src/main/proto/Port.proto deleted file mode 100644 index f32193cc..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/main/proto/Port.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; -option java_package = "org.onosproject.grpc"; - -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; -} - -// TODO What are we going to do with more specific PortDescription ... -message PortDescription { - // PortNumber as String PortNumber#toString - string port_number = 1; - bool is_enabled = 2; - PortType type = 3; - int64 port_speed = 4; - map annotations = 8; -} - -message PortStatistics { - int32 port = 1; - int64 packets_received = 2; - int64 packets_sent = 3; - // TODO add all other fields -} diff --git a/framework/src/onos/incubator/rpc-grpc/src/test/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceTest.java b/framework/src/onos/incubator/rpc-grpc/src/test/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceTest.java deleted file mode 100644 index 69db5714..00000000 --- a/framework/src/onos/incubator/rpc-grpc/src/test/java/org/onosproject/incubator/rpc/grpc/GrpcRemoteServiceTest.java +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright 2015 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.rpc.grpc; - -import static org.junit.Assert.*; -import static org.onosproject.net.DeviceId.deviceId; - -import java.io.IOException; -import java.net.ServerSocket; -import java.net.URI; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang3.RandomUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onlab.packet.ChassisId; -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.incubator.rpc.RemoteServiceContextProvider; -import org.onosproject.incubator.rpc.RemoteServiceContextProviderService; -import org.onosproject.incubator.rpc.RemoteServiceProviderRegistry; -import org.onosproject.net.DefaultAnnotations; -import org.onosproject.net.Device.Type; -import org.onosproject.net.DeviceId; -import org.onosproject.net.MastershipRole; -import org.onosproject.net.PortNumber; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.device.DefaultDeviceDescription; -import org.onosproject.net.device.DefaultPortDescription; -import org.onosproject.net.device.DeviceDescription; -import org.onosproject.net.device.DeviceProvider; -import org.onosproject.net.device.DeviceProviderRegistry; -import org.onosproject.net.device.DeviceProviderService; -import org.onosproject.net.device.PortDescription; -import org.onosproject.net.device.PortStatistics; -import org.onosproject.net.provider.AbstractProviderRegistry; -import org.onosproject.net.provider.AbstractProviderService; -import org.onosproject.net.provider.ProviderId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.ImmutableList; - -/** - * Set of tests of the gRPC RemoteService components. - */ -public class GrpcRemoteServiceTest { - - private static final DeviceId DEVICE_ID = deviceId("dev:000001"); - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private static final ProviderId PID = new ProviderId("test", "com.exmaple.test"); - - private static final URI DURI = URI.create("dev:000001"); - - private static final String MFR = "mfr"; - - private static final String HW = "hw"; - - private static final String SW = "sw"; - - private static final String SN = "serial"; - - private static final ChassisId CHASSIS = new ChassisId(42); - - private static final SparseAnnotations ANON = DefaultAnnotations.builder() - .set("foo", "var") - .build(); - - private static final PortNumber PORT = PortNumber.portNumber(99); - - private static final DeviceDescription DDESC - = new DefaultDeviceDescription(DURI, Type.SWITCH, MFR, HW, SW, SN, - CHASSIS, ANON); - - private GrpcRemoteServiceServer server; - private GrpcRemoteServiceProvider client; - - private DeviceProvider svSideDeviceProvider; - - private MTestDeviceProviderService svDeviceProviderService; - - private CountDownLatch serverReady; - - private URI uri; - - public static int pickListenPort() { - try { - // pick unused port - ServerSocket socket = new ServerSocket(0); - int port = socket.getLocalPort(); - socket.close(); - return port; - } catch (IOException e) { - // something went wrong, try picking randomly - return RandomUtils.nextInt(49152, 0xFFFF + 1); - } - } - - @Before - public void setUp() throws Exception { - serverReady = new CountDownLatch(1); - server = new GrpcRemoteServiceServer(); - server.deviceProviderRegistry = new MTestDeviceProviderRegistry(); - // todo: pass proper ComponentContext - server.listenPort = pickListenPort(); - uri = URI.create("grpc://localhost:" + server.listenPort); - server.activate(null); - - client = new GrpcRemoteServiceProvider(); - client.rpcRegistry = new NoOpRemoteServiceProviderRegistry(); - client.activate(); - } - - @After - public void tearDown() { - client.deactivate(); - server.deactivate(); - } - - private static void assertEqualsButNotSame(Object expected, Object actual) { - assertEquals(expected, actual); - assertNotSame("Cannot be same instance if it properly went through gRPC", - expected, actual); - } - - @Test - public void basics() throws InterruptedException { - RemoteServiceContext remoteServiceContext = client.get(uri); - assertNotNull(remoteServiceContext); - - DeviceProviderRegistry deviceProviderRegistry = remoteServiceContext.get(DeviceProviderRegistry.class); - assertNotNull(deviceProviderRegistry); - - CTestDeviceProvider clDeviceProvider = new CTestDeviceProvider(); - DeviceProviderService clDeviceProviderService = deviceProviderRegistry.register(clDeviceProvider); - - assertTrue(serverReady.await(10, TimeUnit.SECONDS)); - - // client to server communication - clDeviceProviderService.deviceConnected(DEVICE_ID, DDESC); - assertTrue(svDeviceProviderService.deviceConnected.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.deviceConnectedDid); - assertEqualsButNotSame(DDESC, svDeviceProviderService.deviceConnectedDesc); - - PortDescription portDescription = new DefaultPortDescription(PORT, true, ANON); - List portDescriptions = ImmutableList.of(portDescription); - clDeviceProviderService.updatePorts(DEVICE_ID, portDescriptions); - assertTrue(svDeviceProviderService.updatePorts.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.updatePortsDid); - assertEqualsButNotSame(portDescriptions, svDeviceProviderService.updatePortsDescs); - - MastershipRole cRole = MastershipRole.MASTER; - MastershipRole dRole = MastershipRole.STANDBY; - clDeviceProviderService.receivedRoleReply(DEVICE_ID, cRole, dRole); - assertTrue(svDeviceProviderService.receivedRoleReply.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.receivedRoleReplyDid); - assertEquals(cRole, svDeviceProviderService.receivedRoleReplyRequested); - assertEquals(dRole, svDeviceProviderService.receivedRoleReplyResponse); - - clDeviceProviderService.portStatusChanged(DEVICE_ID, portDescription); - assertTrue(svDeviceProviderService.portStatusChanged.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.portStatusChangedDid); - assertEqualsButNotSame(portDescription, svDeviceProviderService.portStatusChangedDesc); - - Collection portStatistics = Collections.emptyList(); - clDeviceProviderService.updatePortStatistics(DEVICE_ID, portStatistics); - assertTrue(svDeviceProviderService.updatePortStatistics.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.updatePortStatisticsDid); - assertEqualsButNotSame(portStatistics, svDeviceProviderService.updatePortStatisticsStats); - - clDeviceProviderService.deviceDisconnected(DEVICE_ID); - assertTrue(svDeviceProviderService.deviceDisconnected.await(10, TimeUnit.SECONDS)); - assertEqualsButNotSame(DEVICE_ID, svDeviceProviderService.deviceDisconnectedDid); - - - - // server to client communication - svSideDeviceProvider.triggerProbe(DEVICE_ID); - assertTrue(clDeviceProvider.triggerProbe.await(10, TimeUnit.SECONDS)); - assertEquals(DEVICE_ID, clDeviceProvider.triggerProbeDid); - assertNotSame("Cannot be same instance if it properly went through gRPC", - DEVICE_ID, clDeviceProvider.triggerProbeDid); - - svSideDeviceProvider.roleChanged(DEVICE_ID, MastershipRole.STANDBY); - assertTrue(clDeviceProvider.roleChanged.await(10, TimeUnit.SECONDS)); - assertEquals(DEVICE_ID, clDeviceProvider.roleChangedDid); - assertNotSame("Cannot be same instance if it properly went through gRPC", - DEVICE_ID, clDeviceProvider.roleChangedDid); - assertEquals(MastershipRole.STANDBY, clDeviceProvider.roleChangedNewRole); - - clDeviceProvider.isReachableReply = false; - assertEquals(clDeviceProvider.isReachableReply, - svSideDeviceProvider.isReachable(DEVICE_ID)); - assertTrue(clDeviceProvider.isReachable.await(10, TimeUnit.SECONDS)); - assertEquals(DEVICE_ID, clDeviceProvider.isReachableDid); - assertNotSame("Cannot be same instance if it properly went through gRPC", - DEVICE_ID, clDeviceProvider.isReachableDid); - } - - /** - * Device Provider on CO side. - */ - public class CTestDeviceProvider implements DeviceProvider { - - final CountDownLatch triggerProbe = new CountDownLatch(1); - DeviceId triggerProbeDid; - - final CountDownLatch roleChanged = new CountDownLatch(1); - DeviceId roleChangedDid; - MastershipRole roleChangedNewRole; - - final CountDownLatch isReachable = new CountDownLatch(1); - DeviceId isReachableDid; - boolean isReachableReply = false; - - @Override - public ProviderId id() { - return PID; - } - - @Override - public void triggerProbe(DeviceId deviceId) { - log.info("triggerProbe({}) on Client called", deviceId); - triggerProbeDid = deviceId; - triggerProbe.countDown(); - } - - @Override - public void roleChanged(DeviceId deviceId, MastershipRole newRole) { - log.info("roleChanged({},{}) on Client called", deviceId, newRole); - roleChangedDid = deviceId; - roleChangedNewRole = newRole; - roleChanged.countDown(); - } - - @Override - public boolean isReachable(DeviceId deviceId) { - log.info("isReachable({}) on Client called", deviceId); - isReachableDid = deviceId; - isReachable.countDown(); - return isReachableReply; - } - - } - - class NoOpRemoteServiceProviderRegistry - implements RemoteServiceProviderRegistry { - - @Override - public RemoteServiceContextProviderService register(RemoteServiceContextProvider provider) { - return new RemoteServiceContextProviderService() { - - @Override - public RemoteServiceContextProvider provider() { - return provider; - } - }; - } - - @Override - public void unregister(RemoteServiceContextProvider provider) { - } - - @Override - public Set getProviders() { - return Collections.emptySet(); - } - } - - /** - * DeviceProvider on Metro side. - */ - public class MTestDeviceProviderRegistry - extends AbstractProviderRegistry - implements DeviceProviderRegistry { - - @Override - protected DeviceProviderService createProviderService(DeviceProvider provider) { - log.info("createProviderService({})", provider); - svSideDeviceProvider = provider; - svDeviceProviderService = new MTestDeviceProviderService(provider); - serverReady.countDown(); - return svDeviceProviderService; - } - - } - - private final class MTestDeviceProviderService - extends AbstractProviderService - implements DeviceProviderService { - - public MTestDeviceProviderService(DeviceProvider provider) { - super(provider); - } - - - final CountDownLatch deviceConnected = new CountDownLatch(1); - DeviceId deviceConnectedDid; - DeviceDescription deviceConnectedDesc; - - @Override - public void deviceConnected(DeviceId deviceId, - DeviceDescription deviceDescription) { - log.info("deviceConnected({}, {}) on Server called", deviceId, deviceDescription); - deviceConnectedDid = deviceId; - deviceConnectedDesc = deviceDescription; - deviceConnected.countDown(); - } - - - final CountDownLatch updatePorts = new CountDownLatch(1); - DeviceId updatePortsDid; - List updatePortsDescs; - - @Override - public void updatePorts(DeviceId deviceId, - List portDescriptions) { - log.info("updatePorts({}, {}) on Server called", deviceId, portDescriptions); - updatePortsDid = deviceId; - updatePortsDescs = portDescriptions; - updatePorts.countDown(); - } - - final CountDownLatch receivedRoleReply = new CountDownLatch(1); - DeviceId receivedRoleReplyDid; - MastershipRole receivedRoleReplyRequested; - MastershipRole receivedRoleReplyResponse; - - @Override - public void receivedRoleReply(DeviceId deviceId, MastershipRole requested, - MastershipRole response) { - log.info("receivedRoleReply({}, {}, {}) on Server called", deviceId, requested, response); - receivedRoleReplyDid = deviceId; - receivedRoleReplyRequested = requested; - receivedRoleReplyResponse = response; - receivedRoleReply.countDown(); - } - - final CountDownLatch portStatusChanged = new CountDownLatch(1); - DeviceId portStatusChangedDid; - PortDescription portStatusChangedDesc; - - - @Override - public void portStatusChanged(DeviceId deviceId, - PortDescription portDescription) { - log.info("portStatusChanged({}, {}) on Server called", deviceId, portDescription); - portStatusChangedDid = deviceId; - portStatusChangedDesc = portDescription; - portStatusChanged.countDown(); - } - - final CountDownLatch updatePortStatistics = new CountDownLatch(1); - DeviceId updatePortStatisticsDid; - Collection updatePortStatisticsStats; - - - @Override - public void updatePortStatistics(DeviceId deviceId, - Collection portStatistics) { - log.info("updatePortStatistics({}, {}) on Server called", deviceId, portStatistics); - updatePortStatisticsDid = deviceId; - updatePortStatisticsStats = portStatistics; - updatePortStatistics.countDown(); - } - - final CountDownLatch deviceDisconnected = new CountDownLatch(1); - DeviceId deviceDisconnectedDid; - - @Override - public void deviceDisconnected(DeviceId deviceId) { - log.info("deviceDisconnected({}) on Server called", deviceId); - deviceDisconnectedDid = deviceId; - deviceDisconnected.countDown(); - } - } - -} diff --git a/framework/src/onos/incubator/rpc/pom.xml b/framework/src/onos/incubator/rpc/pom.xml deleted file mode 100644 index d48ce19e..00000000 --- a/framework/src/onos/incubator/rpc/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - 4.0.0 - - onos-incubator - org.onosproject - 1.4.0-rc1 - - - onos-incubator-rpc - bundle - - ONOS inter-cluster RPC service - http://onosproject.org - - - org.onosproject.incubator.rpc - - - - - org.onosproject - onos-api - - - - org.onosproject - onlab-osgi - - - - junit - junit - test - - - - org.onosproject - onos-api - test - tests - - - - org.onosproject - onos-incubator-api - - - - org.apache.felix - org.apache.felix.scr.annotations - provided - - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.apache.felix - maven-scr-plugin - - - generate-scr-srcdescriptor - - scr - - - - - - bundle - war - - - - - org.onosproject - onos-maven-plugin - - - cfg - generate-resources - - cfg - - - - swagger - generate-sources - - swagger - - - - app - package - - app - - - - - - - - diff --git a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/AbstractProviderRegistry.java b/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/AbstractProviderRegistry.java deleted file mode 100644 index 2a8dda32..00000000 --- a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/AbstractProviderRegistry.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2015 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.rpc.impl; - -import java.util.Map; -import java.util.Set; - -import org.onosproject.incubator.rpc.RemoteServiceContextProvider; -import org.onosproject.incubator.rpc.RemoteServiceContextProviderService; -import org.onosproject.incubator.rpc.RemoteServiceProviderRegistry; -import org.onosproject.net.provider.ProviderId; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; - -// Probably should change name or add missing feature (provider from scheme) to -// org.onosproject.net.provider.AbstractProviderRegistry -@Beta -abstract class AbstractProviderRegistry - implements RemoteServiceProviderRegistry { - - - private final Map pidToProvider = Maps.newConcurrentMap(); - private final Map schemeToProvider = Maps.newConcurrentMap(); - - public AbstractProviderRegistry() { - super(); - } - - protected abstract RemoteServiceContextProviderService createProviderService(RemoteServiceContextProvider provider); - - @Override - public synchronized RemoteServiceContextProviderService register(RemoteServiceContextProvider provider) { - // TODO check if it already exists - pidToProvider.put(provider.id(), provider); - schemeToProvider.put(provider.id().scheme(), provider); - return createProviderService(provider); - } - - @Override - public synchronized void unregister(RemoteServiceContextProvider provider) { - pidToProvider.remove(provider.id(), provider); - schemeToProvider.remove(provider.id().scheme(), provider); - } - - @Override - public Set getProviders() { - return ImmutableSet.copyOf(pidToProvider.keySet()); - } - - protected RemoteServiceContextProvider getProvider(ProviderId pid) { - return pidToProvider.get(pid); - } - - protected RemoteServiceContextProvider getProvider(String scheme) { - return schemeToProvider.get(scheme); - } - -} diff --git a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/LocalRemoteServiceProvider.java b/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/LocalRemoteServiceProvider.java deleted file mode 100644 index d38248ab..00000000 --- a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/LocalRemoteServiceProvider.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2015 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.rpc.impl; - -import static com.google.common.base.Preconditions.checkArgument; - -import java.net.URI; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.onlab.osgi.DefaultServiceDirectory; -import org.onlab.osgi.ServiceDirectory; -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.incubator.rpc.RemoteServiceContextProvider; -import org.onosproject.incubator.rpc.RemoteServiceContextProviderService; -import org.onosproject.incubator.rpc.RemoteServiceProviderRegistry; -import org.onosproject.net.provider.ProviderId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.annotations.Beta; - -/** - * Sample implementation of RemoteServiceContextProvider. - * - * Scheme: "local", calling corresponding local service on request. - * Only expected for testing until real RPC implementation is ready. - * - * Note: This is expected to be removed or separated out as separate bundle - * once other RPC implementaion became available. - */ -@Beta -@Component(immediate = true) -public class LocalRemoteServiceProvider implements RemoteServiceContextProvider { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - private RemoteServiceContext theOne = new LocalServiceContext(); - - private static final ProviderId PID = new ProviderId("local", "org.onosproject.rpc.provider.local"); - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected RemoteServiceProviderRegistry rpcRegistry; - - private final Map, Object> services = new ConcurrentHashMap<>(); - - private RemoteServiceContextProviderService providerService; - - @Activate - protected void activate() { - - services.put(SomeOtherService.class, new SomeOtherServiceImpl()); - - providerService = rpcRegistry.register(this); - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - rpcRegistry.unregister(this); - log.info("Stopped"); - } - - @Override - public ProviderId id() { - return PID; - } - - @Override - public RemoteServiceContext get(URI uri) { - checkArgument(Objects.equals(uri.getScheme(), "local")); - return theOne; - } - - private final class LocalServiceContext implements RemoteServiceContext { - - private final ServiceDirectory directory = new DefaultServiceDirectory(); - - @Override - public T get(Class serviceClass) { - @SuppressWarnings("unchecked") - T service = (T) services.get(serviceClass); - if (service != null) { - return service; - } - // look up OSGi services on this host. - // provided to unblock development depending on RPC. - return directory.get(serviceClass); - } - } - - // Service provided by RPC can be non-OSGi Service - public static interface SomeOtherService { - String hello(); - } - - public static class SomeOtherServiceImpl implements SomeOtherService { - - @Override - public String hello() { - return "Goodbye"; - } - } - -} diff --git a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/RemoteServiceManager.java b/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/RemoteServiceManager.java deleted file mode 100644 index 3b851739..00000000 --- a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/RemoteServiceManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015 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.rpc.impl; - -import java.net.URI; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.incubator.rpc.RemoteServiceDirectory; -import org.onosproject.incubator.rpc.RemoteServiceContextProvider; -import org.onosproject.incubator.rpc.RemoteServiceContextProviderService; -import org.onosproject.incubator.rpc.RemoteServiceProviderRegistry; -import org.onosproject.net.provider.AbstractProviderService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.annotations.Beta; - -/** - * Provides RemoteService related APIs. - */ -@Beta -@Component(immediate = true) -@Service -public class RemoteServiceManager extends AbstractProviderRegistry - implements RemoteServiceDirectory, RemoteServiceProviderRegistry { - - private final Logger log = LoggerFactory.getLogger(getClass()); - - @Activate - protected void activate() { - log.info("Started"); - } - - @Deactivate - protected void deactivate() { - log.info("Stopped"); - } - - @Override - public RemoteServiceContext get(URI uri) { - RemoteServiceContextProvider factory = getProvider(uri.getScheme()); - if (factory != null) { - return factory.get(uri); - } - throw new UnsupportedOperationException(uri.getScheme() + " not supported"); - } - - private final class InternalRemoteServiceContextProviderService - extends AbstractProviderService - implements RemoteServiceContextProviderService { - - public InternalRemoteServiceContextProviderService(RemoteServiceContextProvider provider) { - super(provider); - } - } - - // make this abstract method if slicing out - @Override - protected RemoteServiceContextProviderService createProviderService(RemoteServiceContextProvider provider) { - return new InternalRemoteServiceContextProviderService(provider); - } - -} diff --git a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/package-info.java b/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/package-info.java deleted file mode 100644 index c77b4bec..00000000 --- a/framework/src/onos/incubator/rpc/src/main/java/org/onosproject/incubator/rpc/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the inter-cluster RPC service. - */ -package org.onosproject.incubator.rpc.impl; diff --git a/framework/src/onos/incubator/rpc/src/test/java/org/onosproject/incubator/rpc/impl/RemoteServiceManagerTest.java b/framework/src/onos/incubator/rpc/src/test/java/org/onosproject/incubator/rpc/impl/RemoteServiceManagerTest.java deleted file mode 100644 index 1bfa1e42..00000000 --- a/framework/src/onos/incubator/rpc/src/test/java/org/onosproject/incubator/rpc/impl/RemoteServiceManagerTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2015 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.rpc.impl; - -import static org.junit.Assert.*; - -import java.net.URI; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onosproject.incubator.rpc.RemoteServiceContext; -import org.onosproject.incubator.rpc.RemoteServiceDirectory; -import org.onosproject.incubator.rpc.impl.LocalRemoteServiceProvider.SomeOtherService; - -/** - * Set of tests of the RemoteServiceManager component. - */ -public class RemoteServiceManagerTest { - - private static final URI LOCAL_URI = URI.create("local://whateverIgnored"); - - private RemoteServiceManager rpcManager; - private RemoteServiceDirectory rpcDirectory; - - private LocalRemoteServiceProvider rpcProvider; - - @Before - public void setUp() { - rpcManager = new RemoteServiceManager(); - rpcManager.activate(); - rpcDirectory = rpcManager; - - rpcProvider = new LocalRemoteServiceProvider(); - rpcProvider.rpcRegistry = rpcManager; - rpcProvider.activate(); - - } - - @After - public void tearDown() { - rpcProvider.deactivate(); - - rpcManager.deactivate(); - } - - @Test - public void basics() { - RemoteServiceContext remoteServiceContext = rpcDirectory.get(LOCAL_URI); - assertNotNull("Expecting valid RPC context", remoteServiceContext); - - SomeOtherService someService = remoteServiceContext.get(SomeOtherService.class); - assertNotNull("Expecting reference to sample service", someService); - - assertEquals("Goodbye", someService.hello()); - } - -} diff --git a/framework/src/onos/incubator/store/pom.xml b/framework/src/onos/incubator/store/pom.xml deleted file mode 100644 index 43e51727..00000000 --- a/framework/src/onos/incubator/store/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - 4.0.0 - - - org.onosproject - onos-incubator - 1.4.0-rc1 - ../pom.xml - - - onos-incubator-store - bundle - - ONOS incubating distributed store subsystems - - - - org.onosproject - onos-incubator-api - ${project.version} - - - - org.onosproject - onos-incubator-api - ${project.version} - tests - test - - - - org.onosproject - onos-core-dist - ${project.version} - - - - com.google.guava - guava-testlib - test - - - org.easymock - easymock - test - - - org.onosproject - onos-api - tests - test - - - - org.apache.felix - org.apache.felix.scr.annotations - - - - - - - - org.apache.felix - maven-scr-plugin - - - - - diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/impl/package-info.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/impl/package-info.java deleted file mode 100644 index 2755a98f..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Incubating distributed store implementations. - */ -package org.onosproject.incubator.store.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/DistributedMeterStore.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/DistributedMeterStore.java deleted file mode 100644 index 62a94675..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/DistributedMeterStore.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2015 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.store.meter.impl; - -import com.google.common.collect.Collections2; -import com.google.common.collect.Maps; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.cluster.ClusterService; -import org.onosproject.cluster.NodeId; -import org.onosproject.mastership.MastershipService; -import org.onosproject.net.meter.Band; -import org.onosproject.net.meter.DefaultBand; -import org.onosproject.net.meter.DefaultMeter; -import org.onosproject.net.meter.Meter; -import org.onosproject.net.meter.MeterEvent; -import org.onosproject.net.meter.MeterFailReason; -import org.onosproject.net.meter.MeterId; -import org.onosproject.net.meter.MeterKey; -import org.onosproject.net.meter.MeterOperation; -import org.onosproject.net.meter.MeterState; -import org.onosproject.net.meter.MeterStore; -import org.onosproject.net.meter.MeterStoreDelegate; -import org.onosproject.net.meter.MeterStoreResult; -import org.onosproject.store.AbstractStore; -import org.onosproject.store.serializers.KryoNamespaces; -import org.onosproject.store.service.ConsistentMap; -import org.onosproject.store.service.MapEvent; -import org.onosproject.store.service.MapEventListener; -import org.onosproject.store.service.Serializer; -import org.onosproject.store.service.StorageException; -import org.onosproject.store.service.StorageService; -import org.onosproject.store.service.Versioned; -import org.slf4j.Logger; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -import static org.slf4j.LoggerFactory.getLogger; - -/** - * A distributed meter store implementation. Meters are stored consistently - * across the cluster. - */ -@Component(immediate = true) -@Service -public class DistributedMeterStore extends AbstractStore - implements MeterStore { - - private Logger log = getLogger(getClass()); - - private static final String METERSTORE = "onos-meter-store"; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - private StorageService storageService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - private MastershipService mastershipService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - private ClusterService clusterService; - - private ConsistentMap meters; - private NodeId local; - - private MapEventListener mapListener = new InternalMapEventListener(); - - private Map> futures = - Maps.newConcurrentMap(); - - @Activate - public void activate() { - - local = clusterService.getLocalNode().id(); - - - meters = storageService.consistentMapBuilder() - .withName(METERSTORE) - .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API), - MeterKey.class, - MeterData.class, - DefaultMeter.class, - DefaultBand.class, - Band.Type.class, - MeterState.class, - Meter.Unit.class, - MeterFailReason.class, - MeterId.class)).build(); - - meters.addListener(mapListener); - - log.info("Started"); - } - - @Deactivate - public void deactivate() { - - meters.removeListener(mapListener); - log.info("Stopped"); - } - - - @Override - public CompletableFuture storeMeter(Meter meter) { - CompletableFuture future = new CompletableFuture<>(); - MeterKey key = MeterKey.key(meter.deviceId(), meter.id()); - futures.put(key, future); - MeterData data = new MeterData(meter, null, local); - - try { - meters.put(key, data); - } catch (StorageException e) { - future.completeExceptionally(e); - } - - return future; - - } - - @Override - public CompletableFuture deleteMeter(Meter meter) { - CompletableFuture future = new CompletableFuture<>(); - MeterKey key = MeterKey.key(meter.deviceId(), meter.id()); - futures.put(key, future); - - MeterData data = new MeterData(meter, null, local); - - // update the state of the meter. It will be pruned by observing - // that it has been removed from the dataplane. - try { - if (meters.computeIfPresent(key, (k, v) -> data) == null) { - future.complete(MeterStoreResult.success()); - } - } catch (StorageException e) { - future.completeExceptionally(e); - } - - - return future; - } - - @Override - public CompletableFuture updateMeter(Meter meter) { - CompletableFuture future = new CompletableFuture<>(); - MeterKey key = MeterKey.key(meter.deviceId(), meter.id()); - futures.put(key, future); - - MeterData data = new MeterData(meter, null, local); - try { - if (meters.computeIfPresent(key, (k, v) -> data) == null) { - future.complete(MeterStoreResult.fail(MeterFailReason.INVALID_METER)); - } - } catch (StorageException e) { - future.completeExceptionally(e); - } - return future; - } - - @Override - public void updateMeterState(Meter meter) { - MeterKey key = MeterKey.key(meter.deviceId(), meter.id()); - meters.computeIfPresent(key, (k, v) -> { - DefaultMeter m = (DefaultMeter) v.meter(); - m.setState(meter.state()); - m.setProcessedPackets(meter.packetsSeen()); - m.setProcessedBytes(meter.bytesSeen()); - m.setLife(meter.life()); - // TODO: Prune if drops to zero. - m.setReferenceCount(meter.referenceCount()); - return new MeterData(m, null, v.origin()); - }); - } - - @Override - public Meter getMeter(MeterKey key) { - MeterData data = Versioned.valueOrElse(meters.get(key), null); - return data == null ? null : data.meter(); - } - - @Override - public Collection getAllMeters() { - return Collections2.transform(meters.asJavaMap().values(), - MeterData::meter); - } - - @Override - public void failedMeter(MeterOperation op, MeterFailReason reason) { - MeterKey key = MeterKey.key(op.meter().deviceId(), op.meter().id()); - meters.computeIfPresent(key, (k, v) -> - new MeterData(v.meter(), reason, v.origin())); - } - - @Override - public void deleteMeterNow(Meter m) { - MeterKey key = MeterKey.key(m.deviceId(), m.id()); - futures.remove(key); - meters.remove(key); - } - - private class InternalMapEventListener implements MapEventListener { - @Override - public void event(MapEvent event) { - MeterKey key = event.key(); - MeterData data = event.value().value(); - NodeId master = mastershipService.getMasterFor(data.meter().deviceId()); - switch (event.type()) { - case INSERT: - case UPDATE: - switch (data.meter().state()) { - case PENDING_ADD: - case PENDING_REMOVE: - if (!data.reason().isPresent() && local.equals(master)) { - notifyDelegate( - new MeterEvent(data.meter().state() == MeterState.PENDING_ADD ? - MeterEvent.Type.METER_ADD_REQ : MeterEvent.Type.METER_REM_REQ, - data.meter())); - } else if (data.reason().isPresent() && local.equals(data.origin())) { - MeterStoreResult msr = MeterStoreResult.fail(data.reason().get()); - //TODO: No future -> no friend - futures.get(key).complete(msr); - } - break; - case ADDED: - if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_ADD) { - futures.remove(key).complete(MeterStoreResult.success()); - } - break; - case REMOVED: - if (local.equals(data.origin()) && data.meter().state() == MeterState.PENDING_REMOVE) { - futures.remove(key).complete(MeterStoreResult.success()); - } - break; - default: - log.warn("Unknown meter state type {}", data.meter().state()); - } - break; - case REMOVE: - //Only happens at origin so we do not need to care. - break; - default: - log.warn("Unknown Map event type {}", event.type()); - } - - } - } - - -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/MeterData.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/MeterData.java deleted file mode 100644 index c72bc2e3..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/MeterData.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2015 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.store.meter.impl; - -import org.onosproject.cluster.NodeId; -import org.onosproject.net.meter.Meter; -import org.onosproject.net.meter.MeterFailReason; - -import java.util.Optional; - -/** - * A class representing the meter information stored in the meter store. - */ -public class MeterData { - - private final Meter meter; - private final Optional reason; - private final NodeId origin; - - public MeterData(Meter meter, MeterFailReason reason, NodeId origin) { - this.meter = meter; - this.reason = Optional.ofNullable(reason); - this.origin = origin; - } - - public Meter meter() { - return meter; - } - - public Optional reason() { - return this.reason; - } - - public NodeId origin() { - return this.origin; - } - - -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/package-info.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/package-info.java deleted file mode 100644 index c1992f07..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/meter/impl/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * A distributed meter store implementation that stores meter data consistently - * across the cluster. - */ -package org.onosproject.incubator.store.meter.impl; diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java deleted file mode 100644 index a7183de8..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/DistributedLabelResourceStore.java +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Copyright 2015 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.store.resource.impl; - -import static org.onlab.util.Tools.groupedThreads; -import static org.slf4j.LoggerFactory.getLogger; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.util.KryoNamespace; -import org.onosproject.cluster.ClusterService; -import org.onosproject.cluster.NodeId; -import org.onosproject.incubator.net.resource.label.DefaultLabelResource; -import org.onosproject.incubator.net.resource.label.LabelResource; -import org.onosproject.incubator.net.resource.label.LabelResourceDelegate; -import org.onosproject.incubator.net.resource.label.LabelResourceEvent; -import org.onosproject.incubator.net.resource.label.LabelResourceEvent.Type; -import org.onosproject.incubator.net.resource.label.LabelResourceId; -import org.onosproject.incubator.net.resource.label.LabelResourcePool; -import org.onosproject.incubator.net.resource.label.LabelResourceRequest; -import org.onosproject.incubator.net.resource.label.LabelResourceStore; -import org.onosproject.mastership.MastershipService; -import org.onosproject.net.Device; -import org.onosproject.net.DeviceId; -import org.onosproject.net.device.DeviceService; -import org.onosproject.store.AbstractStore; -import org.onosproject.store.cluster.messaging.ClusterCommunicationService; -import org.onosproject.store.cluster.messaging.ClusterMessage; -import org.onosproject.store.cluster.messaging.ClusterMessageHandler; -import org.onosproject.store.serializers.KryoNamespaces; -import org.onosproject.store.service.ConsistentMap; -import org.onosproject.store.service.Serializer; -import org.onosproject.store.service.StorageService; -import org.onosproject.store.service.Versioned; -import org.slf4j.Logger; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Multimap; - -/** - * Manages label resources using copycat. - */ -@Component(immediate = true, enabled = true) -@Service -public class DistributedLabelResourceStore - extends AbstractStore - implements LabelResourceStore { - private final Logger log = getLogger(getClass()); - - private static final String POOL_MAP_NAME = "labelresourcepool"; - - private static final String GLOBAL_RESOURCE_POOL_DEVICE_ID = "global_resource_pool_device_id"; - - private ConsistentMap resourcePool = null; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected StorageService storageService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected MastershipService mastershipService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ClusterCommunicationService clusterCommunicator; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ClusterService clusterService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected DeviceService deviceService; - - private ExecutorService messageHandlingExecutor; - private static final int MESSAGE_HANDLER_THREAD_POOL_SIZE = 8; - private static final long PEER_REQUEST_TIMEOUT_MS = 5000; - - private static final Serializer SERIALIZER = Serializer - .using(new KryoNamespace.Builder().register(KryoNamespaces.API) - .register(LabelResourceEvent.class) - .register(LabelResourcePool.class).register(DeviceId.class) - .register(LabelResourceRequest.class) - .register(LabelResourceRequest.Type.class) - .register(LabelResourceEvent.Type.class) - .register(DefaultLabelResource.class) - .register(LabelResourceId.class) - .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID).build()); - - @Activate - public void activate() { - - resourcePool = storageService - .consistentMapBuilder() - .withName(POOL_MAP_NAME).withSerializer(SERIALIZER) - .withPartitionsDisabled().build(); - messageHandlingExecutor = Executors - .newFixedThreadPool(MESSAGE_HANDLER_THREAD_POOL_SIZE, - groupedThreads("onos/store/flow", - "message-handlers")); - clusterCommunicator - .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_CREATED, - new ClusterMessageHandler() { - - @Override - public void handle(ClusterMessage message) { - LabelResourcePool operation = SERIALIZER - .decode(message.payload()); - log.trace("received get flow entry request for {}", - operation); - boolean b = internalCreate(operation); - message.respond(SERIALIZER.encode(b)); - } - }, messageHandlingExecutor); - clusterCommunicator - .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_DESTROYED, - new ClusterMessageHandler() { - - @Override - public void handle(ClusterMessage message) { - DeviceId deviceId = SERIALIZER - .decode(message.payload()); - log.trace("received get flow entry request for {}", - deviceId); - boolean b = internalDestroy(deviceId); - message.respond(SERIALIZER.encode(b)); - } - }, messageHandlingExecutor); - clusterCommunicator - .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_APPLY, - new ClusterMessageHandler() { - - @Override - public void handle(ClusterMessage message) { - LabelResourceRequest request = SERIALIZER - .decode(message.payload()); - log.trace("received get flow entry request for {}", - request); - final Collection resource = internalApply(request); - message.respond(SERIALIZER - .encode(resource)); - } - }, messageHandlingExecutor); - clusterCommunicator - .addSubscriber(LabelResourceMessageSubjects.LABEL_POOL_RELEASE, - new ClusterMessageHandler() { - - @Override - public void handle(ClusterMessage message) { - LabelResourceRequest request = SERIALIZER - .decode(message.payload()); - log.trace("received get flow entry request for {}", - request); - final boolean isSuccess = internalRelease(request); - message.respond(SERIALIZER - .encode(isSuccess)); - } - }, messageHandlingExecutor); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - clusterCommunicator - .removeSubscriber(LabelResourceMessageSubjects.LABEL_POOL_CREATED); - clusterCommunicator - .removeSubscriber(LabelResourceMessageSubjects.LABEL_POOL_APPLY); - clusterCommunicator - .removeSubscriber(LabelResourceMessageSubjects.LABEL_POOL_DESTROYED); - clusterCommunicator - .removeSubscriber(LabelResourceMessageSubjects.LABEL_POOL_RELEASE); - messageHandlingExecutor.shutdown(); - log.info("Stopped"); - } - - @Override - public boolean createDevicePool(DeviceId deviceId, - LabelResourceId beginLabel, - LabelResourceId endLabel) { - LabelResourcePool pool = new LabelResourcePool(deviceId.toString(), - beginLabel.labelId(), - endLabel.labelId()); - return this.create(pool); - } - - @Override - public boolean createGlobalPool(LabelResourceId beginLabel, - LabelResourceId endLabel) { - LabelResourcePool pool = new LabelResourcePool(GLOBAL_RESOURCE_POOL_DEVICE_ID, - beginLabel.labelId(), - endLabel.labelId()); - return this.internalCreate(pool); - } - - private boolean create(LabelResourcePool pool) { - Device device = (Device) deviceService.getDevice(pool.deviceId()); - if (device == null) { - return false; - } - - NodeId master = mastershipService.getMasterFor(pool.deviceId()); - - if (master == null) { - log.warn("Failed to create label resource pool: No master for {}", pool); - return false; - } - - if (master.equals(clusterService.getLocalNode().id())) { - return internalCreate(pool); - } - - log.trace("Forwarding getFlowEntries to {}, which is the primary (master) for device {}", - master, pool.deviceId()); - - return complete(clusterCommunicator - .sendAndReceive(pool, - LabelResourceMessageSubjects.LABEL_POOL_CREATED, - SERIALIZER::encode, SERIALIZER::decode, - master)); - } - - private boolean internalCreate(LabelResourcePool pool) { - Versioned poolOld = resourcePool - .get(pool.deviceId()); - if (poolOld == null) { - resourcePool.put(pool.deviceId(), pool); - LabelResourceEvent event = new LabelResourceEvent(Type.POOL_CREATED, - pool); - notifyDelegate(event); - return true; - } - return false; - } - - @Override - public boolean destroyDevicePool(DeviceId deviceId) { - Device device = (Device) deviceService.getDevice(deviceId); - if (device == null) { - return false; - } - - NodeId master = mastershipService.getMasterFor(deviceId); - - if (master == null) { - log.warn("Failed to destroyDevicePool. No master for {}", deviceId); - return false; - } - - if (master.equals(clusterService.getLocalNode().id())) { - return internalDestroy(deviceId); - } - - log.trace("Forwarding request to {}, which is the primary (master) for device {}", - master, deviceId); - - return complete(clusterCommunicator - .sendAndReceive(deviceId, - LabelResourceMessageSubjects.LABEL_POOL_DESTROYED, - SERIALIZER::encode, SERIALIZER::decode, - master)); - } - - private boolean internalDestroy(DeviceId deviceId) { - Versioned poolOld = resourcePool.get(deviceId); - if (poolOld != null) { - resourcePool.remove(deviceId); - LabelResourceEvent event = new LabelResourceEvent(Type.POOL_DESTROYED, - poolOld.value()); - notifyDelegate(event); - } - log.info("success to destroy the label resource pool of device id {}", - deviceId); - return true; - } - - @Override - public Collection applyFromDevicePool(DeviceId deviceId, - long applyNum) { - Device device = (Device) deviceService.getDevice(deviceId); - if (device == null) { - return Collections.emptyList(); - } - LabelResourceRequest request = new LabelResourceRequest(deviceId, - LabelResourceRequest.Type.APPLY, - applyNum, null); - NodeId master = mastershipService.getMasterFor(deviceId); - - if (master == null) { - log.warn("Failed to applyFromDevicePool: No master for {}", deviceId); - return Collections.emptyList(); - } - - if (master.equals(clusterService.getLocalNode().id())) { - return internalApply(request); - } - - log.trace("Forwarding request to {}, which is the primary (master) for device {}", - master, deviceId); - - return complete(clusterCommunicator - .sendAndReceive(request, - LabelResourceMessageSubjects.LABEL_POOL_APPLY, - SERIALIZER::encode, SERIALIZER::decode, - master)); - } - - private Collection internalApply(LabelResourceRequest request) { - DeviceId deviceId = request.deviceId(); - long applyNum = request.applyNum(); - Versioned poolOld = resourcePool.get(deviceId); - LabelResourcePool pool = poolOld.value(); - Collection result = new HashSet(); - long freeNum = this.getFreeNumOfDevicePool(deviceId); - if (applyNum > freeNum) { - log.info("the free number of the label resource pool of deviceId {} is not enough."); - return Collections.emptyList(); - } - Set releaseLabels = new HashSet(pool.releaseLabelId()); - long tmp = releaseLabels.size() > applyNum ? applyNum : releaseLabels - .size(); - LabelResource resource = null; - for (int i = 0; i < tmp; i++) { - Iterator it = releaseLabels.iterator(); - if (it.hasNext()) { - resource = it.next(); - releaseLabels.remove(resource); - } - result.add(resource); - } - for (long j = pool.currentUsedMaxLabelId().labelId(); j < pool - .currentUsedMaxLabelId().labelId() + applyNum - tmp; j++) { - resource = new DefaultLabelResource(deviceId, - LabelResourceId - .labelResourceId(j)); - result.add(resource); - } - long beginLabel = pool.beginLabel().labelId(); - long endLabel = pool.endLabel().labelId(); - long totalNum = pool.totalNum(); - long current = pool.currentUsedMaxLabelId().labelId() + applyNum - tmp; - long usedNum = pool.usedNum() + applyNum; - ImmutableSet freeLabel = ImmutableSet - .copyOf(releaseLabels); - LabelResourcePool newPool = new LabelResourcePool(deviceId.toString(), - beginLabel, endLabel, - totalNum, usedNum, - current, freeLabel); - resourcePool.put(deviceId, newPool); - log.info("success to apply label resource"); - return result; - } - - @Override - public boolean releaseToDevicePool(Multimap release) { - Map> maps = release.asMap(); - Set deviceIdSet = maps.keySet(); - LabelResourceRequest request = null; - for (Iterator it = deviceIdSet.iterator(); it.hasNext();) { - DeviceId deviceId = (DeviceId) it.next(); - Device device = (Device) deviceService.getDevice(deviceId); - if (device == null) { - continue; - } - ImmutableSet collection = ImmutableSet.copyOf(maps - .get(deviceId)); - request = new LabelResourceRequest(deviceId, - LabelResourceRequest.Type.RELEASE, - 0, collection); - NodeId master = mastershipService.getMasterFor(deviceId); - - if (master == null) { - log.warn("Failed to releaseToDevicePool: No master for {}", deviceId); - return false; - } - - if (master.equals(clusterService.getLocalNode().id())) { - return internalRelease(request); - } - - log.trace("Forwarding request to {}, which is the primary (master) for device {}", - master, deviceId); - - return complete(clusterCommunicator - .sendAndReceive(request, - LabelResourceMessageSubjects.LABEL_POOL_RELEASE, - SERIALIZER::encode, SERIALIZER::decode, - master)); - } - return false; - } - - private boolean internalRelease(LabelResourceRequest request) { - DeviceId deviceId = request.deviceId(); - Collection release = request.releaseCollection(); - Versioned poolOld = resourcePool.get(deviceId); - LabelResourcePool pool = poolOld.value(); - if (pool == null) { - log.info("the label resource pool of device id {} does not exist"); - return false; - } - Set storeSet = new HashSet(pool.releaseLabelId()); - LabelResource labelResource = null; - long realReleasedNum = 0; - for (Iterator it = release.iterator(); it.hasNext();) { - labelResource = it.next(); - if (labelResource.labelResourceId().labelId() < pool.beginLabel() - .labelId() - || labelResource.labelResourceId().labelId() > pool - .endLabel().labelId()) { - continue; - } - if (pool.currentUsedMaxLabelId().labelId() > labelResource - .labelResourceId().labelId() - || !storeSet.contains(labelResource)) { - storeSet.add(labelResource); - realReleasedNum++; - } - } - long beginNum = pool.beginLabel().labelId(); - long endNum = pool.endLabel().labelId(); - long totalNum = pool.totalNum(); - long usedNum = pool.usedNum() - realReleasedNum; - long current = pool.currentUsedMaxLabelId().labelId(); - ImmutableSet s = ImmutableSet.copyOf(storeSet); - LabelResourcePool newPool = new LabelResourcePool(deviceId.toString(), - beginNum, endNum, - totalNum, usedNum, - current, s); - resourcePool.put(deviceId, newPool); - log.info("success to release label resource"); - return true; - } - - @Override - public boolean isDevicePoolFull(DeviceId deviceId) { - Versioned pool = resourcePool.get(deviceId); - if (pool == null) { - return true; - } - return pool.value().currentUsedMaxLabelId() == pool.value().endLabel() - && pool.value().releaseLabelId().size() == 0 ? true : false; - } - - @Override - public long getFreeNumOfDevicePool(DeviceId deviceId) { - Versioned pool = resourcePool.get(deviceId); - if (pool == null) { - return 0; - } - return pool.value().endLabel().labelId() - - pool.value().currentUsedMaxLabelId().labelId() - + pool.value().releaseLabelId().size(); - } - - @Override - public LabelResourcePool getDeviceLabelResourcePool(DeviceId deviceId) { - Versioned pool = resourcePool.get(deviceId); - return pool == null ? null : pool.value(); - } - - @Override - public boolean destroyGlobalPool() { - return this.internalDestroy(DeviceId - .deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID)); - } - - @Override - public Collection applyFromGlobalPool(long applyNum) { - LabelResourceRequest request = new LabelResourceRequest(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID), - LabelResourceRequest.Type.APPLY, - applyNum, null); - return this.internalApply(request); - } - - @Override - public boolean releaseToGlobalPool(Set release) { - Set set = new HashSet(); - DefaultLabelResource resource = null; - for (LabelResourceId labelResource : release) { - resource = new DefaultLabelResource(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID), - labelResource); - set.add(resource); - } - LabelResourceRequest request = new LabelResourceRequest(DeviceId.deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID), - LabelResourceRequest.Type.APPLY, - 0, - ImmutableSet.copyOf(set)); - return this.internalRelease(request); - } - - @Override - public boolean isGlobalPoolFull() { - return this.isDevicePoolFull(DeviceId - .deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID)); - } - - @Override - public long getFreeNumOfGlobalPool() { - return this.getFreeNumOfDevicePool(DeviceId - .deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID)); - } - - @Override - public LabelResourcePool getGlobalLabelResourcePool() { - return this.getDeviceLabelResourcePool(DeviceId - .deviceId(GLOBAL_RESOURCE_POOL_DEVICE_ID)); - } - - private T complete(Future future) { - try { - return future.get(PEER_REQUEST_TIMEOUT_MS, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - log.error("Interrupted while waiting for operation to complete.", e); - return null; - } catch (TimeoutException | ExecutionException e) { - log.error("Failed remote operation", e); - return null; - } - } -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/LabelResourceMessageSubjects.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/LabelResourceMessageSubjects.java deleted file mode 100644 index 1b2f6515..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/LabelResourceMessageSubjects.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2015 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.store.resource.impl; - -import org.onosproject.store.cluster.messaging.MessageSubject; - -public final class LabelResourceMessageSubjects { - - private LabelResourceMessageSubjects() { - } - public static final MessageSubject LABEL_POOL_CREATED - = new MessageSubject("label-resource-pool-created"); - public static final MessageSubject LABEL_POOL_DESTROYED - = new MessageSubject("label-resource-pool-destroyed"); - public static final MessageSubject LABEL_POOL_APPLY - = new MessageSubject("label-resource-pool-apply"); - public static final MessageSubject LABEL_POOL_RELEASE - = new MessageSubject("label-resource-pool-release"); -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/package-info.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/package-info.java deleted file mode 100644 index da0dc2e5..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/resource/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of the label resource distributed store. - */ -package org.onosproject.incubator.store.resource.impl; \ No newline at end of file diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java deleted file mode 100644 index f0ad2b01..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright 2014-2015 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.store.tunnel.impl; - -import static org.slf4j.LoggerFactory.getLogger; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.ReferenceCardinality; -import org.apache.felix.scr.annotations.Service; -import org.onlab.util.KryoNamespace; -import org.onosproject.cluster.ClusterService; -import org.onosproject.core.ApplicationId; -import org.onosproject.core.CoreService; -import org.onosproject.core.IdGenerator; -import org.onosproject.incubator.net.tunnel.DefaultTunnel; -import org.onosproject.incubator.net.tunnel.Tunnel; -import org.onosproject.incubator.net.tunnel.Tunnel.Type; -import org.onosproject.incubator.net.tunnel.TunnelEndPoint; -import org.onosproject.incubator.net.tunnel.TunnelEvent; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.tunnel.TunnelName; -import org.onosproject.incubator.net.tunnel.TunnelStore; -import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate; -import org.onosproject.incubator.net.tunnel.TunnelSubscription; -import org.onosproject.net.Annotations; -import org.onosproject.net.DefaultAnnotations; -import org.onosproject.net.SparseAnnotations; -import org.onosproject.net.provider.ProviderId; -import org.onosproject.store.AbstractStore; -import org.onosproject.store.app.GossipApplicationStore.InternalState; -import org.onosproject.store.cluster.messaging.ClusterCommunicationService; -import org.onosproject.store.serializers.KryoNamespaces; -import org.onosproject.store.service.EventuallyConsistentMap; -import org.onosproject.store.service.MultiValuedTimestamp; -import org.onosproject.store.service.StorageService; -import org.onosproject.store.service.WallClockTimestamp; -import org.slf4j.Logger; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableSet; - -/** - * Manages inventory of tunnel in distributed data store that uses optimistic - * replication and gossip based techniques. - */ -@Component(immediate = true) -@Service -public class DistributedTunnelStore - extends AbstractStore - implements TunnelStore { - - private final Logger log = getLogger(getClass()); - - /** - * The topic used for obtaining globally unique ids. - */ - private String runnelOpTopoic = "tunnel-ops-ids"; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ClusterCommunicationService clusterCommunicator; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected ClusterService clusterService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected CoreService coreService; - - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) - protected StorageService storageService; - - // tunnel identity as map key in the store. - private EventuallyConsistentMap tunnelIdAsKeyStore; - // tunnel name as map key in the store. - private EventuallyConsistentMap> tunnelNameAsKeyStore; - // maintains all the tunnels between source and destination. - private EventuallyConsistentMap> srcAndDstKeyStore; - // maintains all the tunnels by tunnel type. - private EventuallyConsistentMap> typeKeyStore; - // maintains records that app subscribes tunnel. - private EventuallyConsistentMap> orderRelationship; - - private IdGenerator idGenerator; - - @Activate - public void activate() { - KryoNamespace.Builder serializer = KryoNamespace.newBuilder() - .register(KryoNamespaces.API) - .register(MultiValuedTimestamp.class) - .register(InternalState.class); - tunnelIdAsKeyStore = storageService - .eventuallyConsistentMapBuilder() - .withName("all_tunnel").withSerializer(serializer) - .withTimestampProvider((k, v) -> new WallClockTimestamp()).build(); - tunnelNameAsKeyStore = storageService - .>eventuallyConsistentMapBuilder() - .withName("tunnel_name_tunnel").withSerializer(serializer) - .withTimestampProvider((k, v) -> new WallClockTimestamp()).build(); - srcAndDstKeyStore = storageService - .>eventuallyConsistentMapBuilder() - .withName("src_dst_tunnel").withSerializer(serializer) - .withTimestampProvider((k, v) -> new WallClockTimestamp()).build(); - typeKeyStore = storageService - .>eventuallyConsistentMapBuilder() - .withName("type_tunnel").withSerializer(serializer) - .withTimestampProvider((k, v) -> new WallClockTimestamp()).build(); - orderRelationship = storageService - .>eventuallyConsistentMapBuilder() - .withName("type_tunnel").withSerializer(serializer) - .withTimestampProvider((k, v) -> new WallClockTimestamp()).build(); - idGenerator = coreService.getIdGenerator(runnelOpTopoic); - log.info("Started"); - } - - @Deactivate - public void deactivate() { - orderRelationship.destroy(); - tunnelIdAsKeyStore.destroy(); - srcAndDstKeyStore.destroy(); - typeKeyStore.destroy(); - tunnelNameAsKeyStore.destroy(); - log.info("Stopped"); - } - - @Override - public TunnelId createOrUpdateTunnel(Tunnel tunnel) { - // tunnelIdAsKeyStore. - if (tunnel.tunnelId() != null && !"".equals(tunnel.tunnelId().toString())) { - Tunnel old = tunnelIdAsKeyStore.get(tunnel.tunnelId()); - if (old == null) { - log.info("This tunnel[" + tunnel.tunnelId() + "] is not available."); - return tunnel.tunnelId(); - } - DefaultAnnotations oldAnno = (DefaultAnnotations) old.annotations(); - SparseAnnotations newAnno = (SparseAnnotations) tunnel.annotations(); - Tunnel newT = new DefaultTunnel(old.providerId(), old.src(), - old.dst(), old.type(), - old.state(), old.groupId(), - old.tunnelId(), - old.tunnelName(), - old.path(), - DefaultAnnotations.merge(oldAnno, newAnno)); - tunnelIdAsKeyStore.put(tunnel.tunnelId(), newT); - TunnelEvent event = new TunnelEvent( - TunnelEvent.Type.TUNNEL_UPDATED, - tunnel); - notifyDelegate(event); - return tunnel.tunnelId(); - } else { - TunnelId tunnelId = TunnelId.valueOf(idGenerator.getNewId()); - Tunnel newT = new DefaultTunnel(tunnel.providerId(), tunnel.src(), - tunnel.dst(), tunnel.type(), - tunnel.state(), tunnel.groupId(), - tunnelId, - tunnel.tunnelName(), - tunnel.path(), - tunnel.annotations()); - TunnelKey key = TunnelKey.tunnelKey(tunnel.src(), tunnel.dst()); - tunnelIdAsKeyStore.put(tunnelId, newT); - Set tunnelnameSet = tunnelNameAsKeyStore.get(tunnel - .tunnelName()); - if (tunnelnameSet == null) { - tunnelnameSet = new HashSet(); - } - tunnelnameSet.add(tunnelId); - tunnelNameAsKeyStore.put(tunnel - .tunnelName(), tunnelnameSet); - Set srcAndDstKeySet = srcAndDstKeyStore.get(key); - if (srcAndDstKeySet == null) { - srcAndDstKeySet = new HashSet(); - } - srcAndDstKeySet.add(tunnelId); - srcAndDstKeyStore.put(key, srcAndDstKeySet); - Set typeKeySet = typeKeyStore.get(tunnel.type()); - if (typeKeySet == null) { - typeKeySet = new HashSet(); - } - typeKeySet.add(tunnelId); - typeKeyStore.put(tunnel.type(), typeKeySet); - TunnelEvent event = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, - tunnel); - notifyDelegate(event); - return tunnelId; - } - } - - @Override - public void deleteTunnel(TunnelId tunnelId) { - Tunnel deletedTunnel = tunnelIdAsKeyStore.get(tunnelId); - if (deletedTunnel == null) { - return; - } - tunnelNameAsKeyStore.get(deletedTunnel.tunnelName()).remove(tunnelId); - tunnelIdAsKeyStore.remove(tunnelId); - TunnelKey key = new TunnelKey(deletedTunnel.src(), deletedTunnel.dst()); - srcAndDstKeyStore.get(key).remove(tunnelId); - typeKeyStore.get(deletedTunnel.type()).remove(tunnelId); - TunnelEvent event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED, - deletedTunnel); - notifyDelegate(event); - } - - @Override - public void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, - ProviderId producerName) { - TunnelKey key = TunnelKey.tunnelKey(src, dst); - Set idSet = srcAndDstKeyStore.get(key); - if (idSet == null) { - return; - } - Tunnel deletedTunnel = null; - TunnelEvent event = null; - List ls = new ArrayList(); - for (TunnelId id : idSet) { - deletedTunnel = tunnelIdAsKeyStore.get(id); - event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED, - deletedTunnel); - ls.add(event); - if (producerName.equals(deletedTunnel.providerId())) { - tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId()); - tunnelNameAsKeyStore.get(deletedTunnel.tunnelName()) - .remove(deletedTunnel.tunnelId()); - srcAndDstKeyStore.get(key).remove(deletedTunnel.tunnelId()); - typeKeyStore.get(deletedTunnel.type()) - .remove(deletedTunnel.tunnelId()); - } - } - notifyDelegate(ls); - } - - @Override - public void deleteTunnel(TunnelEndPoint src, TunnelEndPoint dst, Type type, - ProviderId producerName) { - TunnelKey key = TunnelKey.tunnelKey(src, dst); - Set idSet = srcAndDstKeyStore.get(key); - if (idSet == null) { - return; - } - Tunnel deletedTunnel = null; - TunnelEvent event = null; - List ls = new ArrayList(); - for (TunnelId id : idSet) { - deletedTunnel = tunnelIdAsKeyStore.get(id); - event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED, - deletedTunnel); - ls.add(event); - if (producerName.equals(deletedTunnel.providerId()) - && type.equals(deletedTunnel.type())) { - tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId()); - tunnelNameAsKeyStore.get(deletedTunnel.tunnelName()) - .remove(deletedTunnel.tunnelId()); - srcAndDstKeyStore.get(key).remove(deletedTunnel.tunnelId()); - typeKeyStore.get(deletedTunnel.type()) - .remove(deletedTunnel.tunnelId()); - } - } - notifyDelegate(ls); - } - - @Override - public Tunnel borrowTunnel(ApplicationId appId, TunnelId tunnelId, - Annotations... annotations) { - Set orderSet = orderRelationship.get(appId); - if (orderSet == null) { - orderSet = new HashSet(); - } - TunnelSubscription order = new TunnelSubscription(appId, null, null, tunnelId, null, null, - annotations); - Tunnel result = tunnelIdAsKeyStore.get(tunnelId); - if (result == null || Tunnel.State.INACTIVE.equals(result.state())) { - return null; - } - - orderSet.add(order); - orderRelationship.put(appId, orderSet); - return result; - } - - @Override - public Collection borrowTunnel(ApplicationId appId, - TunnelEndPoint src, - TunnelEndPoint dst, - Annotations... annotations) { - Set orderSet = orderRelationship.get(appId); - if (orderSet == null) { - orderSet = new HashSet(); - } - TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, null, null, annotations); - boolean isExist = orderSet.contains(order); - if (!isExist) { - orderSet.add(order); - } - orderRelationship.put(appId, orderSet); - TunnelKey key = TunnelKey.tunnelKey(src, dst); - Set idSet = srcAndDstKeyStore.get(key); - if (idSet == null || idSet.size() == 0) { - return Collections.emptySet(); - } - Collection tunnelSet = new HashSet(); - for (TunnelId tunnelId : idSet) { - Tunnel result = tunnelIdAsKeyStore.get(tunnelId); - if (Tunnel.State.ACTIVE.equals(result.state())) { - tunnelSet.add(result); - } - } - return tunnelSet; - } - - @Override - public Collection borrowTunnel(ApplicationId appId, - TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations) { - Set orderSet = orderRelationship.get(appId); - if (orderSet == null) { - orderSet = new HashSet(); - } - TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, type, null, annotations); - boolean isExist = orderSet.contains(order); - if (!isExist) { - orderSet.add(order); - } - orderRelationship.put(appId, orderSet); - TunnelKey key = TunnelKey.tunnelKey(src, dst); - Set idSet = srcAndDstKeyStore.get(key); - if (idSet == null || idSet.size() == 0) { - return Collections.emptySet(); - } - Collection tunnelSet = new HashSet(); - for (TunnelId tunnelId : idSet) { - Tunnel result = tunnelIdAsKeyStore.get(tunnelId); - if (type.equals(result.type()) - && Tunnel.State.ACTIVE.equals(result.state())) { - tunnelSet.add(result); - } - } - return tunnelSet; - } - - @Override - public Collection borrowTunnel(ApplicationId appId, - TunnelName tunnelName, - Annotations... annotations) { - Set orderSet = orderRelationship.get(appId); - if (orderSet == null) { - orderSet = new HashSet(); - } - TunnelSubscription order = new TunnelSubscription(appId, null, null, null, null, tunnelName, - annotations); - boolean isExist = orderSet.contains(order); - if (!isExist) { - orderSet.add(order); - } - orderRelationship.put(appId, orderSet); - Set idSet = tunnelNameAsKeyStore.get(tunnelName); - if (idSet == null || idSet.size() == 0) { - return Collections.emptySet(); - } - Collection tunnelSet = new HashSet(); - for (TunnelId tunnelId : idSet) { - Tunnel result = tunnelIdAsKeyStore.get(tunnelId); - if (Tunnel.State.ACTIVE.equals(result.state())) { - tunnelSet.add(result); - } - } - return tunnelSet; - } - - @Override - public boolean returnTunnel(ApplicationId appId, TunnelName tunnelName, - Annotations... annotations) { - TunnelSubscription order = new TunnelSubscription(appId, null, null, null, null, tunnelName, - annotations); - return deleteOrder(order); - } - - @Override - public boolean returnTunnel(ApplicationId appId, TunnelId tunnelId, - Annotations... annotations) { - TunnelSubscription order = new TunnelSubscription(appId, null, null, tunnelId, null, null, - annotations); - return deleteOrder(order); - } - - @Override - public boolean returnTunnel(ApplicationId appId, TunnelEndPoint src, - TunnelEndPoint dst, Type type, - Annotations... annotations) { - TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, type, null, annotations); - return deleteOrder(order); - } - - @Override - public boolean returnTunnel(ApplicationId appId, TunnelEndPoint src, - TunnelEndPoint dst, Annotations... annotations) { - TunnelSubscription order = new TunnelSubscription(appId, src, dst, null, null, null, annotations); - return deleteOrder(order); - } - - private boolean deleteOrder(TunnelSubscription order) { - Set orderSet = orderRelationship.get(order.consumerId()); - if (orderSet == null) { - return true; - } - if (orderSet.contains(order)) { - orderSet.remove(order); - return true; - } - return false; - } - - @Override - public Tunnel queryTunnel(TunnelId tunnelId) { - return tunnelIdAsKeyStore.get(tunnelId); - } - - @Override - public Collection queryTunnelSubscription(ApplicationId appId) { - return orderRelationship.get(appId) != null ? ImmutableSet.copyOf(orderRelationship - .get(appId)) : Collections.emptySet(); - } - - @Override - public Collection queryTunnel(Type type) { - Collection result = new HashSet(); - Set tunnelIds = typeKeyStore.get(type); - if (tunnelIds == null) { - return Collections.emptySet(); - } - for (TunnelId id : tunnelIds) { - result.add(tunnelIdAsKeyStore.get(id)); - } - return result.size() == 0 ? Collections.emptySet() : ImmutableSet - .copyOf(result); - } - - @Override - public Collection queryTunnel(TunnelEndPoint src, TunnelEndPoint dst) { - Collection result = new HashSet(); - TunnelKey key = TunnelKey.tunnelKey(src, dst); - Set tunnelIds = srcAndDstKeyStore.get(key); - if (tunnelIds == null) { - return Collections.emptySet(); - } - for (TunnelId id : tunnelIds) { - result.add(tunnelIdAsKeyStore.get(id)); - } - return result.size() == 0 ? Collections.emptySet() : ImmutableSet - .copyOf(result); - } - - @Override - public Collection queryAllTunnels() { - return tunnelIdAsKeyStore.values(); - } - - @Override - public int tunnelCount() { - return tunnelIdAsKeyStore.size(); - } - - /** - * Uses source TunnelPoint and destination TunnelPoint as map key. - */ - private static final class TunnelKey { - private final TunnelEndPoint src; - private final TunnelEndPoint dst; - - private TunnelKey(TunnelEndPoint src, TunnelEndPoint dst) { - this.src = src; - this.dst = dst; - - } - - /** - * create a map key. - * - * @param src - * @param dst - * @return a key using source ip and destination ip - */ - static TunnelKey tunnelKey(TunnelEndPoint src, TunnelEndPoint dst) { - return new TunnelKey(src, dst); - } - - @Override - public int hashCode() { - return Objects.hash(src, dst); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof TunnelKey) { - final TunnelKey other = (TunnelKey) obj; - return Objects.equals(this.src, other.src) - && Objects.equals(this.dst, other.dst); - } - return false; - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(getClass()).add("src", src) - .add("dst", dst).toString(); - } - } -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/package-info.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/package-info.java deleted file mode 100644 index f0c06f74..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of distributed tunnel store using p2p synchronization protocol. - */ -package org.onosproject.incubator.store.tunnel.impl; diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java deleted file mode 100644 index 69e56c0b..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/DistributedVirtualNetworkStore.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2015 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.store.virtual.impl; - -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Deactivate; -import org.apache.felix.scr.annotations.Service; -import org.onosproject.incubator.net.tunnel.TunnelId; -import org.onosproject.incubator.net.virtual.DefaultVirtualDevice; -import org.onosproject.incubator.net.virtual.DefaultVirtualNetwork; -import org.onosproject.incubator.net.virtual.NetworkId; -import org.onosproject.incubator.net.virtual.TenantId; -import org.onosproject.incubator.net.virtual.VirtualDevice; -import org.onosproject.incubator.net.virtual.VirtualLink; -import org.onosproject.incubator.net.virtual.VirtualNetwork; -import org.onosproject.incubator.net.virtual.VirtualNetworkEvent; -import org.onosproject.incubator.net.virtual.VirtualNetworkStore; -import org.onosproject.incubator.net.virtual.VirtualNetworkStoreDelegate; -import org.onosproject.incubator.net.virtual.VirtualPort; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Port; -import org.onosproject.net.PortNumber; -import org.onosproject.store.AbstractStore; -import org.slf4j.Logger; - -import java.util.Set; - -import static org.slf4j.LoggerFactory.getLogger; - -/** - * Implementation of the network store. - */ -@Component(immediate = true) -@Service -public class DistributedVirtualNetworkStore - extends AbstractStore - implements VirtualNetworkStore { - - private final Logger log = getLogger(getClass()); - - // TODO: track tenants by ID - // TODO: track networks by ID and by tenants - // TODO: track devices by network ID and device ID - // TODO: track devices by network ID - // TODO: setup block allocator for network IDs - - // TODO: notify delegate - - @Activate - public void activate() { - log.info("Started"); - } - - @Deactivate - public void deactivate() { - log.info("Stopped"); - } - - @Override - public void addTenantId(TenantId tenantId) { - } - - @Override - public void removeTenantId(TenantId tenantId) { - } - - @Override - public Set getTenantIds() { - return null; - } - - @Override - public VirtualNetwork addNetwork(TenantId tenantId) { - return new DefaultVirtualNetwork(genNetworkId(), tenantId); - } - - private NetworkId genNetworkId() { - return NetworkId.networkId(0); // TODO: use a block allocator - } - - - @Override - public void removeNetwork(NetworkId networkId) { - } - - @Override - public VirtualDevice addDevice(NetworkId networkId, DeviceId deviceId) { - return new DefaultVirtualDevice(networkId, deviceId); - } - - @Override - public void removeDevice(NetworkId networkId, DeviceId deviceId) { - } - - @Override - public VirtualLink addLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst, TunnelId realizedBy) { - return null; - } - - @Override - public void removeLink(NetworkId networkId, ConnectPoint src, ConnectPoint dst) { - } - - @Override - public VirtualPort addPort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber, Port realizedBy) { - return null; - } - - @Override - public void removePort(NetworkId networkId, DeviceId deviceId, PortNumber portNumber) { - } - - @Override - public Set getNetworks(TenantId tenantId) { - return null; - } - - @Override - public Set getDevices(NetworkId networkId) { - return null; - } - - @Override - public Set getLinks(NetworkId networkId) { - return null; - } - - @Override - public Set getPorts(NetworkId networkId, DeviceId deviceId) { - return null; - } -} diff --git a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java b/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java deleted file mode 100644 index 12fa9091..00000000 --- a/framework/src/onos/incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 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. - */ - -/** - * Implementation of distributed virtual network store. - */ -package org.onosproject.incubator.store.virtual.impl; -- cgit 1.2.3-korg