aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/vtn
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/vtn')
-rw-r--r--framework/src/onos/apps/vtn/app/app.xml25
-rw-r--r--framework/src/onos/apps/vtn/app/features.xml26
-rw-r--r--framework/src/onos/apps/vtn/app/pom.xml44
-rw-r--r--framework/src/onos/apps/vtn/pom.xml84
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/pom.xml67
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/ServiceFunctionForwarderService.java51
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/ServiceFunctionForwarderImpl.java293
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/FlowClassifierInstaller.java46
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/DefaultFlowClassifierInstaller.java45
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/NshSpiIdGenerators.java51
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/SfcService.java91
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java186
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/manager/impl/SfcManagerTest.java269
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowClassifierManagerTestImpl.java93
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowObjectiveServiceTestImpl.java53
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortChainManagerTestImpl.java85
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairGroupManagerTestImpl.java89
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairManagerTestImpl.java89
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VirtualPortManagerTestImpl.java98
-rw-r--r--framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VtnRscManagerTestImpl.java72
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/pom.xml53
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/VTNService.java99
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VTNManager.java1059
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ArpService.java48
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ClassifierService.java105
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/DnatService.java46
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L2ForwardService.java97
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L3ForwardService.java47
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/SnatService.java49
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ArpServiceImpl.java113
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ClassifierServiceImpl.java196
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/DnatServiceImpl.java88
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L2ForwardServiceImpl.java211
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L3ForwardServiceImpl.java95
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/SnatServiceImpl.java90
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/DataPathIdGenerator.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnConfig.java123
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnData.java179
-rw-r--r--framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/pom.xml56
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllocationPool.java38
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllowedAddressPair.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java72
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultAllocationPool.java81
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFloatingIp.java140
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java405
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultHostRoute.java79
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortChain.java201
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPair.java198
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPairGroup.java183
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java146
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultSubnet.java183
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultTenantNetwork.java160
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultVirtualPort.java229
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FixedIp.java93
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIp.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIpId.java85
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifier.java259
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/HostRoute.java39
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java78
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChain.java148
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java91
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPair.java139
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroup.java126
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java92
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java93
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java102
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java108
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterInterface.java119
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Subnet.java129
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java76
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetwork.java130
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java76
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPort.java156
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java70
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/ClassifierService.java41
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/ClassifierManager.java78
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java95
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java92
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java90
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java103
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java97
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java60
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java45
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java99
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java97
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java76
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java71
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java99
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java56
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java50
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java118
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java61
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java46
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java118
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java134
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java45
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java135
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEvent.java125
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEventFeedback.java252
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscListener.java26
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpEvent.java60
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpService.java108
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/FloatingIpManager.java343
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierEvent.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java96
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java160
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainEvent.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainService.java81
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java150
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairEvent.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java164
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupEvent.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupService.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java164
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterEvent.java59
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterListener.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterService.java90
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/RouterManager.java269
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceEvent.java62
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceListener.java27
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceService.java80
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/RouterInterfaceManager.java235
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/VtnRscService.java82
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/VtnRscManager.java582
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/SubnetService.java72
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/SubnetManager.java179
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkService.java80
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/TenantNetworkManager.java167
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/VirtualPortService.java119
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java249
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/resources/OSGI-INF/blueprint/shell-config.xml89
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java75
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java66
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java143
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java66
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java134
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java112
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java97
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java132
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java70
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java68
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java65
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java66
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java79
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.java62
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java65
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java63
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java65
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java125
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java146
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java155
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java126
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java140
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java114
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java97
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java114
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java242
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java65
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java25
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/pom.xml87
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java285
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java164
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java162
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java168
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java159
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java447
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java379
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java364
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java412
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllocationPoolsCodec.java40
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllowedAddressPairCodec.java40
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FixedIpCodec.java40
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FloatingIpCodec.java98
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FlowClassifierCodec.java134
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/HostRoutesCodec.java40
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java105
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairCodec.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java95
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterCodec.java91
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterGatewayInfoCodec.java39
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SecurityGroupCodec.java39
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SubnetCodec.java53
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/TenantNetworkCodec.java47
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VirtualPortCodec.java57
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VtnCodecRegistrator.java56
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/main/webapp/WEB-INF/web.xml51
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/FlowClassifierResourceTest.java301
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortChainResourceTest.java247
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairGroupResourceTest.java234
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairResourceTest.java237
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/VtnResourceTest.java54
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/FlowClassifierCodecTest.java98
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortChainCodecTest.java95
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairCodecTest.java94
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairGroupCodecTest.java93
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/SfcCodecContext.java68
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-FlowClassifier.json14
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortChain.json15
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPair.json9
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPairGroup.json11
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/flowClassifier.json11
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portChain.json14
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPair.json9
-rw-r--r--framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPairGroup.json10
269 files changed, 0 insertions, 25908 deletions
diff --git a/framework/src/onos/apps/vtn/app/app.xml b/framework/src/onos/apps/vtn/app/app.xml
deleted file mode 100644
index a0efd7f4..00000000
--- a/framework/src/onos/apps/vtn/app/app.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<app name="org.onosproject.vtn" origin="ON.Lab" version="${project.version}"
- featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
- features="${project.artifactId}">
- <description>${project.description}</description>
-
- <artifact>mvn:${project.groupId}/onos-app-vtn-mgr/${project.version}</artifact>
- <artifact>mvn:${project.groupId}/onos-app-vtn-web/${project.version}</artifact>
- <artifact>mvn:${project.groupId}/onos-app-vtn-rsc/${project.version}</artifact>
-</app>
diff --git a/framework/src/onos/apps/vtn/app/features.xml b/framework/src/onos/apps/vtn/app/features.xml
deleted file mode 100644
index 8ee882c4..00000000
--- a/framework/src/onos/apps/vtn/app/features.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- ~ 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.
- -->
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
- <feature name="${project.artifactId}" version="${project.version}"
- description="${project.description}">
- <feature>onos-api</feature>
- <feature>onos-drivers</feature>
- <bundle>mvn:${project.groupId}/onos-app-vtn-mgr/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-app-vtn-web/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-app-vtn-rsc/${project.version}</bundle>
- </feature>
-</features>
diff --git a/framework/src/onos/apps/vtn/app/pom.xml b/framework/src/onos/apps/vtn/app/pom.xml
deleted file mode 100644
index 93d2d95c..00000000
--- a/framework/src/onos/apps/vtn/app/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ~ 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. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-vtn-onosfw</artifactId>
- <packaging>pom</packaging>
-
- <description>ONOS framework applications</description>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-rsc</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-web</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-mgr</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/framework/src/onos/apps/vtn/pom.xml b/framework/src/onos/apps/vtn/pom.xml
deleted file mode 100644
index 8bbd2657..00000000
--- a/framework/src/onos/apps/vtn/pom.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-apps</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-vtn</artifactId>
- <packaging>pom</packaging>
-
- <description>ONOS framework applications</description>
-
- <modules>
- <module>sfcmgr</module>
- <module>vtnrsc</module>
- <module>vtnmgr</module>
- <module>vtnweb</module>
- <module>app</module>
- </modules>
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava-testlib</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <scope>test</scope>
- <classifier>tests</classifier>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.jersey-test-framework</groupId>
- <artifactId>jersey-test-framework-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.jersey-test-framework</groupId>
- <artifactId>jersey-test-framework-grizzly2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/framework/src/onos/apps/vtn/sfcmgr/pom.xml b/framework/src/onos/apps/vtn/sfcmgr/pom.xml
deleted file mode 100644
index bac0cc36..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.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.
- -->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-sfc-mgr</artifactId>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-rsc</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Export-Package>
- org.onosproject.openflow.*,org.projectfloodlight.openflow.*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/ServiceFunctionForwarderService.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/ServiceFunctionForwarderService.java
deleted file mode 100644
index 0ed42fcf..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/ServiceFunctionForwarderService.java
+++ /dev/null
@@ -1,51 +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.sfc.forwarder;
-
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.NshServicePathId;
-import org.onosproject.vtnrsc.PortChain;
-
-/**
- * Abstraction of an entity which provides Service function forwarder.
- */
-public interface ServiceFunctionForwarderService {
-
- /**
- * Install Forwarding rule.
- *
- * @param portChain port-chain
- * @param nshSPI nsh spi
- */
- void installForwardingRule(PortChain portChain, NshServicePathId nshSPI);
-
- /**
- * Uninstall Forwarding rule.
- *
- * @param portChain port-chain
- * @param nshSPI nsh spi
- */
- void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSPI);
-
- /**
- * Prepare forwarding object for Service Function.
- *
- * @param portChain port-chain
- * @param nshSPI nsh spi
- * @param type forwarding objective operation type
- */
- void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSPI, Objective.Operation type);
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/ServiceFunctionForwarderImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/ServiceFunctionForwarderImpl.java
deleted file mode 100644
index 2846ee01..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/ServiceFunctionForwarderImpl.java
+++ /dev/null
@@ -1,293 +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.sfc.forwarder.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-import static org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SPI;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.ListIterator;
-
-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.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.behaviour.ExtensionSelectorResolver;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.NshServicePathId;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.driver.DriverService;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.criteria.ExtensionSelector;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.service.VtnRscService;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.onosproject.sfc.forwarder.ServiceFunctionForwarderService;
-
-import org.slf4j.Logger;
-
-/**
- * Provides Service Function Forwarder implementation.
- */
-public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderService {
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DriverService driverService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VtnRscService vtnRscService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortPairService portPairService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortPairGroupService portPairGroupService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected FlowClassifierService flowClassifierService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortChainService portChainService;
-
- private final Logger log = getLogger(getClass());
- protected ApplicationId appId;
- protected FlowObjectiveService flowObjectiveService;
-
- private static final String DRIVER_NAME = "onosfw";
- private static final String PORT_CHAIN_NOT_NULL = "Port-Chain cannot be null";
- private static final String PORT_CHAIN_ID_NOT_NULL = "Port-Chain-Id cannot be null";
- private static final String APP_ID_NOT_NULL = "Application-Id cannot be null";
- private static final int NULL = 0;
-
- /**
- * Default constructor.
- */
- public ServiceFunctionForwarderImpl() {
- }
-
- /**
- * Explicit constructor.
- */
- public ServiceFunctionForwarderImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, APP_ID_NOT_NULL);
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void installForwardingRule(PortChain portChain, NshServicePathId nshSPI) {
- checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
- prepareServiceFunctionForwarder(portChain, nshSPI, Objective.Operation.ADD);
- }
-
- @Override
- public void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSPI) {
- checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
- prepareServiceFunctionForwarder(portChain, nshSPI, Objective.Operation.REMOVE);
- }
-
- @Override
- public void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSPI,
- Objective.Operation type) {
-
- // Go through the port pair group list
- List<PortPairGroupId> portPairGrpList = portChain.portPairGroups();
- ListIterator<PortPairGroupId> listGrpIterator = portPairGrpList.listIterator();
-
- // Get source port pair group
- if (!listGrpIterator.hasNext()) {
- return;
- }
- PortPairGroupId portPairGrpId = listGrpIterator.next();
- PortPairGroup currentPortPairGroup = portPairGroupService.getPortPairGroup(portPairGrpId);
-
- // Get destination port pair group
- if (!listGrpIterator.hasNext()) {
- return;
- }
- portPairGrpId = listGrpIterator.next();
- PortPairGroup nextPortPairGroup = portPairGroupService.getPortPairGroup(portPairGrpId);
-
- // push SFF to OVS
- pushServiceFunctionForwarder(currentPortPairGroup, nextPortPairGroup, listGrpIterator, nshSPI, type);
- }
-
- /**
- * Push service-function-forwarder to OVS.
- *
- * @param currentPortPairGroup current port-pair-group
- * @param nextPortPairGroup next port-pair-group
- * @param listGrpIterator pointer to port-pair-group list
- */
- public void pushServiceFunctionForwarder(PortPairGroup currentPortPairGroup, PortPairGroup nextPortPairGroup,
- ListIterator<PortPairGroupId> listGrpIterator, NshServicePathId nshSPI, Objective.Operation type) {
- MacAddress srcMacAddress = null;
- MacAddress dstMacAddress = null;
- DeviceId deviceId = null;
- DeviceId currentDeviceId = null;
- DeviceId nextDeviceId = null;
- PortPairGroupId portPairGrpId = null;
-
- // Travel from SF to SF.
- do {
- // Get the required information on port pairs from source port pair
- // group
- List<PortPairId> portPairList = currentPortPairGroup.portPairs();
- ListIterator<PortPairId> portPLIterator = portPairList.listIterator();
- if (!portPLIterator.hasNext()) {
- break;
- }
-
- PortPairId portPairId = portPLIterator.next();
- PortPair portPair = portPairService.getPortPair(portPairId);
-
- currentDeviceId = vtnRscService.getSFToSFFMaping(VirtualPortId.portId(portPair.ingress()));
- if (deviceId == null) {
- deviceId = currentDeviceId;
- }
- srcMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.ingress())).macAddress();
- dstMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.egress())).macAddress();
-
- // pack traffic selector
- TrafficSelector.Builder selector = packTrafficSelector(deviceId, srcMacAddress, dstMacAddress, nshSPI);
-
- // Get the required information on port pairs from destination port
- // pair group
- portPairList = nextPortPairGroup.portPairs();
- portPLIterator = portPairList.listIterator();
- if (!portPLIterator.hasNext()) {
- break;
- }
-
- portPairId = portPLIterator.next();
- portPair = portPairService.getPortPair(portPairId);
-
- nextDeviceId = vtnRscService.getSFToSFFMaping(VirtualPortId.portId(portPair.ingress()));
-
- // pack traffic treatment
- TrafficTreatment.Builder treatment = packTrafficTreatment(currentDeviceId, nextDeviceId, portPair);
-
- // Send SFF to OVS
- sendServiceFunctionForwarder(selector, treatment, deviceId, type);
-
- // Replace source port pair group with destination port pair group
- // for moving to next SFF processing.
- currentPortPairGroup = nextPortPairGroup;
- if (!listGrpIterator.hasNext()) {
- break;
- }
- portPairGrpId = listGrpIterator.next();
- nextPortPairGroup = portPairGroupService.getPortPairGroup(portPairGrpId);
- } while (true);
- }
-
- /**
- * Pack Traffic selector.
- *
- * @param deviceId device id
- * @param srcMacAddress source mac-address
- * @param dstMacAddress destination mac-address
- * @param nshSPI nsh spi
- * @return traffic treatment
- */
- public TrafficSelector.Builder packTrafficSelector(DeviceId deviceId, MacAddress srcMacAddress,
- MacAddress dstMacAddress, NshServicePathId nshSPI) {
- TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
- selector.matchEthSrc(srcMacAddress);
- selector.matchEthDst(dstMacAddress);
-
- DriverHandler handler = driverService.createHandler(deviceId);
- ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
- ExtensionSelector nspSpiSelector = resolver.getExtensionSelector(NICIRA_MATCH_NSH_SPI.type());
-
- try {
- nspSpiSelector.setPropertyValue("nshSpi", nshSPI);
- } catch (Exception e) {
- log.error("Failed to get extension instruction to set Nsh Spi Id {}", deviceId);
- }
-
- selector.extension(nspSpiSelector, deviceId);
- return selector;
- }
-
- /**
- * Pack Traffic treatment.
- *
- * @param currentDeviceId current device id
- * @param nextDeviceId next device id
- * @param portPair port-pair
- * @return traffic treatment
- */
- public TrafficTreatment.Builder packTrafficTreatment(DeviceId currentDeviceId, DeviceId nextDeviceId,
- PortPair portPair) {
- MacAddress srcMacAddress = null;
- MacAddress dstMacAddress = null;
-
- // Check the treatment whether destination SF is on same OVS or in
- // different OVS.
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
- if (currentDeviceId.equals(nextDeviceId)) {
- srcMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.ingress())).macAddress();
- dstMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.egress())).macAddress();
- treatment.setEthSrc(srcMacAddress);
- treatment.setEthDst(dstMacAddress);
- } else {
- treatment.setVlanId(VlanId.vlanId(Short.parseShort((vtnRscService.getL3vni(portPair
- .tenantId()).toString()))));
- }
-
- return treatment;
- }
-
- /**
- * Send service function forwarder to OVS.
- *
- * @param selector traffic selector
- * @param treatment traffic treatment
- * @param deviceId device id
- * @param type operation type
- */
- public void sendServiceFunctionForwarder(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment,
- DeviceId deviceId, Objective.Operation type) {
- ForwardingObjective.Builder objective = DefaultForwardingObjective.builder().withTreatment(treatment.build())
- .withSelector(selector.build()).fromApp(appId).makePermanent().withFlag(Flag.SPECIFIC);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/impl/package-info.java
deleted file mode 100644
index 02221196..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/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.
- */
-
-/**
- * SFC Service manager for interacting with SFC.
- */
-package org.onosproject.sfc.forwarder.impl;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/package-info.java
deleted file mode 100644
index 08021f3c..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/forwarder/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 function forwarder for SFC.
- */
-package org.onosproject.sfc.forwarder;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/FlowClassifierInstaller.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/FlowClassifierInstaller.java
deleted file mode 100644
index f05a21dc..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/FlowClassifierInstaller.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.sfc.installer;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortPair;
-
-/**
- * Abstraction of an entity which installs flow classification rules in ovs.
- */
-public interface FlowClassifierInstaller {
-
- /**
- * Install flow classifier rules.
- *
- * @param flowClassifier Flow Classifier
- * @param portPair Port pair
- */
- void install(FlowClassifier flowClassifier, PortPair portPair);
-
- /**
- * Programs forwarding object for flow classifier.
- *
- * @param flowClassifier flow classifier
- * @param portPair port pair
- * @param appid application id
- * @param type forwarding objective operation type
- */
- void programFlowClassification(FlowClassifier flowClassifier, PortPair portPair, ApplicationId appid,
- Objective.Operation type);
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/DefaultFlowClassifierInstaller.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/DefaultFlowClassifierInstaller.java
deleted file mode 100644
index e1a80932..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/DefaultFlowClassifierInstaller.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.sfc.installer.impl;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.flowobjective.Objective.Operation;
-import org.onosproject.sfc.installer.FlowClassifierInstaller;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortPair;
-
-/**
- * Provides flow classifier installer.
- */
-public class DefaultFlowClassifierInstaller implements FlowClassifierInstaller {
-
- /**
- * Default constructor.
- */
- public DefaultFlowClassifierInstaller() {
- }
-
- @Override
- public void install(FlowClassifier flowClassifier, PortPair portPair) {
- // TODO: Process flow-classifier for installation.
- }
-
- @Override
- public void programFlowClassification(FlowClassifier flowClassifier, PortPair portPair, ApplicationId appid,
- Operation type) {
- // TODO: program forwarding objective for flow-classifier installation.
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/impl/package-info.java
deleted file mode 100644
index d9796d80..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/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 installing flow classifier rules in OVS.
- */
-package org.onosproject.sfc.installer.impl;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/package-info.java
deleted file mode 100644
index 77c0ab30..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/installer/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 installing flow classifier rules in OVS.
- */
-package org.onosproject.sfc.installer;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/NshSpiIdGenerators.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/NshSpiIdGenerators.java
deleted file mode 100644
index 1dbe8c8f..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/NshSpiIdGenerators.java
+++ /dev/null
@@ -1,51 +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.sfc.manager;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Unique NSH SPI Id generator for NSH header.
- */
-public final class NshSpiIdGenerators {
-
- private static final AtomicInteger NSH_SPI_ID_GEN = new AtomicInteger();
- private static final int MAX_NSH_SPI_ID = 0x7FFFFFFF;
- private static int nshSpiId;
-
- /**
- * Default constructor.
- */
- private NshSpiIdGenerators() {
- }
-
- /**
- * Get the next NSH SPI id.
- *
- * @return NSH SPI id
- */
- public static int create() {
- do {
- if (nshSpiId >= MAX_NSH_SPI_ID) {
- if (NSH_SPI_ID_GEN.get() >= MAX_NSH_SPI_ID) {
- NSH_SPI_ID_GEN.set(0);
- }
- }
- nshSpiId = NSH_SPI_ID_GEN.incrementAndGet();
- } while (nshSpiId > MAX_NSH_SPI_ID);
- return nshSpiId;
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/SfcService.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/SfcService.java
deleted file mode 100644
index 4af2d47c..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/SfcService.java
+++ /dev/null
@@ -1,91 +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.sfc.manager;
-
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortChain;
-
-/**
- * SFC application that applies flows to the device.
- */
-public interface SfcService {
-
- /**
- * When port-pair is created, check whether Forwarding Rule needs to be
- * updated in OVS.
- *
- * @param portPair port-pair
- */
- void onPortPairCreated(PortPair portPair);
-
- /**
- * When port-pair is deleted, check whether Forwarding Rule needs to be
- * updated in OVS.
- *
- * @param portPair port-pair
- */
- void onPortPairDeleted(PortPair portPair);
-
- /**
- * When port-pair-group is created, check whether Forwarding Rule needs to
- * be updated in OVS.
- *
- * @param portPairGroup port-pair-group
- */
- void onPortPairGroupCreated(PortPairGroup portPairGroup);
-
- /**
- * When port-pair-group is deleted, check whether Forwarding Rule needs to
- * be updated in OVS.
- *
- * @param portPairGroup port-pair-group
- */
- void onPortPairGroupDeleted(PortPairGroup portPairGroup);
-
- /**
- * When flow-classifier is created, check whether Forwarding Rule needs to
- * be updated in OVS.
- *
- * @param flowClassifier flow-classifier
- */
- void onFlowClassifierCreated(FlowClassifier flowClassifier);
-
- /**
- * When flow-classifier is deleted, check whether Forwarding Rule needs to
- * be updated in OVS.
- *
- * @param flowClassifier flow-classifier
- */
- void onFlowClassifierDeleted(FlowClassifier flowClassifier);
-
- /**
- * When port-chain is created, check whether Forwarding Rule needs to be
- * updated in OVS.
- *
- * @param portChain port-chain
- */
- void onPortChainCreated(PortChain portChain);
-
- /**
- * When port-chain is deleted, check whether Forwarding Rule needs to be
- * updated in OVS.
- *
- * @param portChain port-chain
- */
- void onPortChainDeleted(PortChain portChain);
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
deleted file mode 100644
index 4df07929..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java
+++ /dev/null
@@ -1,186 +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.sfc.manager.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-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.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.sfc.manager.SfcService;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.event.VtnRscEvent;
-import org.onosproject.vtnrsc.event.VtnRscListener;
-import org.onosproject.vtnrsc.service.VtnRscService;
-
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of SFC Service.
- */
-@Component(immediate = true)
-@Service
-public class SfcManager implements SfcService {
-
- private final Logger log = getLogger(getClass());
- private static final String APP_ID = "org.onosproject.app.vtn";
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VtnRscService vtnRscService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- protected ApplicationId appId;
-
- private final VtnRscListener vtnRscListener = new InnerVtnRscListener();
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(APP_ID);
-
- vtnRscService.addListener(vtnRscListener);
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(TenantId.class)
- .register(PortPairId.class)
- .register(PortPairGroupId.class)
- .register(FlowClassifierId.class)
- .register(PortChainId.class);
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- vtnRscService.removeListener(vtnRscListener);
-
- log.info("Stopped");
- }
-
- /*
- * Handle events.
- */
- private class InnerVtnRscListener implements VtnRscListener {
- @Override
- public void event(VtnRscEvent event) {
-
- if (VtnRscEvent.Type.PORT_PAIR_PUT == event.type()) {
- PortPair portPair = (PortPair) event.subject();
- onPortPairCreated(portPair);
- } else if (VtnRscEvent.Type.PORT_PAIR_DELETE == event.type()) {
- PortPair portPair = (PortPair) event.subject();
- onPortPairDeleted(portPair);
- } else if (VtnRscEvent.Type.PORT_PAIR_UPDATE == event.type()) {
- PortPair portPair = (PortPair) event.subject();
- onPortPairDeleted(portPair);
- onPortPairCreated(portPair);
- } else if (VtnRscEvent.Type.PORT_PAIR_GROUP_PUT == event.type()) {
- PortPairGroup portPairGroup = (PortPairGroup) event.subject();
- onPortPairGroupCreated(portPairGroup);
- } else if (VtnRscEvent.Type.PORT_PAIR_GROUP_DELETE == event.type()) {
- PortPairGroup portPairGroup = (PortPairGroup) event.subject();
- onPortPairGroupDeleted(portPairGroup);
- } else if (VtnRscEvent.Type.PORT_PAIR_GROUP_UPDATE == event.type()) {
- PortPairGroup portPairGroup = (PortPairGroup) event.subject();
- onPortPairGroupDeleted(portPairGroup);
- onPortPairGroupCreated(portPairGroup);
- } else if (VtnRscEvent.Type.FLOW_CLASSIFIER_PUT == event.type()) {
- FlowClassifier flowClassifier = (FlowClassifier) event.subject();
- onFlowClassifierCreated(flowClassifier);
- } else if (VtnRscEvent.Type.FLOW_CLASSIFIER_DELETE == event.type()) {
- FlowClassifier flowClassifier = (FlowClassifier) event.subject();
- onFlowClassifierDeleted(flowClassifier);
- } else if (VtnRscEvent.Type.FLOW_CLASSIFIER_UPDATE == event.type()) {
- FlowClassifier flowClassifier = (FlowClassifier) event.subject();
- onFlowClassifierDeleted(flowClassifier);
- onFlowClassifierCreated(flowClassifier);
- } else if (VtnRscEvent.Type.PORT_CHAIN_PUT == event.type()) {
- PortChain portChain = (PortChain) event.subject();
- onPortChainCreated(portChain);
- } else if (VtnRscEvent.Type.PORT_CHAIN_DELETE == event.type()) {
- PortChain portChain = (PortChain) event.subject();
- onPortChainDeleted(portChain);
- } else if (VtnRscEvent.Type.PORT_CHAIN_UPDATE == event.type()) {
- PortChain portChain = (PortChain) event.subject();
- onPortChainDeleted(portChain);
- onPortChainCreated(portChain);
- }
- }
- }
-
- @Override
- public void onPortPairCreated(PortPair portPair) {
- log.debug("onPortPairCreated");
- // TODO: Modify forwarding rule on port-pair creation.
- }
-
- @Override
- public void onPortPairDeleted(PortPair portPair) {
- log.debug("onPortPairDeleted");
- // TODO: Modify forwarding rule on port-pair deletion.
- }
-
- @Override
- public void onPortPairGroupCreated(PortPairGroup portPairGroup) {
- log.debug("onPortPairGroupCreated");
- // TODO: Modify forwarding rule on port-pair-group creation.
- }
-
- @Override
- public void onPortPairGroupDeleted(PortPairGroup portPairGroup) {
- log.debug("onPortPairGroupDeleted");
- // TODO: Modify forwarding rule on port-pair-group deletion.
- }
-
- @Override
- public void onFlowClassifierCreated(FlowClassifier flowClassifier) {
- log.debug("onFlowClassifierCreated");
- // TODO: Modify forwarding rule on flow-classifier creation.
- }
-
- @Override
- public void onFlowClassifierDeleted(FlowClassifier flowClassifier) {
- log.debug("onFlowClassifierDeleted");
- // TODO: Modify forwarding rule on flow-classifier deletion.
- }
-
- @Override
- public void onPortChainCreated(PortChain portChain) {
- log.debug("onPortChainCreated");
- //TODO: Apply forwarding rule on port-chain creation.
- }
-
- @Override
- public void onPortChainDeleted(PortChain portChain) {
- log.debug("onPortChainDeleted");
- //TODO: Apply forwarding rule on port-chain deletion.
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/package-info.java
deleted file mode 100644
index 7161380a..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/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.
- */
-
-/**
- * SFC Service manager for interacting with SFC.
- */
-package org.onosproject.sfc.manager.impl;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/package-info.java b/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/package-info.java
deleted file mode 100644
index 1dd0f5a0..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/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 interacting with SFC.
- */
-package org.onosproject.sfc.manager;
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/manager/impl/SfcManagerTest.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/manager/impl/SfcManagerTest.java
deleted file mode 100644
index e4f31f98..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/manager/impl/SfcManagerTest.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.sfc.manager.impl;
-
-import org.junit.Test;
-
-import java.util.List;
-import java.util.LinkedList;
-
-import org.onlab.packet.IpPrefix;
-import org.onosproject.sfc.manager.SfcService;
-import org.onosproject.vtnrsc.DefaultPortChain;
-import org.onosproject.vtnrsc.DefaultPortPair;
-import org.onosproject.vtnrsc.DefaultPortPairGroup;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.DefaultFlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.FlowClassifier;
-
-/**
- * Unit tests for SfcManager class.
- */
-public class SfcManagerTest {
- /**
- * Checks the operation of onPortPairCreated() method.
- */
- @Test
- public void testOnPortPairCreated() {
- final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPair";
- final String description = "PortPair";
- final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
- DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
- PortPair portPair = null;
- SfcService sfcService = new SfcManager();
-
- // create port pair
- portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name).setDescription(description)
- .setIngress(ingress).setEgress(egress).build();
- sfcService.onPortPairCreated(portPair);
- }
-
- /**
- * Checks the operation of onPortPairDeleted() method.
- */
- @Test
- public void testOnPortPairDeleted() {
- final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPair";
- final String description = "PortPair";
- final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
- DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
- PortPair portPair = null;
- SfcService sfcService = new SfcManager();
-
- // create port pair
- portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name).setDescription(description)
- .setIngress(ingress).setEgress(egress).build();
- sfcService.onPortPairDeleted(portPair);
- }
-
- /**
- * Checks the operation of onPortPairGroupCreated() method.
- */
- @Test
- public void testOnPortPairGroupCreated() {
- final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPairGroup";
- final String description = "PortPairGroup";
- final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
- DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- PortPairGroup portPairGroup = null;
- SfcService sfcService = new SfcManager();
-
- // create port-pair-id list
- PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
- portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
-
- // create port pair
- portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairs(portPairIdList).build();
- sfcService.onPortPairGroupCreated(portPairGroup);
- }
-
- /**
- * Checks the operation of onPortPairGroupDeleted() method.
- */
- @Test
- public void testOnPortPairGroupDeleted() {
- final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPairGroup";
- final String description = "PortPairGroup";
- final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
- DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- PortPairGroup portPairGroup = null;
- SfcService sfcService = new SfcManager();
-
- // create port-pair-id list
- PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
- portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
-
- // create port pair
- portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairs(portPairIdList).build();
- sfcService.onPortPairGroupDeleted(portPairGroup);
- }
-
- /**
- * Checks the operation of onFlowClassifierCreated() method.
- */
- @Test
- public void testOnFlowClassifierCreated() {
- final String name = "FlowClassifier";
- final String description = "FlowClassifier";
- final String ethType = "IPv4";
- final String protocol = "udp";
- final int minSrcPortRange = 1024;
- final int maxSrcPortRange = 5000;
- final int minDstPortRange = 1024;
- final int maxDstPortRange = 5000;
- final FlowClassifierId flowClassifierId = FlowClassifierId.of("71111111-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("8");
- final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix = IpPrefix.valueOf("100.100.100.100/0");
- final VirtualPortId virtualSrcPort = VirtualPortId.portId("100");
- final VirtualPortId virtualDstPort = VirtualPortId.portId("200");
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- FlowClassifier flowClassifier = null;
- SfcService sfcService = new SfcManager();
-
- // create flow classifier
- flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId).setTenantId(tenantId)
- .setName(name).setDescription(description).setEtherType(ethType).setProtocol(protocol)
- .setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
- sfcService.onFlowClassifierCreated(flowClassifier);
- }
-
- /**
- * Checks the operation of onFlowClassifierDeleted() method.
- */
- @Test
- public void testOnFlowClassifierDeleted() {
- final String name = "FlowClassifier";
- final String description = "FlowClassifier";
- final String ethType = "IPv4";
- final String protocol = "udp";
- final int minSrcPortRange = 1024;
- final int maxSrcPortRange = 5000;
- final int minDstPortRange = 1024;
- final int maxDstPortRange = 5000;
- final FlowClassifierId flowClassifierId = FlowClassifierId.of("71111111-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("8");
- final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix = IpPrefix.valueOf("100.100.100.100/0");
- final VirtualPortId virtualSrcPort = VirtualPortId.portId("100");
- final VirtualPortId virtualDstPort = VirtualPortId.portId("200");
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- FlowClassifier flowClassifier = null;
- SfcService sfcService = new SfcManager();
-
- // create flow classifier
- flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId).setTenantId(tenantId)
- .setName(name).setDescription(description).setEtherType(ethType).setProtocol(protocol)
- .setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
- sfcService.onFlowClassifierDeleted(flowClassifier);
- }
-
- /**
- * Checks the operation of onPortChainCreated() method.
- */
- @Test
- public void testOnPortChainCreated() {
- final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortChain";
- final String description = "PortChain";
- final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>();
- final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>();
- DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- PortChain portChain = null;
- SfcService sfcService = new SfcManager();
-
- // create list of Port Pair Groups.
- PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroupList.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroupList.add(portPairGroupId);
-
- // create list of Flow classifiers.
- FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifierList.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifierList.add(flowClassifierId);
-
- // create port chain
- portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name).setDescription(description)
- .setPortPairGroups(portPairGroupList).setFlowClassifiers(flowClassifierList).build();
- sfcService.onPortChainCreated(portChain);
- }
-
- /**
- * Checks the operation of onPortChainDeleted() method.
- */
- @Test
- public void testOnPortChainDeleted() {
- final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortChain";
- final String description = "PortChain";
- final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>();
- final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>();
- DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- PortChain portChain = null;
- SfcService sfcService = new SfcManager();
-
- // create list of Port Pair Groups.
- PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroupList.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroupList.add(portPairGroupId);
-
- // create list of Flow classifiers.
- FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifierList.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifierList.add(flowClassifierId);
-
- // create port chain
- portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name).setDescription(description)
- .setPortPairGroups(portPairGroupList).setFlowClassifiers(flowClassifierList).build();
- sfcService.onPortChainDeleted(portChain);
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowClassifierManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowClassifierManagerTestImpl.java
deleted file mode 100644
index fe5babbd..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowClassifierManagerTestImpl.java
+++ /dev/null
@@ -1,93 +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.sfc.util;
-
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Provides implementation of the Flow Classifier Service.
- */
-public class FlowClassifierManagerTestImpl implements FlowClassifierService {
-
- private final ConcurrentMap<FlowClassifierId, FlowClassifier> flowClassifierStore = new ConcurrentHashMap<>();
-
- @Override
- public boolean exists(FlowClassifierId id) {
- return flowClassifierStore.containsKey(id);
- }
-
- @Override
- public int getFlowClassifierCount() {
- return flowClassifierStore.size();
- }
-
- @Override
- public Iterable<FlowClassifier> getFlowClassifiers() {
- return ImmutableList.copyOf(flowClassifierStore.values());
- }
-
- @Override
- public FlowClassifier getFlowClassifier(FlowClassifierId id) {
- return flowClassifierStore.get(id);
- }
-
- @Override
- public boolean createFlowClassifier(FlowClassifier flowClassifier) {
- FlowClassifierId id = flowClassifier.flowClassifierId();
-
- flowClassifierStore.put(id, flowClassifier);
- if (!flowClassifierStore.containsKey(id)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updateFlowClassifier(FlowClassifier flowClassifier) {
-
- if (!flowClassifierStore.containsKey(flowClassifier.flowClassifierId())) {
- return false;
- }
-
- flowClassifierStore.put(flowClassifier.flowClassifierId(), flowClassifier);
-
- if (!flowClassifier.equals(flowClassifierStore.get(flowClassifier.flowClassifierId()))) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removeFlowClassifier(FlowClassifierId id) {
- return true;
- }
-
- @Override
- public void addListener(FlowClassifierListener listener) {
- }
-
- @Override
- public void removeListener(FlowClassifierListener listener) {
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowObjectiveServiceTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowObjectiveServiceTestImpl.java
deleted file mode 100644
index 9da9ee94..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/FlowObjectiveServiceTestImpl.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.sfc.util;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.FilteringObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.NextObjective;
-
-/**
- * Testing version of implementation on FlowObjectiveService.
- */
-public class FlowObjectiveServiceTestImpl implements FlowObjectiveService {
-
- @Override
- public void filter(DeviceId deviceId, FilteringObjective filteringObjective) {
-
- }
-
- @Override
- public void forward(DeviceId deviceId, ForwardingObjective forwardingObjective) {
-
- }
-
- @Override
- public void next(DeviceId deviceId, NextObjective nextObjective) {
-
- }
-
- @Override
- public int allocateNextId() {
- return 0;
- }
-
- @Override
- public void initPolicy(String policy) {
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortChainManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortChainManagerTestImpl.java
deleted file mode 100644
index 4a3ba03d..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortChainManagerTestImpl.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.sfc.util;
-
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Collections;
-
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.onosproject.vtnrsc.portchain.PortChainEvent;
-import org.onosproject.vtnrsc.portchain.PortChainListener;
-import org.onosproject.event.AbstractListenerManager;
-
-/**
- * Provides implementation of the portChainService.
- */
-public class PortChainManagerTestImpl
- extends AbstractListenerManager<PortChainEvent, PortChainListener>
- implements PortChainService {
-
- private ConcurrentMap<PortChainId, PortChain> portChainStore = new ConcurrentHashMap<>();
-
- @Override
- public boolean exists(PortChainId portChainId) {
- return portChainStore.containsKey(portChainId);
- }
-
- @Override
- public int getPortChainCount() {
- return portChainStore.size();
- }
-
- @Override
- public Iterable<PortChain> getPortChains() {
- return Collections.unmodifiableCollection(portChainStore.values());
- }
-
- @Override
- public PortChain getPortChain(PortChainId portChainId) {
- return portChainStore.get(portChainId);
- }
-
- @Override
- public boolean createPortChain(PortChain portChain) {
- portChainStore.put(portChain.portChainId(), portChain);
- if (!portChainStore.containsKey(portChain.portChainId())) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortChain(PortChain portChain) {
- if (!portChainStore.containsKey(portChain.portChainId())) {
- return false;
- }
-
- portChainStore.put(portChain.portChainId(), portChain);
-
- if (!portChain.equals(portChainStore.get(portChain.portChainId()))) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortChain(PortChainId portChainId) {
- return true;
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairGroupManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairGroupManagerTestImpl.java
deleted file mode 100644
index ba31cd60..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairGroupManagerTestImpl.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.sfc.util;
-
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Collections;
-
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupListener;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-
-/**
- * Provides implementation of the portPairGroupService.
- */
-public class PortPairGroupManagerTestImpl implements PortPairGroupService {
-
- private ConcurrentMap<PortPairGroupId, PortPairGroup> portPairGroupStore = new ConcurrentHashMap<>();
-
- @Override
- public boolean exists(PortPairGroupId portPairGroupId) {
- return portPairGroupStore.containsKey(portPairGroupId);
- }
-
- @Override
- public int getPortPairGroupCount() {
- return portPairGroupStore.size();
- }
-
- @Override
- public Iterable<PortPairGroup> getPortPairGroups() {
- return Collections.unmodifiableCollection(portPairGroupStore.values());
- }
-
- @Override
- public PortPairGroup getPortPairGroup(PortPairGroupId portPairGroupId) {
- return portPairGroupStore.get(portPairGroupId);
- }
-
- @Override
- public boolean createPortPairGroup(PortPairGroup portPairGroup) {
- portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
- if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortPairGroup(PortPairGroup portPairGroup) {
- if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
- return false;
- }
-
- portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
-
- if (!portPairGroup.equals(portPairGroupStore.get(portPairGroup.portPairGroupId()))) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortPairGroup(PortPairGroupId portPairGroupId) {
- return true;
- }
-
- @Override
- public void addListener(PortPairGroupListener listener) {
- }
-
- @Override
- public void removeListener(PortPairGroupListener listener) {
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairManagerTestImpl.java
deleted file mode 100644
index aff58823..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/PortPairManagerTestImpl.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.sfc.util;
-
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Collections;
-
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.portpair.PortPairListener;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-
-/**
- * Provides implementation of the portPairService.
- */
-public class PortPairManagerTestImpl implements PortPairService {
-
- private ConcurrentMap<PortPairId, PortPair> portPairStore = new ConcurrentHashMap<>();
-
- @Override
- public boolean exists(PortPairId portPairId) {
- return portPairStore.containsKey(portPairId);
- }
-
- @Override
- public int getPortPairCount() {
- return portPairStore.size();
- }
-
- @Override
- public Iterable<PortPair> getPortPairs() {
- return Collections.unmodifiableCollection(portPairStore.values());
- }
-
- @Override
- public PortPair getPortPair(PortPairId portPairId) {
- return portPairStore.get(portPairId);
- }
-
- @Override
- public boolean createPortPair(PortPair portPair) {
- portPairStore.put(portPair.portPairId(), portPair);
- if (!portPairStore.containsKey(portPair.portPairId())) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortPair(PortPair portPair) {
- if (!portPairStore.containsKey(portPair.portPairId())) {
- return false;
- }
-
- portPairStore.put(portPair.portPairId(), portPair);
-
- if (!portPair.equals(portPairStore.get(portPair.portPairId()))) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortPair(PortPairId portPairId) {
- return true;
- }
-
- @Override
- public void addListener(PortPairListener listener) {
- }
-
- @Override
- public void removeListener(PortPairListener listener) {
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VirtualPortManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VirtualPortManagerTestImpl.java
deleted file mode 100644
index de056a78..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VirtualPortManagerTestImpl.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.sfc.util;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-
-/**
- * Provides implementation of the VirtualPort APIs.
- */
-public class VirtualPortManagerTestImpl implements VirtualPortService {
-
- protected ConcurrentMap<VirtualPortId, VirtualPort> vPortStore = new ConcurrentHashMap<>();
-
- @Override
- public boolean exists(VirtualPortId vPortId) {
- return vPortStore.containsKey(vPortId);
- }
-
- @Override
- public VirtualPort getPort(VirtualPortId vPortId) {
- return vPortStore.get(vPortId);
- }
-
- @Override
- public VirtualPort getPort(FixedIp fixedIP) {
- return null;
- }
-
- @Override
- public Collection<VirtualPort> getPorts() {
- return null;
- }
-
- @Override
- public Collection<VirtualPort> getPorts(TenantNetworkId networkId) {
- return null;
- }
-
- @Override
- public Collection<VirtualPort> getPorts(TenantId tenantId) {
- return null;
- }
-
- @Override
- public Collection<VirtualPort> getPorts(DeviceId deviceId) {
- return null;
- }
-
- @Override
- public VirtualPort getPort(TenantNetworkId networkId, IpAddress ipAddress) {
- return null;
- }
-
- @Override
- public boolean createPorts(Iterable<VirtualPort> vPorts) {
- for (VirtualPort vPort : vPorts) {
- vPortStore.put(vPort.portId(), vPort);
- if (!vPortStore.containsKey(vPort.portId())) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updatePorts(Iterable<VirtualPort> vPorts) {
- return true;
- }
-
- @Override
- public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
- return true;
- }
-}
diff --git a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VtnRscManagerTestImpl.java b/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VtnRscManagerTestImpl.java
deleted file mode 100644
index 4188cee6..00000000
--- a/framework/src/onos/apps/vtn/sfcmgr/src/test/java/org/onosproject/sfc/util/VtnRscManagerTestImpl.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.sfc.util;
-
-import java.util.Iterator;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.event.VtnRscListener;
-import org.onosproject.vtnrsc.service.VtnRscService;
-
-/**
- * Provides implementation of the VtnRsc service.
- */
-public class VtnRscManagerTestImpl implements VtnRscService {
- @Override
- public void addListener(VtnRscListener listener) {
- }
-
- @Override
- public void removeListener(VtnRscListener listener) {
- }
-
- @Override
- public SegmentationId getL3vni(TenantId tenantId) {
- return null;
- }
-
- @Override
- public Iterator<Device> getClassifierOfTenant(TenantId tenantId) {
- return null;
- }
-
- @Override
- public Iterator<Device> getSFFOfTenant(TenantId tenantId) {
- return null;
- }
-
- @Override
- public MacAddress getGatewayMac(HostId hostId) {
- return null;
- }
-
- @Override
- public boolean isServiceFunction(VirtualPortId portId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public DeviceId getSFToSFFMaping(VirtualPortId portId) {
- return DeviceId.deviceId("www.google.com");
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/pom.xml b/framework/src/onos/apps/vtn/vtnmgr/pom.xml
deleted file mode 100644
index 890b2168..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/pom.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.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.
- -->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-vtn-mgr</artifactId>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-incubator-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-rsc</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/VTNService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/VTNService.java
deleted file mode 100644
index d7ee3607..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/VTNService.java
+++ /dev/null
@@ -1,99 +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.vtn.manager;
-
-import org.onosproject.net.Device;
-import org.onosproject.net.Host;
-import org.onosproject.vtnrsc.event.VtnRscEventFeedback;
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-public interface VTNService {
-
- /**
- * Creates a vxlan tunnel and creates the ovs when a ovs controller node is
- * detected.
- *
- * @param device controller-type device
- */
- void onControllerDetected(Device device);
-
- /**
- * Drops a vxlan tunnel and drops the ovs when a ovs controller node is
- * vanished.
- *
- * @param device controller-type device
- */
- void onControllerVanished(Device device);
-
- /**
- * Applies default forwarding flows when a ovs is detected.
- *
- * @param device switch-type device
- */
- void onOvsDetected(Device device);
-
- /**
- * Remove default forwarding flows when a ovs is vanished.
- *
- * @param device switch-type device
- */
- void onOvsVanished(Device device);
-
- /**
- * Applies multicast flows and tunnel flows when a VM is detected.
- *
- * @param host a VM
- */
- void onHostDetected(Host host);
-
- /**
- * Remove multicast flows and tunnel flows when a VM is vanished.
- *
- * @param host a VM
- */
- void onHostVanished(Host host);
-
- /**
- * Applies east west flows when neutron created router interface.
- *
- * @param l3Feedback VtnrscEventFeedback
- */
- void onRouterInterfaceDetected(VtnRscEventFeedback l3Feedback);
-
- /**
- * Remove east west flows when neutron removed router interface.
- *
- * @param l3Feedback VtnrscEventFeedback
- */
- void onRouterInterfaceVanished(VtnRscEventFeedback l3Feedback);
-
- /**
- * Applies north south flows when neutron bind floating ip.
- *
- * @param l3Feedback VtnrscEventFeedback
- */
- void onFloatingIpDetected(VtnRscEventFeedback l3Feedback);
-
- /**
- * Applies north south flows when neutron unbind floating ip.
- *
- * @param l3Feedback VtnrscEventFeedback
- */
- void onFloatingIpVanished(VtnRscEventFeedback l3Feedback);
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VTNManager.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VTNManager.java
deleted file mode 100644
index 6429314e..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/VTNManager.java
+++ /dev/null
@@ -1,1059 +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.vtn.manager.impl;
-
-import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-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.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.mastership.MastershipService;
-import org.onosproject.net.AnnotationKeys;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.HostId;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.BridgeConfig;
-import org.onosproject.net.behaviour.BridgeDescription;
-import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.config.basics.BasicDeviceConfig;
-import org.onosproject.net.device.DeviceEvent;
-import org.onosproject.net.device.DeviceListener;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.driver.DriverService;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficTreatment.Builder;
-import org.onosproject.net.flow.instructions.ExtensionTreatment;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.group.DefaultGroupBucket;
-import org.onosproject.net.group.DefaultGroupDescription;
-import org.onosproject.net.group.DefaultGroupKey;
-import org.onosproject.net.group.GroupBucket;
-import org.onosproject.net.group.GroupBuckets;
-import org.onosproject.net.group.GroupDescription;
-import org.onosproject.net.group.GroupKey;
-import org.onosproject.net.group.GroupService;
-import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.host.HostListener;
-import org.onosproject.net.host.HostService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.LogicalClockService;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtn.manager.VTNService;
-import org.onosproject.vtn.table.ArpService;
-import org.onosproject.vtn.table.ClassifierService;
-import org.onosproject.vtn.table.DnatService;
-import org.onosproject.vtn.table.L2ForwardService;
-import org.onosproject.vtn.table.L3ForwardService;
-import org.onosproject.vtn.table.SnatService;
-import org.onosproject.vtn.table.impl.ClassifierServiceImpl;
-import org.onosproject.vtn.table.impl.L2ForwardServiceImpl;
-import org.onosproject.vtn.util.DataPathIdGenerator;
-import org.onosproject.vtn.util.VtnConfig;
-import org.onosproject.vtn.util.VtnData;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterGateway;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.event.VtnRscEvent;
-import org.onosproject.vtnrsc.event.VtnRscEventFeedback;
-import org.onosproject.vtnrsc.event.VtnRscListener;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-import org.onosproject.vtnrsc.service.VtnRscService;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of VTNService.
- */
-@Component(immediate = true)
-@Service
-public class VTNManager implements VTNService {
- private final Logger log = getLogger(getClass());
- private static final String APP_ID = "org.onosproject.app.vtn";
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected NetworkConfigService configService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceService deviceService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected HostService hostService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService tenantNetworkService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DriverService driverService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LogicalClockService clockService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected MastershipService mastershipService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected GroupService groupService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected SubnetService subnetService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VtnRscService vtnRscService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected FloatingIpService floatingIpService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterService routerService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterInterfaceService routerInterfaceService;
-
- private ApplicationId appId;
- private ClassifierService classifierService;
- private L2ForwardService l2ForwardService;
- private ArpService arpService;
- private L3ForwardService l3ForwardService;
- private SnatService snatService;
- private DnatService dnatService;
-
- private final HostListener hostListener = new InnerHostListener();
- private final DeviceListener deviceListener = new InnerDeviceListener();
- private final VtnRscListener l3EventListener = new VtnL3EventListener();
-
- private static final String IFACEID = "ifaceid";
- private static final String CONTROLLER_IP_KEY = "ipaddress";
- public static final String DRIVER_NAME = "onosfw";
- private static final String EX_PORT_NAME = "eth0";
- private static final String VIRTUALPORT = "vtn-virtual-port";
- private static final String SWITCHES_OF_CONTROLLER = "switchesOfController";
- private static final String SWITCH_OF_LOCAL_HOST_PORTS = "switchOfLocalHostPorts";
- private static final String ROUTERINF_FLAG_OF_TENANT = "routerInfFlagOfTenant";
- private static final String HOSTS_OF_SUBNET = "hostsOfSubnet";
- private static final String EX_PORT_OF_DEVICE = "exPortOfDevice";
- private static final String DEFAULT_IP = "0.0.0.0";
- private static final String PORT_MAC = "portMac";
- private static final int SUBNET_NUM = 2;
-
- private EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore;
- private EventuallyConsistentMap<IpAddress, Boolean> switchesOfController;
- private EventuallyConsistentMap<DeviceId, NetworkOfLocalHostPorts> switchOfLocalHostPorts;
- private EventuallyConsistentMap<SubnetId, Map<HostId, Host>> hostsOfSubnet;
- private EventuallyConsistentMap<TenantId, Boolean> routerInfFlagOfTenant;
- private EventuallyConsistentMap<DeviceId, Port> exPortOfDevice;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(APP_ID);
- classifierService = new ClassifierServiceImpl(appId);
- l2ForwardService = new L2ForwardServiceImpl(appId);
-
- deviceService.addListener(deviceListener);
- hostService.addListener(hostListener);
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(NetworkOfLocalHostPorts.class)
- .register(TenantNetworkId.class)
- .register(Host.class)
- .register(TenantNetwork.class)
- .register(TenantId.class)
- .register(SubnetId.class)
- .register(VirtualPortId.class)
- .register(VirtualPort.State.class)
- .register(AllowedAddressPair.class)
- .register(FixedIp.class)
- .register(BindingHostId.class)
- .register(SecurityGroup.class)
- .register(IpAddress.class)
- .register(DefaultVirtualPort.class);
-
- vPortStore = storageService
- .<VirtualPortId, VirtualPort>eventuallyConsistentMapBuilder()
- .withName(VIRTUALPORT).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- switchesOfController = storageService
- .<IpAddress, Boolean>eventuallyConsistentMapBuilder()
- .withName(SWITCHES_OF_CONTROLLER).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- switchOfLocalHostPorts = storageService
- .<DeviceId, NetworkOfLocalHostPorts>eventuallyConsistentMapBuilder()
- .withName(SWITCH_OF_LOCAL_HOST_PORTS).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- hostsOfSubnet = storageService
- .<SubnetId, Map<HostId, Host>>eventuallyConsistentMapBuilder()
- .withName(HOSTS_OF_SUBNET).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- routerInfFlagOfTenant = storageService
- .<TenantId, Boolean>eventuallyConsistentMapBuilder()
- .withName(ROUTERINF_FLAG_OF_TENANT).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- exPortOfDevice = storageService
- .<DeviceId, Port>eventuallyConsistentMapBuilder()
- .withName(EX_PORT_OF_DEVICE).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- deviceService.removeListener(deviceListener);
- hostService.removeListener(hostListener);
- vtnRscService.removeListener(l3EventListener);
- log.info("Stopped");
- }
-
- @Override
- public void onControllerDetected(Device controllerDevice) {
- if (controllerDevice == null) {
- log.error("The controller device is null");
- return;
- }
- String localIpAddress = controllerDevice.annotations()
- .value(CONTROLLER_IP_KEY);
- IpAddress localIp = IpAddress.valueOf(localIpAddress);
- DeviceId controllerDeviceId = controllerDevice.id();
- DriverHandler handler = driverService.createHandler(controllerDeviceId);
- if (mastershipService.isLocalMaster(controllerDeviceId)) {
- // Get DataPathIdGenerator
- String ipaddress = controllerDevice.annotations().value("ipaddress");
- DataPathIdGenerator dpidGenerator = DataPathIdGenerator.builder()
- .addIpAddress(ipaddress).build();
- DeviceId deviceId = dpidGenerator.getDeviceId();
- String dpid = dpidGenerator.getDpId();
- // Inject pipeline driver name
- BasicDeviceConfig config = configService.addConfig(deviceId,
- BasicDeviceConfig.class);
- config.driver(DRIVER_NAME);
- configService.applyConfig(deviceId, BasicDeviceConfig.class, config.node());
- // Add Bridge
- VtnConfig.applyBridgeConfig(handler, dpid, EX_PORT_NAME);
- log.info("A new ovs is created in node {}", localIp.toString());
- switchesOfController.put(localIp, true);
- }
- // Create tunnel in br-int on all controllers
- programTunnelConfig(controllerDeviceId, localIp, handler);
- }
-
- @Override
- public void onControllerVanished(Device controllerDevice) {
- if (controllerDevice == null) {
- log.error("The device is null");
- return;
- }
- String dstIp = controllerDevice.annotations().value(CONTROLLER_IP_KEY);
- IpAddress dstIpAddress = IpAddress.valueOf(dstIp);
- DeviceId controllerDeviceId = controllerDevice.id();
- if (mastershipService.isLocalMaster(controllerDeviceId)) {
- switchesOfController.remove(dstIpAddress);
- }
- // remove tunnel in br-int on other controllers
- programTunnelConfig(controllerDeviceId, dstIpAddress, null);
- }
-
- @Override
- public void onOvsDetected(Device device) {
- // Create tunnel out flow rules
- applyTunnelOut(device, Objective.Operation.ADD);
- }
-
- @Override
- public void onOvsVanished(Device device) {
- // Remove Tunnel out flow rules
- applyTunnelOut(device, Objective.Operation.REMOVE);
- }
-
- @Override
- public void onHostDetected(Host host) {
- DeviceId deviceId = host.location().deviceId();
- if (!mastershipService.isLocalMaster(deviceId)) {
- return;
- }
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error("The ifaceId of Host is null");
- return;
- }
- // apply L2 openflow rules
- applyHostMonitoredL2Rules(host, Objective.Operation.ADD);
- // apply L3 openflow rules
- applyHostMonitoredL3Rules(host, Objective.Operation.ADD);
- }
-
- @Override
- public void onHostVanished(Host host) {
- DeviceId deviceId = host.location().deviceId();
- if (!mastershipService.isLocalMaster(deviceId)) {
- return;
- }
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error("The ifaceId of Host is null");
- return;
- }
- // apply L2 openflow rules
- applyHostMonitoredL2Rules(host, Objective.Operation.REMOVE);
- // apply L3 openflow rules
- applyHostMonitoredL3Rules(host, Objective.Operation.REMOVE);
- }
-
- private void programTunnelConfig(DeviceId localDeviceId, IpAddress localIp,
- DriverHandler localHandler) {
- if (mastershipService.isLocalMaster(localDeviceId)) {
- VtnConfig.applyTunnelConfig(localHandler, localIp, IpAddress.valueOf(DEFAULT_IP));
- log.info("Add tunnel on {}", localIp);
- }
- }
-
- private void applyTunnelOut(Device device, Objective.Operation type) {
- if (device == null) {
- log.error("The device is null");
- return;
- }
- if (!mastershipService.isLocalMaster(device.id())) {
- return;
- }
- String controllerIp = VtnData.getControllerIpOfSwitch(device);
- if (controllerIp == null) {
- log.error("Can't find controller of device: {}",
- device.id().toString());
- return;
- }
- IpAddress ipAddress = IpAddress.valueOf(controllerIp);
- if (!switchesOfController.containsKey(ipAddress)) {
- log.error("Can't find controller of device: {}",
- device.id().toString());
- return;
- }
- if (type == Objective.Operation.ADD) {
- switchOfLocalHostPorts.put(device.id(), new NetworkOfLocalHostPorts());
- } else if (type == Objective.Operation.REMOVE) {
- switchOfLocalHostPorts.remove(device.id());
- }
- Iterable<Device> devices = deviceService.getAvailableDevices();
- DeviceId localControllerId = VtnData.getControllerId(device, devices);
- DriverHandler handler = driverService.createHandler(localControllerId);
- Set<PortNumber> ports = VtnConfig.getPortNumbers(handler);
- Iterable<Host> allHosts = hostService.getHosts();
- String tunnelName = "vxlan-" + DEFAULT_IP;
- if (allHosts != null) {
- Sets.newHashSet(allHosts).stream().forEach(host -> {
- MacAddress hostMac = host.mac();
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error("The ifaceId of Host is null");
- return;
- }
- VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
- VirtualPort virtualPort = virtualPortService
- .getPort(virtualPortId);
- TenantNetwork network = tenantNetworkService
- .getNetwork(virtualPort.networkId());
- SegmentationId segmentationId = network.segmentationId();
- DeviceId remoteDeviceId = host.location().deviceId();
- Device remoteDevice = deviceService.getDevice(remoteDeviceId);
- String remoteControllerIp = VtnData
- .getControllerIpOfSwitch(remoteDevice);
- if (remoteControllerIp == null) {
- log.error("Can't find remote controller of device: {}",
- remoteDeviceId.toString());
- return;
- }
- IpAddress remoteIpAddress = IpAddress
- .valueOf(remoteControllerIp);
- ports.stream()
- .filter(p -> p.name().equalsIgnoreCase(tunnelName))
- .forEach(p -> {
- l2ForwardService
- .programTunnelOut(device.id(), segmentationId, p,
- hostMac, type, remoteIpAddress);
- });
- });
- }
- }
-
- private void applyHostMonitoredL2Rules(Host host, Objective.Operation type) {
- DeviceId deviceId = host.location().deviceId();
- if (!mastershipService.isLocalMaster(deviceId)) {
- return;
- }
- String ifaceId = host.annotations().value(IFACEID);
- if (ifaceId == null) {
- log.error("The ifaceId of Host is null");
- return;
- }
- VirtualPortId virtualPortId = VirtualPortId.portId(ifaceId);
- VirtualPort virtualPort = virtualPortService.getPort(virtualPortId);
- if (virtualPort == null) {
- virtualPort = VtnData.getPort(vPortStore, virtualPortId);
- }
-
- Iterable<Device> devices = deviceService.getAvailableDevices();
- PortNumber inPort = host.location().port();
- MacAddress mac = host.mac();
- Device device = deviceService.getDevice(deviceId);
- String controllerIp = VtnData.getControllerIpOfSwitch(device);
- IpAddress ipAddress = IpAddress.valueOf(controllerIp);
- TenantNetwork network = tenantNetworkService.getNetwork(virtualPort.networkId());
- if (network == null) {
- log.error("Can't find network of the host");
- return;
- }
- SegmentationId segmentationId = network.segmentationId();
- // Get all the tunnel PortNumber in the current node
- Iterable<Port> ports = deviceService.getPorts(deviceId);
- Collection<PortNumber> localTunnelPorts = VtnData.getLocalTunnelPorts(ports);
- // Get all the local vm's PortNumber in the current node
- Map<TenantNetworkId, Set<PortNumber>> localHostPorts = switchOfLocalHostPorts
- .get(deviceId).getNetworkOfLocalHostPorts();
- Set<PortNumber> networkOflocalHostPorts = localHostPorts.get(network.id());
- for (PortNumber p : localTunnelPorts) {
- programGroupTable(deviceId, appId, p, devices, type);
- }
-
- if (type == Objective.Operation.ADD) {
- vPortStore.put(virtualPortId, virtualPort);
- if (networkOflocalHostPorts == null) {
- networkOflocalHostPorts = new HashSet<PortNumber>();
- localHostPorts.putIfAbsent(network.id(), networkOflocalHostPorts);
- }
- networkOflocalHostPorts.add(inPort);
- l2ForwardService.programLocalBcastRules(deviceId, segmentationId,
- inPort, networkOflocalHostPorts,
- localTunnelPorts,
- type);
- classifierService.programTunnelIn(deviceId, segmentationId,
- localTunnelPorts,
- type);
- } else if (type == Objective.Operation.REMOVE) {
- vPortStore.remove(virtualPortId);
- if (networkOflocalHostPorts != null) {
- l2ForwardService.programLocalBcastRules(deviceId, segmentationId,
- inPort, networkOflocalHostPorts,
- localTunnelPorts,
- type);
- networkOflocalHostPorts.remove(inPort);
- if (networkOflocalHostPorts.isEmpty()) {
- classifierService.programTunnelIn(deviceId, segmentationId,
- localTunnelPorts,
- type);
- switchOfLocalHostPorts.get(deviceId).getNetworkOfLocalHostPorts()
- .remove(virtualPort.networkId());
- }
- }
- }
-
- l2ForwardService.programLocalOut(deviceId, segmentationId, inPort, mac,
- type);
-
- l2ForwardService.programTunnelBcastRules(deviceId, segmentationId,
- networkOflocalHostPorts,
- localTunnelPorts,
- type);
-
- programTunnelOuts(devices, ipAddress, segmentationId, mac,
- type);
-
- classifierService.programLocalIn(deviceId, segmentationId, inPort, mac,
- appId, type);
- }
-
- private void programTunnelOuts(Iterable<Device> devices,
- IpAddress ipAddress,
- SegmentationId segmentationId,
- MacAddress dstMac,
- Objective.Operation type) {
- String tunnelName = "vxlan-" + DEFAULT_IP;
- Sets.newHashSet(devices).stream()
- .filter(d -> d.type() == Device.Type.CONTROLLER)
- .filter(d -> !("ovsdb:" + ipAddress).equals(d.id().toString()))
- .forEach(d -> {
- DriverHandler handler = driverService.createHandler(d.id());
- BridgeConfig bridgeConfig = handler
- .behaviour(BridgeConfig.class);
- Collection<BridgeDescription> bridgeDescriptions = bridgeConfig
- .getBridges();
- Set<PortNumber> ports = bridgeConfig.getPortNumbers();
- Iterator<BridgeDescription> it = bridgeDescriptions
- .iterator();
- if (it.hasNext()) {
- BridgeDescription sw = it.next();
- ports.stream()
- .filter(p -> p.name()
- .equalsIgnoreCase(tunnelName))
- .forEach(p -> {
- l2ForwardService.programTunnelOut(sw.deviceId(),
- segmentationId, p,
- dstMac, type, ipAddress);
- });
- }
- });
- }
-
- private class InnerDeviceListener implements DeviceListener {
-
- @Override
- public void event(DeviceEvent event) {
- Device device = event.subject();
- if (Device.Type.CONTROLLER == device.type()) {
- if (DeviceEvent.Type.DEVICE_ADDED == event.type()) {
- onControllerDetected(device);
- }
- if (DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event.type()) {
- if (deviceService.isAvailable(device.id())) {
- onControllerDetected(device);
- } else {
- onControllerVanished(device);
- }
- }
- } else if (Device.Type.SWITCH == device.type()) {
- if (DeviceEvent.Type.DEVICE_ADDED == event.type()) {
- onOvsDetected(device);
- }
- if (DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED == event.type()) {
- if (deviceService.isAvailable(device.id())) {
- onOvsDetected(device);
- } else {
- onOvsVanished(device);
- }
- }
- } else {
- log.info("Do nothing for this device type");
- }
- }
- }
-
- private class InnerHostListener implements HostListener {
-
- @Override
- public void event(HostEvent event) {
- Host host = event.subject();
- if (HostEvent.Type.HOST_ADDED == event.type()) {
- onHostDetected(host);
- } else if (HostEvent.Type.HOST_REMOVED == event.type()) {
- onHostVanished(host);
- } else if (HostEvent.Type.HOST_UPDATED == event.type()) {
- onHostVanished(host);
- onHostDetected(host);
- }
- }
-
- }
-
- // Local Host Ports of Network.
- private class NetworkOfLocalHostPorts {
- private final Map<TenantNetworkId, Set<PortNumber>> networkOfLocalHostPorts =
- new HashMap<TenantNetworkId, Set<PortNumber>>();
-
- public Map<TenantNetworkId, Set<PortNumber>> getNetworkOfLocalHostPorts() {
- return networkOfLocalHostPorts;
- }
- }
-
- private void programGroupTable(DeviceId deviceId, ApplicationId appid,
- PortNumber portNumber, Iterable<Device> devices, Objective.Operation type) {
- if (type.equals(Objective.Operation.REMOVE)) {
- return;
- }
-
- List<GroupBucket> buckets = Lists.newArrayList();
- Sets.newHashSet(devices)
- .stream()
- .filter(d -> d.type() == Device.Type.CONTROLLER)
- .filter(d -> !deviceId.equals(d.id()))
- .forEach(d -> {
- String ipAddress = d.annotations()
- .value(CONTROLLER_IP_KEY);
- Ip4Address dst = Ip4Address.valueOf(ipAddress);
- Builder builder = DefaultTrafficTreatment.builder();
-
- DriverHandler handler = driverService.createHandler(deviceId);
- ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
- try {
- treatment.setPropertyValue("tunnelDst", dst);
- } catch (Exception e) {
- log.error("Failed to get extension instruction to set tunnel dst {}", deviceId);
- }
-
- builder.extension(treatment, deviceId);
- builder.setOutput(portNumber);
- GroupBucket bucket = DefaultGroupBucket
- .createAllGroupBucket(builder.build());
- buckets.add(bucket);
- });
- final GroupKey key = new DefaultGroupKey(APP_ID.getBytes());
- GroupDescription groupDescription = new DefaultGroupDescription(deviceId,
- GroupDescription.Type.ALL,
- new GroupBuckets(buckets),
- key,
- L2ForwardServiceImpl.GROUP_ID,
- appid);
- groupService.addGroup(groupDescription);
- }
-
- private class VtnL3EventListener implements VtnRscListener {
- @Override
- public void event(VtnRscEvent event) {
- VtnRscEventFeedback l3Feedback = event.subject();
- if (VtnRscEvent.Type.ROUTER_INTERFACE_PUT == event.type()) {
- onRouterInterfaceDetected(l3Feedback);
- } else
- if (VtnRscEvent.Type.ROUTER_INTERFACE_DELETE == event.type()) {
- onRouterInterfaceVanished(l3Feedback);
- } else if (VtnRscEvent.Type.FLOATINGIP_PUT == event.type()) {
- onFloatingIpDetected(l3Feedback);
- } else if (VtnRscEvent.Type.FLOATINGIP_DELETE == event.type()) {
- onFloatingIpVanished(l3Feedback);
- }
- }
-
- }
-
- @Override
- public void onRouterInterfaceDetected(VtnRscEventFeedback l3Feedback) {
- Objective.Operation operation = Objective.Operation.ADD;
- RouterInterface routerInf = l3Feedback.routerInterface();
- Iterable<RouterInterface> interfaces = routerInterfaceService
- .getRouterInterfaces();
- Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
- .stream().filter(r -> r.tenantId().equals(routerInf.tenantId()))
- .collect(Collectors.toSet());
- if (routerInfFlagOfTenant.get(routerInf.tenantId()) != null) {
- programRouterInterface(routerInf, operation);
- } else {
- if (interfacesSet.size() >= SUBNET_NUM) {
- programInterfacesSet(interfacesSet, operation);
- }
- }
- }
-
- @Override
- public void onRouterInterfaceVanished(VtnRscEventFeedback l3Feedback) {
- Objective.Operation operation = Objective.Operation.REMOVE;
- RouterInterface routerInf = l3Feedback.routerInterface();
- Iterable<RouterInterface> interfaces = routerInterfaceService
- .getRouterInterfaces();
- Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
- .stream().filter(r -> r.tenantId().equals(routerInf.tenantId()))
- .collect(Collectors.toSet());
- if (routerInfFlagOfTenant.get(routerInf.tenantId()) != null) {
- programRouterInterface(routerInf, operation);
- if (interfacesSet.size() == 1) {
- routerInfFlagOfTenant.remove(routerInf.tenantId());
- interfacesSet.stream().forEach(r -> {
- programRouterInterface(r, operation);
- });
- }
- }
- }
-
- @Override
- public void onFloatingIpDetected(VtnRscEventFeedback l3Feedback) {
- programFloatingIpEvent(l3Feedback, VtnRscEvent.Type.FLOATINGIP_PUT);
- }
-
- @Override
- public void onFloatingIpVanished(VtnRscEventFeedback l3Feedback) {
- programFloatingIpEvent(l3Feedback, VtnRscEvent.Type.FLOATINGIP_DELETE);
- }
-
- private void programInterfacesSet(Set<RouterInterface> interfacesSet,
- Objective.Operation operation) {
- int subnetVmNum = 0;
- for (RouterInterface r : interfacesSet) {
- // Get all the host of the subnet
- Map<HostId, Host> hosts = hostsOfSubnet.get(r.subnetId());
- if (hosts.size() > 0) {
- subnetVmNum++;
- if (subnetVmNum >= SUBNET_NUM) {
- routerInfFlagOfTenant.put(r.tenantId(), true);
- interfacesSet.stream().forEach(f -> {
- programRouterInterface(f, operation);
- });
- break;
- }
- }
- }
- }
-
- private void programRouterInterface(RouterInterface routerInf,
- Objective.Operation operation) {
- SegmentationId l3vni = vtnRscService.getL3vni(routerInf.tenantId());
- // Get all the host of the subnet
- Map<HostId, Host> hosts = hostsOfSubnet.get(routerInf.subnetId());
- hosts.values().stream().forEach(h -> {
- applyEastWestL3Flows(h, l3vni, operation);
- });
- }
-
- private void applyEastWestL3Flows(Host h, SegmentationId l3vni,
- Objective.Operation operation) {
- if (!mastershipService.isLocalMaster(h.location().deviceId())) {
- log.debug("not master device:{}", h.location().deviceId());
- return;
- }
- String ifaceId = h.annotations().value(IFACEID);
- VirtualPort hPort = virtualPortService
- .getPort(VirtualPortId.portId(ifaceId));
- if (hPort == null) {
- hPort = VtnData.getPort(vPortStore, VirtualPortId.portId(ifaceId));
- }
- IpAddress srcIp = null;
- IpAddress srcGwIp = null;
- MacAddress srcVmGwMac = null;
- SubnetId srcSubnetId = null;
- Iterator<FixedIp> srcIps = hPort.fixedIps().iterator();
- if (srcIps.hasNext()) {
- FixedIp fixedIp = srcIps.next();
- srcIp = fixedIp.ip();
- srcSubnetId = fixedIp.subnetId();
- srcGwIp = subnetService.getSubnet(srcSubnetId).gatewayIp();
- FixedIp fixedGwIp = FixedIp.fixedIp(srcSubnetId, srcGwIp);
- VirtualPort gwPort = virtualPortService.getPort(fixedGwIp);
- if (gwPort == null) {
- gwPort = VtnData.getPort(vPortStore, fixedGwIp);
- }
- srcVmGwMac = gwPort.macAddress();
- }
- TenantNetwork network = tenantNetworkService
- .getNetwork(hPort.networkId());
- // Classifier rules
- classifierService
- .programL3InPortClassifierRules(h.location().deviceId(),
- h.location().port(), h.mac(),
- srcVmGwMac, l3vni, operation);
- // Arp rules
- if (operation == Objective.Operation.ADD) {
- classifierService.programArpClassifierRules(h.location().deviceId(),
- srcGwIp,
- network.segmentationId(),
- operation);
- DriverHandler handler = driverService.createHandler(h.location().deviceId());
- arpService.programArpRules(handler, h.location().deviceId(), srcGwIp,
- network.segmentationId(), srcVmGwMac,
- operation);
- }
- Iterable<Device> devices = deviceService.getAvailableDevices();
- IpAddress srcArpIp = srcIp;
- MacAddress srcArpGwMac = srcVmGwMac;
- Sets.newHashSet(devices).stream()
- .filter(d -> Device.Type.SWITCH == d.type()).forEach(d -> {
- // L3FWD rules
- l3ForwardService.programRouteRules(d.id(), l3vni, srcArpIp,
- network.segmentationId(),
- srcArpGwMac, h.mac(),
- operation);
- });
- }
-
- private void programFloatingIpEvent(VtnRscEventFeedback l3Feedback,
- VtnRscEvent.Type type) {
- FloatingIp floaingIp = l3Feedback.floatingIp();
- if (floaingIp != null) {
- VirtualPortId vmPortId = floaingIp.portId();
- VirtualPort vmPort = virtualPortService.getPort(vmPortId);
- VirtualPort fipPort = virtualPortService
- .getPort(floaingIp.networkId(), floaingIp.floatingIp());
- if (vmPort == null) {
- vmPort = VtnData.getPort(vPortStore, vmPortId);
- }
- if (fipPort == null) {
- fipPort = VtnData.getPort(vPortStore, floaingIp.networkId(),
- floaingIp.floatingIp());
- }
- Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
- Host host = null;
- for (Host h : hostSet) {
- String ifaceid = h.annotations().value(IFACEID);
- if (ifaceid != null && ifaceid.equals(vmPortId.portId())) {
- host = h;
- break;
- }
- }
- if (host != null && vmPort != null && fipPort != null) {
- DeviceId deviceId = host.location().deviceId();
- Port exPort = exPortOfDevice.get(deviceId);
- SegmentationId l3vni = vtnRscService
- .getL3vni(vmPort.tenantId());
- // Floating ip BIND
- if (type == VtnRscEvent.Type.FLOATINGIP_PUT) {
- applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
- floaingIp, l3vni, exPort,
- Objective.Operation.ADD);
- } else if (type == VtnRscEvent.Type.FLOATINGIP_DELETE) {
- // Floating ip UNBIND
- applyNorthSouthL3Flows(deviceId, host, vmPort, fipPort,
- floaingIp, l3vni, exPort,
- Objective.Operation.REMOVE);
- }
- }
- }
- }
-
- private void applyNorthSouthL3Flows(DeviceId deviceId, Host host,
- VirtualPort vmPort, VirtualPort fipPort,
- FloatingIp floatingIp,
- SegmentationId l3Vni, Port exPort,
- Objective.Operation operation) {
- if (!mastershipService.isLocalMaster(deviceId)) {
- log.debug("not master device:{}", deviceId);
- return;
- }
- List gwIpMac = getGwIpAndMac(vmPort);
- IpAddress dstVmGwIp = (IpAddress) gwIpMac.get(0);
- MacAddress dstVmGwMac = (MacAddress) gwIpMac.get(1);
- FixedIp fixedGwIp = getGwFixedIp(floatingIp);
- MacAddress fGwMac = null;
- if (fixedGwIp != null) {
- VirtualPort gwPort = virtualPortService.getPort(fixedGwIp);
- if (gwPort == null) {
- gwPort = VtnData.getPort(vPortStore, fixedGwIp);
- }
- fGwMac = gwPort.macAddress();
- }
- TenantNetwork vmNetwork = tenantNetworkService
- .getNetwork(vmPort.networkId());
- TenantNetwork fipNetwork = tenantNetworkService
- .getNetwork(fipPort.networkId());
- // L3 downlink traffic flow
- MacAddress exPortMac = MacAddress.valueOf(exPort.annotations().value(PORT_MAC));
- classifierService.programArpClassifierRules(deviceId, floatingIp.floatingIp(),
- fipNetwork.segmentationId(),
- operation);
- classifierService.programL3ExPortClassifierRules(deviceId, exPort.number(),
- floatingIp.floatingIp(), operation);
- DriverHandler handler = driverService.createHandler(deviceId);
- arpService.programArpRules(handler, deviceId, floatingIp.floatingIp(),
- fipNetwork.segmentationId(), exPortMac,
- operation);
- dnatService.programRules(deviceId, floatingIp.floatingIp(),
- fGwMac, floatingIp.fixedIp(),
- l3Vni, operation);
- l3ForwardService
- .programRouteRules(deviceId, l3Vni, floatingIp.fixedIp(),
- vmNetwork.segmentationId(), dstVmGwMac,
- vmPort.macAddress(), operation);
-
- // L3 uplink traffic flow
- classifierService.programL3InPortClassifierRules(deviceId,
- host.location().port(),
- host.mac(), dstVmGwMac,
- l3Vni, operation);
- snatService.programRules(deviceId, l3Vni, floatingIp.fixedIp(),
- fGwMac, exPortMac,
- floatingIp.floatingIp(),
- fipNetwork.segmentationId(), operation);
- if (operation == Objective.Operation.ADD) {
- classifierService.programArpClassifierRules(deviceId, dstVmGwIp,
- vmNetwork.segmentationId(),
- operation);
- arpService.programArpRules(handler, deviceId, dstVmGwIp,
- vmNetwork.segmentationId(), dstVmGwMac,
- operation);
- l2ForwardService.programLocalOut(deviceId,
- fipNetwork.segmentationId(),
- exPort.number(), fGwMac, operation);
- }
- }
-
- private Port getExPort(DeviceId deviceId) {
- List<Port> ports = deviceService.getPorts(deviceId);
- Port exPort = null;
- for (Port port : ports) {
- String portName = port.annotations().value(AnnotationKeys.PORT_NAME);
- if (portName != null && portName.equals(EX_PORT_NAME)) {
- exPort = port;
- break;
- }
- }
- return exPort;
- }
-
- private List getGwIpAndMac(VirtualPort port) {
- List list = new ArrayList();
- MacAddress gwMac = null;
- SubnetId subnetId = null;
- IpAddress gwIp = null;
- Iterator<FixedIp> fixips = port.fixedIps().iterator();
- if (fixips.hasNext()) {
- FixedIp fixip = fixips.next();
- subnetId = fixip.subnetId();
- gwIp = subnetService.getSubnet(subnetId).gatewayIp();
- FixedIp fixedGwIp = FixedIp.fixedIp(fixip.subnetId(), gwIp);
- VirtualPort gwPort = virtualPortService.getPort(fixedGwIp);
- if (gwPort == null) {
- gwPort = VtnData.getPort(vPortStore, fixedGwIp);
- }
- gwMac = gwPort.macAddress();
- }
- list.add(gwIp);
- list.add(gwMac);
- return list;
- }
-
- private FixedIp getGwFixedIp(FloatingIp floatingIp) {
- RouterId routerId = floatingIp.routerId();
- Router router = routerService.getRouter(routerId);
- RouterGateway routerGateway = router.externalGatewayInfo();
- Iterable<FixedIp> externalFixedIps = routerGateway.externalFixedIps();
- FixedIp fixedGwIp = null;
- if (externalFixedIps != null) {
- Iterator<FixedIp> exFixedIps = externalFixedIps.iterator();
- if (exFixedIps.hasNext()) {
- fixedGwIp = exFixedIps.next();
- }
- }
- return fixedGwIp;
- }
-
- private void applyHostMonitoredL3Rules(Host host,
- Objective.Operation operation) {
- String ifaceId = host.annotations().value(IFACEID);
- DeviceId deviceId = host.location().deviceId();
- VirtualPortId portId = VirtualPortId.portId(ifaceId);
- VirtualPort port = virtualPortService.getPort(portId);
- if (port == null) {
- port = VtnData.getPort(vPortStore, portId);
- }
- TenantId tenantId = port.tenantId();
- Port exPort = exPortOfDevice.get(deviceId);
- SegmentationId l3vni = vtnRscService.getL3vni(tenantId);
- Iterator<FixedIp> fixips = port.fixedIps().iterator();
- SubnetId sid = null;
- IpAddress hostIp = null;
- if (fixips.hasNext()) {
- FixedIp fixip = fixips.next();
- sid = fixip.subnetId();
- hostIp = fixip.ip();
- }
- final SubnetId subnetId = sid;
- // L3 internal network access to each other
- Iterable<RouterInterface> interfaces = routerInterfaceService
- .getRouterInterfaces();
- Set<RouterInterface> interfacesSet = Sets.newHashSet(interfaces)
- .stream().filter(r -> r.tenantId().equals(tenantId))
- .collect(Collectors.toSet());
- long count = interfacesSet.stream()
- .filter(r -> !r.subnetId().equals(subnetId)).count();
- if (count > 0) {
- if (operation == Objective.Operation.ADD) {
- if (routerInfFlagOfTenant.get(tenantId) != null) {
- applyEastWestL3Flows(host, l3vni, operation);
- } else {
- if (interfacesSet.size() > 1) {
- programInterfacesSet(interfacesSet, operation);
- }
- }
- } else if (operation == Objective.Operation.REMOVE) {
- if (routerInfFlagOfTenant.get(tenantId) != null) {
- applyEastWestL3Flows(host, l3vni, operation);
- }
- }
- }
- // L3 external and internal network access to each other
- FloatingIp floatingIp = null;
- Iterable<FloatingIp> floatingIps = floatingIpService.getFloatingIps();
- Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIps).stream()
- .filter(f -> f.tenantId().equals(tenantId))
- .collect(Collectors.toSet());
- for (FloatingIp f : floatingIpSet) {
- IpAddress fixedIp = f.fixedIp();
- if (fixedIp.equals(hostIp)) {
- floatingIp = f;
- break;
- }
- }
- if (floatingIp != null) {
- VirtualPort fipPort = virtualPortService
- .getPort(floatingIp.networkId(), floatingIp.floatingIp());
- if (fipPort == null) {
- fipPort = VtnData.getPort(vPortStore, floatingIp.networkId(),
- floatingIp.floatingIp());
- }
- applyNorthSouthL3Flows(deviceId, host, port, fipPort, floatingIp,
- l3vni, exPort, operation);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/package-info.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/impl/package-info.java
deleted file mode 100644
index 4c9a58cc..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/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.
- */
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-package org.onosproject.vtn.manager.impl;
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/package-info.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/package-info.java
deleted file mode 100644
index 09bd80f8..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/manager/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.
- */
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-package org.onosproject.vtn.manager;
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ArpService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ArpService.java
deleted file mode 100644
index ebb9ac3b..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ArpService.java
+++ /dev/null
@@ -1,48 +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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-
-/**
- * ArpService interface providing the rules in ARP table which is Table(10).
- */
-public interface ArpService {
-
- /**
- * Assemble the arp rules.
- * Match: arp type, vnid and destination ip.
- * Action: set arp_operation, move arp_eth_src to arp_eth_dst, set arp_eth_src,
- * move arp_ip_src to arp_ip_dst, set arp_ip_src, set output port.
- *
- * @param hander DriverHandler
- * @param deviceId Device Id
- * @param dstIP destination ip
- * @param matchVni the vni of the source network (l2vni)
- * @param dstMac destination mac
- * @param type the operation type of the flow rules
- */
- void programArpRules(DriverHandler hander, DeviceId deviceId, IpAddress dstIP,
- SegmentationId matchVni, MacAddress dstMac,
- Objective.Operation type);
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ClassifierService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ClassifierService.java
deleted file mode 100644
index 69e951a2..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/ClassifierService.java
+++ /dev/null
@@ -1,105 +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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-/**
- * Applies classifier flows to the device. Classifier table is Table(0).
- */
-public interface ClassifierService {
-
- /**
- * The port rule that message from host matches Table(0) Match: host mac and
- * ingress port Action: set vnid and go to L2Forward Table(50).
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param inPort the ingress port of the host
- * @param srcMac the mac of the host
- * @param appId the application ID of the vtn
- * @param type the operation of the flow
- */
- void programLocalIn(DeviceId deviceId, SegmentationId segmentationId,
- PortNumber inPort, MacAddress srcMac,
- ApplicationId appId, Objective.Operation type);
-
- /**
- * The port rule that message from tunnel Table(0) Match: tunnel port and
- * vnid Action: go to L2Forward Table(50).
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param localTunnelPorts the tunnel pors of the device
- * @param type the operation of the flow
- */
- void programTunnelIn(DeviceId deviceId, SegmentationId segmentationId,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type);
-
- /**
- * Assemble the L3 Classifier table rules which are sended from external port.
- * Match: ipv4 type, ingress port and destination ip.
- * Action: go to DNAT Table(20).
- *
- * @param deviceId Device Id
- * @param inPort external port
- * @param dstIp floating ip
- * @param type the operation type of the flow rules
- */
- void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
- IpAddress dstIp,
- Objective.Operation type);
-
- /**
- * Assemble the L3 Classifier table rules which are sended from internal port.
- * Match: ingress port, source mac and destination mac.
- * Action: set vnid and go to L3Forward Table(30).
- *
- * @param deviceId Device Id
- * @param inPort the ingress port of the host
- * @param srcMac source mac
- * @param dstMac destination vm gateway mac
- * @param actionVni the vni of L3 network
- * @param type the operation type of the flow rules
- */
- void programL3InPortClassifierRules(DeviceId deviceId,
- PortNumber inPort, MacAddress srcMac,
- MacAddress dstMac,
- SegmentationId actionVni,
- Objective.Operation type);
-
- /**
- * Assemble the Arp Classifier table rules.
- * Match: arp type and destination ip.
- * Action: set vnid and go to ARP Table(10).
- *
- * @param deviceId Device Id
- * @param dstIp source gateway ip
- * @param actionVni the vni of the source network (l2vni)
- * @param type the operation type of the flow rules
- */
- void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
- SegmentationId actionVni,
- Objective.Operation type);
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/DnatService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/DnatService.java
deleted file mode 100644
index 88c56288..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/DnatService.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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-/**
- * DnatService interface provides the rules in DNAT table which is Table(20) for ovs pipeline.
- * DNAT means Destination Network Address Translation, it is acronym for network terminology.
- * Handle the downward flows.
- */
-public interface DnatService {
-
- /**
- * Assemble the DNAT table rules.
- * Match: ipv4 type and destination ip.
- * Action: set eth_src, set ip_dst, set vnid and goto L3Forward Table(30).
- *
- * @param deviceId Device Id
- * @param dstIp floating ip
- * @param ethSrc floating ip gateway mac
- * @param ipDst destination vm ip
- * @param actionVni the vni of L3 network
- * @param type the operation type of the flow rules
- */
- void programRules(DeviceId deviceId, IpAddress dstIp,
- MacAddress ethSrc, IpAddress ipDst,
- SegmentationId actionVni, Objective.Operation type);
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L2ForwardService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L2ForwardService.java
deleted file mode 100644
index cb661f8b..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L2ForwardService.java
+++ /dev/null
@@ -1,97 +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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-/**
- * Applies L2 flows to the device. L2Forward table is Table(50).
- */
-public interface L2ForwardService {
-
- /**
- * The local broadcast rule that message matches Table(50).
- * Match: broadcast mac and vnid.
- * Action: set output port.
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param inPort the ingress port of the host
- * @param localVmPorts the local ports of the network which connect host
- * @param localTunnelPorts the tunnel pors of the device
- * @param type the operation of the flow
- */
- void programLocalBcastRules(DeviceId deviceId,
- SegmentationId segmentationId,
- PortNumber inPort,
- Iterable<PortNumber> localVmPorts,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type);
-
- /**
- * The tunnel broadcast rule that message matches Table(50).
- * Match: broadcast mac and vnid.
- * Action: output port.
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param localVmPorts the local ports of the network which connect host
- * @param localTunnelPorts the tunnel pors of the device
- * @param type the operation of the flow
- */
- void programTunnelBcastRules(DeviceId deviceId,
- SegmentationId segmentationId,
- Iterable<PortNumber> localVmPorts,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type);
-
- /**
- * The local out rule that message matches Table(50).
- * Match: local host mac and vnid.
- * Action: output local host port.
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param outPort the ingress port of the host
- * @param sourceMac the mac of the host
- * @param type the operation of the flow
- */
- void programLocalOut(DeviceId deviceId, SegmentationId segmentationId,
- PortNumber outPort, MacAddress sourceMac,
- Objective.Operation type);
-
- /**
- * The tunnel out rule that message matches Table(50).
- * Match: host mac and vnid.
- * Action: output tunnel port.
- *
- * @param deviceId Device Id
- * @param segmentationId the vnid of the host belong to
- * @param tunnelOutPort the port of the tunnel
- * @param dstMac the mac of the host
- * @param type the operation of the flow
- * @param ipAddress the ipAddress of the node
- */
- void programTunnelOut(DeviceId deviceId, SegmentationId segmentationId,
- PortNumber tunnelOutPort, MacAddress dstMac,
- Objective.Operation type, IpAddress ipAddress);
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L3ForwardService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L3ForwardService.java
deleted file mode 100644
index 718253a4..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/L3ForwardService.java
+++ /dev/null
@@ -1,47 +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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-/**
- * L3ForwardService interface provide the rules in L3Forward table which is Table(30).
- */
-public interface L3ForwardService {
-
- /**
- * Assemble the L3Forward table rules.
- * Match: ipv4 type, vnid and destination ip.
- * Action: set eth_src, set eth_dst, set vnid and goto L2Forward Table(50).
- *
- * @param deviceId Device Id
- * @param l3Vni the vni of L3 network
- * @param dstVmIP destination vm ip
- * @param dstVni the vni of the destination network (l2vni)
- * @param dstVmGwMac destination VM gateway mac
- * @param dstVmMac destination VM mac
- * @param type the operation type of the flow rules
- */
- void programRouteRules(DeviceId deviceId, SegmentationId l3Vni,
- IpAddress dstVmIP, SegmentationId dstVni,
- MacAddress dstVmGwMac, MacAddress dstVmMac,
- Objective.Operation type);
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/SnatService.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/SnatService.java
deleted file mode 100644
index e57596ed..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/SnatService.java
+++ /dev/null
@@ -1,49 +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.vtn.table;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtnrsc.SegmentationId;
-
-/**
- * SnatService interface provides the rules in SNAT table which is Table(40) for ovs pipeline.
- * SNAT means Source Network Address Translation, it is acronym for network terminology.
- * Handle the upward flows.
- */
-public interface SnatService {
-
- /**
- * Assemble the SNAT table rules.
- * Match: ipv4 type, vnid and source ip.
- * Action: set eth_src, set eth_dst, set ip_src, set vnid and goto L2Forward Table(50).
- *
- * @param deviceId Device Id
- * @param matchVni the vni of L3 network
- * @param srcIP source ip
- * @param ethDst external gateway mac
- * @param ethSrc external port mac
- * @param ipSrc floating ip
- * @param actionVni external network VNI
- * @param type the operation type of the flow rules
- */
- void programRules(DeviceId deviceId, SegmentationId matchVni,
- IpAddress srcIP, MacAddress ethDst,
- MacAddress ethSrc, IpAddress ipSrc,
- SegmentationId actionVni, Objective.Operation type);
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ArpServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ArpServiceImpl.java
deleted file mode 100644
index 574d15a7..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ArpServiceImpl.java
+++ /dev/null
@@ -1,113 +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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.EthType.EtherType;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.instructions.ExtensionTreatment;
-import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.flowobjective.Objective.Operation;
-import org.onosproject.vtn.table.ArpService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-/**
- * ArpTable class providing the rules in ARP table.
- */
-public class ArpServiceImpl implements ArpService {
- private final Logger log = getLogger(getClass());
-
- private static final int ARP_PRIORITY = 0xffff;
- private static final short ARP_RESPONSE = 0x2;
- private static final EtherType ARP_TYPE = EtherType.ARP;
-
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
-
- /**
- * Construct a ArpServiceImpl object.
- *
- * @param appId the application id of vtn
- */
- public ArpServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void programArpRules(DriverHandler hander, DeviceId deviceId,
- IpAddress dstIP, SegmentationId srcVni,
- MacAddress dstMac, Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(ARP_TYPE.ethType().toShort())
- .matchArpTpa(Ip4Address.valueOf(dstIP.toString()))
- .matchTunnelId(Long.parseLong(srcVni.segmentationId())).build();
-
- ExtensionTreatmentResolver resolver = hander
- .behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment ethSrcToDst = resolver
- .getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
- .NICIRA_MOV_ETH_SRC_TO_DST.type());
- ExtensionTreatment arpShaToTha = resolver
- .getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
- .NICIRA_MOV_ARP_SHA_TO_THA.type());
- ExtensionTreatment arpSpaToTpa = resolver
- .getExtensionInstruction(ExtensionTreatmentType.ExtensionTreatmentTypes
- .NICIRA_MOV_ARP_SPA_TO_TPA.type());
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .extension(ethSrcToDst, deviceId)
- .setEthSrc(dstMac).setArpOp(ARP_RESPONSE)
- .extension(arpShaToTha, deviceId)
- .extension(arpSpaToTpa, deviceId)
- .setArpSha(dstMac).setArpSpa(dstIP)
- .setOutput(PortNumber.IN_PORT).build();
-
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(ARP_PRIORITY);
-
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("PrivateArpRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("PrivateArpRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ClassifierServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ClassifierServiceImpl.java
deleted file mode 100644
index 512a1559..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/ClassifierServiceImpl.java
+++ /dev/null
@@ -1,196 +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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.EthType.EtherType;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.instructions.Instructions;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtn.table.ClassifierService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of ClassifierService.
- */
-public class ClassifierServiceImpl implements ClassifierService {
- private final Logger log = getLogger(getClass());
-
- private static final EtherType ETH_TYPE = EtherType.ARP;
- private static final int ARP_CLASSIFIER_PRIORITY = 60000;
- private static final int L3_CLASSIFIER_PRIORITY = 0xffff;
- private static final int L2_CLASSIFIER_PRIORITY = 50000;
-
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
-
- /**
- * Constructor.
- *
- * @param appId the application id of vtn
- */
- public ClassifierServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void programLocalIn(DeviceId deviceId,
- SegmentationId segmentationId, PortNumber inPort,
- MacAddress srcMac, ApplicationId appid,
- Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(inPort).matchEthSrc(srcMac).build();
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
- treatment.add(Instructions
- .modTunnelId(Long.parseLong(segmentationId.toString())));
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).makePermanent()
- .withFlag(Flag.SPECIFIC).withPriority(L2_CLASSIFIER_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("programLocalIn-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("programLocalIn-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
- @Override
- public void programTunnelIn(DeviceId deviceId,
- SegmentationId segmentationId,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type) {
- if (localTunnelPorts == null) {
- log.info("No tunnel port in device");
- return;
- }
- Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(tp).add(Criteria.matchTunnelId(Long
- .parseLong(segmentationId.toString())))
- .build();
-
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).makePermanent().withFlag(Flag.SPECIFIC)
- .withPriority(L2_CLASSIFIER_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("programTunnelIn-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("programTunnelIn-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- });
- }
-
- @Override
- public void programL3ExPortClassifierRules(DeviceId deviceId, PortNumber inPort,
- IpAddress dstIp,
- Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(Ethernet.TYPE_IPV4).matchInPort(inPort)
- .matchIPDst(IpPrefix.valueOf(dstIp, 32)).build();
- TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(L3_CLASSIFIER_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("L3ExToInClassifierRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("L3ExToInClassifierRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
- @Override
- public void programL3InPortClassifierRules(DeviceId deviceId, PortNumber inPort,
- MacAddress srcMac, MacAddress dstMac,
- SegmentationId actionVni,
- Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(inPort).matchEthSrc(srcMac).matchEthDst(dstMac)
- .build();
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .setTunnelId(Long.parseLong(actionVni.segmentationId())).build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(L3_CLASSIFIER_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("L3InternalClassifierRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("L3InternalClassifierRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
- @Override
- public void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
- SegmentationId actionVni,
- Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(ETH_TYPE.ethType().toShort())
- .matchArpTpa(Ip4Address.valueOf(dstIp.toString()))
- .build();
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .setTunnelId(Long.parseLong(actionVni.segmentationId()))
- .build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(ARP_CLASSIFIER_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("ArpClassifierRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("ArpClassifierRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/DnatServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/DnatServiceImpl.java
deleted file mode 100644
index 7b8d42fa..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/DnatServiceImpl.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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtn.table.DnatService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of DnatService.
- */
-public class DnatServiceImpl implements DnatService {
- private final Logger log = getLogger(getClass());
-
- private static final int DNAT_PRIORITY = 0xffff;
- private static final int PREFIX_LENGTH = 32;
-
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
-
- /**
- * Construct a DnatServiceImpl object.
- *
- * @param appId the application id of vtn
- */
- public DnatServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void programRules(DeviceId deviceId, IpAddress dstIp,
- MacAddress ethSrc, IpAddress ipDst,
- SegmentationId actionVni, Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(Ethernet.TYPE_IPV4)
- .matchIPDst(IpPrefix.valueOf(dstIp, PREFIX_LENGTH)).build();
-
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
- treatment.setEthSrc(ethSrc).setIpDst(ipDst)
- .setTunnelId(Long.parseLong(actionVni.segmentationId()));
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(DNAT_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("RouteRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("RouteRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L2ForwardServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L2ForwardServiceImpl.java
deleted file mode 100644
index 3581cf6e..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L2ForwardServiceImpl.java
+++ /dev/null
@@ -1,211 +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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_TUNNEL_DST;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.DefaultGroupId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
-import org.onosproject.net.driver.DriverHandler;
-import org.onosproject.net.driver.DriverService;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.TrafficTreatment.Builder;
-import org.onosproject.net.flow.criteria.Criteria;
-import org.onosproject.net.flow.instructions.ExtensionTreatment;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtn.table.L2ForwardService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of L2ForwardService.
- */
-public final class L2ForwardServiceImpl implements L2ForwardService {
- private final Logger log = getLogger(getClass());
-
- private static final int MAC_PRIORITY = 0xffff;
- public static final Integer GROUP_ID = 1;
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
- private final DriverService driverService;
- /**
- * Constructor.
- *
- * @param appId the application id of vtn
- */
- public L2ForwardServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- this.driverService = serviceDirectory.get(DriverService.class);
- }
-
- @Override
- public void programLocalBcastRules(DeviceId deviceId,
- SegmentationId segmentationId,
- PortNumber inPort,
- Iterable<PortNumber> localVmPorts,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type) {
- if (localVmPorts == null || localTunnelPorts == null) {
- log.info("No other host port and tunnel in the device");
- return;
- }
- Sets.newHashSet(localVmPorts).stream().forEach(lp -> {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(lp).matchEthDst(MacAddress.BROADCAST)
- .add(Criteria.matchTunnelId(Long
- .parseLong(segmentationId.toString())))
- .build();
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment
- .builder();
- boolean flag = false;
- for (PortNumber outPort : localVmPorts) {
- flag = true;
- if (outPort != lp) {
- treatment.setOutput(outPort);
- }
- }
- if (type.equals(Objective.Operation.REMOVE) && inPort == lp) {
- flag = false;
- }
- treatment.group(new DefaultGroupId(GROUP_ID));
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).makePermanent()
- .withFlag(Flag.SPECIFIC).withPriority(MAC_PRIORITY);
- if (flag) {
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- });
- }
-
- @Override
- public void programTunnelBcastRules(DeviceId deviceId,
- SegmentationId segmentationId,
- Iterable<PortNumber> localVmPorts,
- Iterable<PortNumber> localTunnelPorts,
- Objective.Operation type) {
- if (localVmPorts == null || localTunnelPorts == null) {
- log.info("No other host port or tunnel ports in the device");
- return;
- }
- Sets.newHashSet(localTunnelPorts).stream().forEach(tp -> {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchInPort(tp)
- .add(Criteria.matchTunnelId(Long
- .parseLong(segmentationId.toString())))
- .matchEthDst(MacAddress.BROADCAST).build();
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment
- .builder();
-
- for (PortNumber outPort : localVmPorts) {
- treatment.setOutput(outPort);
- }
-
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).makePermanent()
- .withFlag(Flag.SPECIFIC).withPriority(MAC_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- if (Sets.newHashSet(localVmPorts).size() == 0) {
- flowObjectiveService.forward(deviceId, objective.remove());
- } else {
- flowObjectiveService.forward(deviceId, objective.add());
- }
- } else {
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- });
- }
-
- @Override
- public void programLocalOut(DeviceId deviceId,
- SegmentationId segmentationId,
- PortNumber outPort, MacAddress sourceMac,
- Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchTunnelId(Long.parseLong(segmentationId.toString()))
- .matchEthDst(sourceMac).build();
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .setOutput(outPort).build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(MAC_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- flowObjectiveService.forward(deviceId, objective.remove());
- }
-
- }
-
- @Override
- public void programTunnelOut(DeviceId deviceId,
- SegmentationId segmentationId,
- PortNumber tunnelOutPort, MacAddress dstMac,
- Objective.Operation type, IpAddress ipAddress) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthDst(dstMac).add(Criteria.matchTunnelId(Long
- .parseLong(segmentationId.toString())))
- .build();
-
- DriverHandler handler = driverService.createHandler(deviceId);
- ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
- ExtensionTreatment treatment = resolver.getExtensionInstruction(NICIRA_SET_TUNNEL_DST.type());
- try {
- treatment.setPropertyValue("tunnelDst", Ip4Address.valueOf(ipAddress.toString()));
- } catch (Exception e) {
- log.error("Failed to get extension instruction to set tunnel dst {}", deviceId);
- }
-
- Builder builder = DefaultTrafficTreatment.builder();
- builder.extension(treatment, deviceId)
- .setOutput(tunnelOutPort).build();
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(builder.build()).withSelector(selector)
- .fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(MAC_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- flowObjectiveService.forward(deviceId, objective.remove());
- }
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L3ForwardServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L3ForwardServiceImpl.java
deleted file mode 100644
index cf97e76d..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/L3ForwardServiceImpl.java
+++ /dev/null
@@ -1,95 +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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flow.instructions.Instructions;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.net.flowobjective.Objective.Operation;
-import org.onosproject.vtn.table.L3ForwardService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of L3ForwardService.
- */
-public class L3ForwardServiceImpl implements L3ForwardService {
- private final Logger log = getLogger(getClass());
-
- private static final int L3FWD_PRIORITY = 0xffff;
- private static final short IP_TYPE = Ethernet.TYPE_IPV4;
- private static final int PREFIX_LENGTH = 32;
-
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
-
- /**
- * Construct a L3ForwardServiceImpl object.
- *
- * @param appId the application id of vtn
- */
- public L3ForwardServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void programRouteRules(DeviceId deviceId, SegmentationId l3Vni,
- IpAddress dstVmIP, SegmentationId dstVni,
- MacAddress dstVmGwMac, MacAddress dstVmMac,
- Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(IP_TYPE)
- .matchTunnelId(Long.parseLong(l3Vni.segmentationId()))
- .matchIPDst(IpPrefix.valueOf(dstVmIP, PREFIX_LENGTH)).build();
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
- treatment.setEthSrc(dstVmGwMac)
- .setEthDst(dstVmMac)
- .add(Instructions.modTunnelId(Long.parseLong(dstVni
- .segmentationId())));
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(L3FWD_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("RouteRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("RouteRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/SnatServiceImpl.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/SnatServiceImpl.java
deleted file mode 100644
index 0f090954..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/SnatServiceImpl.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.vtn.table.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.onlab.osgi.DefaultServiceDirectory;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.flowobjective.DefaultForwardingObjective;
-import org.onosproject.net.flowobjective.FlowObjectiveService;
-import org.onosproject.net.flowobjective.ForwardingObjective;
-import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
-import org.onosproject.net.flowobjective.Objective;
-import org.onosproject.vtn.table.SnatService;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of SnatService.
- */
-public class SnatServiceImpl implements SnatService {
- private final Logger log = getLogger(getClass());
-
- private static final int SNAT_PRIORITY = 0xffff;
- private static final int PREFIC_LENGTH = 32;
-
- private final FlowObjectiveService flowObjectiveService;
- private final ApplicationId appId;
-
- /**
- * Construct a SnatServiceImpl object.
- *
- * @param appId the application id of vtn
- */
- public SnatServiceImpl(ApplicationId appId) {
- this.appId = checkNotNull(appId, "ApplicationId can not be null");
- ServiceDirectory serviceDirectory = new DefaultServiceDirectory();
- this.flowObjectiveService = serviceDirectory.get(FlowObjectiveService.class);
- }
-
- @Override
- public void programRules(DeviceId deviceId, SegmentationId matchVni,
- IpAddress srcIP, MacAddress ethDst,
- MacAddress ethSrc, IpAddress ipSrc,
- SegmentationId actionVni, Objective.Operation type) {
- TrafficSelector selector = DefaultTrafficSelector.builder()
- .matchEthType(Ethernet.TYPE_IPV4)
- .matchTunnelId(Long.parseLong(matchVni.segmentationId()))
- .matchIPSrc(IpPrefix.valueOf(srcIP, PREFIC_LENGTH)).build();
-
- TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
- treatment.setEthDst(ethDst).setEthSrc(ethSrc).setIpSrc(ipSrc)
- .setTunnelId(Long.parseLong(actionVni.segmentationId()));
- ForwardingObjective.Builder objective = DefaultForwardingObjective
- .builder().withTreatment(treatment.build())
- .withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
- .withPriority(SNAT_PRIORITY);
- if (type.equals(Objective.Operation.ADD)) {
- log.debug("RouteRules-->ADD");
- flowObjectiveService.forward(deviceId, objective.add());
- } else {
- log.debug("RouteRules-->REMOVE");
- flowObjectiveService.forward(deviceId, objective.remove());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/package-info.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/impl/package-info.java
deleted file mode 100644
index fd2e18e5..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/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.
- */
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-package org.onosproject.vtn.table.impl;
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/package-info.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/package-info.java
deleted file mode 100644
index cf53c966..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/table/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.
- */
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-package org.onosproject.vtn.table;
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/DataPathIdGenerator.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/DataPathIdGenerator.java
deleted file mode 100644
index c2413475..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/DataPathIdGenerator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.onosproject.vtn.util;
-
-import static org.onlab.util.Tools.toHex;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Calendar;
-
-import org.onosproject.core.IdGenerator;
-import org.onosproject.net.DeviceId;
-
-public final class DataPathIdGenerator implements IdGenerator {
- private static final String SCHEME = "of";
- private String ipAddress;
- private String timeStamp;
-
- private DataPathIdGenerator(Builder builder) {
- this.ipAddress = builder.ipAddress;
- Calendar cal = Calendar.getInstance();
- this.timeStamp = String.valueOf(cal.get(Calendar.SECOND))
- + String.valueOf(cal.get(Calendar.MILLISECOND));
- }
-
- @Override
- public long getNewId() {
- String dpid = ipAddress.replace(".", "") + timeStamp;
- return Long.parseLong(dpid);
- }
-
- public String getDpId() {
- return toHex(getNewId());
- }
-
- public DeviceId getDeviceId() {
- try {
- URI uri = new URI(SCHEME, toHex(getNewId()), null);
- return DeviceId.deviceId(uri);
- } catch (URISyntaxException e) {
- return null;
- }
- }
-
- /**
- * Returns a new builder.
- *
- * @return new builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- public static final class Builder {
- private String ipAddress;
-
- public Builder addIpAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- return this;
- }
-
- public DataPathIdGenerator build() {
- return new DataPathIdGenerator(this);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnConfig.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnConfig.java
deleted file mode 100644
index 5ac04661..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnConfig.java
+++ /dev/null
@@ -1,123 +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.vtn.util;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.DefaultAnnotations;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.behaviour.BridgeConfig;
-import org.onosproject.net.behaviour.BridgeName;
-import org.onosproject.net.behaviour.DefaultTunnelDescription;
-import org.onosproject.net.behaviour.IpTunnelEndPoint;
-import org.onosproject.net.behaviour.TunnelConfig;
-import org.onosproject.net.behaviour.TunnelDescription;
-import org.onosproject.net.behaviour.TunnelEndPoint;
-import org.onosproject.net.behaviour.TunnelName;
-import org.onosproject.net.driver.DriverHandler;
-
-/**
- * Applies configuration to the device.
- */
-public final class VtnConfig {
-
- private static final String DEFAULT_BRIDGE_NAME = "br-int";
- private static final String DEFAULT_TUNNEL = "vxlan-0.0.0.0";
- private static final Map<String, String> DEFAULT_TUNNEL_OPTIONS = new HashMap<String, String>() {
- {
- put("key", "flow");
- put("remote_ip", "flow");
- }
- };
- /**
- * Constructs a vtn config object. Utility classes should not have a
- * public or default constructor, otherwise IDE will compile unsuccessfully. This
- * class should not be instantiated.
- */
- private VtnConfig() {
- }
-
- /**
- * Creates or update bridge in the controller device.
- *
- * @param handler DriverHandler
- * @param dpid datapath id
- * @param exPortName external port name
- */
- public static void applyBridgeConfig(DriverHandler handler, String dpid, String exPortName) {
- BridgeConfig bridgeConfig = handler.behaviour(BridgeConfig.class);
- bridgeConfig.addBridge(BridgeName.bridgeName(DEFAULT_BRIDGE_NAME), dpid, exPortName);
- }
-
- /**
- * Creates or update tunnel in the controller device.
- *
- * @param handler DriverHandler
- * @param srcIp the ipAddress of the local controller device
- * @param dstIp the ipAddress of the remote controller device
- */
- public static void applyTunnelConfig(DriverHandler handler, IpAddress srcIp,
- IpAddress dstIp) {
- DefaultAnnotations.Builder optionBuilder = DefaultAnnotations.builder();
- for (String key : DEFAULT_TUNNEL_OPTIONS.keySet()) {
- optionBuilder.set(key, DEFAULT_TUNNEL_OPTIONS.get(key));
- }
- TunnelConfig tunnelConfig = handler.behaviour(TunnelConfig.class);
- TunnelEndPoint tunnelAsSrc = IpTunnelEndPoint.ipTunnelPoint(srcIp);
- TunnelDescription tunnel = new DefaultTunnelDescription(
- tunnelAsSrc,
- null,
- TunnelDescription.Type.VXLAN,
- TunnelName.tunnelName(DEFAULT_TUNNEL),
- optionBuilder.build());
- tunnelConfig.createTunnelInterface(BridgeName.bridgeName(DEFAULT_BRIDGE_NAME), tunnel);
- }
-
- /**
- * Creates or update tunnel in the controller device.
- *
- * @param handler DriverHandler
- * @param srcIp the ipAddress of the local controller device
- * @param dstIp the ipAddress of the remote controller device
- */
- public static void removeTunnelConfig(DriverHandler handler, IpAddress srcIp,
- IpAddress dstIp) {
- TunnelConfig tunnelConfig = handler.behaviour(TunnelConfig.class);
- TunnelEndPoint tunnelAsSrc = IpTunnelEndPoint.ipTunnelPoint(srcIp);
- TunnelEndPoint tunnelAsDst = IpTunnelEndPoint.ipTunnelPoint(dstIp);
- TunnelDescription tunnel = new DefaultTunnelDescription(
- tunnelAsSrc,
- tunnelAsDst,
- TunnelDescription.Type.VXLAN,
- null);
- tunnelConfig.removeTunnel(tunnel);
- }
-
- /**
- * Gets ports in the controller device.
- *
- * @param handler DriverHandler
- * @return set of port numbers
- */
- public static Set<PortNumber> getPortNumbers(DriverHandler handler) {
- BridgeConfig bridgeConfig = handler.behaviour(BridgeConfig.class);
- return bridgeConfig.getPortNumbers();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnData.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnData.java
deleted file mode 100644
index cca905c2..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/VtnData.java
+++ /dev/null
@@ -1,179 +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.vtn.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.AnnotationKeys;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Port;
-import org.onosproject.net.PortNumber;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Sets;
-
-/**
- * VtnData utility class.
- */
-public final class VtnData {
-
- private static final Logger log = LoggerFactory.getLogger(VtnData.class);
- private static final String SWITCH_CHANNEL_ID = "channelId";
- private static final String PORT_HEAD = "vxlan";
-
- /**
- * Constructs a VtnData object. Utility classes should not have a public or
- * default constructor, otherwise IDE will compile unsuccessfully. This
- * class should not be instantiated.
- */
- private VtnData() {
- }
-
- /**
- * Get the ControllerIp from the device .
- *
- * @param device Device
- * @return Controller Ip
- */
- public static String getControllerIpOfSwitch(Device device) {
- String url = device.annotations().value(SWITCH_CHANNEL_ID);
- return url.substring(0, url.lastIndexOf(":"));
- }
-
- /**
- * Get the ControllerId from the device .
- *
- * @param device Device
- * @param devices Devices
- * @return Controller Id
- */
- public static DeviceId getControllerId(Device device,
- Iterable<Device> devices) {
- for (Device d : devices) {
- if (d.type() == Device.Type.CONTROLLER && d.id().toString()
- .contains(getControllerIpOfSwitch(device))) {
- return d.id();
- }
- }
- log.info("Can not find controller for device : {}", device.id());
- return null;
- }
-
- /**
- * Get local tunnel ports.
- *
- * @param ports Iterable of Port
- * @return Collection of PortNumber
- */
- public static Collection<PortNumber> getLocalTunnelPorts(Iterable<Port> ports) {
- Collection<PortNumber> localTunnelPorts = new ArrayList<>();
- Sets.newHashSet(ports).stream()
- .filter(p -> !p.number().equals(PortNumber.LOCAL))
- .forEach(p -> {
- if (p.annotations().value(AnnotationKeys.PORT_NAME)
- .startsWith(PORT_HEAD)) {
- localTunnelPorts.add(p.number());
- }
- });
- return localTunnelPorts;
- }
-
- /**
- * Get VirtualPort.
- *
- * @param vPortStore EventuallyConsistentMap of VirtualPort
- * @param vPortId VirtualPortId of the VirtualPort
- * @return VirtualPort
- */
- public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
- VirtualPortId vPortId) {
- if (vPortStore != null) {
- return vPortStore.get(vPortId);
- }
- return null;
- }
-
- /**
- * Get VirtualPort.
- *
- * @param vPortStore EventuallyConsistentMap of VirtualPort
- * @param fixedIP FixedIp of the VirtualPort
- * @return VirtualPort
- */
- public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
- FixedIp fixedIP) {
- if (vPortStore != null) {
- List<VirtualPort> vPorts = new ArrayList<>();
- vPortStore.values().stream().forEach(p -> {
- Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
- while (fixedIps.hasNext()) {
- if (fixedIps.next().equals(fixedIP)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
- return null;
- }
-
- /**
- * Get VirtualPort.
- *
- * @param vPortStore EventuallyConsistentMap of VirtualPort
- * @param networkId TenantNetworkId of the VirtualPort
- * @param ip IpAddress of the VirtualPort
- * @return VirtualPort
- */
- public static VirtualPort getPort(EventuallyConsistentMap<VirtualPortId, VirtualPort> vPortStore,
- TenantNetworkId networkId, IpAddress ip) {
- if (vPortStore != null) {
- List<VirtualPort> vPorts = new ArrayList<>();
- vPortStore.values().stream()
- .filter(p -> p.networkId().equals(networkId))
- .forEach(p -> {
- Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
- while (fixedIps.hasNext()) {
- if (fixedIps.next().ip().equals(ip)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
- return null;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/package-info.java b/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/package-info.java
deleted file mode 100644
index 213b9e28..00000000
--- a/framework/src/onos/apps/vtn/vtnmgr/src/main/java/org/onosproject/vtn/util/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.
- */
-
-/**
- * VTN application that applies configuration and flows to the device.
- */
-package org.onosproject.vtn.util;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/pom.xml b/framework/src/onos/apps/vtn/vtnrsc/pom.xml
deleted file mode 100644
index a2905909..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.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.
- -->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
-
- <artifactId>onos-app-vtn-rsc</artifactId>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-core-serializers</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllocationPool.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllocationPool.java
deleted file mode 100644
index 3d6ba8e8..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllocationPool.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.vtnrsc;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * The continuous IP address range between the start address and the end address for the allocation pools.
- */
-public interface AllocationPool {
-
- /**
- * The start address for the allocation pool.
- *
- * @return startIp
- */
- IpAddress startIp();
-
- /**
- * The end address for the allocation pool.
- *
- * @return endIp
- */
- IpAddress endIp();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllowedAddressPair.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllowedAddressPair.java
deleted file mode 100644
index 4e1028d8..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/AllowedAddressPair.java
+++ /dev/null
@@ -1,94 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-/**
- * Immutable representation of a allowed address pair.
- */
-public final class AllowedAddressPair {
- private final IpAddress ip;
- private final MacAddress mac;
- // Public construction is prohibited
- private AllowedAddressPair(IpAddress ip, MacAddress mac) {
- checkNotNull(ip, "IpAddress cannot be null");
- checkNotNull(mac, "MacAddress cannot be null");
- this.ip = ip;
- this.mac = mac;
- }
- /**
- * Returns the AllowedAddressPair ip address.
- *
- * @return ip address
- */
- public IpAddress ip() {
- return ip;
- }
-
- /**
- * Returns the AllowedAddressPair MAC address.
- *
- * @return MAC address
- */
- public MacAddress mac() {
- return mac;
- }
-
-
- /**
- * Creates a allowedAddressPair using the supplied ipAddress &amp;
- * macAddress.
- *
- * @param ip IP address
- * @param mac MAC address
- * @return AllowedAddressPair
- */
- public static AllowedAddressPair allowedAddressPair(IpAddress ip,
- MacAddress mac) {
- return new AllowedAddressPair(ip, mac);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(ip, mac);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof AllowedAddressPair) {
- final AllowedAddressPair that = (AllowedAddressPair) obj;
- return Objects.equals(this.ip, that.ip)
- && Objects.equals(this.mac, that.mac);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("ip", ip).add("mac", mac).toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
deleted file mode 100644
index 7dca32de..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.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.vtnrsc;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-public final class BindingHostId {
- private final String bindingHostId;
-
- // Public construction is prohibited
- private BindingHostId(String bindingHostId) {
- checkNotNull(bindingHostId, "BindingHosttId cannot be null");
- this.bindingHostId = bindingHostId;
- }
-
- /**
- * Creates a BindingHostId identifier.
- *
- * @param bindingHostId the bindingHostId identifier
- * @return the bindingHostId identifier
- */
- public static BindingHostId bindingHostId(String bindingHostId) {
- return new BindingHostId(bindingHostId);
- }
-
- /**
- * Returns the bindingHostId identifier.
- *
- * @return the bindingHostId identifier
- */
- public String bindingHostId() {
- return bindingHostId;
- }
-
- @Override
- public int hashCode() {
- return bindingHostId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof BindingHostId) {
- final BindingHostId that = (BindingHostId) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.bindingHostId, that.bindingHostId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return bindingHostId;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultAllocationPool.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultAllocationPool.java
deleted file mode 100644
index 8a480194..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultAllocationPool.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * The continuous IP address range between the start address and the end address
- * for the allocation pools.
- */
-public final class DefaultAllocationPool implements AllocationPool {
-
- private final IpAddress startIp;
- private final IpAddress endIp;
-
- /**
- * Creates an AllocationPool by using the start IP address and the end IP
- * address.
- *
- * @param startIp the start IP address of the allocation pool
- * @param endIp the end IP address of the allocation pool
- */
- public DefaultAllocationPool(IpAddress startIp, IpAddress endIp) {
- checkNotNull(startIp, "StartIp cannot be null");
- checkNotNull(endIp, "EndIp cannot be null");
- this.startIp = startIp;
- this.endIp = endIp;
- }
-
- @Override
- public IpAddress startIp() {
- return startIp;
- }
-
- @Override
- public IpAddress endIp() {
- return endIp;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(startIp, endIp);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultAllocationPool) {
- final DefaultAllocationPool other = (DefaultAllocationPool) obj;
- return Objects.equals(this.startIp, other.startIp)
- && Objects.equals(this.endIp, other.endIp);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("startIp", startIp).add("endIp", endIp)
- .toString();
- }
-}
-
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFloatingIp.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFloatingIp.java
deleted file mode 100644
index 7a297d90..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFloatingIp.java
+++ /dev/null
@@ -1,140 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * Default implementation of FloatingIp interface.
- */
-public final class DefaultFloatingIp implements FloatingIp {
-
- private final FloatingIpId id;
- private final TenantId tenantId;
- private final TenantNetworkId networkId;
- private final VirtualPortId portId;
- private final RouterId routerId;
- private final IpAddress floatingIp;
- private final IpAddress fixedIp;
- private final Status status;
-
- /**
- *
- * Creates a floating Ip object.
- *
- * @param id floatingIp identifier
- * @param tenantId tenant identifier
- * @param networkId the identifier of network associated with the floating Ip
- * @param portId port identifier
- * @param routerId router identifier
- * @param floatingIp floatingIp address
- * @param fixedIp the fixed Ip associated with the floating Ip
- * @param status the floating Ip status
- */
- public DefaultFloatingIp(FloatingIpId id, TenantId tenantId,
- TenantNetworkId networkId, VirtualPortId portId,
- RouterId routerId, IpAddress floatingIp,
- IpAddress fixedIp, Status status) {
- this.id = checkNotNull(id, "id cannot be null");
- this.tenantId = checkNotNull(tenantId, "tenantId cannot be null");
- this.networkId = checkNotNull(networkId, "networkId cannot be null");
- this.portId = portId;
- this.routerId = routerId;
- this.floatingIp = checkNotNull(floatingIp, "floatingIp cannot be null");
- this.fixedIp = fixedIp;
- this.status = checkNotNull(status, "status cannot be null");
- }
-
- @Override
- public FloatingIpId id() {
- return id;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public TenantNetworkId networkId() {
- return networkId;
- }
-
- @Override
- public VirtualPortId portId() {
- return portId;
- }
-
- @Override
- public RouterId routerId() {
- return routerId;
- }
-
- @Override
- public IpAddress floatingIp() {
- return floatingIp;
- }
-
- @Override
- public IpAddress fixedIp() {
- return fixedIp;
- }
-
- @Override
- public Status status() {
- return status;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, tenantId, networkId, portId, routerId,
- floatingIp, fixedIp, status);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultFloatingIp) {
- final DefaultFloatingIp that = (DefaultFloatingIp) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.tenantId, that.tenantId)
- && Objects.equals(this.networkId, that.networkId)
- && Objects.equals(this.portId, that.portId)
- && Objects.equals(this.routerId, that.routerId)
- && Objects.equals(this.floatingIp, that.floatingIp)
- && Objects.equals(this.fixedIp, that.fixedIp)
- && Objects.equals(this.status, that.status);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("tenantId", tenantId)
- .add("networkId", networkId).add("portId", portId)
- .add("routerId", routerId).add("floatingIp", floatingIp)
- .add("fixedIp", fixedIp).add("floatingIpStatus", status)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java
deleted file mode 100644
index 7915ce08..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java
+++ /dev/null
@@ -1,405 +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.vtnrsc;
-
-import java.util.Objects;
-import org.onlab.packet.IpPrefix;
-
-import com.google.common.base.MoreObjects;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Provides Default flow classifier.
- */
-public final class DefaultFlowClassifier implements FlowClassifier {
-
- private final FlowClassifierId flowClassifierId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final String etherType;
- private final String protocol;
- private final int minSrcPortRange;
- private final int maxSrcPortRange;
- private final int minDstPortRange;
- private final int maxDstPortRange;
- private final IpPrefix srcIpPrefix;
- private final IpPrefix dstIpPrefix;
- private final VirtualPortId srcPort;
- private final VirtualPortId dstPort;
- private static final int NULL_PORT = 0;
- private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "FlowClassifier id can not be null.";
- private static final String TENANT_ID_NOT_NULL = "Tenant id can not be null.";
- private static final String NAME_NOT_NULL = "Name can not be null.";
- private static final String ETHER_TYPE_NOT_NULL = "Ether Type can not be null.";
-
- /**
- * Constructor to create default flow classifier.
- *
- * @param flowClassifierId flow classifier Id
- * @param tenantId Tenant ID
- * @param name flow classifier name
- * @param description flow classifier description
- * @param etherType etherType
- * @param protocol IP protocol
- * @param minSrcPortRange Minimum Source port range
- * @param maxSrcPortRange Maximum Source port range
- * @param minDstPortRange Minimum destination port range
- * @param maxDstPortRange Maximum destination port range
- * @param srcIpPrefix Source IP prefix
- * @param dstIpPrefix destination IP prefix
- * @param srcPort Source VirtualPort
- * @param dstPort destination VirtualPort
- */
- private DefaultFlowClassifier(FlowClassifierId flowClassifierId, TenantId tenantId, String name,
- String description, String etherType, String protocol, int minSrcPortRange, int maxSrcPortRange,
- int minDstPortRange, int maxDstPortRange, IpPrefix srcIpPrefix, IpPrefix dstIpPrefix,
- VirtualPortId srcPort, VirtualPortId dstPort) {
- this.flowClassifierId = flowClassifierId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.etherType = etherType;
- this.protocol = protocol;
- this.minSrcPortRange = minSrcPortRange;
- this.maxSrcPortRange = maxSrcPortRange;
- this.minDstPortRange = minDstPortRange;
- this.maxDstPortRange = maxDstPortRange;
- this.srcIpPrefix = srcIpPrefix;
- this.dstIpPrefix = dstIpPrefix;
- this.srcPort = srcPort;
- this.dstPort = dstPort;
- }
-
- @Override
- public FlowClassifierId flowClassifierId() {
- return flowClassifierId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public String etherType() {
- return etherType;
- }
-
- @Override
- public String protocol() {
- return protocol;
- }
-
- @Override
- public int minSrcPortRange() {
- return minSrcPortRange;
- }
-
- @Override
- public int maxSrcPortRange() {
- return maxSrcPortRange;
- }
-
- @Override
- public int minDstPortRange() {
- return minDstPortRange;
- }
-
- @Override
- public int maxDstPortRange() {
- return maxDstPortRange;
- }
-
- @Override
- public IpPrefix srcIpPrefix() {
- return srcIpPrefix;
- }
-
- @Override
- public IpPrefix dstIpPrefix() {
- return dstIpPrefix;
- }
-
- @Override
- public VirtualPortId srcPort() {
- return srcPort;
- }
-
- @Override
- public VirtualPortId dstPort() {
- return dstPort;
- }
-
- /**
- * Builder class for constructing Flow classifier.
- */
- public static class Builder implements FlowClassifier.Builder {
-
- private FlowClassifierId flowClassifierId;
- private TenantId tenantId;
- private String name;
- private String description;
- private boolean isFlowClassifierDescriptionSet = false;
- private String etherType;
- private String protocol;
- private boolean isProtocolSet = false;
- private int minSrcPortRange;
- private boolean isMinSrcPortRangeSet = false;
- private int maxSrcPortRange;
- private boolean isMaxSrcPortRangeSet = false;
- private int minDstPortRange;
- private boolean isMinDstPortRangeSet = false;
- private int maxDstPortRange;
- private boolean isMaxDstPortRangeSet = false;
- private IpPrefix srcIpPrefix;
- private boolean isSrcIpPrefixSet = false;
- private IpPrefix dstIpPrefix;
- private boolean isDstIpPrefixSet = false;
- private VirtualPortId srcPort;
- private boolean isSrcPortSet = false;
- private VirtualPortId dstPort;
- private boolean isDstPortSet = false;
-
- @Override
- public FlowClassifier build() {
-
- checkNotNull(flowClassifierId, FLOW_CLASSIFIER_ID_NOT_NULL);
- checkNotNull(tenantId, TENANT_ID_NOT_NULL);
- checkNotNull(name, NAME_NOT_NULL);
- checkNotNull(etherType, ETHER_TYPE_NOT_NULL);
- String description = null;
- String protocol = null;
- int minSrcPortRange = NULL_PORT;
- int maxSrcPortRange = NULL_PORT;
- int minDstPortRange = NULL_PORT;
- int maxDstPortRange = NULL_PORT;
- IpPrefix srcIpPrefix = null;
- IpPrefix dstIpPrefix = null;
- VirtualPortId srcPort = null;
- VirtualPortId dstPort = null;
-
- if (isFlowClassifierDescriptionSet) {
- description = this.description;
- }
- if (isProtocolSet) {
- protocol = this.protocol;
- }
- if (isMinSrcPortRangeSet) {
- minSrcPortRange = this.minSrcPortRange;
- }
- if (isMaxSrcPortRangeSet) {
- maxSrcPortRange = this.maxSrcPortRange;
- }
- if (isMinDstPortRangeSet) {
- minDstPortRange = this.minDstPortRange;
- }
- if (isMaxDstPortRangeSet) {
- maxDstPortRange = this.maxDstPortRange;
- }
- if (isSrcIpPrefixSet) {
- srcIpPrefix = this.srcIpPrefix;
- }
- if (isDstIpPrefixSet) {
- dstIpPrefix = this.dstIpPrefix;
- }
- if (isSrcPortSet) {
- srcPort = this.srcPort;
- }
- if (isDstPortSet) {
- dstPort = this.dstPort;
- }
-
- return new DefaultFlowClassifier(flowClassifierId, tenantId, name, description, etherType, protocol,
- minSrcPortRange, maxSrcPortRange, minDstPortRange, maxDstPortRange, srcIpPrefix, dstIpPrefix,
- srcPort, dstPort);
- }
-
- @Override
- public Builder setFlowClassifierId(FlowClassifierId flowClassifierId) {
- this.flowClassifierId = flowClassifierId;
- return this;
- }
-
- @Override
- public Builder setTenantId(TenantId tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- @Override
- public Builder setName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Builder setDescription(String description) {
- this.description = description;
- this.isFlowClassifierDescriptionSet = true;
- return this;
- }
-
- @Override
- public Builder setEtherType(String etherType) {
- this.etherType = etherType;
- return this;
- }
-
- @Override
- public Builder setProtocol(String protocol) {
- this.protocol = protocol;
- this.isProtocolSet = true;
- return this;
- }
-
- @Override
- public Builder setMinSrcPortRange(int minSrcPortRange) {
- this.minSrcPortRange = minSrcPortRange;
- this.isMinSrcPortRangeSet = true;
- return this;
- }
-
- @Override
- public Builder setMaxSrcPortRange(int maxSrcPortRange) {
- this.maxSrcPortRange = maxSrcPortRange;
- this.isMaxSrcPortRangeSet = true;
- return this;
- }
-
- @Override
- public Builder setMinDstPortRange(int minDstPortRange) {
- this.minDstPortRange = minDstPortRange;
- this.isMinDstPortRangeSet = true;
- return this;
- }
-
- @Override
- public Builder setMaxDstPortRange(int maxDstPortRange) {
- this.maxDstPortRange = maxDstPortRange;
- this.isMaxDstPortRangeSet = true;
- return this;
- }
-
- @Override
- public Builder setSrcIpPrefix(IpPrefix srcIpPrefix) {
- this.srcIpPrefix = srcIpPrefix;
- this.isSrcIpPrefixSet = true;
- return this;
- }
-
- @Override
- public Builder setDstIpPrefix(IpPrefix dstIpPrefix) {
- this.dstIpPrefix = dstIpPrefix;
- this.isDstIpPrefixSet = true;
- return this;
- }
-
- @Override
- public Builder setSrcPort(VirtualPortId srcPort) {
- this.srcPort = srcPort;
- this.isSrcPortSet = true;
- return this;
- }
-
- @Override
- public Builder setDstPort(VirtualPortId dstPort) {
- this.dstPort = dstPort;
- this.isDstPortSet = true;
- return this;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(flowClassifierId, tenantId, name, description, etherType, protocol, minSrcPortRange,
- maxSrcPortRange, minDstPortRange, maxDstPortRange, srcIpPrefix, dstIpPrefix, srcPort, dstPort);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultFlowClassifier) {
- DefaultFlowClassifier other = (DefaultFlowClassifier) obj;
- return Objects.equals(this.flowClassifierId, other.flowClassifierId)
- && Objects.equals(this.tenantId, other.tenantId)
- && Objects.equals(this.name, other.name)
- && Objects.equals(this.description, other.description)
- && Objects.equals(this.etherType, other.etherType)
- && Objects.equals(this.protocol, other.protocol)
- && Objects.equals(this.minSrcPortRange, other.minSrcPortRange)
- && Objects.equals(this.maxSrcPortRange, other.maxSrcPortRange)
- && Objects.equals(this.minDstPortRange, other.minDstPortRange)
- && Objects.equals(this.maxDstPortRange, other.maxDstPortRange)
- && Objects.equals(this.srcIpPrefix, other.srcIpPrefix)
- && Objects.equals(this.dstIpPrefix, other.dstIpPrefix)
- && Objects.equals(this.srcPort, other.srcPort)
- && Objects.equals(this.dstPort, other.dstPort);
- }
- return false;
- }
-
- @Override
- public boolean exactMatch(FlowClassifier flowClassifier) {
- return this.equals(flowClassifier)
- && Objects.equals(this.flowClassifierId, flowClassifier.flowClassifierId())
- && Objects.equals(this.tenantId, flowClassifier.tenantId())
- && Objects.equals(this.name, flowClassifier.name())
- && Objects.equals(this.description, flowClassifier.description())
- && Objects.equals(this.etherType, flowClassifier.etherType())
- && Objects.equals(this.protocol, flowClassifier.protocol())
- && Objects.equals(this.minSrcPortRange, flowClassifier.minSrcPortRange())
- && Objects.equals(this.maxSrcPortRange, flowClassifier.maxSrcPortRange())
- && Objects.equals(this.minDstPortRange, flowClassifier.minDstPortRange())
- && Objects.equals(this.maxDstPortRange, flowClassifier.maxDstPortRange())
- && Objects.equals(this.srcIpPrefix, flowClassifier.srcIpPrefix())
- && Objects.equals(this.dstIpPrefix, flowClassifier.dstIpPrefix())
- && Objects.equals(this.srcPort, flowClassifier.srcPort())
- && Objects.equals(this.dstPort, flowClassifier.dstPort());
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("FlowClassifierId", flowClassifierId)
- .add("TenantId", tenantId)
- .add("Name", name)
- .add("Description", description)
- .add("String", etherType)
- .add("Protocol", protocol)
- .add("MinSrcPortRange", minSrcPortRange)
- .add("MaxSrcPortRange", maxSrcPortRange)
- .add("MinDstPortRange", minDstPortRange)
- .add("MaxDstPortRange", maxDstPortRange)
- .add("SrcIpPrefix", srcIpPrefix)
- .add("DstIpPrefix", dstIpPrefix)
- .add("SrcPort", srcPort)
- .add("DstPort", dstPort)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultHostRoute.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultHostRoute.java
deleted file mode 100644
index 8679100d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultHostRoute.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-
-/**
- * Host route dictionaries for the subnet.
- */
-public final class DefaultHostRoute implements HostRoute {
-
- private final IpAddress nexthop;
- private final IpPrefix destination;
-
- /**
- *
- * Creates a DefaultHostRoute by using the next hop and the destination.
- *
- * @param nexthop of the DefaultHostRoute
- * @param destination of the DefaultHostRoute
- */
- public DefaultHostRoute(IpAddress nexthop, IpPrefix destination) {
- this.nexthop = nexthop;
- this.destination = destination;
- }
-
- @Override
- public IpAddress nexthop() {
- return nexthop;
- }
-
- @Override
- public IpPrefix destination() {
- return destination;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("nexthop", nexthop)
- .add("destination", destination).toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(nexthop, destination);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultHostRoute) {
- final DefaultHostRoute other = (DefaultHostRoute) obj;
- return Objects.equals(this.nexthop, other.nexthop)
- && Objects.equals(this.destination, other.destination);
- }
- return false;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortChain.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortChain.java
deleted file mode 100644
index 89b94b3e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortChain.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Objects;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Implementation of port chain.
- */
-public final class DefaultPortChain implements PortChain {
-
- private final PortChainId portChainId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final List<PortPairGroupId> portPairGroupList;
- private final List<FlowClassifierId> flowClassifierList;
-
- /**
- * Default constructor to create port chain.
- *
- * @param portChainId port chain id
- * @param tenantId tenant id
- * @param name name of port chain
- * @param description description of port chain
- * @param portPairGroupList port pair group list
- * @param flowClassifierList flow classifier list
- */
- private DefaultPortChain(PortChainId portChainId, TenantId tenantId,
- String name, String description,
- List<PortPairGroupId> portPairGroupList,
- List<FlowClassifierId> flowClassifierList) {
-
- this.portChainId = portChainId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.portPairGroupList = portPairGroupList;
- this.flowClassifierList = flowClassifierList;
- }
-
- @Override
- public PortChainId portChainId() {
- return portChainId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public List<PortPairGroupId> portPairGroups() {
- return ImmutableList.copyOf(portPairGroupList);
- }
-
- @Override
- public List<FlowClassifierId> flowClassifiers() {
- return ImmutableList.copyOf(flowClassifierList);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(portChainId, tenantId, name, description,
- portPairGroupList, flowClassifierList);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultPortChain) {
- DefaultPortChain that = (DefaultPortChain) obj;
- return Objects.equals(portChainId, that.portChainId) &&
- Objects.equals(tenantId, that.tenantId) &&
- Objects.equals(name, that.name) &&
- Objects.equals(description, that.description) &&
- Objects.equals(portPairGroupList, that.portPairGroupList) &&
- Objects.equals(flowClassifierList, that.flowClassifierList);
- }
- return false;
- }
-
- @Override
- public boolean exactMatch(PortChain portChain) {
- return this.equals(portChain) &&
- Objects.equals(this.portChainId, portChain.portChainId()) &&
- Objects.equals(this.tenantId, portChain.tenantId());
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("id", portChainId.toString())
- .add("tenantId", tenantId.toString())
- .add("name", name)
- .add("description", description)
- .add("portPairGroupList", portPairGroupList)
- .add("flowClassifier", flowClassifierList)
- .toString();
- }
-
- /**
- * To create an instance of the builder.
- *
- * @return instance of builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder class for Port chain.
- */
- public static final class Builder implements PortChain.Builder {
-
- private PortChainId portChainId;
- private TenantId tenantId;
- private String name;
- private String description;
- private List<PortPairGroupId> portPairGroupList;
- private List<FlowClassifierId> flowClassifierList;
-
- @Override
- public Builder setId(PortChainId portChainId) {
- this.portChainId = portChainId;
- return this;
- }
-
- @Override
- public Builder setTenantId(TenantId tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- @Override
- public Builder setName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Builder setDescription(String description) {
- this.description = description;
- return this;
- }
-
- @Override
- public Builder setPortPairGroups(List<PortPairGroupId> portPairGroups) {
- this.portPairGroupList = portPairGroups;
- return this;
- }
-
- @Override
- public Builder setFlowClassifiers(List<FlowClassifierId> flowClassifiers) {
- this.flowClassifierList = flowClassifiers;
- return this;
- }
-
- @Override
- public PortChain build() {
-
- checkNotNull(portChainId, "Port chain id cannot be null");
- checkNotNull(tenantId, "Tenant id cannot be null");
- checkNotNull(portPairGroupList, "Port pair groups cannot be null");
-
- return new DefaultPortChain(portChainId, tenantId, name, description,
- portPairGroupList, flowClassifierList);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPair.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPair.java
deleted file mode 100644
index 4b3b7cf3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPair.java
+++ /dev/null
@@ -1,198 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-/**
- * Implementation of port pair.
- */
-public final class DefaultPortPair implements PortPair {
-
- private final PortPairId portPairId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final String ingress;
- private final String egress;
-
- /**
- * Default constructor to create Port Pair.
- *
- * @param portPairId port pair id
- * @param tenantId tenant id
- * @param name name of port pair
- * @param description description of port pair
- * @param ingress ingress port
- * @param egress egress port
- */
- private DefaultPortPair(PortPairId portPairId, TenantId tenantId,
- String name, String description,
- String ingress, String egress) {
-
- this.portPairId = portPairId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.ingress = ingress;
- this.egress = egress;
- }
-
- @Override
- public PortPairId portPairId() {
- return portPairId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public String ingress() {
- return ingress;
- }
-
- @Override
- public String egress() {
- return egress;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(portPairId, tenantId, name, description,
- ingress, egress);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultPortPair) {
- DefaultPortPair that = (DefaultPortPair) obj;
- return Objects.equals(portPairId, that.portPairId) &&
- Objects.equals(tenantId, that.tenantId) &&
- Objects.equals(name, that.name) &&
- Objects.equals(description, that.description) &&
- Objects.equals(ingress, that.ingress) &&
- Objects.equals(egress, that.egress);
- }
- return false;
- }
-
- @Override
- public boolean exactMatch(PortPair portPair) {
- return this.equals(portPair) &&
- Objects.equals(this.portPairId, portPair.portPairId()) &&
- Objects.equals(this.tenantId, portPair.tenantId());
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("id", portPairId.toString())
- .add("tenantId", tenantId.tenantId())
- .add("name", name)
- .add("description", description)
- .add("ingress", ingress)
- .add("egress", egress)
- .toString();
- }
-
- /**
- * To create an instance of the builder.
- *
- * @return instance of builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder class for Port pair.
- */
- public static final class Builder implements PortPair.Builder {
-
- private PortPairId portPairId;
- private TenantId tenantId;
- private String name;
- private String description;
- private String ingress;
- private String egress;
-
- @Override
- public Builder setId(PortPairId portPairId) {
- this.portPairId = portPairId;
- return this;
- }
-
- @Override
- public Builder setTenantId(TenantId tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- @Override
- public Builder setName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Builder setDescription(String description) {
- this.description = description;
- return this;
- }
-
- @Override
- public Builder setIngress(String ingress) {
- this.ingress = ingress;
- return this;
- }
-
- @Override
- public Builder setEgress(String egress) {
- this.egress = egress;
- return this;
- }
-
- @Override
- public PortPair build() {
-
- checkNotNull(portPairId, "Port pair id cannot be null");
- checkNotNull(tenantId, "Tenant id cannot be null");
- checkNotNull(ingress, "Ingress of a port pair cannot be null");
- checkNotNull(egress, "Egress of a port pair cannot be null");
-
- return new DefaultPortPair(portPairId, tenantId, name, description,
- ingress, egress);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPairGroup.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPairGroup.java
deleted file mode 100644
index 877cc6c9..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultPortPairGroup.java
+++ /dev/null
@@ -1,183 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Objects;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Implementation of port pair group.
- */
-public final class DefaultPortPairGroup implements PortPairGroup {
-
- private final PortPairGroupId portPairGroupId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final List<PortPairId> portPairList;
-
- /**
- * Default constructor to create Port Pair Group.
- *
- * @param portPairGroupId port pair group id
- * @param tenantId tenant id
- * @param name name of port pair group
- * @param description description of port pair group
- * @param portPairList list of port pairs
- */
- private DefaultPortPairGroup(PortPairGroupId portPairGroupId, TenantId tenantId,
- String name, String description,
- List<PortPairId> portPairList) {
-
- this.portPairGroupId = portPairGroupId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.portPairList = portPairList;
- }
-
- @Override
- public PortPairGroupId portPairGroupId() {
- return portPairGroupId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public List<PortPairId> portPairs() {
- return ImmutableList.copyOf(portPairList);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(portPairGroupId, tenantId, name, description,
- portPairList);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultPortPairGroup) {
- DefaultPortPairGroup that = (DefaultPortPairGroup) obj;
- return Objects.equals(portPairGroupId, that.portPairGroupId) &&
- Objects.equals(tenantId, that.tenantId) &&
- Objects.equals(name, that.name) &&
- Objects.equals(description, that.description) &&
- Objects.equals(portPairList, that.portPairList);
- }
- return false;
- }
-
- @Override
- public boolean exactMatch(PortPairGroup portPairGroup) {
- return this.equals(portPairGroup) &&
- Objects.equals(this.portPairGroupId, portPairGroup.portPairGroupId()) &&
- Objects.equals(this.tenantId, portPairGroup.tenantId());
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("id", portPairGroupId.toString())
- .add("tenantId", tenantId.toString())
- .add("name", name)
- .add("description", description)
- .add("portPairGroupList", portPairList)
- .toString();
- }
-
- /**
- * To create an instance of the builder.
- *
- * @return instance of builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder class for Port pair group.
- */
- public static final class Builder implements PortPairGroup.Builder {
-
- private PortPairGroupId portPairGroupId;
- private TenantId tenantId;
- private String name;
- private String description;
- private List<PortPairId> portPairList;
-
- @Override
- public Builder setId(PortPairGroupId portPairGroupId) {
- this.portPairGroupId = portPairGroupId;
- return this;
- }
-
- @Override
- public Builder setTenantId(TenantId tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- @Override
- public Builder setName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Builder setDescription(String description) {
- this.description = description;
- return this;
- }
-
- @Override
- public Builder setPortPairs(List<PortPairId> portPairs) {
- this.portPairList = portPairs;
- return this;
- }
-
- @Override
- public PortPairGroup build() {
-
- checkNotNull(portPairGroupId, "Port pair group id cannot be null");
- checkNotNull(tenantId, "Tenant id cannot be null");
- checkNotNull(portPairList, "Port pairs cannot be null");
-
- return new DefaultPortPairGroup(portPairGroupId, tenantId, name, description,
- portPairList);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java
deleted file mode 100644
index a2404f56..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultRouter.java
+++ /dev/null
@@ -1,146 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Default implementation of router interface.
- */
-public final class DefaultRouter implements Router {
- private final RouterId id;
- private final String name;
- private final boolean adminStateUp;
- private final Status status;
- private final boolean distributed;
- private final RouterGateway externalGatewayInfo;
- private final VirtualPortId gatewayPortId;
- private final TenantId tenantId;
- private final List<String> routes;
-
- /**
- * Creates router object.
- *
- * @param id router identifier
- * @param routerName the name of router
- * @param adminStateUp the status of admin state
- * @param status the status of router
- * @param distributed the status of router distributed
- * @param externalGatewayInfo the gateway info of router
- * @param gatewayPortId the port identifier of router gateway
- * @param tenantId the tenant identifier
- * @param routes the routes configure
- */
- public DefaultRouter(RouterId id, String routerName, boolean adminStateUp,
- Status status, boolean distributed,
- RouterGateway externalGatewayInfo,
- VirtualPortId gatewayPortId, TenantId tenantId,
- List<String> routes) {
- this.id = checkNotNull(id, "id cannot be null");
- this.name = routerName;
- this.adminStateUp = checkNotNull(adminStateUp, "adminStateUp cannot be null");
- this.status = checkNotNull(status, "status cannot be null");
- this.distributed = checkNotNull(distributed, "distributed cannot be null");
- this.externalGatewayInfo = externalGatewayInfo;
- this.gatewayPortId = gatewayPortId;
- this.tenantId = checkNotNull(tenantId, "tenantId cannot be null");
- this.routes = routes;
- }
-
- @Override
- public RouterId id() {
- return id;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public boolean adminStateUp() {
- return adminStateUp;
- }
-
- @Override
- public Status status() {
- return status;
- }
-
- @Override
- public boolean distributed() {
- return distributed;
- }
-
- @Override
- public RouterGateway externalGatewayInfo() {
- return externalGatewayInfo;
- }
-
- @Override
- public VirtualPortId gatewayPortid() {
- return gatewayPortId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public List<String> routes() {
- return routes;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, name, adminStateUp, status, distributed,
- externalGatewayInfo, gatewayPortId, routes);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultRouter) {
- final DefaultRouter that = (DefaultRouter) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.name, that.name)
- && Objects.equals(this.adminStateUp, that.adminStateUp)
- && Objects.equals(this.status, that.status)
- && Objects.equals(this.distributed, that.distributed)
- && Objects.equals(this.externalGatewayInfo,
- that.externalGatewayInfo)
- && Objects.equals(this.gatewayPortId, that.gatewayPortId)
- && Objects.equals(this.routes, that.routes);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("routerName", name)
- .add("adminStateUp", adminStateUp).add("status", status)
- .add("distributed", distributed)
- .add("externalGatewayInfo", externalGatewayInfo)
- .add("gatewayPortid", gatewayPortId).add("routes", routes).toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultSubnet.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultSubnet.java
deleted file mode 100644
index 6049b558..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultSubnet.java
+++ /dev/null
@@ -1,183 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-import java.util.Set;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpAddress.Version;
-import org.onlab.packet.IpPrefix;
-
-/**
- * Default implementation of Subnet interface .
- */
-public final class DefaultSubnet implements Subnet {
- private final SubnetId id;
- private final String subnetName;
- private final TenantNetworkId networkId;
- private final TenantId tenantId;
- private final Version ipVersion;
- private final IpPrefix cidr;
- private final IpAddress gatewayIp;
- private final boolean dhcpEnabled;
- private final boolean shared;
- private final Mode ipV6AddressMode;
- private final Mode ipV6RaMode;
- private final Set<HostRoute> hostRoutes;
- private final Set<AllocationPool> allocationPools;
-
- /**
- * Creates a subnet object.
- *
- * @param id subnet identifier
- * @param subnetName the name of subnet
- * @param networkId network identifier
- * @param tenantId tenant identifier
- * @param ipVersion Version of ipv4 or ipv6
- * @param cidr the cidr
- * @param gatewayIp gateway ip
- * @param dhcpEnabled dhcp enabled or not
- * @param shared indicates whether this network is shared across all
- * tenants, By default, only administrative user can change this
- * value
- * @param hostRoutes a collection of host routes
- * @param ipV6AddressMode ipV6AddressMode
- * @param ipV6RaMode ipV6RaMode
- * @param allocationPoolsIt a collection of allocationPools
- */
- public DefaultSubnet(SubnetId id, String subnetName,
- TenantNetworkId networkId, TenantId tenantId,
- Version ipVersion, IpPrefix cidr, IpAddress gatewayIp,
- boolean dhcpEnabled, boolean shared,
- Set<HostRoute> hostRoutes, Mode ipV6AddressMode,
- Mode ipV6RaMode,
- Set<AllocationPool> allocationPoolsIt) {
- this.id = id;
- this.subnetName = subnetName;
- this.networkId = networkId;
- this.tenantId = tenantId;
- this.ipVersion = ipVersion;
- this.cidr = cidr;
- this.gatewayIp = gatewayIp;
- this.dhcpEnabled = dhcpEnabled;
- this.shared = shared;
- this.ipV6AddressMode = ipV6AddressMode;
- this.ipV6RaMode = ipV6RaMode;
- this.hostRoutes = hostRoutes;
- this.allocationPools = allocationPoolsIt;
- }
-
- @Override
- public SubnetId id() {
- return id;
- }
-
- @Override
- public String subnetName() {
- return subnetName;
- }
-
- @Override
- public TenantNetworkId networkId() {
- return networkId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public Version ipVersion() {
- return ipVersion;
- }
-
- @Override
- public IpPrefix cidr() {
- return cidr;
- }
-
- @Override
- public IpAddress gatewayIp() {
- return gatewayIp;
- }
-
- @Override
- public boolean dhcpEnabled() {
- return dhcpEnabled;
- }
-
- @Override
- public boolean shared() {
- return shared;
- }
-
- @Override
- public Iterable<HostRoute> hostRoutes() {
- return hostRoutes;
- }
-
- @Override
- public Mode ipV6AddressMode() {
- return ipV6AddressMode;
- }
-
- @Override
- public Mode ipV6RaMode() {
- return ipV6RaMode;
- }
-
- @Override
- public Iterable<AllocationPool> allocationPools() {
- return allocationPools;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, subnetName, ipVersion, cidr, gatewayIp,
- dhcpEnabled, shared, tenantId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultSubnet) {
- final DefaultSubnet that = (DefaultSubnet) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.subnetName, that.subnetName)
- && Objects.equals(this.ipVersion, that.ipVersion)
- && Objects.equals(this.cidr, that.cidr)
- && Objects.equals(this.shared, that.shared)
- && Objects.equals(this.gatewayIp, that.gatewayIp)
- && Objects.equals(this.dhcpEnabled, that.dhcpEnabled);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("subnetName", subnetName)
- .add("ipVersion", ipVersion).add("cidr", cidr)
- .add("shared", shared).add("gatewayIp", gatewayIp)
- .add("dhcpEnabled", dhcpEnabled).toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultTenantNetwork.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultTenantNetwork.java
deleted file mode 100644
index 8c941ea2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultTenantNetwork.java
+++ /dev/null
@@ -1,160 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
-/**
- * Default implementation of TenantNetwork interface.
- */
-public final class DefaultTenantNetwork implements TenantNetwork {
- private final TenantNetworkId id;
- private final String name;
- private final boolean adminStateUp;
- private final State state;
- private final boolean shared;
- private final Type type;
- private final TenantId tenantId;
- private final boolean routerExternal;
- private final PhysicalNetwork physicalNetwork;
- private final SegmentationId segmentationId;
-
- /**
- * Creates a neutronNetwork element attributed to the specified provider.
- *
- * @param id network identifier
- * @param name the network name
- * @param adminStateUp administrative state of the network
- * @param state the network state
- * @param shared indicates whether this network is shared across all
- * tenants, By default, only administrative user can change this
- * value
- * @param tenantId tenant identifier
- * @param routerExternal network routerExternal
- * @param type the network type
- * @param physicalNetwork physicalNetwork identifier
- * @param segmentationId segmentation identifier
- */
- public DefaultTenantNetwork(TenantNetworkId id, String name,
- boolean adminStateUp, State state,
- boolean shared, TenantId tenantId,
- boolean routerExternal, Type type,
- PhysicalNetwork physicalNetwork,
- SegmentationId segmentationId) {
- this.id = id;
- this.name = name;
- this.adminStateUp = adminStateUp;
- this.state = state;
- this.shared = shared;
- this.type = type;
- this.tenantId = tenantId;
- this.routerExternal = routerExternal;
- this.physicalNetwork = physicalNetwork;
- this.segmentationId = segmentationId;
- }
-
- @Override
- public TenantNetworkId id() {
- return id;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public boolean adminStateUp() {
- return adminStateUp;
- }
-
- @Override
- public State state() {
- return state;
- }
-
- @Override
- public boolean shared() {
- return shared;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public boolean routerExternal() {
- return routerExternal;
- }
-
- @Override
- public Type type() {
- return type;
- }
-
- @Override
- public PhysicalNetwork physicalNetwork() {
- return physicalNetwork;
- }
-
- @Override
- public SegmentationId segmentationId() {
- return segmentationId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, name, adminStateUp, state, shared, tenantId,
- routerExternal, type, physicalNetwork,
- segmentationId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultTenantNetwork) {
- final DefaultTenantNetwork that = (DefaultTenantNetwork) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.name, that.name)
- && Objects.equals(this.adminStateUp, that.adminStateUp)
- && Objects.equals(this.state, that.state)
- && Objects.equals(this.shared, that.shared)
- && Objects.equals(this.tenantId, that.tenantId)
- && Objects.equals(this.routerExternal, that.routerExternal)
- && Objects.equals(this.type, that.type)
- && Objects.equals(this.physicalNetwork,
- that.physicalNetwork)
- && Objects.equals(this.segmentationId, that.segmentationId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("name", name)
- .add("adminStateUp", adminStateUp).add("state", state)
- .add("shared", shared).add("tenantId", tenantId)
- .add("routeExternal", routerExternal).add("type", type)
- .add("physicalNetwork", physicalNetwork)
- .add("segmentationId", segmentationId).toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultVirtualPort.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultVirtualPort.java
deleted file mode 100644
index 9ee85da7..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultVirtualPort.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-
-/**
- * Default implementation of VirtualPort interface .
- */
-public final class DefaultVirtualPort implements VirtualPort {
- private final VirtualPortId id;
- private final TenantNetworkId networkId;
- private final Boolean adminStateUp;
- private final String name;
- private final State state;
- private final MacAddress macAddress;
- private final TenantId tenantId;
- private final String deviceOwner;
- private final DeviceId deviceId;
- private final Set<FixedIp> fixedIps;
- private final BindingHostId bindingHostId;
- private final String bindingVnicType;
- private final String bindingVifType;
- private final String bindingVifDetails;
- private final Set<AllowedAddressPair> allowedAddressPairs;
- private final Set<SecurityGroup> securityGroups;
-
- /**
- * Creates a VirtualPort object.
- *
- * @param id the virtual port identifier
- * @param networkId the network identifier
- * @param adminStateUp adminStateup true or false
- * @param strMap the map of properties of virtual port
- * @param state virtual port state
- * @param macAddress the MAC address
- * @param tenantId the tenant identifier
- * @param deviceId the device identifier
- * @param fixedIps set of fixed IP
- * @param bindingHostId the binding host identifier
- * @param allowedAddressPairs the collection of allowdeAddressPairs
- * @param securityGroups the collection of securityGroups
- */
- public DefaultVirtualPort(VirtualPortId id,
- TenantNetworkId networkId,
- Boolean adminStateUp,
- Map<String, String> strMap,
- State state,
- MacAddress macAddress,
- TenantId tenantId,
- DeviceId deviceId,
- Set<FixedIp> fixedIps,
- BindingHostId bindingHostId,
- Set<AllowedAddressPair> allowedAddressPairs,
- Set<SecurityGroup> securityGroups) {
- this.id = id;
- this.networkId = networkId;
- this.adminStateUp = adminStateUp;
- this.name = strMap.get("name");
- this.state = state;
- this.macAddress = macAddress;
- this.tenantId = tenantId;
- this.deviceOwner = strMap.get("deviceOwner");
- this.deviceId = deviceId;
- this.fixedIps = fixedIps;
- this.bindingHostId = bindingHostId;
- this.bindingVnicType = strMap.get("bindingVnicType");
- this.bindingVifType = strMap.get("bindingVifType");
- this.bindingVifDetails = strMap.get("bindingVifDetails");
- this.allowedAddressPairs = allowedAddressPairs;
- this.securityGroups = securityGroups;
- }
-
- @Override
- public VirtualPortId portId() {
- return id;
- }
-
- @Override
- public TenantNetworkId networkId() {
- return networkId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public boolean adminStateUp() {
- return adminStateUp;
- }
-
- @Override
- public State state() {
- return state;
- }
-
- @Override
- public MacAddress macAddress() {
- return macAddress;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public DeviceId deviceId() {
- return deviceId;
- }
-
- @Override
- public String deviceOwner() {
- return deviceOwner;
- }
-
- @Override
- public Collection<AllowedAddressPair> allowedAddressPairs() {
- return allowedAddressPairs;
- }
-
- @Override
- public Set<FixedIp> fixedIps() {
- return fixedIps;
- }
-
- @Override
- public BindingHostId bindingHostId() {
- return bindingHostId;
- }
-
- @Override
- public String bindingVnicType() {
- return bindingVifType;
- }
-
- @Override
- public String bindingVifType() {
- return bindingVifType;
- }
-
- @Override
- public String bindingVifDetails() {
- return bindingVifDetails;
- }
-
- @Override
- public Collection<SecurityGroup> securityGroups() {
- return securityGroups;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, networkId, adminStateUp, name, state,
- macAddress, tenantId, deviceId, deviceOwner,
- allowedAddressPairs, fixedIps, bindingHostId,
- bindingVnicType, bindingVifType, bindingVifDetails,
- securityGroups);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DefaultVirtualPort) {
- final DefaultVirtualPort that = (DefaultVirtualPort) obj;
- return Objects.equals(this.id, that.id)
- && Objects.equals(this.networkId, that.networkId)
- && Objects.equals(this.adminStateUp, that.adminStateUp)
- && Objects.equals(this.state, that.state)
- && Objects.equals(this.name, that.name)
- && Objects.equals(this.tenantId, that.tenantId)
- && Objects.equals(this.macAddress, that.macAddress)
- && Objects.equals(this.deviceId, that.deviceId)
- && Objects.equals(this.deviceOwner, that.deviceOwner)
- && Objects.equals(this.allowedAddressPairs,
- that.allowedAddressPairs)
- && Objects.equals(this.fixedIps, that.fixedIps)
- && Objects.equals(this.bindingHostId, that.bindingHostId)
- && Objects.equals(this.bindingVifDetails,
- that.bindingVifDetails)
- && Objects.equals(this.bindingVifType, that.bindingVifType)
- && Objects.equals(this.bindingVnicType,
- that.bindingVnicType)
- && Objects.equals(this.securityGroups, that.securityGroups);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("id", id).add("network_id", networkId)
- .add("adminStateUp", adminStateUp).add("state", state)
- .add("name", name).add("state", state)
- .add("macAddress", macAddress).add("tenantId", tenantId)
- .add("deviced", deviceId).add("deviceOwner", deviceOwner)
- .add("allowedAddressPairs", allowedAddressPairs)
- .add("fixedIp", fixedIps).add("bindingHostId", bindingHostId)
- .add("bindingVnicType", bindingVnicType)
- .add("bindingVifDetails", bindingVifDetails)
- .add("bindingVifType", bindingVifType)
- .add("securityGroups", securityGroups).toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FixedIp.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FixedIp.java
deleted file mode 100644
index c6569a7b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FixedIp.java
+++ /dev/null
@@ -1,93 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * Immutable representation of a IP address for the port, Include the IP address
- * and subnet identity.
- */
-public final class FixedIp {
- private final SubnetId subnetId;
- private final IpAddress ip;
- // Public construction is prohibited
- private FixedIp(SubnetId subnetId, IpAddress ip) {
- checkNotNull(subnetId, "SubnetId cannot be null");
- checkNotNull(ip, "IpAddress cannot be null");
- this.subnetId = subnetId;
- this.ip = ip;
- }
-
- /**
- * Returns the FixedIp subnet identifier.
- *
- * @return subnet identifier
- */
- public SubnetId subnetId() {
- return subnetId;
- }
-
- /**
- * Returns the FixedIp IP address.
- *
- * @return IP address
- */
- public IpAddress ip() {
- return ip;
- }
-
- /**
- * Creates a fixed ip using the supplied fixedIp.
- *
- * @param subnetId subnet identity
- * @param ip IP address
- * @return FixedIp
- */
- public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) {
- return new FixedIp(subnetId, ip);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(subnetId, ip);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof FixedIp) {
- final FixedIp that = (FixedIp) obj;
- return Objects.equals(this.subnetId, that.subnetId)
- && Objects.equals(this.ip, that.ip);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("subnetId", subnetId).add("ip", ip)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIp.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIp.java
deleted file mode 100644
index 0933d9ef..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIp.java
+++ /dev/null
@@ -1,94 +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.vtnrsc;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * Representation of a floatingIp.
- */
-public interface FloatingIp {
-
- /**
- * Coarse classification of the type of the FloatingIp.
- */
- public enum Status {
- /**
- * Signifies that a floating Ip is currently active.
- */
- ACTIVE,
- /**
- * Signifies that a floating Ip is currently inactive.
- */
- INACTIVE
- }
-
- /**
- * Returns the floatingIp identifier.
- *
- * @return identifier
- */
- FloatingIpId id();
-
- /**
- * Returns the tenant identifier.
- *
- * @return the tenant identifier
- */
- TenantId tenantId();
-
- /**
- * Returns the network identifier.
- *
- * @return the network identifier
- */
- TenantNetworkId networkId();
-
- /**
- * Returns the port identifier.
- *
- * @return the port identifier
- */
- VirtualPortId portId();
-
- /**
- * Returns the router identifier.
- *
- * @return the router identifier
- */
- RouterId routerId();
-
- /**
- * Returns the floating ip address.
- *
- * @return floatingIp
- */
- IpAddress floatingIp();
-
- /**
- * Returns the fixed ip address.
- *
- * @return fixedIp
- */
- IpAddress fixedIp();
-
- /**
- * Returns the status of floating ip.
- *
- * @return floatingIpStatus
- */
- Status status();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIpId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIpId.java
deleted file mode 100644
index 1b48c7d6..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FloatingIpId.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-import java.util.UUID;
-
-/**
- * Immutable representation of a floating IP identifier.
- */
-public final class FloatingIpId {
- private final UUID floatingIpId;
-
- // Public construction is prohibited
- private FloatingIpId(UUID floatingIpId) {
- this.floatingIpId = checkNotNull(floatingIpId, "floatingIpId cannot be null");
- }
-
- /**
- * Creates a floating IP identifier.
- *
- * @param floatingIpId the UUID id of floating IP identifier
- * @return object of floating IP identifier
- */
- public static FloatingIpId of(UUID floatingIpId) {
- return new FloatingIpId(floatingIpId);
- }
-
- /**
- * Creates a floating IP identifier.
- *
- * @param floatingIpId the floating IP identifier in string
- * @return object of floating IP identifier
- */
- public static FloatingIpId of(String floatingIpId) {
- return new FloatingIpId(UUID.fromString(floatingIpId));
- }
-
- /**
- * Returns the floating IP identifier.
- *
- * @return the floating IP identifier
- */
- public UUID floatingIpId() {
- return floatingIpId;
- }
-
- @Override
- public int hashCode() {
- return floatingIpId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof FloatingIpId) {
- final FloatingIpId that = (FloatingIpId) obj;
- return Objects.equals(this.floatingIpId, that.floatingIpId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("floatingIpId", floatingIpId).toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifier.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifier.java
deleted file mode 100644
index 7b4108dc..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifier.java
+++ /dev/null
@@ -1,259 +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.vtnrsc;
-
-import org.onlab.packet.IpPrefix;
-
-/**
- * Abstraction of an entity which provides flow classifier for service function chain.
- * FlowClassifier classify the traffic based on the criteria defined in the request.
- * The classification can be based on port range or source and destination IP address or
- * other flow classifier elements.
- */
-public interface FlowClassifier {
-
- /**
- * Returns flow classifier ID.
- *
- * @return flow classifier id
- */
- FlowClassifierId flowClassifierId();
-
- /**
- * Returns Tenant ID.
- *
- * @return tenant Id
- */
- TenantId tenantId();
-
- /**
- * Returns flow classifier name.
- *
- * @return flow classifier name
- */
- String name();
-
- /**
- * Returns flow classifier description.
- *
- * @return flow classifier description
- */
- String description();
-
- /**
- * Returns EtherType.
- *
- * @return EtherType
- */
- String etherType();
-
- /**
- * Returns IP Protocol.
- *
- * @return IP protocol
- */
- String protocol();
-
- /**
- * Returns minimum source port range.
- *
- * @return minimum source port range
- */
- int minSrcPortRange();
-
- /**
- * Returns maximum source port range.
- *
- * @return maximum source port range
- */
- int maxSrcPortRange();
-
- /**
- * Returns minimum destination port range.
- *
- * @return minimum destination port range
- */
- int minDstPortRange();
-
- /**
- * Returns maximum destination port range.
- *
- * @return maximum destination port range.
- */
- int maxDstPortRange();
-
- /**
- * Returns Source IP prefix.
- *
- * @return Source IP prefix
- */
- IpPrefix srcIpPrefix();
-
- /**
- * Returns Destination IP prefix.
- *
- * @return Destination IP prefix
- */
- IpPrefix dstIpPrefix();
-
- /**
- * Returns Source virtual port.
- *
- * @return Source virtual port
- */
- VirtualPortId srcPort();
-
- /**
- * Returns Destination virtual port.
- *
- * @return Destination virtual port
- */
- VirtualPortId dstPort();
-
- /**
- * Returns whether this Flow classifier is an exact match to the
- * Flow classifier given in the argument.
- *
- * @param flowClassifier other flowClassifier to match against
- * @return true if the flowClassifiers are an exact match, otherwise false
- */
- boolean exactMatch(FlowClassifier flowClassifier);
-
- /**
- * Builder for flow Classifier.
- */
- interface Builder {
-
- /**
- * Returns Flow Classifier.
- *
- * @return flow classifier.
- */
- FlowClassifier build();
-
- /**
- * Sets Flow Classifier ID.
- *
- * @param flowClassifierId flow classifier id.
- * @return Builder object by setting flow classifier Id.
- */
- Builder setFlowClassifierId(FlowClassifierId flowClassifierId);
-
- /**
- * Sets Tenant ID.
- *
- * @param tenantId tenant id.
- * @return Builder object by setting Tenant ID.
- */
- Builder setTenantId(TenantId tenantId);
-
- /**
- * Sets Flow classifier name.
- *
- * @param name flow classifier name
- * @return builder object by setting flow classifier name
- */
- Builder setName(String name);
-
- /**
- * Sets flow classifier description.
- *
- * @param description flow classifier description
- * @return flow classifier description
- */
- Builder setDescription(String description);
-
- /**
- * Sets EtherType.
- *
- * @param etherType EtherType
- * @return EtherType
- */
- Builder setEtherType(String etherType);
-
- /**
- * Sets IP protocol.
- *
- * @param protocol IP protocol
- * @return builder object by setting IP protocol
- */
- Builder setProtocol(String protocol);
-
- /**
- * Set minimum source port range.
- *
- * @param minRange minimum source port range
- * @return builder object by setting minimum source port range
- */
- Builder setMinSrcPortRange(int minRange);
-
- /**
- * Sets maximum source port range.
- *
- * @param maxRange maximum source port range
- * @return builder object by setting maximum source port range
- */
- Builder setMaxSrcPortRange(int maxRange);
-
- /**
- * Sets minimum destination port range.
- *
- * @param minRange minimum destination port range
- * @return builder object by setting minimum destination port range
- */
- Builder setMinDstPortRange(int minRange);
-
- /**
- * Sets maximum destination port range.
- *
- * @param maxRange maximum destination port range.
- * @return builder object by setting maximum destination port range.
- */
- Builder setMaxDstPortRange(int maxRange);
-
- /**
- * Sets Source IP prefix.
- *
- * @param srcIpPrefix Source IP prefix
- * @return builder object by setting Source IP prefix
- */
- Builder setSrcIpPrefix(IpPrefix srcIpPrefix);
-
- /**
- * Sets Destination IP prefix.
- *
- * @param dstIpPrefix Destination IP prefix
- * @return builder object by setting Destination IP prefix
- */
- Builder setDstIpPrefix(IpPrefix dstIpPrefix);
-
- /**
- * Sets Source virtual port.
- *
- * @param srcPort Source virtual port
- * @return builder object by setting Source virtual port
- */
- Builder setSrcPort(VirtualPortId srcPort);
-
- /**
- * Sets Destination virtual port.
- *
- * @param dstPort Destination virtual port
- * @return builder object by setting Destination virtual port
- */
- Builder setDstPort(VirtualPortId dstPort);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java
deleted file mode 100644
index df180ebe..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java
+++ /dev/null
@@ -1,94 +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.vtnrsc;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import com.google.common.base.MoreObjects;
-
-import java.util.UUID;
-import java.util.Objects;
-
-/**
- * Flow classification identifier.
- */
-public final class FlowClassifierId {
-
- private final UUID flowClassifierId;
-
- /**
- * Constructor to create flow classifier id.
- *
- * @param flowClassifierId flow classifier id.
- */
- private FlowClassifierId(final UUID flowClassifierId) {
- checkNotNull(flowClassifierId, "Flow classifier id can not be null");
- this.flowClassifierId = flowClassifierId;
- }
-
- /**
- * Returns new flow classifier id.
- *
- * @param flowClassifierId flow classifier id
- * @return new flow classifier id
- */
- public static FlowClassifierId of(final UUID flowClassifierId) {
- return new FlowClassifierId(flowClassifierId);
- }
-
- /**
- * Returns new flow classifier id.
- *
- * @param flowClassifierId flow classifier id
- * @return new flow classifier id
- */
- public static FlowClassifierId of(final String flowClassifierId) {
- return new FlowClassifierId(UUID.fromString(flowClassifierId));
- }
-
- /**
- * Returns the value of flow classifier id.
- *
- * @return flow classifier id.
- */
- public UUID value() {
- return flowClassifierId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(this.flowClassifierId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof FlowClassifierId) {
- final FlowClassifierId other = (FlowClassifierId) obj;
- return Objects.equals(this.flowClassifierId, other.flowClassifierId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("FlowClassifierId", flowClassifierId)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/HostRoute.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/HostRoute.java
deleted file mode 100644
index b18cb950..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/HostRoute.java
+++ /dev/null
@@ -1,39 +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.vtnrsc;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-
-/**
- * Host route dictionaries for the subnet.
- */
-public interface HostRoute {
-
- /**
- * Returns the next hop address.
- *
- * @return next hop address
- */
- IpAddress nexthop();
-
- /**
- * Returns the destination address.
- *
- * @return destination address
- */
- IpPrefix destination();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
deleted file mode 100644
index 30631d28..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
+++ /dev/null
@@ -1,78 +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.vtnrsc;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a physical network identity.
- */
-public final class PhysicalNetwork {
-
- private final String physicalNetwork;
-
- // Public construction is prohibited
- private PhysicalNetwork(String physicalNetwork) {
- checkNotNull(physicalNetwork, "PhysicalNetwork cannot be null");
- this.physicalNetwork = physicalNetwork;
- }
-
- /**
- * Creates a PhysicalNetwork object.
- *
- * @param physicalNetwork physical network
- * @return physical network
- */
- public static PhysicalNetwork physicalNetwork(String physicalNetwork) {
- return new PhysicalNetwork(physicalNetwork);
- }
-
- /**
- * Returns a physicalNetwork.
- *
- * @return physical network
- */
- public String physicalNetwork() {
- return physicalNetwork;
- }
-
- @Override
- public int hashCode() {
- return physicalNetwork.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PhysicalNetwork) {
- final PhysicalNetwork that = (PhysicalNetwork) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.physicalNetwork,
- that.physicalNetwork);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return physicalNetwork;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChain.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChain.java
deleted file mode 100644
index d147eaaa..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChain.java
+++ /dev/null
@@ -1,148 +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.vtnrsc;
-
-import java.util.List;
-
-/**
- * Abstraction of an entity providing Port Chain information.
- * A Port Chain (Service Function Path) consists of
- * a set of Neutron ports, to define the sequence of service functions
- * a set of flow classifiers, to specify the classified traffic flows to enter the chain
- */
-public interface PortChain {
-
- /**
- * Returns the ID of this port chain.
- *
- * @return the port chain id
- */
- PortChainId portChainId();
-
- /**
- * Returns the tenant id of this port chain.
- *
- * @return the tenant id
- */
- TenantId tenantId();
-
- /**
- * Returns the name of this port chain.
- *
- * @return name of port chain
- */
- String name();
-
- /**
- * Returns the description of this port chain.
- *
- * @return description of port chain
- */
- String description();
-
- /**
- * Returns the list of port pair groups associated with
- * this port chain.
- *
- * @return list of port pair groups
- */
- List<PortPairGroupId> portPairGroups();
-
- /**
- * Returns the list of flow classifiers associated with
- * this port chain.
- *
- * @return list of flow classifiers
- */
- List<FlowClassifierId> flowClassifiers();
-
- /**
- * Returns whether this port chain is an exact match to the port chain given
- * in the argument.
- * <p>
- * Exact match means the port pair groups and flow classifiers match
- * with the given port chain. It does not consider the port chain id, name
- * and description.
- * </p>
- *
- * @param portChain other port chain to match against
- * @return true if the port chains are an exact match, otherwise false
- */
- boolean exactMatch(PortChain portChain);
-
- /**
- * A port chain builder..
- */
- interface Builder {
-
- /**
- * Assigns the port chain id to this object.
- *
- * @param portChainId the port chain id
- * @return this the builder object
- */
- Builder setId(PortChainId portChainId);
-
- /**
- * Assigns tenant id to this object.
- *
- * @param tenantId tenant id of the port chain
- * @return this the builder object
- */
- Builder setTenantId(TenantId tenantId);
-
- /**
- * Assigns the name to this object.
- *
- * @param name name of the port chain
- * @return this the builder object
- */
- Builder setName(String name);
-
- /**
- * Assigns the description to this object.
- *
- * @param description description of the port chain
- * @return this the builder object
- */
- Builder setDescription(String description);
-
- /**
- * Assigns the port pair groups associated with the port chain
- * to this object.
- *
- * @param portPairGroups list of port pair groups
- * @return this the builder object
- */
- Builder setPortPairGroups(List<PortPairGroupId> portPairGroups);
-
- /**
- * Assigns the flow classifiers associated with the port chain
- * to this object.
- *
- * @param flowClassifiers list of flow classifiers
- * @return this the builder object
- */
- Builder setFlowClassifiers(List<FlowClassifierId> flowClassifiers);
-
- /**
- * Builds a port chain object.
- *
- * @return a port chain.
- */
- PortChain build();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java
deleted file mode 100644
index a42a700f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java
+++ /dev/null
@@ -1,91 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.UUID;
-import java.util.Objects;
-
-/**
- * Representation of a Port Chain ID.
- */
-public final class PortChainId {
-
- private final UUID portChainId;
-
- /**
- * Private constructor for port chain id.
- *
- * @param id UUID id of port chain
- */
- private PortChainId(UUID id) {
- checkNotNull(id, "Port chain id can not be null");
- this.portChainId = id;
- }
-
- /**
- * Returns newly created port chain id object.
- *
- * @param id UUID of port chain
- * @return object of port chain id
- */
- public static PortChainId of(UUID id) {
- return new PortChainId(id);
- }
-
- /**
- * Returns newly created port chain id object.
- *
- * @param id port chain id in string
- * @return object of port chain id
- */
- public static PortChainId of(String id) {
- return new PortChainId(UUID.fromString(id));
- }
-
- /**
- * Returns the value of port chain id.
- *
- * @return port chain id
- */
- public UUID value() {
- return portChainId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PortChainId) {
- final PortChainId other = (PortChainId) obj;
- return Objects.equals(this.portChainId, other.portChainId);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(this.portChainId);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("portChainId", portChainId).toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPair.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPair.java
deleted file mode 100644
index f6285e61..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPair.java
+++ /dev/null
@@ -1,139 +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.vtnrsc;
-
-
-/**
- * Abstraction of an entity providing Port Pair information.
- * A port pair represents a service function instance.
- */
-public interface PortPair {
-
- /**
- * Returns the ID of this port Pair.
- *
- * @return the port pair id
- */
- PortPairId portPairId();
-
- /**
- * Returns the tenant id of this port pair.
- *
- * @return an tenant id
- */
- TenantId tenantId();
-
- /**
- * Returns the description of this port pair.
- *
- * @return description of port pair
- */
- String name();
-
- /**
- * Returns the description of this port pair.
- *
- * @return description of port pair
- */
- String description();
-
- /**
- * Returns the ingress port of this port pair.
- *
- * @return ingress of port pair
- */
- String ingress();
-
- /**
- * Returns the egress port of this port pair.
- *
- * @return egress of port pair
- */
- String egress();
-
- /**
- * Returns whether this port pair is an exact match to the port pair given
- * in the argument.
- * <p>
- * Exact match means the Port port pairs match with the given port pair.
- * It does not consider the port pair id, name and description.
- * </p>
- * @param portPair other port pair to match against
- * @return true if the port pairs are an exact match, otherwise false
- */
- boolean exactMatch(PortPair portPair);
-
- /**
- * A port pair builder..
- */
- interface Builder {
-
- /**
- * Assigns the port pair id to this object.
- *
- * @param portPairId the port pair id
- * @return this the builder object
- */
- Builder setId(PortPairId portPairId);
-
- /**
- * Assigns tenant id to this object.
- *
- * @param tenantId tenant id of the port pair
- * @return this the builder object
- */
- Builder setTenantId(TenantId tenantId);
-
- /**
- * Assigns the name to this object.
- *
- * @param name name of the port pair
- * @return this the builder object
- */
- Builder setName(String name);
-
- /**
- * Assigns the description to this object.
- *
- * @param description description of the port pair
- * @return this the builder object
- */
- Builder setDescription(String description);
-
- /**
- * Assigns the ingress port to this object.
- *
- * @param port ingress port of the port pair
- * @return this the builder object
- */
- Builder setIngress(String port);
-
- /**
- * Assigns the egress port to this object.
- *
- * @param port egress port of the port pair
- * @return this the builder object
- */
- Builder setEgress(String port);
-
- /**
- * Builds a port pair object.
- *
- * @return a port pair.
- */
- PortPair build();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroup.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroup.java
deleted file mode 100644
index f647b57f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroup.java
+++ /dev/null
@@ -1,126 +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.vtnrsc;
-
-import java.util.List;
-
-/**
- * Abstraction of an entity providing Port Pair Group information.
- * A port pair group consists of one or more port pairs.
- */
-public interface PortPairGroup {
-
- /**
- * Returns the ID of this port pair group.
- *
- * @return the port pair group id
- */
- PortPairGroupId portPairGroupId();
-
- /**
- * Returns the tenant id of this port pair group.
- *
- * @return the tenant id
- */
- TenantId tenantId();
-
- /**
- * Returns the name of this port pair group.
- *
- * @return name of port pair group
- */
- String name();
-
- /**
- * Returns the description of this port pair group.
- *
- * @return description of port pair group
- */
- String description();
-
- /**
- * Returns the list of port pairs associated with this port pair group.
- *
- * @return list of port pairs
- */
- List<PortPairId> portPairs();
-
- /**
- * Returns whether this port pair group is an exact match to the
- * port pair group given in the argument.
- * <p>
- * Exact match means the Port pairs match with the given port pair group.
- * It does not consider the port pair group id, name and description.
- * </p>
- * @param portPairGroup other port pair group to match against
- * @return true if the port pairs are an exact match, otherwise false
- */
- boolean exactMatch(PortPairGroup portPairGroup);
-
- /**
- * A port pair group builder..
- */
- interface Builder {
-
- /**
- * Assigns the port pair group id to this object.
- *
- * @param portPairGroupId the port pair group id
- * @return this the builder object
- */
- Builder setId(PortPairGroupId portPairGroupId);
-
- /**
- * Assigns tenant id to this object.
- *
- * @param tenantId tenant id of port pair group
- * @return this the builder object
- */
- Builder setTenantId(TenantId tenantId);
-
- /**
- * Assigns the name to this object.
- *
- * @param name name of the port pair group
- * @return this the builder object
- */
- Builder setName(String name);
-
- /**
- * Assigns the description to this object.
- *
- * @param description description of the port pair group
- * @return this the builder object
- */
- Builder setDescription(String description);
-
- /**
- * Assigns the port pairs associated with the port pair group
- * to this object.
- *
- * @param portPairs list of port pairs
- * @return this the builder object
- */
- Builder setPortPairs(List<PortPairId> portPairs);
-
- /**
- * Builds a port pair group object.
- *
- * @return a port pair group object.
- */
- PortPairGroup build();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
deleted file mode 100644
index a52a2bb3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.UUID;
-import java.util.Objects;
-
-/**
- * Representation of a Port Pair Group ID.
- */
-public final class PortPairGroupId {
-
- private final UUID portPairGroupId;
-
- /**
- * Private constructor for port pair group id.
- *
- * @param id UUID id of port pair group
- */
- private PortPairGroupId(UUID id) {
- checkNotNull(id, "Port pair group id can not be null");
- this.portPairGroupId = id;
- }
-
- /**
- * Returns newly created port pair group id object.
- *
- * @param id port pair group id in UUID
- * @return object of port pair group id
- */
- public static PortPairGroupId of(UUID id) {
- return new PortPairGroupId(id);
- }
-
- /**
- * Returns newly created port pair group id object.
- *
- * @param id port pair group id in string
- * @return object of port pair group id
- */
- public static PortPairGroupId of(String id) {
- return new PortPairGroupId(UUID.fromString(id));
- }
-
- /**
- * Returns the value of port pair group id.
- *
- * @return port pair group id
- */
- public UUID value() {
- return portPairGroupId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PortPairGroupId) {
- final PortPairGroupId other = (PortPairGroupId) obj;
- return Objects.equals(this.portPairGroupId, other.portPairGroupId);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(this.portPairGroupId);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("portPairGroupId", portPairGroupId)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
deleted file mode 100644
index 1f45e80e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
+++ /dev/null
@@ -1,93 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.UUID;
-import java.util.Objects;
-
-/**
- * Representation of a Port Pair ID.
- */
-public final class PortPairId {
-
- private final UUID portPairId;
-
- /**
- * Private constructor for port pair id.
- *
- * @param id UUID id of port pair
- */
- private PortPairId(UUID id) {
- checkNotNull(id, "Port chain id can not be null");
- this.portPairId = id;
- }
-
- /**
- * Returns newly created port pair id object.
- *
- * @param id UUID of port pair id
- * @return object of port pair id
- */
- public static PortPairId of(UUID id) {
- return new PortPairId(id);
- }
-
- /**
- * Returns newly created port pair id object.
- *
- * @param id port pair id in string
- * @return object of port pair id
- */
- public static PortPairId of(String id) {
- return new PortPairId(UUID.fromString(id));
- }
-
- /**
- * Returns teh value of port pair id.
- *
- * @return port pair id
- */
- public UUID value() {
- return portPairId;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof PortPairId) {
- final PortPairId other = (PortPairId) obj;
- return Objects.equals(this.portPairId, other.portPairId);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(this.portPairId);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("portPairId", portPairId)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java
deleted file mode 100644
index e853ec2f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java
+++ /dev/null
@@ -1,102 +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.vtnrsc;
-
-import java.util.List;
-
-/**
- * Representation of a Router.
- */
-public interface Router {
-
- /**
- * Coarse classification of the type of the Router.
- */
- public enum Status {
- /**
- * Signifies that a router is currently active.
- */
- ACTIVE,
- /**
- * Signifies that a router is currently inactive.
- */
- INACTIVE
- }
-
- /**
- * Returns the router identifier.
- *
- * @return identifier
- */
- RouterId id();
-
- /**
- * Returns the router Name.
- *
- * @return routerName
- */
- String name();
-
- /**
- * Returns the router admin state.
- *
- * @return true or false
- */
- boolean adminStateUp();
-
- /**
- * Returns the status of router.
- *
- * @return RouterStatus
- */
- Status status();
-
- /**
- * Returns the distributed status of this router.
- * If true, indicates a distributed router.
- *
- * @return true or false
- */
- boolean distributed();
-
- /**
- * Returns the RouterGateway of router.
- *
- * @return routerGateway
- */
- RouterGateway externalGatewayInfo();
-
- /**
- * Returns the gatewayPortid of router.
- *
- * @return virtualPortId
- */
- VirtualPortId gatewayPortid();
-
- /**
- * Returns the owner(tenant) of this router.
- *
- * @return tenantId
- */
- TenantId tenantId();
-
- /**
- * Returns the router list of router.
- *
- * @return routes
- */
- List<String> routes();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
deleted file mode 100644
index 9a755561..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
+++ /dev/null
@@ -1,108 +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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Collection;
-import java.util.Objects;
-
-/**
- * Representation of a Router gateway.
- */
-public final class RouterGateway {
-
- private final TenantNetworkId networkId;
- private final boolean enableSnat;
- private final Collection<FixedIp> externalFixedIps;
-
- // Public construction is prohibited
- private RouterGateway(TenantNetworkId networkId, boolean enableSnat,
- Collection<FixedIp> externalFixedIps) {
- this.networkId = checkNotNull(networkId, "networkId cannot be null");
- this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null");
- this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null");
- }
-
- /**
- * Creates router gateway object.
- *
- * @param networkId network identifier
- * @param enableSnat SNAT enable or not
- * @param externalFixedIps external fixed IP
- * @return RouterGateway
- */
- public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
- Collection<FixedIp> externalFixedIps) {
- return new RouterGateway(networkId, enableSnat, externalFixedIps);
- }
-
- /**
- * Returns network identifier.
- *
- * @return networkId
- */
- public TenantNetworkId networkId() {
- return networkId;
- }
-
- /**
- * Return SNAT enable or not.
- *
- * @return enableSnat
- */
- public boolean enableSnat() {
- return enableSnat;
- }
-
- /**
- * Return external fixed Ip.
- *
- * @return externalFixedIps
- */
- public Collection<FixedIp> externalFixedIps() {
- return externalFixedIps;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(networkId, enableSnat, externalFixedIps);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof RouterGateway) {
- final RouterGateway that = (RouterGateway) obj;
- return Objects.equals(this.networkId, that.networkId)
- && Objects.equals(this.enableSnat, that.enableSnat)
- && Objects.equals(this.externalFixedIps, that.externalFixedIps);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("networkId", networkId)
- .add("enableSnat", enableSnat)
- .add("externalFixedIps", externalFixedIps)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java
deleted file mode 100644
index d396c0d1..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-/**
- * Immutable representation of a router identifier.
- */
-public final class RouterId {
-
- private final String routerId;
-
- // Public construction is prohibited
- private RouterId(String routerId) {
- checkNotNull(routerId, "routerId cannot be null");
- this.routerId = routerId;
- }
-
- /**
- * Creates a router identifier.
- *
- * @param routerId the router identifier
- * @return the router identifier
- */
- public static RouterId valueOf(String routerId) {
- return new RouterId(routerId);
- }
-
- /**
- * Returns the router identifier.
- *
- * @return the router identifier
- */
- public String routerId() {
- return routerId;
- }
-
- @Override
- public int hashCode() {
- return routerId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof RouterId) {
- final RouterId that = (RouterId) obj;
- return Objects.equals(this.routerId, that.routerId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("routerId", routerId).toString();
- }
-}
-
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterInterface.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterInterface.java
deleted file mode 100644
index 5c37c30b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterInterface.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.vtnrsc;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-/**
- * Representation of a Router interface.
- */
-public final class RouterInterface {
- private final SubnetId subnetId;
- private final VirtualPortId portId;
- private final RouterId routerId;
- private final TenantId tenantId;
-
- // Public construction is prohibited
- private RouterInterface(SubnetId subnetId, VirtualPortId portId,
- RouterId routerId, TenantId tenantId) {
- this.subnetId = checkNotNull(subnetId, "subnetId cannot be null");
- this.portId = checkNotNull(portId, "portId cannot be null");
- this.routerId = checkNotNull(routerId, "routerId cannot be null");
- this.tenantId = checkNotNull(tenantId, "tenantId cannot be null");
- }
-
- /**
- * Creates router interface object.
- *
- * @param subnetId subnet identifier
- * @param portId port identifier
- * @param routerId router identifier
- * @param tenantId tenant identifier
- * @return RouterInterface
- */
- public static RouterInterface routerInterface(SubnetId subnetId,
- VirtualPortId portId,
- RouterId routerId,
- TenantId tenantId) {
- return new RouterInterface(subnetId, portId, routerId, tenantId);
- }
-
- /**
- * Returns subnet identifier.
- *
- * @return subnetId the subnet identifier
- */
- public SubnetId subnetId() {
- return subnetId;
- }
-
- /**
- * Returns port identifier.
- *
- * @return portId the port identifier
- */
- public VirtualPortId portId() {
- return portId;
- }
-
- /**
- * Returns router identifier.
- *
- * @return routerId the router identifier
- */
- public RouterId routerId() {
- return routerId;
- }
-
- /**
- * Returns tenant identifier.
- *
- * @return tenantId the tenant identifier
- */
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(subnetId, portId, routerId, tenantId);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof RouterInterface) {
- final RouterInterface that = (RouterInterface) obj;
- return Objects.equals(this.subnetId, that.subnetId)
- && Objects.equals(this.portId, that.portId)
- && Objects.equals(this.routerId, that.routerId)
- && Objects.equals(this.tenantId, that.tenantId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("subnetId", subnetId)
- .add("portId", portId).add("routerId", routerId)
- .add("tenantId", tenantId).toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
deleted file mode 100644
index 33ddcbfe..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.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.vtnrsc;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a security group.
- */
-public final class SecurityGroup {
- private final String securityGroup;
-
- /**
- * Returns the securityGroup.
- *
- * @return securityGroup
- */
- public String securityGroup() {
- return securityGroup;
- }
- // Public construction is prohibited
- private SecurityGroup(String securityGroup) {
- checkNotNull(securityGroup, "SecurityGroup cannot be null");
- this.securityGroup = securityGroup;
- }
-
- /**
- * Creates a securityGroup using the supplied securityGroup.
- *
- * @param securityGroup security group
- * @return securityGroup
- */
- public static SecurityGroup securityGroup(String securityGroup) {
- return new SecurityGroup(securityGroup);
- }
-
- @Override
- public int hashCode() {
- return securityGroup.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SecurityGroup) {
- final SecurityGroup that = (SecurityGroup) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.securityGroup, that.securityGroup);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("securityGroup", securityGroup)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
deleted file mode 100644
index 651ebd89..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.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.vtnrsc;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a Segmentation identifier.
- */
-public final class SegmentationId {
-
- private final String segmentationId;
-
- // Public construction is prohibited
- private SegmentationId(String segmentationId) {
- checkNotNull(segmentationId, "SegmentationId cannot be null");
- this.segmentationId = segmentationId;
- }
-
- /**
- * Creates a SegmentationId object.
- *
- * @param segmentationId segmentation identifier
- * @return SegmentationId
- */
- public static SegmentationId segmentationId(String segmentationId) {
- return new SegmentationId(segmentationId);
- }
-
- /**
- * Returns the segmentation identifier.
- *
- * @return segmentationId
- */
- public String segmentationId() {
- return segmentationId;
- }
-
- @Override
- public int hashCode() {
- return segmentationId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SegmentationId) {
- final SegmentationId that = (SegmentationId) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.segmentationId, that.segmentationId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return segmentationId;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Subnet.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Subnet.java
deleted file mode 100644
index f563a78f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Subnet.java
+++ /dev/null
@@ -1,129 +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.vtnrsc;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpAddress.Version;
-import org.onlab.packet.IpPrefix;
-
-/**
- * Representation of a subnet.
- */
-public interface Subnet {
-
- /**
- * Coarse classification of the type of the ipV6Mode.
- */
- enum Mode {
- DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC
- }
-
- /**
- * Returns the subnet identifier.
- *
- * @return identifier
- */
- SubnetId id();
-
- /**
- * Returns the name of the subnet.
- *
- * @return subnetName
- */
- String subnetName();
-
- /**
- * Returns the network identifier.
- *
- * @return the network identifier
- */
- TenantNetworkId networkId();
-
- /**
- * Returns tenant identifier.
- *
- * @return the tenant identifier
- */
- TenantId tenantId();
-
- /**
- * Returns the IP version, which is 4 or 6.
- *
- * @return ipVersion
- */
- Version ipVersion();
-
- /**
- * Returns the cidr.
- *
- * @return cidr
- */
- IpPrefix cidr();
-
- /**
- * Returns the gateway IP address.
- *
- * @return gatewayIp
- */
- IpAddress gatewayIp();
-
- /**
- * Returns true if DHCP is enabled and return false if DHCP is disabled.
- *
- * @return true or false
- */
- boolean dhcpEnabled();
-
- /**
- * Indicates whether this tenantNetwork is shared across all tenants. By
- * default, only administrative user can change this value.
- *
- * @return true or false
- */
- boolean shared();
-
- /**
- * Returns a collection of hostRoutes.
- *
- * @return a collection of hostRoutes
- */
- Iterable<HostRoute> hostRoutes();
-
- /**
- * Returns the ipV6AddressMode. A valid value is dhcpv6-stateful,
- * dhcpv6-stateless, or slaac.
- *
- * @return ipV6AddressMode whose value is dhcpv6-stateful, dhcpv6-stateless
- * or slaac
- */
- Mode ipV6AddressMode();
-
- /**
- * Returns the ipV6RaMode.A valid value is dhcpv6-stateful,
- * dhcpv6-stateless, or slaac.
- *
- * @return ipV6RaMode whose value is dhcpv6-stateful, dhcpv6-stateless or
- * slaac
- */
- Mode ipV6RaMode();
-
- /**
- * Returns a collection of allocation_pools.
- *
- * @return a collection of allocationPools
- */
- Iterable<AllocationPool> allocationPools();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
deleted file mode 100644
index eb93d153..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.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.vtnrsc;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-/**
- * Immutable representation of a subnet identifier.
- */
-public final class SubnetId {
-
- private final String subnetId;
-
- // Public construction is prohibited
- private SubnetId(String subnetId) {
- checkNotNull(subnetId, "SubnetId cannot be null");
- this.subnetId = subnetId;
- }
-
- /**
- * Creates a Subnet identifier.
- *
- * @param subnetId the subnet identifier
- * @return the subnet identifier
- */
- public static SubnetId subnetId(String subnetId) {
- return new SubnetId(subnetId);
- }
-
- /**
- * Returns the subnet identifier.
- *
- * @return the subnet identifier
- */
- public String subnetId() {
- return subnetId;
- }
-
- @Override
- public int hashCode() {
- return subnetId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof SubnetId) {
- final SubnetId that = (SubnetId) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.subnetId, that.subnetId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return subnetId;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
deleted file mode 100644
index 0e7c9417..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.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.vtnrsc;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a tenant identifier.
- */
-public final class TenantId {
-
- private final String tenantId;
-
- // Public construction is prohibited
- private TenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- /**
- * Creates a network id using the tenantid.
- *
- * @param tenantid network String
- * @return TenantId
- */
- public static TenantId tenantId(String tenantid) {
- checkNotNull(tenantid, "Tenantid can not be null");
- return new TenantId(tenantid);
- }
-
- /**
- * Returns the tenant identifier.
- *
- * @return the tenant identifier
- */
- public String tenantId() {
- return tenantId;
- }
-
- @Override
- public int hashCode() {
- return tenantId.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.tenantId, that.tenantId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return tenantId;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetwork.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetwork.java
deleted file mode 100644
index 256352f4..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetwork.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.vtnrsc;
-
-/**
- * Representation of the tenantNetwork.
- */
-public interface TenantNetwork {
-
- /**
- * Coarse classification of the state of the tenantNetwork.
- */
- enum State {
- /**
- * Signifies that a tenantNetwork is currently active.This state means
- * that this network is available.
- */
- ACTIVE,
- /**
- * Signifies that a tenantNetwork is currently built.
- */
- BUILD,
- /**
- * Signifies that a tenantNetwork is currently unavailable.
- */
- DOWN,
- /**
- * Signifies that a tenantNetwork is currently error.
- */
- ERROR
- }
-
- /**
- * Coarse classification of the type of the tenantNetwork.
- */
- enum Type {
- /**
- * Signifies that a tenantNetwork is local.
- */
- LOCAL
- }
-
- /**
- * Returns the tenantNetwork identifier.
- *
- * @return tenantNetwork identifier
- */
- TenantNetworkId id();
-
- /**
- * Returns the tenantNetwork name.
- *
- * @return tenantNetwork name
- */
- String name();
-
- /**
- * Returns the administrative state of the tenantNetwork,which is up(true)
- * or down(false).
- *
- * @return true or false
- */
- boolean adminStateUp();
-
- /**
- * Returns the tenantNetwork state.
- *
- * @return tenant network state
- */
- State state();
-
- /**
- * Indicates whether this tenantNetwork is shared across all tenants. By
- * default,only administrative user can change this value.
- *
- * @return true or false
- */
- boolean shared();
-
- /**
- * Returns the UUID of the tenant that will own the tenantNetwork. This
- * tenant can be different from the tenant that makes the create
- * tenantNetwork request.
- *
- * @return the tenant identifier
- */
- TenantId tenantId();
-
- /**
- * Returns the routerExternal.Indicates whether this network is externally
- * accessible.
- *
- * @return true or false
- */
- boolean routerExternal();
-
- /**
- * Returns the tenantNetwork Type.
- *
- * @return tenantNetwork Type
- */
- Type type();
-
- /**
- * Returns the tenantNetwork physical network.
- *
- * @return tenantNetwork physical network
- */
- PhysicalNetwork physicalNetwork();
-
- /**
- * Returns the tenantNetwork segmentation id.
- *
- * @return tenantNetwork segmentation id
- */
- SegmentationId segmentationId();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
deleted file mode 100644
index 8680d28f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.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.vtnrsc;
-
-import java.util.Objects;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Immutable representation of a tenantNetwork identity.
- */
-public final class TenantNetworkId {
-
- private final String networkId;
-
- // Public construction is prohibited
- private TenantNetworkId(String networkId) {
- this.networkId = networkId;
- }
-
- /**
- * Creates a TenantNetwork identifier.
- *
- * @param networkId tenantNetwork identify string
- * @return the attached tenantNetwork identifier
- */
- public static TenantNetworkId networkId(String networkId) {
- checkNotNull(networkId, "Networkid cannot be null");
- return new TenantNetworkId(networkId);
- }
-
- /**
- * Returns tenantNetwork identifier.
- *
- * @return the tenantNetwork identifier
- */
- public String networkId() {
- return networkId;
- }
-
- @Override
- public int hashCode() {
- return networkId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof TenantNetworkId) {
- final TenantNetworkId that = (TenantNetworkId) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.networkId, that.networkId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return networkId;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPort.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPort.java
deleted file mode 100644
index d2d7c146..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPort.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.vtnrsc;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-
-/**
- * Representation of the VirtualPort.
- */
-public interface VirtualPort {
- /**
- * Coarse classification of the type of the virtual port.
- */
- enum State {
- /**
- * Signifies that a virtualPort is currently active,This state mean that
- * this virtualPort is available.
- */
- ACTIVE,
- /**
- * Signifies that a virtualPort is currently unavailable.
- */
- DOWN;
- }
-
- /**
- * Returns the virtualPort identifier.
- *
- * @return virtualPort identifier
- */
- VirtualPortId portId();
-
- /**
- * Returns the network identifier.
- *
- * @return tenantNetwork identifier
- */
- TenantNetworkId networkId();
-
- /**
- * Returns the symbolic name for the virtualPort.
- *
- * @return virtualPort name
- */
- String name();
-
- /**
- * Returns the administrative status of the port,which is up(true) or
- * down(false).
- *
- * @return true if the administrative status of the port is up
- */
- boolean adminStateUp();
-
- /**
- * Returns the state.
- *
- * @return state
- */
- State state();
-
- /**
- * Returns the MAC address.
- *
- * @return MAC Address
- */
- MacAddress macAddress();
-
- /**
- * Returns the port tenantId.
- *
- * @return port tenantId
- */
- TenantId tenantId();
-
- /**
- * Returns the device identifier.
- *
- * @return deviceId
- */
- DeviceId deviceId();
-
- /**
- * Returns the identifier of the entity that uses this port.
- *
- * @return deviceOwner
- */
- String deviceOwner();
-
- /**
- * Returns the virtualPort allowedAddressPairs.
- *
- * @return virtualPort allowedAddressPairs
- */
- Collection<AllowedAddressPair> allowedAddressPairs();
-
- /**
- * Returns set of IP addresses for the port, include the IP addresses and subnet
- * identity.
- *
- * @return FixedIps Set of fixedIp
- */
- Set<FixedIp> fixedIps();
-
- /**
- * Returns the virtualPort bindinghostId.
- *
- * @return virtualPort bindinghostId
- */
- BindingHostId bindingHostId();
-
- /**
- * Returns the virtualPort bindingVnicType.
- *
- * @return virtualPort bindingVnicType
- */
- String bindingVnicType();
-
- /**
- * Returns the virtualPort bindingVifType.
- *
- * @return virtualPort bindingVifType
- */
- String bindingVifType();
-
- /**
- * Returns the virtualPort bindingvifDetail.
- *
- * @return virtualPort bindingvifDetail
- */
- String bindingVifDetails();
-
- /**
- * Returns the security groups.
- *
- * @return port security groups
- */
- Iterable<SecurityGroup> securityGroups();
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
deleted file mode 100644
index a3863483..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.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.vtnrsc;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Objects;
-
-/**
- * Immutable representation of a virtual port identifier.
- */
-public final class VirtualPortId {
- private final String portId;
- // Public construction is prohibited
- private VirtualPortId(String virtualPortId) {
- checkNotNull(virtualPortId, "VirtualPortId cannot be null");
- this.portId = virtualPortId;
- }
-
- public String portId() {
- return portId;
- }
-
- /**
- * Creates a virtualPort id using the supplied portId.
- *
- * @param portId virtualport identifier
- * @return VirtualPortId
- */
- public static VirtualPortId portId(String portId) {
- return new VirtualPortId(portId);
- }
-
- @Override
- public int hashCode() {
- return portId.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof VirtualPortId) {
- final VirtualPortId that = (VirtualPortId) obj;
- return this.getClass() == that.getClass()
- && Objects.equals(this.portId, that.portId);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return portId;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/ClassifierService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/ClassifierService.java
deleted file mode 100644
index a15da3ef..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/ClassifierService.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.vtnrsc.classifier;
-
-import org.onosproject.net.DeviceId;
-
-/**
- * Provides Services for Classifier.
- */
-public interface ClassifierService {
-
- /**
- * Get Classifier devices for sfc.
- *
- * @return list of device id's for classifiers
- */
- Iterable<DeviceId> getClassifiers();
-
- /**
- * Add Classifier device for sfc.
- */
- void addClassifier(DeviceId deviceId);
-
- /**
- * Remove Classifier device for sfc.
- */
- void removeClassifier(DeviceId deviceId);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/ClassifierManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/ClassifierManager.java
deleted file mode 100644
index a12d6221..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/ClassifierManager.java
+++ /dev/null
@@ -1,78 +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.vtnrsc.classifier.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-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.DeviceId;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.DistributedSet;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtnrsc.classifier.ClassifierService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Provides implementation of the Classifier Service.
- */
-@Component(immediate = true)
-@Service
-public class ClassifierManager implements ClassifierService {
-
- private final Logger log = getLogger(ClassifierManager.class);
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- private DistributedSet<DeviceId> classifierList;
-
- @Activate
- protected void activate() {
- classifierList = storageService.<DeviceId>setBuilder()
- .withName("classifier")
- .withSerializer(Serializer.using(KryoNamespaces.API))
- .build();
- log.info("Started");
- }
-
- @Deactivate
- protected void deactivate() {
- log.info("Stopped");
- }
-
- @Override
- public void addClassifier(DeviceId deviceId) {
- classifierList.add(deviceId);
- }
-
- @Override
- public Iterable<DeviceId> getClassifiers() {
- return ImmutableList.copyOf(classifierList);
- }
-
- @Override
- public void removeClassifier(DeviceId deviceId) {
- classifierList.remove(deviceId);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/impl/package-info.java
deleted file mode 100644
index dc72e806..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/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 Classifier service.
- */
-package org.onosproject.vtnrsc.classifier.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/package-info.java
deleted file mode 100644
index 56976d96..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/classifier/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 interacting with Classifier of SFC.
- */
-package org.onosproject.vtnrsc.classifier;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java
deleted file mode 100644
index 00758dd2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpCreateCommand.java
+++ /dev/null
@@ -1,95 +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.vtnrsc.cli.floatingip;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.IpAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIp.Status;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for create a floating IP.
- */
-@Command(scope = "onos", name = "floatingip-create",
- description = "Supports for creating a floating IP")
-public class FloatingIpCreateCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "id", description = "The floating IP identifier",
- required = true, multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "networkId", description = "The network identifier of floating IP",
- required = true, multiValued = false)
- String networkId = null;
-
- @Argument(index = 2, name = "tenantId", description = "The tenant identifier of floating IP",
- required = true, multiValued = false)
- String tenantId = null;
-
- @Argument(index = 3, name = "routerId", description = "The router identifier of floating IP",
- required = true, multiValued = false)
- String routerId = null;
-
- @Argument(index = 4, name = "fixedIp", description = "The fixed IP of floating IP",
- required = true, multiValued = false)
- String fixedIp = null;
-
- @Argument(index = 5, name = "floatingIp", description = "The floating IP of floating IP",
- required = true, multiValued = false)
- String floatingIp = null;
-
- @Option(name = "-p", aliases = "--portId", description = "The port identifier of floating IP",
- required = false, multiValued = false)
- String portId = null;
-
- @Option(name = "-s", aliases = "--status", description = "The status of floating IP",
- required = false, multiValued = false)
- String status = null;
-
- @Override
- protected void execute() {
- FloatingIpService service = get(FloatingIpService.class);
- try {
- FloatingIp floatingIpObj = new DefaultFloatingIp(
- FloatingIpId.of(id),
- TenantId.tenantId(tenantId),
- TenantNetworkId.networkId(networkId),
- VirtualPortId.portId(portId),
- RouterId.valueOf(routerId),
- floatingIp == null ? null : IpAddress.valueOf(floatingIp),
- fixedIp == null ? null : IpAddress.valueOf(fixedIp),
- status == null ? Status.ACTIVE
- : Status.valueOf(status));
- Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
- service.createFloatingIps(floatingIpSet);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.java
deleted file mode 100644
index c441d535..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpQueryCommand.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.vtnrsc.cli.floatingip;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-
-/**
- * Supports for query a floating IP.
- */
-@Command(scope = "onos", name = "floatingips", description = "Supports for querying a floating IP")
-public class FloatingIpQueryCommand extends AbstractShellCommand {
- @Option(name = "-I", aliases = "--id", description = "The floating IP identifier",
- required = false, multiValued = false)
- String id = null;
-
- @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP",
- required = false, multiValued = false)
- String fixedIp = null;
-
- @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP",
- required = false, multiValued = false)
- String floatingIp = null;
-
- private static final String FMT = "floatingIpId=%s, networkId=%s, tenantId=%s, portId=%s,"
- + "routerId=%s, fixedIp=%s, floatingIp=%s, status=%s";
-
- @Override
- protected void execute() {
- FloatingIpService service = get(FloatingIpService.class);
- if (id != null) {
- FloatingIp floatingIp = service.getFloatingIp(FloatingIpId
- .of(id));
- printFloatingIp(floatingIp);
- } else if (fixedIp != null || floatingIp != null) {
- Iterable<FloatingIp> floatingIps = service.getFloatingIps();
- if (floatingIps == null) {
- return;
- }
- if (fixedIp != null) {
- for (FloatingIp floatingIp : floatingIps) {
- if (floatingIp.fixedIp().toString().equals(fixedIp)) {
- printFloatingIp(floatingIp);
- return;
- }
- }
- print(null, "The fixedIp is not existed");
- }
- if (floatingIp != null) {
- for (FloatingIp floatingIpObj : floatingIps) {
- if (floatingIpObj.fixedIp().toString().equals(floatingIp)) {
- printFloatingIp(floatingIpObj);
- return;
- }
- }
- print(null, "The floatingIp is not existed");
- }
- } else {
- Iterable<FloatingIp> floatingIps = service.getFloatingIps();
- if (floatingIps == null) {
- return;
- }
- for (FloatingIp floatingIp : floatingIps) {
- printFloatingIp(floatingIp);
- }
- }
- }
-
- private void printFloatingIp(FloatingIp floatingIp) {
- print(FMT, floatingIp.id(), floatingIp.networkId(),
- floatingIp.tenantId(), floatingIp.portId(),
- floatingIp.routerId(), floatingIp.fixedIp(),
- floatingIp.floatingIp(), floatingIp.status());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.java
deleted file mode 100644
index a413503a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpRemoveCommand.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.vtnrsc.cli.floatingip;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for remove a floating IP.
- */
-@Command(scope = "onos", name = "floatingip-remove", description = "Supports for removing a floating IP")
-public class FloatingIpRemoveCommand extends AbstractShellCommand {
- @Option(name = "-I", aliases = "--id", description = "The floating IP identifier",
- required = false, multiValued = false)
- String id = null;
-
- @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP",
- required = false, multiValued = false)
- String fixedIp = null;
-
- @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP",
- required = false, multiValued = false)
- String floatingIp = null;
-
- @Override
- protected void execute() {
- FloatingIpService service = get(FloatingIpService.class);
- if (id == null && fixedIp == null && floatingIp == null) {
- print(null, "one of id, fixedIp, floatingIp should not be null");
- }
- try {
- Set<FloatingIpId> floatingIpSet = Sets.newHashSet();
- if (id != null) {
- floatingIpSet.add(FloatingIpId.of(id));
- service.removeFloatingIps(floatingIpSet);
- } else {
- Iterable<FloatingIp> floatingIps = service.getFloatingIps();
- if (floatingIps == null) {
- return;
- }
- if (fixedIp != null) {
- for (FloatingIp floatingIp : floatingIps) {
- if (floatingIp.fixedIp().toString().equals(fixedIp)) {
- floatingIpSet.add(floatingIp.id());
- service.removeFloatingIps(floatingIpSet);
- return;
- }
- }
- print(null, "The fixedIp is not existed");
- return;
- }
- if (floatingIp != null) {
- for (FloatingIp floatingIpObj : floatingIps) {
- if (floatingIpObj.fixedIp().toString()
- .equals(floatingIp)) {
- floatingIpSet.add(floatingIpObj.id());
- service.removeFloatingIps(floatingIpSet);
- return;
- }
- }
- print(null, "The floatingIp is not existed");
- return;
- }
- }
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java
deleted file mode 100644
index 413b3bdb..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/FloatingIpUpdateCommand.java
+++ /dev/null
@@ -1,103 +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.vtnrsc.cli.floatingip;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.IpAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIp.Status;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for update a floating IP.
- */
-@Command(scope = "onos", name = "floatingip-update",
- description = "Supports for updating a floating IP")
-public class FloatingIpUpdateCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "id", description = "The floating IP identifier",
- required = true, multiValued = false)
- String id = null;
-
- @Option(name = "-n", aliases = "--networkId", description = "The network identifier of floating IP",
- required = false, multiValued = false)
- String networkId = null;
-
- @Option(name = "-t", aliases = "--tenantId", description = "The tenant identifier of floating IP",
- required = false, multiValued = false)
- String tenantId = null;
-
- @Option(name = "-r", aliases = "--routerId", description = "The router identifier of floating IP",
- required = false, multiValued = false)
- String routerId = null;
-
- @Option(name = "-p", aliases = "--portId", description = "The port identifier of floating IP",
- required = false, multiValued = false)
- String portId = null;
-
- @Option(name = "-s", aliases = "--status", description = "The status of floating IP",
- required = false, multiValued = false)
- String status = null;
-
- @Option(name = "-i", aliases = "--fixedIp", description = "The fixed IP of floating IP",
- required = false, multiValued = false)
- String fixedIp = null;
-
- @Option(name = "-l", aliases = "--floatingIp", description = "The floating IP of floating IP",
- required = false, multiValued = false)
- String floatingIp = null;
-
- @Override
- protected void execute() {
- FloatingIpService service = get(FloatingIpService.class);
- FloatingIpId floatingIpId = FloatingIpId.of(id);
- FloatingIp floatingIpStore = get(FloatingIpService.class).getFloatingIp(floatingIpId);
- try {
- FloatingIp floatingIpObj = new DefaultFloatingIp(
- floatingIpId,
- tenantId == null ? floatingIpStore.tenantId()
- : TenantId.tenantId(tenantId),
- networkId == null ? floatingIpStore.networkId()
- : TenantNetworkId.networkId(networkId),
- portId == null ? floatingIpStore.portId()
- : VirtualPortId.portId(portId),
- routerId == null ? floatingIpStore.routerId()
- : RouterId.valueOf(routerId),
- floatingIp == null ? floatingIpStore.floatingIp()
- : IpAddress.valueOf(floatingIp),
- fixedIp == null ? floatingIpStore.fixedIp()
- : IpAddress.valueOf(fixedIp),
- status == null ? floatingIpStore.status()
- : Status.valueOf(status));
- Set<FloatingIp> floatingIpSet = Sets.newHashSet(floatingIpObj);
- service.updateFloatingIps(floatingIpSet);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/package-info.java
deleted file mode 100644
index ac560771..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/floatingip/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.
- */
-
-/**
- * Command line interface for floatingIP.
- */
-package org.onosproject.vtnrsc.cli.floatingip;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java
deleted file mode 100644
index bcfdacfa..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkCreateCommand.java
+++ /dev/null
@@ -1,97 +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.vtnrsc.cli.network;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultTenantNetwork;
-import org.onosproject.vtnrsc.PhysicalNetwork;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for creating a TenantNetwork.
- */
-@Command(scope = "onos", name = "tenantnetwork-create",
- description = "Supports for creating a TenantNetwork")
-public class TenantNetworkCreateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "TenantNetwork network id", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "tenantID", description = "The tenant id of TenantNetwork",
- required = true, multiValued = false)
- String tenantID = null;
-
- @Argument(index = 2, name = "type", description = "The type of TenantNetwork", required = true,
- multiValued = false)
- String type = null;
-
- @Argument(index = 3, name = "segmentationID", description = "The segmentation id of TenantNetwork",
- required = true, multiValued = false)
- String segmentationID = "";
-
- @Option(name = "-n", aliases = "--name", description = "TenantNetwork name", required = false,
- multiValued = false)
- String name = null;
-
- @Option(name = "-a", aliases = "--adminStateUp", description = "TenantNetwork adminStateUp is true or false",
- required = false, multiValued = false)
- boolean adminStateUp = false;
-
- @Option(name = "-s", aliases = "--state", description = "The state of TenantNetwork",
- required = false, multiValued = false)
- String state = null;
-
- @Option(name = "-d", aliases = "--shared", description = "TenantNetwork is shared or not",
- required = false, multiValued = false)
- boolean shared = false;
-
- @Option(name = "-r", aliases = "--routerExternal",
- description = "TenantNetwork is routerExternal or not", required = false,
- multiValued = false)
- boolean routerExternal = false;
-
- @Option(name = "-p", aliases = "--physicalNetwork", description = "The physical network of Tenant",
- required = false, multiValued = false)
- String physicalNetwork = "";
-
- @Override
- protected void execute() {
- TenantNetworkService service = get(TenantNetworkService.class);
- TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name,
- adminStateUp,
- TenantNetwork.State.valueOf(state),
- shared, TenantId.tenantId(tenantID),
- routerExternal,
- TenantNetwork.Type.valueOf(type),
- PhysicalNetwork.physicalNetwork(physicalNetwork),
- SegmentationId.segmentationId(segmentationID));
-
- Set<TenantNetwork> networksSet = Sets.newHashSet(network);
- service.createNetworks(networksSet);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java
deleted file mode 100644
index 47ea83c2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkQueryCommand.java
+++ /dev/null
@@ -1,60 +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.vtnrsc.cli.network;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-
-/**
- * Supports for querying TenantNetworks by network id.
- */
-@Command(scope = "onos", name = "tenantnetworks", description = "Supports for querying"
- + "tenantNetworks by networkid")
-public class TenantNetworkQueryCommand extends AbstractShellCommand {
-
- @Option(name = "-i", aliases = "--id", description = "TenantNetwork id", required = false,
- multiValued = false)
- String id = null;
-
- private static final String FMT = "networkId=%s, networkName=%s, segmentationId=%s,"
- + "tenantId=%s, type=%s, adminStateUp=%s";
-
- @Override
- protected void execute() {
- TenantNetworkService service = get(TenantNetworkService.class);
- if (id != null) {
- TenantNetwork network = service.getNetwork(TenantNetworkId.networkId(id));
- printNetwork(network);
- } else {
- Iterable<TenantNetwork> networks = service.getNetworks();
- for (TenantNetwork network : networks) {
- printNetwork(network);
- }
- }
- }
-
- private void printNetwork(TenantNetwork network) {
- if (network == null) {
- return;
- }
- print(FMT, network.id(), network.name(), network.segmentationId(),
- network.tenantId(), network.type(), network.adminStateUp());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.java
deleted file mode 100644
index 0ea22853..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkRemoveCommand.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.vtnrsc.cli.network;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for removing a TenantNetwork by network id.
- */
-@Command(scope = "onos", name = "tenantnetwork-remove", description = "Supports for removing"
- + " a tenantNetwork by tenantNetworkid")
-public class TenantNetworkRemoveCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "TenantNetwork neutronNetwork Id",
- required = true, multiValued = false)
- String id = null;
-
- @Override
- protected void execute() {
- TenantNetworkService service = get(TenantNetworkService.class);
- Set<TenantNetworkId> networkIds = Sets.newHashSet(TenantNetworkId.networkId(id));
- service.removeNetworks(networkIds);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java
deleted file mode 100644
index 2a738f72..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/TenantNetworkUpdateCommand.java
+++ /dev/null
@@ -1,99 +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.vtnrsc.cli.network;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultTenantNetwork;
-import org.onosproject.vtnrsc.PhysicalNetwork;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for updating a TenantNetwork.
- */
-@Command(scope = "onos", name = "tenantnetwork-update",
- description = "Supports for updating a TenantNetwork")
-public class TenantNetworkUpdateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "TenantNetwork network id", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "tenantID", description = "The tenant id of TenantNetwork",
- required = true, multiValued = false)
- String tenantID = null;
-
- @Argument(index = 2, name = "type", description = "The type of TenantNetwork", required = true,
- multiValued = false)
- String type = null;
-
- @Argument(index = 3, name = "segmentationID", description = "The segmentation id of TenantNetwork",
- required = true, multiValued = false)
- String segmentationID = "";
-
- @Option(name = "-n", aliases = "--name", description = "TenantNetwork name", required = false,
- multiValued = false)
- String name = null;
-
- @Option(name = "-a", aliases = "--adminStateUp", description = "TenantNetwork adminStateUp is true or false",
- required = false, multiValued = false)
- boolean adminStateUp = false;
-
- @Option(name = "-s", aliases = "--state", description = "The state of TenantNetwork",
- required = false, multiValued = false)
- String state = null;
-
- @Option(name = "-d", aliases = "--shared", description = "TenantNetwork is shared or not",
- required = false, multiValued = false)
- boolean shared = false;
-
- @Option(name = "-r", aliases = "--routerExternal",
- description = "TenantNetwork is routerExternal or not", required = false,
- multiValued = false)
- boolean routerExternal = false;
-
- @Option(name = "-p", aliases = "--physicalNetwork", description = "The physical network of Tenant",
- required = false, multiValued = false)
- String physicalNetwork = "";
-
- @Override
- protected void execute() {
- TenantNetworkService service = get(TenantNetworkService.class);
- TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name,
- adminStateUp,
- TenantNetwork.State.valueOf(state),
- shared, TenantId.tenantId(tenantID),
- routerExternal,
- TenantNetwork.Type.valueOf(type),
- PhysicalNetwork.physicalNetwork(physicalNetwork),
- SegmentationId.segmentationId(segmentationID));
-
- Set<TenantNetwork> networksSet = Sets.newHashSet();
- networksSet.add(network);
- service.updateNetworks(networksSet);
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/package-info.java
deleted file mode 100644
index 1622c800..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/network/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.
- */
-
-/**
- * Command line interface for tenant networks.
- */
-package org.onosproject.vtnrsc.cli.network;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java
deleted file mode 100644
index 3a736deb..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterCreateCommand.java
+++ /dev/null
@@ -1,97 +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.vtnrsc.cli.router;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultRouter;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.Router.Status;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.router.RouterService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for create a router.
- */
-@Command(scope = "onos", name = "router-create",
- description = "Supports for creating a router")
-public class RouterCreateCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "id", description = "The router identifier",
- required = true, multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "routerName", description = "The name of router",
- required = true, multiValued = false)
- String routerName = null;
-
- @Argument(index = 2, name = "tenantId", description = "The tenant identifier of router",
- required = true, multiValued = false)
- String tenantId = null;
-
- @Option(name = "-g", aliases = "--gatewayPortId", description = "The gatewayPort identifier of router",
- required = false, multiValued = false)
- String gatewayPortId = null;
-
- @Option(name = "-e", aliases = "--externalGatewayInfo", description = "The external gateway info of router",
- required = false, multiValued = false)
- String externalGatewayInfo = null;
-
- @Option(name = "-s", aliases = "--status", description = "The status of router",
- required = false, multiValued = false)
- String status = null;
-
- @Option(name = "-a", aliases = "--adminStateUp", description = "The boolean adminStateUp of router",
- required = false, multiValued = false)
- boolean adminStateUp = true;
-
- @Option(name = "-d", aliases = "--distributed", description = "The boolean distributed of router",
- required = false, multiValued = false)
- boolean distributed = false;
-
- @Override
- protected void execute() {
- RouterService service = get(RouterService.class);
- try {
- List<String> routes = new ArrayList<String>();
- Router router = new DefaultRouter(
- RouterId.valueOf(id),
- routerName,
- adminStateUp,
- status == null ? Status.ACTIVE
- : Status.valueOf(status),
- distributed,
- null,
- VirtualPortId.portId(gatewayPortId),
- TenantId.tenantId(tenantId),
- routes);
- Set<Router> routerSet = Sets.newHashSet(router);
- service.createRouters(routerSet);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.java
deleted file mode 100644
index a8a4b585..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterQueryCommand.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.vtnrsc.cli.router;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.router.RouterService;
-
-/**
- * Supports for query a list of router.
- */
-@Command(scope = "onos", name = "routers", description = "Supports for creating a router")
-public class RouterQueryCommand extends AbstractShellCommand {
- @Option(name = "-i", aliases = "--id", description = "The router identifier",
- required = false, multiValued = false)
- String id = null;
-
- @Option(name = "-n", aliases = "--routerName", description = "The name of router",
- required = false, multiValued = false)
- String routerName = null;
-
- private static final String FMT = "routerId=%s, routerName=%s, tenantId=%s, gatewayPortId=%s,"
- + "externalGatewayInfo=%s, status=%s, adminStateUp=%s, distributed=%s, routers=%s";
-
- @Override
- protected void execute() {
- RouterService service = get(RouterService.class);
- if (id != null) {
- Router router = service.getRouter(RouterId.valueOf(id));
- printFloatingIp(router);
- } else if (routerName != null) {
- Iterable<Router> routers = service.getRouters();
- if (routers == null) {
- return;
- }
- for (Router router : routers) {
- if (router.name().equals(routerName)) {
- printFloatingIp(router);
- return;
- }
- }
- print(null, "The routerName is not existed");
- } else {
- Iterable<Router> routers = service.getRouters();
- if (routers == null) {
- return;
- }
- for (Router router : routers) {
- printFloatingIp(router);
- }
- }
- }
-
- private void printFloatingIp(Router router) {
- print(FMT, router.id(), router.name(), router.tenantId(),
- router.gatewayPortid(), router.externalGatewayInfo(),
- router.status(), router.adminStateUp(), router.distributed(),
- router.routes());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.java
deleted file mode 100644
index b48434a1..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterRemoveCommand.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.vtnrsc.cli.router;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.router.RouterService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for remove a router.
- */
-@Command(scope = "onos", name = "router-remove", description = "Supports for removing a router")
-public class RouterRemoveCommand extends AbstractShellCommand {
- @Option(name = "-i", aliases = "--id", description = "The router identifier",
- required = false, multiValued = false)
- String id = null;
-
- @Option(name = "-n", aliases = "--routerName", description = "The name of router",
- required = false, multiValued = false)
- String routerName = null;
-
- @Override
- protected void execute() {
- RouterService service = get(RouterService.class);
- if (id == null && routerName == null) {
- print(null, "one of id, routerName should not be null");
- }
- try {
- Set<RouterId> routerSet = Sets.newHashSet();
- if (id != null) {
- routerSet.add(RouterId.valueOf(id));
- service.removeRouters(routerSet);
- } else {
- Iterable<Router> routers = service.getRouters();
- if (routers == null) {
- return;
- }
- for (Router router : routers) {
- if (router.name().equals(routerName)) {
- routerSet.add(router.id());
- service.removeRouters(routerSet);
- return;
- }
- }
- }
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java
deleted file mode 100644
index 699874b3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/RouterUpdateCommand.java
+++ /dev/null
@@ -1,99 +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.vtnrsc.cli.router;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.DefaultRouter;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.Router.Status;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.router.RouterService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for update a router.
- */
-@Command(scope = "onos", name = "router-update", description = "Supports for updating a router")
-public class RouterUpdateCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "id", description = "The router identifier",
- required = true, multiValued = false)
- String id = null;
-
- @Option(name = "-r", aliases = "--routerName", description = "The name of router",
- required = false, multiValued = false)
- String routerName = null;
-
- @Option(name = "-t", aliases = "--tenantId", description = "The tenant identifier of router",
- required = false, multiValued = false)
- String tenantId = null;
-
- @Option(name = "-g", aliases = "--gatewayPortId", description = "The gatewayPort identifier of router",
- required = false, multiValued = false)
- String gatewayPortId = null;
-
- @Option(name = "-e", aliases = "--externalGatewayInfo", description = "The externalGatewayInfo of router",
- required = false, multiValued = false)
- String externalGatewayInfo = null;
-
- @Option(name = "-s", aliases = "--status", description = "The status of router",
- required = false, multiValued = false)
- String status = null;
-
- @Option(name = "-a", aliases = "--adminStateUp", description = "The boolean adminStateUp of router",
- required = false, multiValued = false)
- boolean adminStateUp = true;
-
- @Option(name = "-d", aliases = "--distributed", description = "The boolean distributed of router",
- required = false, multiValued = false)
- boolean distributed = false;
-
- @Override
- protected void execute() {
- RouterService service = get(RouterService.class);
- RouterId routerId = RouterId.valueOf(id);
- Router router = get(RouterService.class).getRouter(routerId);
- try {
- List<String> routes = new ArrayList<String>();
- Router routerObj = new DefaultRouter(
- RouterId.valueOf(id),
- routerName == null ? router.name() : routerName,
- adminStateUp,
- status == null ? Status.ACTIVE
- : Status.valueOf(status),
- distributed,
- null,
- gatewayPortId == null ? router.gatewayPortid()
- : VirtualPortId.portId(gatewayPortId),
- tenantId == null ? router.tenantId()
- : TenantId.tenantId(tenantId),
- routes);
- Set<Router> routerSet = Sets.newHashSet(routerObj);
- service.createRouters(routerSet);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/package-info.java
deleted file mode 100644
index 4f1768ac..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/router/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.
- */
-
-/**
- * Command line interface for router.
- */
-package org.onosproject.vtnrsc.cli.router;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.java
deleted file mode 100644
index a3a174c9..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceCreateCommand.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.vtnrsc.cli.routerinterface;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-
-/**
- * Supports for create a router interface.
- */
-@Command(scope = "onos", name = "routerinterface-create", description = "Supports for creating a router interface")
-public class RouterInterfaceCreateCommand extends AbstractShellCommand {
- @Argument(index = 0, name = "routerId", description = "The router identifier of router interface",
- required = true, multiValued = false)
- String routerId = null;
-
- @Argument(index = 1, name = "tenantId", description = "The tenant identifier of router interface",
- required = true, multiValued = false)
- String tenantId = null;
-
- @Argument(index = 2, name = "portId", description = "The port identifier of router interface",
- required = true, multiValued = false)
- String portId = null;
-
- @Argument(index = 3, name = "subnetId", description = "The subnet identifier of router interface",
- required = true, multiValued = false)
- String subnetId = null;
-
- @Override
- protected void execute() {
- RouterInterfaceService service = get(RouterInterfaceService.class);
- try {
- RouterInterface routerInterface = RouterInterface.routerInterface(
- SubnetId.subnetId(subnetId),
- VirtualPortId.portId(portId),
- RouterId.valueOf(routerId),
- TenantId.tenantId(tenantId));
- service.addRouterInterface(routerInterface);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java
deleted file mode 100644
index 5de35aee..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceQueryCommand.java
+++ /dev/null
@@ -1,56 +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.vtnrsc.cli.routerinterface;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-
-/**
- * Supports for query a router interface.
- */
-@Command(scope = "onos", name = "routerinterfaces", description = "Supports for querying a router interface")
-public class RouterInterfaceQueryCommand extends AbstractShellCommand {
- @Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface",
- required = false, multiValued = false)
- String subnetId = null;
-
- private static final String FMT = "subnetId=%s, tenantId=%s, portId=%s, routerId=%s";
-
- @Override
- protected void execute() {
- RouterInterfaceService service = get(RouterInterfaceService.class);
- if (subnetId != null) {
- RouterInterface routerInterface = service
- .getRouterInterface(SubnetId.subnetId(subnetId));
- printRouterInterface(routerInterface);
- } else {
- Iterable<RouterInterface> routerInterfaces = service
- .getRouterInterfaces();
- for (RouterInterface routerInterface : routerInterfaces) {
- printRouterInterface(routerInterface);
- }
- }
- }
-
- private void printRouterInterface(RouterInterface routerInterface) {
- print(FMT, routerInterface.subnetId(), routerInterface.tenantId(),
- routerInterface.portId(), routerInterface.routerId());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.java
deleted file mode 100644
index 4e838e26..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/RouterInterfaceRemoveCommand.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.vtnrsc.cli.routerinterface;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-
-/**
- * Supports for remove a router interface.
- */
-@Command(scope = "onos", name = "routerinterface-remove", description = "Supports for removing a router interface")
-public class RouterInterfaceRemoveCommand extends AbstractShellCommand {
- @Option(name = "-s", aliases = "--subnetId", description = "The subnet identifier of router interface",
- required = true, multiValued = false)
- String subnetId = null;
-
- @Override
- protected void execute() {
- RouterInterfaceService service = get(RouterInterfaceService.class);
- try {
- RouterInterface routerInterface = service
- .getRouterInterface(SubnetId.subnetId(subnetId));
- if (routerInterface == null) {
- print(null, "subnet ID of interface doesn't exist");
- return;
- }
- service.removeRouterInterface(routerInterface);
- } catch (Exception e) {
- print(null, e.getMessage());
- }
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/package-info.java
deleted file mode 100644
index 7b82004e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/routerinterface/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.
- */
-
-/**
- * Command line interface for router interface.
- */
-package org.onosproject.vtnrsc.cli.routerinterface;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java
deleted file mode 100644
index de8cfe53..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetCreateCommand.java
+++ /dev/null
@@ -1,118 +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.vtnrsc.cli.subnet;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpAddress.Version;
-import org.onlab.packet.IpPrefix;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.AllocationPool;
-import org.onosproject.vtnrsc.DefaultSubnet;
-import org.onosproject.vtnrsc.HostRoute;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.Subnet.Mode;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for creating a subnet.
- */
-@Command(scope = "onos", name = "subnet-create", description = "Supports for creating a subnet")
-public class SubnetCreateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "Subnet Id", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "subnetName", description = "Subnet String name", required = true,
- multiValued = false)
- String subnetName = null;
-
- @Argument(index = 2, name = "networkId", description = "Subnet Network Id", required = true,
- multiValued = false)
- String networkId = null;
-
- @Argument(index = 3, name = "tenantId", description = "Subnet Tenant Id", required = true,
- multiValued = false)
- String tenantId = null;
-
- @Option(name = "-i", aliases = "--ipVersion", description = "Subnet Version ipVersion",
- required = false, multiValued = false)
- Version ipVersion = null;
-
- @Option(name = "-c", aliases = "--cidr", description = "Subnet IpPrefix cidr",
- required = false, multiValued = false)
- String cidr = "0.0.0.0/0";
-
- @Option(name = "-g", aliases = "--gatewayIp", description = "Subnet IpAddress gatewayIp",
- required = false, multiValued = false)
- String gatewayIp = "0.0.0.0";
-
- @Option(name = "-d", aliases = "--dhcpEnabled", description = "Subnet boolean dhcpEnabled",
- required = false, multiValued = false)
- boolean dhcpEnabled = false;
-
- @Option(name = "-s", aliases = "--shared", description = "Subnet boolean shared",
- required = false, multiValued = false)
- boolean shared = false;
-
- @Option(name = "-m", aliases = "--ipV6AddressMode",
- description = "Subnet Mode ipV6AddressMode", required = false, multiValued = false)
- String ipV6AddressMode = null;
-
- @Option(name = "-r", aliases = "--ipV6RaMode", description = "Subnet Mode ipV6RaMode",
- required = false, multiValued = false)
- String ipV6RaMode = null;
-
- @Option(name = "-h", aliases = "--hostRoutes", description = "Subnet jsonnode hostRoutes",
- required = false, multiValued = false)
- Set<HostRoute> hostRoutes = Sets.newHashSet();
-
- @Option(name = "-a", aliases = "--allocationPools",
- description = "Subnet jsonnode allocationPools", required = false, multiValued = false)
- Set<AllocationPool> allocationPools = Sets.newHashSet();
-
- @Override
- protected void execute() {
- SubnetService service = get(SubnetService.class);
- if (id == null || networkId == null || tenantId == null) {
- print("id,networkId,tenantId can not be null");
- return;
- }
- Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName,
- TenantNetworkId.networkId(networkId),
- TenantId.tenantId(tenantId), ipVersion,
- cidr == null ? null : IpPrefix.valueOf(cidr),
- gatewayIp == null ? null : IpAddress.valueOf(gatewayIp),
- dhcpEnabled, shared, hostRoutes,
- ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode),
- ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode),
- allocationPools);
-
- Set<Subnet> subnetsSet = Sets.newHashSet(subnet);
- service.createSubnets(subnetsSet);
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.java
deleted file mode 100644
index f5a94f0f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetQueryCommand.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.vtnrsc.cli.subnet;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-
-/**
- * Supports for querying a subnet.
- */
-@Command(scope = "onos", name = "subnets", description = "Supports for querying a subnet")
-public class SubnetQueryCommand extends AbstractShellCommand {
-
- @Option(name = "-i", aliases = "--id", description = "Subnet id", required = false,
- multiValued = false)
- String id = null;
-
- private static final String FMT = "subnetId=%s, networkId=%s, subnetName=%s,"
- + "tenantId=%s, cidr=%s, dhcpEnabled=%s, gatewayIp=%s," + "ipVersion=%s";
-
- @Override
- protected void execute() {
- SubnetService service = get(SubnetService.class);
- if (id != null) {
- Subnet subnet = service.getSubnet(SubnetId.subnetId(id));
- printSubnet(subnet);
- } else {
- Iterable<Subnet> subnets = service.getSubnets();
- if (subnets == null) {
- return;
- }
- for (Subnet subnet : subnets) {
- printSubnet(subnet);
- }
- }
- }
-
- private void printSubnet(Subnet subnet) {
- print(FMT, subnet.id(), subnet.networkId(), subnet.subnetName(),
- subnet.tenantId(), subnet.cidr(), subnet.dhcpEnabled(), subnet
- .gatewayIp(), subnet.ipVersion());
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.java
deleted file mode 100644
index 241af87e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetRemoveCommand.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.vtnrsc.cli.subnet;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for removing a subnet.
- */
-@Command(scope = "onos", name = "subnet-remove", description = "Supports for removing a subnet")
-public class SubnetRemoveCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "Subnet SubnetId Id", required = true,
- multiValued = false)
- String id = null;
-
- @Override
- protected void execute() {
- SubnetService service = get(SubnetService.class);
- Set<SubnetId> subnetsSet = Sets.newHashSet();
- subnetsSet.add(SubnetId.subnetId(id));
- service.removeSubnets(subnetsSet);
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java
deleted file mode 100644
index c76ca5b2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/SubnetUpdateCommand.java
+++ /dev/null
@@ -1,118 +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.vtnrsc.cli.subnet;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpAddress.Version;
-import org.onlab.packet.IpPrefix;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.AllocationPool;
-import org.onosproject.vtnrsc.DefaultSubnet;
-import org.onosproject.vtnrsc.HostRoute;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.Subnet.Mode;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for updating a subnet.
- */
-@Command(scope = "onos", name = "subnet-update", description = "Supports for updating a subnet")
-public class SubnetUpdateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "Subnet Id", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "subnetName", description = "Subnet String name", required = true,
- multiValued = false)
- String subnetName = null;
-
- @Argument(index = 2, name = "networkId", description = "Subnet Network Id", required = true,
- multiValued = false)
- String networkId = null;
-
- @Argument(index = 3, name = "tenantId", description = "Subnet Tenant Id", required = true,
- multiValued = false)
- String tenantId = null;
-
- @Option(name = "-i", aliases = "--ipVersion", description = "Subnet Version ipVersion",
- required = false, multiValued = false)
- Version ipVersion = null;
-
- @Option(name = "-c", aliases = "--cidr", description = "Subnet IpPrefix cidr", required = false,
- multiValued = false)
- String cidr = "0.0.0.0/0";
-
- @Option(name = "-g", aliases = "--gatewayIp", description = "Subnet IpAddress gatewayIp",
- required = false, multiValued = false)
- String gatewayIp = "0.0.0.0";
-
- @Option(name = "-d", aliases = "--dhcpEnabled", description = "Subnet boolean dhcpEnabled",
- required = false, multiValued = false)
- boolean dhcpEnabled = false;
-
- @Option(name = "-s", aliases = "--shared", description = "Subnet boolean shared", required = false,
- multiValued = false)
- boolean shared = false;
-
- @Option(name = "-m", aliases = "--ipV6AddressMode", description = "Subnet Mode ipV6AddressMode",
- required = false, multiValued = false)
- String ipV6AddressMode = null;
-
- @Option(name = "-r", aliases = "--ipV6RaMode", description = "Subnet Mode ipV6RaMode",
- required = false, multiValued = false)
- String ipV6RaMode = null;
-
- @Option(name = "-h", aliases = "--hostRoutes", description = "Subnet jsonnode hostRoutes",
- required = false, multiValued = false)
- Set<HostRoute> hostRoutes = Sets.newHashSet();
-
- @Option(name = "-a", aliases = "--allocationPools",
- description = "Subnet jsonnode allocationPools", required = false, multiValued = false)
- Set<AllocationPool> allocationPools = Sets.newHashSet();
-
- @Override
- protected void execute() {
- SubnetService service = get(SubnetService.class);
- if (id == null || networkId == null || tenantId == null) {
- print("id,networkId,tenantId can not be null");
- return;
- }
- Subnet subnet = new DefaultSubnet(SubnetId.subnetId(id), subnetName,
- TenantNetworkId.networkId(networkId),
- TenantId.tenantId(tenantId), ipVersion,
- cidr == null ? null : IpPrefix.valueOf(cidr),
- gatewayIp == null ? null : IpAddress.valueOf(gatewayIp),
- dhcpEnabled, shared, hostRoutes,
- ipV6AddressMode == null ? null : Mode.valueOf(ipV6AddressMode),
- ipV6RaMode == null ? null : Mode.valueOf(ipV6RaMode),
- allocationPools);
- Set<Subnet> subnetsSet = Sets.newHashSet();
- subnetsSet.add(subnet);
- service.updateSubnets(subnetsSet);
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/package-info.java
deleted file mode 100644
index b3a2ff51..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/subnet/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.
- */
-
-/**
- * Command line interface for subnets.
- */
-package org.onosproject.vtnrsc.cli.subnet;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java
deleted file mode 100644
index 4c555e33..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortCreateCommand.java
+++ /dev/null
@@ -1,134 +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.vtnrsc.cli.virtualport;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.MacAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * Supports for creating a virtualPort.
- */
-@Command(scope = "onos", name = "virtualport-create",
- description = "Supports for creating a virtualPort.")
-public class VirtualPortCreateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "virtualPort id.", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "networkId", description = "network id.", required = true,
- multiValued = false)
- String networkId = null;
-
- @Argument(index = 2, name = "name", description = "virtualPort name.", required = true,
- multiValued = false)
- String name = null;
-
- @Argument(index = 3, name = "tenantId", description = "tenant id.", required = true,
- multiValued = false)
- String tenantId = null;
-
- @Argument(index = 4, name = "deviceId", description = "device id.", required = true,
- multiValued = false)
- String deviceId = null;
-
- @Option(name = "-a", aliases = "--adminStateUp",
- description = "administrative status of the virtualPort which is true or false.",
- required = false, multiValued = false)
- Boolean adminStateUp = false;
-
- @Option(name = "-s", aliases = "--state", description = "virtualPort state.", required = false,
- multiValued = false)
- String state = null;
-
- @Option(name = "-m", aliases = "--macAddress", description = "MAC address.", required = false,
- multiValued = false)
- String macAddress = "";
-
- @Option(name = "-d", aliases = "--deviceOwner", description = "ID of the entity that uses this "
- + "virtualPort.", required = false, multiValued = false)
- String deviceOwner = null;
-
- @Option(name = "-f", aliases = "--fixedIp",
- description = "The IP address for the port,include the IP address "
- + "and subnet identity.", required = false, multiValued = false)
- FixedIp fixedIp = null;
-
- @Option(name = "-i", aliases = "--bindingHostId", description = "virtualPort bindingHostId.",
- required = false, multiValued = false)
- String bindingHostId = null;
-
- @Option(name = "-t", aliases = "--bindingvnicType", description = "virtualPort bindingvnicType.",
- required = false, multiValued = false)
- String bindingvnicType = null;
-
- @Option(name = "-v", aliases = "--bindingvifType", description = "virtualPort bindingvifType.",
- required = false, multiValued = false)
- String bindingvifType = null;
-
- @Option(name = "-b", aliases = "--bindingvnicDetails",
- description = "virtualPort bindingvnicDetails.", required = false, multiValued = false)
- String bindingvnicDetails = null;
-
- @Option(name = "-l", aliases = "--allowedAddress", description = "virtual allowedAddressPair.",
- required = false, multiValued = false)
- Set<AllowedAddressPair> allowedAddressPairs = Sets.newHashSet();
-
- @Option(name = "-e", aliases = "--securityGroups", description = "virtualPort securityGroups.",
- required = false, multiValued = false)
- Set<SecurityGroup> securityGroups = Sets.newHashSet();
-
- @Override
- protected void execute() {
- Map<String, String> strMap = Maps.newHashMap();
- strMap.putIfAbsent("name", name);
- strMap.putIfAbsent("deviceOwner", deviceOwner);
- strMap.putIfAbsent("bindingvnicType", bindingvnicType);
- strMap.putIfAbsent("bindingvifType", bindingvifType);
- strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
- VirtualPortService service = get(VirtualPortService.class);
- VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
- TenantNetworkId.networkId(networkId),
- false, strMap, VirtualPort.State.ACTIVE,
- MacAddress.valueOf(macAddress),
- TenantId.tenantId(tenantId),
- DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
- BindingHostId.bindingHostId(bindingHostId),
- allowedAddressPairs, securityGroups);
- Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
- service.createPorts(virtualPorts);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java
deleted file mode 100644
index 47126d1b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortQueryCommand.java
+++ /dev/null
@@ -1,94 +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.vtnrsc.cli.virtualport;
-
-import java.util.Collection;
-
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-
-/**
- * Supports for querying virtualPorts.
- */
-@Command(scope = "onos", name = "virtualports", description = "Supports for querying virtualPorts.")
-public class VirtualPortQueryCommand extends AbstractShellCommand {
-
- @Option(name = "-v", aliases = "--vPortId", description = "virtualPort ID.", required = false,
- multiValued = false)
- String vPortId;
-
- @Option(name = "-n", aliases = "--networkId", description = "network ID.", required = false,
- multiValued = false)
- String networkId;
-
- @Option(name = "-d", aliases = "--deviceId", description = "device ID.", required = false,
- multiValued = false)
- String deviceId;
-
- @Option(name = "-t", aliases = "--tenantId", description = "tenant ID.", required = false,
- multiValued = false)
- String tenantId;
-
- private static final String FMT = "virtualPortId=%s, networkId=%s, name=%s,"
- + " tenantId=%s, deviceId=%s, adminStateUp=%s, state=%s,"
- + " macAddress=%s, deviceOwner=%s, fixedIp=%s, bindingHostId=%s,"
- + " bindingvnicType=%s, bindingvifType=%s, bindingvnicDetails=%s,"
- + " allowedAddress=%s, securityGroups=%s";
-
- @Override
- protected void execute() {
- VirtualPortService service = get(VirtualPortService.class);
- if (vPortId != null && networkId == null && deviceId == null && tenantId == null) {
- VirtualPort port = service.getPort(VirtualPortId.portId(vPortId));
- printPort(port);
- } else if (vPortId == null && networkId != null && deviceId == null && tenantId == null) {
- Collection<VirtualPort> ports = service.getPorts(TenantNetworkId.networkId(networkId));
- printPorts(ports);
- } else if (vPortId == null && networkId == null && deviceId != null && tenantId == null) {
- Collection<VirtualPort> ports = service.getPorts(DeviceId.deviceId(deviceId));
- printPorts(ports);
- } else if (vPortId == null && networkId == null && deviceId == null && tenantId != null) {
- Collection<VirtualPort> ports = service.getPorts(DeviceId.deviceId(tenantId));
- printPorts(ports);
- } else if (vPortId == null && networkId == null && deviceId == null && tenantId == null) {
- Collection<VirtualPort> ports = service.getPorts();
- printPorts(ports);
- } else {
- print("cannot input more than one parameter");
- }
-
- }
-
- private void printPorts(Collection<VirtualPort> ports) {
- for (VirtualPort port : ports) {
- printPort(port);
- }
- }
-
- private void printPort(VirtualPort port) {
- print(FMT, port.portId(), port.networkId(), port.name(), port.tenantId(), port.deviceId(),
- port.adminStateUp(), port.state(), port.macAddress(), port.deviceOwner(), port
- .fixedIps(), port.bindingHostId(), port.bindingVnicType(),
- port.bindingVifType(), port.bindingVifDetails(), port.allowedAddressPairs(),
- port.securityGroups());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.java
deleted file mode 100644
index 1a3cb4f0..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortRemoveCommand.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.vtnrsc.cli.virtualport;
-
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-
-import com.google.common.collect.Sets;
-
-/**
- * Supports for removing a virtualPort.
- */
-@Command(scope = "onos", name = "virtualport-remove",
- description = "Supports for removing a virtualPort.")
-public class VirtualPortRemoveCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "virtualPort id.", required = true,
- multiValued = false)
- String id = null;
-
- @Override
- protected void execute() {
- VirtualPortService service = get(VirtualPortService.class);
- Set<VirtualPortId> virtualPorts = Sets.newHashSet(VirtualPortId.portId(id));
- service.removePorts(virtualPorts);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java
deleted file mode 100644
index 6df4b23c..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/VirtualPortUpdateCommand.java
+++ /dev/null
@@ -1,135 +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.vtnrsc.cli.virtualport;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.onlab.packet.MacAddress;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * Supports for updating a virtualPort.
- */
-@Command(scope = "onos", name = "virtualport-update",
- description = "Supports for updating a virtualPort.")
-public class VirtualPortUpdateCommand extends AbstractShellCommand {
-
- @Argument(index = 0, name = "id", description = "virtualPort id.", required = true,
- multiValued = false)
- String id = null;
-
- @Argument(index = 1, name = "networkId", description = "network id.", required = true,
- multiValued = false)
- String networkId = null;
-
- @Argument(index = 2, name = "name", description = "virtualPort name.", required = true,
- multiValued = false)
- String name = null;
-
- @Argument(index = 3, name = "tenantId", description = "tenant id.", required = true,
- multiValued = false)
- String tenantId = null;
-
- @Argument(index = 4, name = "deviceId", description = "device id.", required = true,
- multiValued = false)
- String deviceId = null;
-
- @Option(name = "-a", aliases = "--adminStateUp",
- description = "administrative status of the virtualPort which is true or false.",
- required = false, multiValued = false)
- Boolean adminStateUp = false;
-
- @Option(name = "-s", aliases = "--state", description = "virtualPort state.", required = false,
- multiValued = false)
- String state = null;
-
- @Option(name = "-m", aliases = "--macAddress", description = "MAC address.", required = false,
- multiValued = false)
- String macAddress = "";
-
- @Option(name = "-d", aliases = "--deviceOwner",
- description = "ID of the entity that uses this " + "virtualPort.", required = false,
- multiValued = false)
- String deviceOwner = null;
-
- @Option(name = "-f", aliases = "--fixedIp",
- description = "The IP address for the port,include the IP address "
- + "and subnet identity.", required = false, multiValued = false)
- FixedIp fixedIp = null;
-
- @Option(name = "-i", aliases = "--bindingHostId", description = "virtualPort bindingHostId.",
- required = false, multiValued = false)
- String bindingHostId = "";
-
- @Option(name = "-t", aliases = "--bindingvnicType",
- description = "virtualPort bindingvnicType.", required = false, multiValued = false)
- String bindingvnicType = null;
-
- @Option(name = "-v", aliases = "--bindingvifType", description = "virtualPort bindingvifType.",
- required = false, multiValued = false)
- String bindingvifType = null;
-
- @Option(name = "-b", aliases = "--bindingvnicDetails",
- description = "virtualPort bindingvnicDetails.", required = false, multiValued = false)
- String bindingvnicDetails = null;
-
- @Option(name = "-l", aliases = "--allowedAddress", description = "virtual allowedAddressPair.",
- required = false, multiValued = false)
- Set<AllowedAddressPair> allowedAddressPairs = Sets.newHashSet();
-
- @Option(name = "-e", aliases = "--securityGroups", description = "virtualPort securityGroups.",
- required = false, multiValued = false)
- Set<SecurityGroup> securityGroups = Sets.newHashSet();
-
- @Override
- protected void execute() {
- VirtualPortService service = get(VirtualPortService.class);
- Map<String, String> strMap = Maps.newHashMap();
- strMap.putIfAbsent("name", name);
- strMap.putIfAbsent("deviceOwner", deviceOwner);
- strMap.putIfAbsent("bindingvnicType", bindingvnicType);
- strMap.putIfAbsent("bindingvifType", bindingvifType);
- strMap.putIfAbsent("bindingvnicDetails", bindingvnicDetails);
- VirtualPort virtualPort = new DefaultVirtualPort(VirtualPortId.portId(id),
- TenantNetworkId.networkId(networkId),
- false, strMap, VirtualPort.State.ACTIVE,
- MacAddress.valueOf(macAddress),
- TenantId.tenantId(tenantId),
- DeviceId.deviceId(deviceId), Sets.newHashSet(fixedIp),
- BindingHostId.bindingHostId(bindingHostId),
- allowedAddressPairs, securityGroups);
- Set<VirtualPort> virtualPorts = Sets.newHashSet(virtualPort);
- service.updatePorts(virtualPorts);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/package-info.java
deleted file mode 100644
index fac214a1..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/cli/virtualport/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.
- */
-
-/**
- * Command line interface for virtual ports.
- */
-package org.onosproject.vtnrsc.cli.virtualport;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEvent.java
deleted file mode 100644
index ce3faae7..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEvent.java
+++ /dev/null
@@ -1,125 +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.vtnrsc.event;
-
-import org.onosproject.event.AbstractEvent;
-
-
-/**
- * Describes network vtnrsc event.
- */
-public class VtnRscEvent
- extends AbstractEvent<VtnRscEvent.Type, VtnRscEventFeedback> {
-
- /**
- * Type of vtnrsc events.
- */
- public enum Type {
- /**
- * Signifies that floating IP has create.
- */
- FLOATINGIP_PUT,
- /**
- * Signifies that floating IP has delete.
- */
- FLOATINGIP_DELETE,
- /**
- * Signifies that router has create.
- */
- ROUTER_PUT,
- /**
- * Signifies that router has delete.
- */
- ROUTER_DELETE,
- /**
- * Signifies that router interface has add.
- */
- ROUTER_INTERFACE_PUT,
- /**
- * Signifies that router interface has remove.
- */
- ROUTER_INTERFACE_DELETE,
- /**
- * Signifies that port-pair has add.
- */
- PORT_PAIR_PUT,
- /**
- * Signifies that port-pair has remove.
- */
- PORT_PAIR_DELETE,
- /**
- * Signifies that port-pair has update.
- */
- PORT_PAIR_UPDATE,
- /**
- * Signifies that port-pair-group has add.
- */
- PORT_PAIR_GROUP_PUT,
- /**
- * Signifies that port-pair-group has remove.
- */
- PORT_PAIR_GROUP_DELETE,
- /**
- * Signifies that port-pair-group has update.
- */
- PORT_PAIR_GROUP_UPDATE,
- /**
- * Signifies that flow-classifier has add.
- */
- FLOW_CLASSIFIER_PUT,
- /**
- * Signifies that flow-classifier has remove.
- */
- FLOW_CLASSIFIER_DELETE,
- /**
- * Signifies that flow-classifier has update.
- */
- FLOW_CLASSIFIER_UPDATE,
- /**
- * Signifies that port-chain has add.
- */
- PORT_CHAIN_PUT,
- /**
- * Signifies that port-chain has remove.
- */
- PORT_CHAIN_DELETE,
- /**
- * Signifies that port-chain has update.
- */
- PORT_CHAIN_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified vtn event feedback.
- *
- * @param type Vtnrsc event type
- * @param vtnFeedback event VtnrscEventFeedback subject
- */
- public VtnRscEvent(Type type, VtnRscEventFeedback vtnFeedback) {
- super(type, vtnFeedback);
- }
-
- /**
- * Creates an event of a given type and for the specified vtn event feedback.
- *
- * @param type Vtnrsc event type
- * @param vtnFeedback event VtnrscEventFeedback subject
- * @param time occurrence time
- */
- public VtnRscEvent(Type type, VtnRscEventFeedback vtnFeedback, long time) {
- super(type, vtnFeedback, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEventFeedback.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEventFeedback.java
deleted file mode 100644
index 112c6411..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscEventFeedback.java
+++ /dev/null
@@ -1,252 +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.vtnrsc.event;
-
-import java.util.Objects;
-
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortChain;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Representation of a VtnRsc event feedback.
- */
-public class VtnRscEventFeedback {
- private final FloatingIp floaingtIp;
- private final Router router;
- private final RouterInterface routerInterface;
- private final PortPair portPair;
- private final PortPairGroup portPairGroup;
- private final FlowClassifier flowClassifier;
- private final PortChain portChain;
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param floatingIp the floating Ip
- */
- public VtnRscEventFeedback(FloatingIp floatingIp) {
- this.floaingtIp = checkNotNull(floatingIp, "floaintIp cannot be null");
- this.router = null;
- this.routerInterface = null;
- this.portPair = null;
- this.portPairGroup = null;
- this.flowClassifier = null;
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param router the router
- */
- public VtnRscEventFeedback(Router router) {
- this.floaingtIp = null;
- this.router = checkNotNull(router, "router cannot be null");
- this.routerInterface = null;
- this.portPair = null;
- this.portPairGroup = null;
- this.flowClassifier = null;
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param routerInterface the router interface
- */
- public VtnRscEventFeedback(RouterInterface routerInterface) {
- this.floaingtIp = null;
- this.router = null;
- this.routerInterface = checkNotNull(routerInterface,
- "routerInterface cannot be null");
- this.portPair = null;
- this.portPairGroup = null;
- this.flowClassifier = null;
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param portPair the Port-Pair
- */
- public VtnRscEventFeedback(PortPair portPair) {
- this.floaingtIp = null;
- this.router = null;
- this.routerInterface = null;
- this.portPair = checkNotNull(portPair,
- "Port-Pair cannot be null");
- this.portPairGroup = null;
- this.flowClassifier = null;
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param portPairGroup the Port-Pair-Group
- */
- public VtnRscEventFeedback(PortPairGroup portPairGroup) {
- this.floaingtIp = null;
- this.router = null;
- this.routerInterface = null;
- this.portPair = null;
- this.portPairGroup = checkNotNull(portPairGroup,
- "Port-Pair-Group cannot be null");
- this.flowClassifier = null;
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param flowClassifier the Flow-Classifier
- */
- public VtnRscEventFeedback(FlowClassifier flowClassifier) {
- this.floaingtIp = null;
- this.router = null;
- this.routerInterface = null;
- this.portPair = null;
- this.portPairGroup = null;
- this.flowClassifier = checkNotNull(flowClassifier,
- "Flow-Classifier cannot be null");
- this.portChain = null;
- }
-
- /**
- * Creates VtnRscEventFeedback object.
- *
- * @param portChain the Port-Chain
- */
- public VtnRscEventFeedback(PortChain portChain) {
- this.floaingtIp = null;
- this.router = null;
- this.routerInterface = null;
- this.portPair = null;
- this.portPairGroup = null;
- this.flowClassifier = null;
- this.portChain = checkNotNull(portChain,
- "Port-Chain cannot be null");
- }
-
- /**
- * Returns floating IP.
- *
- * @return floaingtIp the floating IP
- */
- public FloatingIp floatingIp() {
- return floaingtIp;
- }
-
- /**
- * Returns router.
- *
- * @return router the router
- */
- public Router router() {
- return router;
- }
-
- /**
- * Returns router interface.
- *
- * @return routerInterface the router interface
- */
- public RouterInterface routerInterface() {
- return routerInterface;
- }
-
- /**
- * Returns Port-Pair.
- *
- * @return portPair the Port-Pair
- */
- public PortPair portPair() {
- return portPair;
- }
-
- /**
- * Returns Port-Pair-Group.
- *
- * @return portPairGroup the Port-Pair-Group
- */
- public PortPairGroup portPairGroup() {
- return portPairGroup;
- }
-
- /**
- * Returns Flow-Classifier.
- *
- * @return flowClassifier the Flow-Classifier
- */
- public FlowClassifier flowClassifier() {
- return flowClassifier;
- }
-
- /**
- * Returns Port-Chain.
- *
- * @return portChain the Port-Chain
- */
- public PortChain portChain() {
- return portChain;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(floaingtIp, router, routerInterface, portPair,
- portPairGroup, flowClassifier, portChain);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof VtnRscEventFeedback) {
- final VtnRscEventFeedback that = (VtnRscEventFeedback) obj;
- return Objects.equals(this.floaingtIp, that.floaingtIp)
- && Objects.equals(this.router, that.router)
- && Objects.equals(this.routerInterface, that.routerInterface)
- && Objects.equals(this.portPair, that.portPair)
- && Objects.equals(this.portPairGroup, that.portPairGroup)
- && Objects.equals(this.flowClassifier, that.flowClassifier)
- && Objects.equals(this.portChain, that.portChain);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("router", router)
- .add("floaingtIp", floaingtIp)
- .add("routerInterface", routerInterface)
- .add("portPair", portPair)
- .add("portPairGroup", portPairGroup)
- .add("flowClassifier", flowClassifier)
- .add("portChain", portChain)
- .toString();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscListener.java
deleted file mode 100644
index fdd67552..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/VtnRscListener.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.vtnrsc.event;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of VtnRsc related events.
- */
-public interface VtnRscListener extends EventListener<VtnRscEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/package-info.java
deleted file mode 100644
index c1575ad3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/event/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.
- */
-
-/**
- * Event of VtnRsc for VtnRsc service.
- */
-package org.onosproject.vtnrsc.event;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpEvent.java
deleted file mode 100644
index f76007f7..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpEvent.java
+++ /dev/null
@@ -1,60 +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.vtnrsc.floatingip;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.FloatingIp;
-
-/**
- * Describes network Floating IP event.
- */
-public class FloatingIpEvent
- extends AbstractEvent<FloatingIpEvent.Type, FloatingIp> {
- /**
- * Type of Floating IP events.
- */
- public enum Type {
- /**
- * Signifies that Floating IP has been created.
- */
- FLOATINGIP_PUT,
- /**
- * Signifies that Floating IP has been deleted.
- */
- FLOATINGIP_DELETE
- }
-
- /**
- * Creates an event of a given type and for the specified Floating IP.
- *
- * @param type Floating IP event type
- * @param floagingIp Floating IP subject
- */
- public FloatingIpEvent(Type type, FloatingIp floagingIp) {
- super(type, floagingIp);
- }
-
- /**
- * Creates an event of a given type and for the specified Floating IP.
- *
- * @param type Floating IP event type
- * @param floagingIp Floating IP subject
- * @param time occurrence time
- */
- public FloatingIpEvent(Type type, FloatingIp floagingIp, long time) {
- super(type, floagingIp, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpListener.java
deleted file mode 100644
index a42af136..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.floatingip;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Floating IP related events.
- */
-public interface FloatingIpListener extends EventListener<FloatingIpEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpService.java
deleted file mode 100644
index 3f6f2515..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/FloatingIpService.java
+++ /dev/null
@@ -1,108 +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.vtnrsc.floatingip;
-
-import java.util.Collection;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.TenantId;
-
-/**
- * Service for interacting with the inventory of floating IP.
- */
-public interface FloatingIpService {
- /**
- * Returns exists or not of specific floatingIp identifier.
- *
- * @param floatingIpId floatingIp identifier
- * @return true or false
- */
- boolean exists(FloatingIpId floatingIpId);
-
- /**
- * Returns is used or not of specific floating IP address.
- *
- * @param floatingIpAddr floatingIp address
- * @param floatingIpId floatingIp identifier
- * @return true or false
- */
- boolean floatingIpIsUsed(IpAddress floatingIpAddr, FloatingIpId floatingIpId);
-
- /**
- * Returns is used or not of specific fixed IP address.
- *
- * @param fixedIpAddr fixedIp address
- * @param tenantId the tenant identifier of floating IP
- * @param floatingIpId floatingIp identifier
- * @return true or false
- */
- boolean fixedIpIsUsed(IpAddress fixedIpAddr, TenantId tenantId, FloatingIpId floatingIpId);
-
- /**
- * Returns a collection of the currently known floating IP.
- *
- * @return collection of floating IP
- */
- Collection<FloatingIp> getFloatingIps();
-
- /**
- * Returns the floatingIp with the specified identifier.
- *
- * @param floatingIpId floatingIp identifier
- * @return floatingIp or null if one with the given identifier is not known
- */
- FloatingIp getFloatingIp(FloatingIpId floatingIpId);
-
- /**
- * Creates new floatingIps.
- *
- * @param floatingIps the collection of floatingIp
- * @return true if the identifier floatingIp has been created right
- */
- boolean createFloatingIps(Collection<FloatingIp> floatingIps);
-
- /**
- * Updates existing floatingIps.
- *
- * @param floatingIps the collection of floatingIp
- * @return true if all floatingIp were updated successfully
- */
- boolean updateFloatingIps(Collection<FloatingIp> floatingIps);
-
- /**
- * Removes the specified floatingIp from the store.
- *
- * @param floatingIpIds the collection of floatingIp identifier
- * @return true if remove identifier floatingIp successfully
- */
- boolean removeFloatingIps(Collection<FloatingIpId> floatingIpIds);
-
- /**
- * Adds the specified listener to floating Ip manager.
- *
- * @param listener floating Ip listener
- */
- void addListener(FloatingIpListener listener);
-
- /**
- * Removes the specified listener to floating Ip manager.
- *
- * @param listener floating Ip listener
- */
- void removeListener(FloatingIpListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/FloatingIpManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/FloatingIpManager.java
deleted file mode 100644
index ce9bb21f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/FloatingIpManager.java
+++ /dev/null
@@ -1,343 +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.vtnrsc.floatingip.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collection;
-import java.util.Collections;
-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.packet.IpAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapEvent;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.floatingip.FloatingIpEvent;
-import org.onosproject.vtnrsc.floatingip.FloatingIpListener;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the FloatingIp service.
- */
-@Component(immediate = true)
-@Service
-public class FloatingIpManager implements FloatingIpService {
- private static final String FLOATINGIP_ID_NOT_NULL = "Floatingip ID cannot be null";
- private static final String FLOATINGIP_NOT_NULL = "Floatingip cannot be null";
- private static final String FLOATINGIP = "vtn-floatingip-store";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
- private static final String EVENT_NOT_NULL = "event cannot be null";
-
- private final Logger log = getLogger(getClass());
- private final Set<FloatingIpListener> listeners = Sets
- .newCopyOnWriteArraySet();
- private EventuallyConsistentMapListener<FloatingIpId, FloatingIp> floatingIpListener =
- new InnerFloatingIpStoreListener();
- protected EventuallyConsistentMap<FloatingIpId, FloatingIp> floatingIpStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService tenantNetworkService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterService routerService;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(VTNRSC_APP);
- KryoNamespace.Builder serializer = KryoNamespace
- .newBuilder()
- .register(KryoNamespaces.API)
- .register(FloatingIp.class, FloatingIpId.class,
- TenantNetworkId.class, TenantId.class,
- FloatingIp.Status.class, RouterId.class,
- VirtualPortId.class, DefaultFloatingIp.class);
- floatingIpStore = storageService
- .<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
- .withName(FLOATINGIP).withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp())
- .build();
- floatingIpStore.addListener(floatingIpListener);
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- floatingIpStore.removeListener(floatingIpListener);
- floatingIpStore.destroy();
- listeners.clear();
- log.info("Stopped");
- }
-
- @Override
- public Collection<FloatingIp> getFloatingIps() {
- return Collections.unmodifiableCollection(floatingIpStore.values());
- }
-
- @Override
- public FloatingIp getFloatingIp(FloatingIpId floatingIpId) {
- checkNotNull(floatingIpId, FLOATINGIP_ID_NOT_NULL);
- return floatingIpStore.get(floatingIpId);
- }
-
- @Override
- public boolean exists(FloatingIpId floatingIpId) {
- checkNotNull(floatingIpId, FLOATINGIP_ID_NOT_NULL);
- return floatingIpStore.containsKey(floatingIpId);
- }
-
- @Override
- public boolean floatingIpIsUsed(IpAddress floatingIpAddr,
- FloatingIpId floatingIpId) {
- checkNotNull(floatingIpAddr, "Floating IP address cannot be null");
- checkNotNull(floatingIpId, "Floating IP Id cannot be null");
- Collection<FloatingIp> floatingIps = getFloatingIps();
- for (FloatingIp floatingIp : floatingIps) {
- if (floatingIp.floatingIp().equals(floatingIpAddr)
- && !floatingIp.id().equals(floatingIpId)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean fixedIpIsUsed(IpAddress fixedIpAddr, TenantId tenantId,
- FloatingIpId floatingIpId) {
- checkNotNull(fixedIpAddr, "Fixed IP address cannot be null");
- checkNotNull(tenantId, "Tenant Id cannot be null");
- checkNotNull(floatingIpId, "Floating IP Id cannot be null");
- Collection<FloatingIp> floatingIps = getFloatingIps();
- for (FloatingIp floatingIp : floatingIps) {
- IpAddress fixedIp = floatingIp.fixedIp();
- if (fixedIp != null) {
- if (fixedIp.equals(fixedIpAddr)
- && floatingIp.tenantId().equals(tenantId)
- && !floatingIp.id().equals(floatingIpId)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public boolean createFloatingIps(Collection<FloatingIp> floatingIps) {
- checkNotNull(floatingIps, FLOATINGIP_NOT_NULL);
- boolean result = true;
- for (FloatingIp floatingIp : floatingIps) {
- verifyFloatingIpData(floatingIp);
- if (floatingIp.portId() != null) {
- floatingIpStore.put(floatingIp.id(), floatingIp);
- if (!floatingIpStore.containsKey(floatingIp.id())) {
- log.debug("The floating Ip is created failed whose identifier is {}",
- floatingIp.id().toString());
- result = false;
- }
- } else {
- FloatingIp oldFloatingIp = floatingIpStore.get(floatingIp.id());
- if (oldFloatingIp != null) {
- floatingIpStore.remove(floatingIp.id(), oldFloatingIp);
- if (floatingIpStore.containsKey(floatingIp.id())) {
- log.debug("The floating Ip is created failed whose identifier is {}",
- floatingIp.id().toString());
- result = false;
- }
- }
- }
- }
- return result;
- }
-
- @Override
- public boolean updateFloatingIps(Collection<FloatingIp> floatingIps) {
- checkNotNull(floatingIps, FLOATINGIP_NOT_NULL);
- boolean result = true;
- for (FloatingIp floatingIp : floatingIps) {
- verifyFloatingIpData(floatingIp);
- if (floatingIp.portId() != null) {
- floatingIpStore.put(floatingIp.id(), floatingIp);
- if (!floatingIpStore.containsKey(floatingIp.id())) {
- log.debug("The floating Ip is updated failed whose identifier is {}",
- floatingIp.id().toString());
- result = false;
- }
- } else {
- FloatingIp oldFloatingIp = floatingIpStore.get(floatingIp.id());
- if (oldFloatingIp != null) {
- floatingIpStore.remove(floatingIp.id(), oldFloatingIp);
- if (floatingIpStore.containsKey(floatingIp.id())) {
- log.debug("The floating Ip is updated failed whose identifier is {}",
- floatingIp.id().toString());
- result = false;
- }
- }
- }
- }
- return result;
- }
-
- @Override
- public boolean removeFloatingIps(Collection<FloatingIpId> floatingIpIds) {
- checkNotNull(floatingIpIds, FLOATINGIP_ID_NOT_NULL);
- boolean result = true;
- for (FloatingIpId floatingIpId : floatingIpIds) {
- if (!floatingIpStore.containsKey(floatingIpId)) {
- log.debug("The floatingIp is not exist whose identifier is {}",
- floatingIpId.toString());
- throw new IllegalArgumentException(
- "FloatingIP ID doesn't exist");
- }
- FloatingIp floatingIp = floatingIpStore.get(floatingIpId);
- floatingIpStore.remove(floatingIpId, floatingIp);
- if (floatingIpStore.containsKey(floatingIpId)) {
- log.debug("The floating Ip is deleted failed whose identifier is {}",
- floatingIpId.toString());
- result = false;
- }
- }
- return result;
- }
-
- @Override
- public void addListener(FloatingIpListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(FloatingIpListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- /**
- * Verifies validity of FloatingIp data.
- *
- * @param floatingIps floatingIp instance
- */
- private void verifyFloatingIpData(FloatingIp floatingIps) {
- checkNotNull(floatingIps, FLOATINGIP_NOT_NULL);
- if (!tenantNetworkService.exists(floatingIps.networkId())) {
- log.debug("The network identifier {} that the floating Ip {} create for is not exist",
- floatingIps.networkId().toString(), floatingIps.id()
- .toString());
- throw new IllegalArgumentException(
- "Floating network ID doesn't exist");
- }
-
- VirtualPortId portId = floatingIps.portId();
- if (portId != null && !virtualPortService.exists(portId)) {
- log.debug("The port identifier {} that the floating Ip {} create for is not exist",
- floatingIps.portId().toString(), floatingIps.id()
- .toString());
- throw new IllegalArgumentException("Port ID doesn't exist");
- }
-
- RouterId routerId = floatingIps.routerId();
- if (routerId != null && !routerService.exists(routerId)) {
- log.debug("The router identifier {} that the floating Ip {} create for is not exist",
- floatingIps.routerId().toString(), floatingIps.id()
- .toString());
- throw new IllegalArgumentException("Router ID doesn't exist");
- }
-
- if (floatingIpIsUsed(floatingIps.floatingIp(), floatingIps.id())) {
- log.debug("The floaing Ip {} that the floating Ip {} create for is used",
- floatingIps.floatingIp().toString(), floatingIps.id()
- .toString());
- throw new IllegalArgumentException(
- "The floating IP address is used");
- }
-
- IpAddress fixedIp = floatingIps.fixedIp();
- if (fixedIp != null
- && fixedIpIsUsed(fixedIp, floatingIps.tenantId(),
- floatingIps.id())) {
- log.debug("The fixed Ip {} that the floating Ip {} create for is used",
- floatingIps.fixedIp().toString(), floatingIps.id()
- .toString());
- throw new IllegalArgumentException("The fixed IP address is used");
- }
- }
-
- private class InnerFloatingIpStoreListener
- implements
- EventuallyConsistentMapListener<FloatingIpId, FloatingIp> {
-
- @Override
- public void event(EventuallyConsistentMapEvent<FloatingIpId, FloatingIp> event) {
- checkNotNull(event, EVENT_NOT_NULL);
- FloatingIp floatingIp = event.value();
- if (EventuallyConsistentMapEvent.Type.PUT == event.type()) {
- notifyListeners(new FloatingIpEvent(
- FloatingIpEvent.Type.FLOATINGIP_PUT,
- floatingIp));
- }
- if (EventuallyConsistentMapEvent.Type.REMOVE == event.type()) {
- notifyListeners(new FloatingIpEvent(
- FloatingIpEvent.Type.FLOATINGIP_DELETE,
- floatingIp));
- }
- }
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event Floating IP event
- */
- private void notifyListeners(FloatingIpEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- listeners.forEach(listener -> listener.event(event));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/impl/package-info.java
deleted file mode 100644
index c638eba0..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/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 FloatingIp service.
- */
-package org.onosproject.vtnrsc.floatingip.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/package-info.java
deleted file mode 100644
index 274cbdd0..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/floatingip/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 interacting with the inventory of FloatingIp.
- */
-package org.onosproject.vtnrsc.floatingip;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierEvent.java
deleted file mode 100644
index d81ab48a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierEvent.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.vtnrsc.flowclassifier;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.FlowClassifier;
-
-/**
- * Describes network Flow-Classifier event.
- */
-public class FlowClassifierEvent extends AbstractEvent<FlowClassifierEvent.Type, FlowClassifier> {
- /**
- * Type of flow-classifier events.
- */
- public enum Type {
- /**
- * Signifies that flow-classifier has been created.
- */
- FLOW_CLASSIFIER_PUT,
- /**
- * Signifies that flow-classifier has been deleted.
- */
- FLOW_CLASSIFIER_DELETE,
- /**
- * Signifies that flow-classifier has been updated.
- */
- FLOW_CLASSIFIER_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified Flow-Classifier.
- *
- * @param type Flow-Classifier event type
- * @param flowClassifier Flow-Classifier subject
- */
- public FlowClassifierEvent(Type type, FlowClassifier flowClassifier) {
- super(type, flowClassifier);
- }
-
- /**
- * Creates an event of a given type and for the specified Flow-Classifier.
- *
- * @param type Flow-Classifier event type
- * @param flowClassifier Flow-Classifier subject
- * @param time occurrence time
- */
- public FlowClassifierEvent(Type type, FlowClassifier flowClassifier, long time) {
- super(type, flowClassifier, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierListener.java
deleted file mode 100644
index 3c0409ad..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.flowclassifier;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Flow-Classifier related events.
- */
-public interface FlowClassifierListener extends EventListener<FlowClassifierEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java
deleted file mode 100644
index e3cbf9ac..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java
+++ /dev/null
@@ -1,96 +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.vtnrsc.flowclassifier;
-
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-
-/**
- * Provides Services for Flow Classifier.
- */
-public interface FlowClassifierService {
-
- /**
- * Check whether Flow Classifier is present based on given Flow Classifier
- * Id.
- *
- * @param id flow classifier identifier
- * @return true if flow classifier is present otherwise return false
- */
- boolean exists(FlowClassifierId id);
-
- /**
- * Returns the number of flow classifiers known to the system.
- *
- * @return number of flow classifiers
- */
- int getFlowClassifierCount();
-
- /**
- * Store Flow Classifier.
- *
- * @param flowClassifier flow classifier
- * @return true if adding flow classifier into store is success otherwise
- * return false
- */
- boolean createFlowClassifier(FlowClassifier flowClassifier);
-
- /**
- * Return the existing collection of Flow Classifier.
- *
- * @return flow classifier collections
- */
- Iterable<FlowClassifier> getFlowClassifiers();
-
- /**
- * Retrieve the Flow Classifier based on given Flow Classifier id.
- *
- * @param id flow classifier identifier
- * @return flow classifier if present otherwise returns null
- */
- FlowClassifier getFlowClassifier(FlowClassifierId id);
-
- /**
- * Update Flow Classifier based on given Flow Classifier Id.
- *
- * @param flowClassifier flow classifier
- * @return true if flow classifier update is success otherwise return false
- */
- boolean updateFlowClassifier(FlowClassifier flowClassifier);
-
- /**
- * Remove Flow Classifier from store based on given Flow Classifier Id.
- *
- * @param id flow classifier identifier
- * @return true if flow classifier removal is success otherwise return
- * false
- */
- boolean removeFlowClassifier(FlowClassifierId id);
-
- /**
- * Adds the specified listener to Flow-Classifier manager.
- *
- * @param listener Flow-Classifier listener
- */
- void addListener(FlowClassifierListener listener);
-
- /**
- * Removes the specified listener to Flow-Classifier manager.
- *
- * @param listener Flow-Classifier listener
- */
- void removeListener(FlowClassifierListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java
deleted file mode 100644
index b29dc7a3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java
+++ /dev/null
@@ -1,160 +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.vtnrsc.flowclassifier.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-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.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.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-import org.slf4j.Logger;
-
-import java.util.Set;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the Flow Classifier Service.
- */
-@Component(immediate = true)
-@Service
-public class FlowClassifierManager implements FlowClassifierService {
-
- private static final String FLOW_CLASSIFIER_NOT_NULL = "Flow Classifier cannot be null";
- private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "Flow Classifier Id cannot be null";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
-
- private final Logger log = getLogger(FlowClassifierManager.class);
- private final Set<FlowClassifierListener> listeners = Sets.newCopyOnWriteArraySet();
- private EventuallyConsistentMap<FlowClassifierId, FlowClassifier> flowClassifierStore;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Activate
- protected void activate() {
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(MultiValuedTimestamp.class)
- .register(FlowClassifier.class);
- flowClassifierStore = storageService
- .<FlowClassifierId, FlowClassifier>eventuallyConsistentMapBuilder()
- .withName("flowclassifierstore").withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
- log.info("Flow Classifier service activated");
- }
-
- @Deactivate
- protected void deactivate() {
- flowClassifierStore.destroy();
- listeners.clear();
- log.info("Flow Classifier service deactivated");
- }
-
- @Override
- public boolean exists(FlowClassifierId id) {
- checkNotNull(id, FLOW_CLASSIFIER_ID_NOT_NULL);
- return flowClassifierStore.containsKey(id);
- }
-
- @Override
- public int getFlowClassifierCount() {
- return flowClassifierStore.size();
- }
-
- @Override
- public Iterable<FlowClassifier> getFlowClassifiers() {
- return ImmutableList.copyOf(flowClassifierStore.values());
- }
-
- @Override
- public FlowClassifier getFlowClassifier(FlowClassifierId id) {
- checkNotNull(id, FLOW_CLASSIFIER_ID_NOT_NULL);
- return flowClassifierStore.get(id);
- }
-
- @Override
- public boolean createFlowClassifier(FlowClassifier flowClassifier) {
- log.debug("createFlowClassifier");
- checkNotNull(flowClassifier, FLOW_CLASSIFIER_NOT_NULL);
- FlowClassifierId id = flowClassifier.flowClassifierId();
-
- flowClassifierStore.put(id, flowClassifier);
- if (!flowClassifierStore.containsKey(id)) {
- log.debug("Flow Classifier creation is failed whose identifier is {}.", id.toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updateFlowClassifier(FlowClassifier flowClassifier) {
- checkNotNull(flowClassifier, FLOW_CLASSIFIER_NOT_NULL);
-
- if (!flowClassifierStore.containsKey(flowClassifier.flowClassifierId())) {
- log.debug("The flowClassifier is not exist whose identifier was {} ", flowClassifier.flowClassifierId()
- .toString());
- return false;
- }
-
- flowClassifierStore.put(flowClassifier.flowClassifierId(), flowClassifier);
-
- if (!flowClassifier.equals(flowClassifierStore.get(flowClassifier.flowClassifierId()))) {
- log.debug("Updation of flowClassifier is failed whose identifier was {} ", flowClassifier
- .flowClassifierId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removeFlowClassifier(FlowClassifierId id) {
- checkNotNull(id, FLOW_CLASSIFIER_ID_NOT_NULL);
- flowClassifierStore.remove(id);
- if (flowClassifierStore.containsKey(id)) {
- log.debug("The Flow Classifier removal is failed whose identifier is {}", id.toString());
- return false;
- }
- return true;
- }
-
- @Override
- public void addListener(FlowClassifierListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(FlowClassifierListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java
deleted file mode 100644
index 62b5603d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/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 flow Classifier service.
- */
-package org.onosproject.vtnrsc.flowclassifier.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java
deleted file mode 100644
index c8c75bf3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/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 interacting with flow Classifier of SFC.
- */
-package org.onosproject.vtnrsc.flowclassifier;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/package-info.java
deleted file mode 100644
index b245fb14..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/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.
- */
-
-/**
- * VTN resources that used by virtual tenant network.
- */
-package org.onosproject.vtnrsc;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainEvent.java
deleted file mode 100644
index 44a4e8ed..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainEvent.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.vtnrsc.portchain;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.PortChain;
-
-/**
- * Describes network Port-Chain event.
- */
-public class PortChainEvent extends AbstractEvent<PortChainEvent.Type, PortChain> {
- /**
- * Type of port-chain events.
- */
- public enum Type {
- /**
- * Signifies that port-chain has been created.
- */
- PORT_CHAIN_PUT,
- /**
- * Signifies that port-chain has been deleted.
- */
- PORT_CHAIN_DELETE,
- /**
- * Signifies that port-chain has been updated.
- */
- PORT_CHAIN_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Chain.
- *
- * @param type Port-Chain event type
- * @param portChain Port-Chain subject
- */
- public PortChainEvent(Type type, PortChain portChain) {
- super(type, portChain);
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Chain.
- *
- * @param type Port-Chain event type
- * @param portChain Port-Chain subject
- * @param time occurrence time
- */
- public PortChainEvent(Type type, PortChain portChain, long time) {
- super(type, portChain, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainListener.java
deleted file mode 100644
index 27a498b5..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.portchain;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Port-Chain related events.
- */
-public interface PortChainListener extends EventListener<PortChainEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainService.java
deleted file mode 100644
index 5b08262b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/PortChainService.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.vtnrsc.portchain;
-
-import org.onosproject.event.ListenerService;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-
-/**
- * Service for interacting with the inventory of port chains.
- */
-public interface PortChainService extends ListenerService<PortChainEvent, PortChainListener> {
-
- /**
- * Returns if the port chain is existed.
- *
- * @param portChainId port chain identifier
- * @return true or false if one with the given identifier exists.
- */
- boolean exists(PortChainId portChainId);
-
- /**
- * Returns the number of port chains known to the system.
- *
- * @return number of port chains.
- */
- int getPortChainCount();
-
- /**
- * Returns an iterable collection of the currently known port chains.
- *
- * @return collection of port chains.
- */
- Iterable<PortChain> getPortChains();
-
- /**
- * Returns the portChain with the given identifier.
- *
- * @param portChainId port chain identifier
- * @return PortChain or null if port chain with the given identifier is not
- * known.
- */
- PortChain getPortChain(PortChainId portChainId);
-
- /**
- * Creates a PortChain in the store.
- *
- * @param portChain the port chain to create
- * @return true if given port chain is created successfully.
- */
- boolean createPortChain(PortChain portChain);
-
- /**
- * Updates the portChain in the store.
- *
- * @param portChain the port chain to update
- * @return true if given port chain is updated successfully.
- */
- boolean updatePortChain(PortChain portChain);
-
- /**
- * Deletes portChain by given portChainId.
- *
- * @param portChainId id of port chain to remove
- * @return true if the give port chain is deleted successfully.
- */
- boolean removePortChain(PortChainId portChainId);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java
deleted file mode 100644
index 0062db48..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java
+++ /dev/null
@@ -1,150 +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.vtnrsc.portchain.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-
-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.event.AbstractListenerManager;
-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.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.portchain.PortChainEvent;
-import org.onosproject.vtnrsc.portchain.PortChainListener;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of the portChainService.
- */
-@Component(immediate = true)
-@Service
-public class PortChainManager extends AbstractListenerManager<PortChainEvent, PortChainListener> implements
- PortChainService {
-
- private static final String PORT_CHAIN_ID_NULL = "PortChain ID cannot be null";
- private static final String PORT_CHAIN_NULL = "PortChain cannot be null";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
-
- private final Logger log = getLogger(getClass());
- private EventuallyConsistentMap<PortChainId, PortChain> portChainStore;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Activate
- public void activate() {
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(MultiValuedTimestamp.class)
- .register(PortChain.class);
-
- portChainStore = storageService
- .<PortChainId, PortChain>eventuallyConsistentMapBuilder()
- .withName("portchainstore").withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- portChainStore.destroy();
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(PortChainId portChainId) {
- checkNotNull(portChainId, PORT_CHAIN_ID_NULL);
- return portChainStore.containsKey(portChainId);
- }
-
- @Override
- public int getPortChainCount() {
- return portChainStore.size();
- }
-
- @Override
- public Iterable<PortChain> getPortChains() {
- return Collections.unmodifiableCollection(portChainStore.values());
- }
-
- @Override
- public PortChain getPortChain(PortChainId portChainId) {
- checkNotNull(portChainId, PORT_CHAIN_ID_NULL);
- return portChainStore.get(portChainId);
- }
-
- @Override
- public boolean createPortChain(PortChain portChain) {
- checkNotNull(portChain, PORT_CHAIN_NULL);
-
- portChainStore.put(portChain.portChainId(), portChain);
- if (!portChainStore.containsKey(portChain.portChainId())) {
- log.debug("The portChain is created failed which identifier was {}", portChain.portChainId()
- .toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortChain(PortChain portChain) {
- checkNotNull(portChain, PORT_CHAIN_NULL);
-
- if (!portChainStore.containsKey(portChain.portChainId())) {
- log.debug("The portChain is not exist whose identifier was {} ",
- portChain.portChainId().toString());
- return false;
- }
-
- portChainStore.put(portChain.portChainId(), portChain);
-
- if (!portChain.equals(portChainStore.get(portChain.portChainId()))) {
- log.debug("The portChain is updated failed whose identifier was {} ",
- portChain.portChainId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortChain(PortChainId portChainId) {
- checkNotNull(portChainId, PORT_CHAIN_NULL);
-
- portChainStore.remove(portChainId);
- if (portChainStore.containsKey(portChainId)) {
- log.debug("The portChain is removed failed whose identifier was {}",
- portChainId.toString());
- return false;
- }
- return true;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java
deleted file mode 100644
index 424d54ab..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/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 the inventory of port chains.
- */
-package org.onosproject.vtnrsc.portchain.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/package-info.java
deleted file mode 100644
index 74642bc3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/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 interacting with the inventory of port chains.
- */
-package org.onosproject.vtnrsc.portchain;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairEvent.java
deleted file mode 100644
index 31ecc737..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairEvent.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.vtnrsc.portpair;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.PortPair;
-
-/**
- * Describes network Port-Pair event.
- */
-public class PortPairEvent extends AbstractEvent<PortPairEvent.Type, PortPair> {
- /**
- * Type of port-pair events.
- */
- public enum Type {
- /**
- * Signifies that port-pair has been created.
- */
- PORT_PAIR_PUT,
- /**
- * Signifies that port-pair has been deleted.
- */
- PORT_PAIR_DELETE,
- /**
- * Signifies that port-pair has been updated.
- */
- PORT_PAIR_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Pair.
- *
- * @param type Port-Pair event type
- * @param portPair Port-Pair subject
- */
- public PortPairEvent(Type type, PortPair portPair) {
- super(type, portPair);
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Pair.
- *
- * @param type Port-Pair event type
- * @param portPair Port-Pair subject
- * @param time occurrence time
- */
- public PortPairEvent(Type type, PortPair portPair, long time) {
- super(type, portPair, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairListener.java
deleted file mode 100644
index 3bdb9e4e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.portpair;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Port-Pair related events.
- */
-public interface PortPairListener extends EventListener<PortPairEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java
deleted file mode 100644
index e98a6a20..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java
+++ /dev/null
@@ -1,94 +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.vtnrsc.portpair;
-
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-
-/**
- * Service for interacting with the inventory of port pairs.
- */
-public interface PortPairService {
-
- /**
- * Returns if the port pair is existed.
- *
- * @param portPairId port pair identifier
- * @return true or false if one with the given identifier exists.
- */
- boolean exists(PortPairId portPairId);
-
- /**
- * Returns the number of port pairs known to the system.
- *
- * @return number of port pairs.
- */
- int getPortPairCount();
-
- /**
- * Returns an iterable collection of the currently known port pairs.
- *
- * @return collection of port pairs.
- */
- Iterable<PortPair> getPortPairs();
-
- /**
- * Returns the portPair with the given identifier.
- *
- * @param portPairId port pair identifier
- * @return PortPair or null if port pair with the given identifier is not
- * known.
- */
- PortPair getPortPair(PortPairId portPairId);
-
- /**
- * Creates a PortPair in the store.
- *
- * @param portPair the port pair to create
- * @return true if given port pair is created successfully.
- */
- boolean createPortPair(PortPair portPair);
-
- /**
- * Updates the portPair in the store.
- *
- * @param portPair the port pair to update
- * @return true if given port pair is updated successfully.
- */
- boolean updatePortPair(PortPair portPair);
-
- /**
- * Deletes portPair by given portPairId.
- *
- * @param portPairId id of port pair to remove
- * @return true if the give port pair is deleted successfully.
- */
- boolean removePortPair(PortPairId portPairId);
-
- /**
- * Adds the specified listener to Port-Pair manager.
- *
- * @param listener Port-Pair listener
- */
- void addListener(PortPairListener listener);
-
- /**
- * Removes the specified listener to Port-Pair manager.
- *
- * @param listener Port-Pair listener
- */
- void removeListener(PortPairListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java
deleted file mode 100644
index ad6fd4bb..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java
+++ /dev/null
@@ -1,164 +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.vtnrsc.portpair.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-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.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.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.portpair.PortPairListener;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the portPairService.
- */
-@Component(immediate = true)
-@Service
-public class PortPairManager implements PortPairService {
-
- private static final String PORT_PAIR_ID_NULL = "PortPair ID cannot be null";
- private static final String PORT_PAIR_NULL = "PortPair cannot be null";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
-
- private final Logger log = getLogger(getClass());
- private final Set<PortPairListener> listeners = Sets.newCopyOnWriteArraySet();
- private EventuallyConsistentMap<PortPairId, PortPair> portPairStore;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Activate
- public void activate() {
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(MultiValuedTimestamp.class)
- .register(PortPair.class);
-
- portPairStore = storageService
- .<PortPairId, PortPair>eventuallyConsistentMapBuilder()
- .withName("portpairstore").withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- portPairStore.destroy();
- listeners.clear();
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(PortPairId portPairId) {
- checkNotNull(portPairId, PORT_PAIR_ID_NULL);
- return portPairStore.containsKey(portPairId);
- }
-
- @Override
- public int getPortPairCount() {
- return portPairStore.size();
- }
-
- @Override
- public Iterable<PortPair> getPortPairs() {
- return Collections.unmodifiableCollection(portPairStore.values());
- }
-
- @Override
- public PortPair getPortPair(PortPairId portPairId) {
- checkNotNull(portPairId, PORT_PAIR_ID_NULL);
- return portPairStore.get(portPairId);
- }
-
- @Override
- public boolean createPortPair(PortPair portPair) {
- checkNotNull(portPair, PORT_PAIR_NULL);
-
- portPairStore.put(portPair.portPairId(), portPair);
- if (!portPairStore.containsKey(portPair.portPairId())) {
- log.debug("The portPair is created failed which identifier was {}", portPair.portPairId()
- .toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortPair(PortPair portPair) {
- checkNotNull(portPair, PORT_PAIR_NULL);
-
- if (!portPairStore.containsKey(portPair.portPairId())) {
- log.debug("The portPair is not exist whose identifier was {} ",
- portPair.portPairId().toString());
- return false;
- }
-
- portPairStore.put(portPair.portPairId(), portPair);
-
- if (!portPair.equals(portPairStore.get(portPair.portPairId()))) {
- log.debug("The portPair is updated failed whose identifier was {} ",
- portPair.portPairId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortPair(PortPairId portPairId) {
- checkNotNull(portPairId, PORT_PAIR_NULL);
-
- portPairStore.remove(portPairId);
- if (portPairStore.containsKey(portPairId)) {
- log.debug("The portPair is removed failed whose identifier was {}",
- portPairId.toString());
- return false;
- }
- return true;
- }
-
- @Override
- public void addListener(PortPairListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(PortPairListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java
deleted file mode 100644
index 625fbdd4..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/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 the inventory of port pairs.
- */
-package org.onosproject.vtnrsc.portpair.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java
deleted file mode 100644
index e2c61531..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/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 interacting with the inventory of port pairs.
- */
-package org.onosproject.vtnrsc.portpair;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupEvent.java
deleted file mode 100644
index 88e1d7fb..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupEvent.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.vtnrsc.portpairgroup;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.PortPairGroup;
-
-/**
- * Describes network Port-Pair-Group event.
- */
-public class PortPairGroupEvent extends AbstractEvent<PortPairGroupEvent.Type, PortPairGroup> {
- /**
- * Type of port-pair-group events.
- */
- public enum Type {
- /**
- * Signifies that port-pair-group has been created.
- */
- PORT_PAIR_GROUP_PUT,
- /**
- * Signifies that port-pair-group has been deleted.
- */
- PORT_PAIR_GROUP_DELETE,
- /**
- * Signifies that port-pair-group has been updated.
- */
- PORT_PAIR_GROUP_UPDATE
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Pair-Group.
- *
- * @param type Port-Pair-Group event type
- * @param portPairGroup Port-Pair-Group subject
- */
- public PortPairGroupEvent(Type type, PortPairGroup portPairGroup) {
- super(type, portPairGroup);
- }
-
- /**
- * Creates an event of a given type and for the specified Port-Pair-Group.
- *
- * @param type Port-Pair-Group event type
- * @param portPairGroup Port-Pair-Group subject
- * @param time occurrence time
- */
- public PortPairGroupEvent(Type type, PortPairGroup portPairGroup, long time) {
- super(type, portPairGroup, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupListener.java
deleted file mode 100644
index 637149e3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.portpairgroup;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Port-Pair-Group related events.
- */
-public interface PortPairGroupListener extends EventListener<PortPairGroupEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupService.java
deleted file mode 100644
index efee0eb9..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/PortPairGroupService.java
+++ /dev/null
@@ -1,94 +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.vtnrsc.portpairgroup;
-
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-
-/**
- * Service for interacting with the inventory of port pair groups.
- */
-public interface PortPairGroupService {
-
- /**
- * Returns if the port pair group is existed.
- *
- * @param portPairGroupId port pair group identifier
- * @return true or false if one with the given identifier exists.
- */
- boolean exists(PortPairGroupId portPairGroupId);
-
- /**
- * Returns the number of port pair groups known to the system.
- *
- * @return number of port pair groups.
- */
- int getPortPairGroupCount();
-
- /**
- * Returns an iterable collection of the currently known port pair groups.
- *
- * @return collection of port pair groups.
- */
- Iterable<PortPairGroup> getPortPairGroups();
-
- /**
- * Returns the portPairGroup with the given identifier.
- *
- * @param portPairGroupId port pair group identifier
- * @return PortPairGroup or null if port pair group with the given identifier is not
- * known.
- */
- PortPairGroup getPortPairGroup(PortPairGroupId portPairGroupId);
-
- /**
- * Creates a PortPairGroup in the store.
- *
- * @param portPairGroup the port pair group to create
- * @return true if given port pair group is created successfully.
- */
- boolean createPortPairGroup(PortPairGroup portPairGroup);
-
- /**
- * Updates the portPairGroup in the store.
- *
- * @param portPairGroup the port pair group to update
- * @return true if given port pair group is updated successfully.
- */
- boolean updatePortPairGroup(PortPairGroup portPairGroup);
-
- /**
- * Deletes portPairGroup by given portPairGroupId.
- *
- * @param portPairGroupId id of port pair group to remove
- * @return true if the give port pair group is deleted successfully.
- */
- boolean removePortPairGroup(PortPairGroupId portPairGroupId);
-
- /**
- * Adds the specified listener to Port-Pair-Group manager.
- *
- * @param listener Port-Pair-Group listener
- */
- void addListener(PortPairGroupListener listener);
-
- /**
- * Removes the specified listener to Port-Pair-Group manager.
- *
- * @param listener Port-Pair-Group listener
- */
- void removeListener(PortPairGroupListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java
deleted file mode 100644
index 5f80ef64..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java
+++ /dev/null
@@ -1,164 +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.vtnrsc.portpairgroup.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collections;
-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.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.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupListener;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the portPairGroupService.
- */
-@Component(immediate = true)
-@Service
-public class PortPairGroupManager implements PortPairGroupService {
-
- private static final String PORT_PAIR_GROUP_ID_NULL = "PortPairGroup ID cannot be null";
- private static final String PORT_PAIR_GROUP_NULL = "PortPairGroup cannot be null";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
-
- private final Logger log = getLogger(getClass());
- private final Set<PortPairGroupListener> listeners = Sets.newCopyOnWriteArraySet();
- private EventuallyConsistentMap<PortPairGroupId, PortPairGroup> portPairGroupStore;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Activate
- public void activate() {
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(MultiValuedTimestamp.class)
- .register(PortPairGroup.class);
-
- portPairGroupStore = storageService
- .<PortPairGroupId, PortPairGroup>eventuallyConsistentMapBuilder()
- .withName("portpairgroupstore").withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- portPairGroupStore.destroy();
- listeners.clear();
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(PortPairGroupId portPairGroupId) {
- checkNotNull(portPairGroupId, PORT_PAIR_GROUP_ID_NULL);
- return portPairGroupStore.containsKey(portPairGroupId);
- }
-
- @Override
- public int getPortPairGroupCount() {
- return portPairGroupStore.size();
- }
-
- @Override
- public Iterable<PortPairGroup> getPortPairGroups() {
- return Collections.unmodifiableCollection(portPairGroupStore.values());
- }
-
- @Override
- public PortPairGroup getPortPairGroup(PortPairGroupId portPairGroupId) {
- checkNotNull(portPairGroupId, PORT_PAIR_GROUP_ID_NULL);
- return portPairGroupStore.get(portPairGroupId);
- }
-
- @Override
- public boolean createPortPairGroup(PortPairGroup portPairGroup) {
- checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);
-
- portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
- if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
- log.debug("The portPairGroup is created failed which identifier was {}", portPairGroup.portPairGroupId()
- .toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean updatePortPairGroup(PortPairGroup portPairGroup) {
- checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);
-
- if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
- log.debug("The portPairGroup is not exist whose identifier was {} ",
- portPairGroup.portPairGroupId().toString());
- return false;
- }
-
- portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
-
- if (!portPairGroup.equals(portPairGroupStore.get(portPairGroup.portPairGroupId()))) {
- log.debug("The portPairGroup is updated failed whose identifier was {} ",
- portPairGroup.portPairGroupId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removePortPairGroup(PortPairGroupId portPairGroupId) {
- checkNotNull(portPairGroupId, PORT_PAIR_GROUP_NULL);
-
- portPairGroupStore.remove(portPairGroupId);
- if (portPairGroupStore.containsKey(portPairGroupId)) {
- log.debug("The portPairGroup is removed failed whose identifier was {}",
- portPairGroupId.toString());
- return false;
- }
- return true;
- }
-
- @Override
- public void addListener(PortPairGroupListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(PortPairGroupListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java
deleted file mode 100644
index 68c186bc..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/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 the inventory of port pair groups.
- */
-package org.onosproject.vtnrsc.portpairgroup.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/package-info.java
deleted file mode 100644
index 8a79fe97..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/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 interacting with the inventory of port pair groups.
- */
-package org.onosproject.vtnrsc.portpairgroup;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterEvent.java
deleted file mode 100644
index 25bd7b31..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterEvent.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.vtnrsc.router;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.Router;
-
-/**
- * Describes network Router event.
- */
-public class RouterEvent extends AbstractEvent<RouterEvent.Type, Router> {
- /**
- * Type of Router events.
- */
- public enum Type {
- /**
- * Signifies that router has been created.
- */
- ROUTER_PUT,
- /**
- * Signifies that router has been deleted.
- */
- ROUTER_DELETE
- }
-
- /**
- * Creates an event of a given type and for the specified Router.
- *
- * @param type Router event type
- * @param router Router subject
- */
- public RouterEvent(Type type, Router router) {
- super(type, router);
- }
-
- /**
- * Creates an event of a given type and for the specified Router.
- *
- * @param type Router event type
- * @param router Router subject
- * @param time occurrence time
- */
- public RouterEvent(Type type, Router router, long time) {
- super(type, router, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterListener.java
deleted file mode 100644
index dc772981..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterListener.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.router;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Router related events.
- */
-public interface RouterListener extends EventListener<RouterEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterService.java
deleted file mode 100644
index 362fa02b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/RouterService.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.vtnrsc.router;
-
-import java.util.Collection;
-
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterId;
-
-/**
- * Service for interacting with the inventory of Routers.
- */
-public interface RouterService {
- /**
- * Returns exists or not of specific router identifier.
- *
- * @param routerId router identifier
- * @return true or false
- */
- boolean exists(RouterId routerId);
-
- /**
- * Returns a collection of the currently known Routers.
- *
- * @return collection of Routers
- */
- Collection<Router> getRouters();
-
- /**
- * Returns the Router with the specified identifier.
- *
- * @param routerId Router identifier
- * @return Router or null if one with the given identifier is not known
- */
- Router getRouter(RouterId routerId);
-
- /**
- * Creates new Routers.
- *
- * @param routers the collection of Routers
- * @return true if the identifier Router has been created right.
- * false if the identifier Router is failed to store
- */
- boolean createRouters(Collection<Router> routers);
-
- /**
- * Updates existing Routers.
- *
- * @param routers the collection of Routers
- * @return true if Routers were updated successfully.
- * false if Routers were updated failed
- */
- boolean updateRouters(Collection<Router> routers);
-
- /**
- * Removes the specified Routers from the store.
- *
- * @param routerIds the collection of Routers identifier
- * @return true if remove identifier Routers successfully. false if remove
- * identifier Routers failed
- */
- boolean removeRouters(Collection<RouterId> routerIds);
-
- /**
- * Adds the specified listener to Router manager.
- *
- * @param listener Router listener
- */
- void addListener(RouterListener listener);
-
- /**
- * Removes the specified listener to Router manager.
- *
- * @param listener Router listener
- */
- void removeListener(RouterListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/RouterManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/RouterManager.java
deleted file mode 100644
index b796fd7b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/RouterManager.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.vtnrsc.router.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collection;
-import java.util.Collections;
-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.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapEvent;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.vtnrsc.DefaultRouter;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterGateway;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.router.RouterEvent;
-import org.onosproject.vtnrsc.router.RouterListener;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the Router service.
- */
-@Component(immediate = true)
-@Service
-public class RouterManager implements RouterService {
-
- private static final String ROUTER_ID_NULL = "Router ID cannot be null";
- private static final String ROUTER_NOT_NULL = "Router cannot be null";
- private static final String ROUTER = "vtn-router-store";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
- private static final String EVENT_NOT_NULL = "event cannot be null";
-
- private final Logger log = getLogger(getClass());
- private final Set<RouterListener> listeners = Sets.newCopyOnWriteArraySet();
- private EventuallyConsistentMapListener<RouterId, Router> routerListener = new InnerRouterStoreListener();
- protected EventuallyConsistentMap<RouterId, Router> routerStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService tenantNetworkService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected SubnetService subnetService;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(VTNRSC_APP);
- KryoNamespace.Builder serializer = KryoNamespace
- .newBuilder()
- .register(KryoNamespaces.API)
- .register(Router.class, RouterId.class, DefaultRouter.class,
- TenantNetworkId.class, TenantId.class,
- VirtualPortId.class, DefaultRouter.class,
- RouterGateway.class, Router.Status.class,
- SubnetId.class);
- routerStore = storageService
- .<RouterId, Router>eventuallyConsistentMapBuilder()
- .withName(ROUTER).withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp())
- .build();
- routerStore.addListener(routerListener);
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- routerStore.removeListener(routerListener);
- routerStore.destroy();
- listeners.clear();
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(RouterId routerId) {
- checkNotNull(routerId, ROUTER_ID_NULL);
- return routerStore.containsKey(routerId);
- }
-
- @Override
- public Collection<Router> getRouters() {
- return Collections.unmodifiableCollection(routerStore.values());
- }
-
- @Override
- public Router getRouter(RouterId routerId) {
- checkNotNull(routerId, ROUTER_ID_NULL);
- return routerStore.get(routerId);
- }
-
- @Override
- public boolean createRouters(Collection<Router> routers) {
- checkNotNull(routers, ROUTER_NOT_NULL);
- for (Router router : routers) {
- verifyRouterData(router);
- routerStore.put(router.id(), router);
- if (!routerStore.containsKey(router.id())) {
- log.debug("The router is created failed whose identifier is {}",
- router.id().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updateRouters(Collection<Router> routers) {
- checkNotNull(routers, ROUTER_NOT_NULL);
- for (Router router : routers) {
- if (!routerStore.containsKey(router.id())) {
- log.debug("The routers is not exist whose identifier is {}",
- router.id().toString());
- throw new IllegalArgumentException(
- "routers ID doesn't exist");
- }
- verifyRouterData(router);
- routerStore.put(router.id(), router);
- if (!router.equals(routerStore.get(router.id()))) {
- log.debug("The router is updated failed whose identifier is {}",
- router.id().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean removeRouters(Collection<RouterId> routerIds) {
- checkNotNull(routerIds, ROUTER_ID_NULL);
- for (RouterId routerId : routerIds) {
- if (!routerStore.containsKey(routerId)) {
- log.debug("The router is not exist whose identifier is {}",
- routerId.toString());
- throw new IllegalArgumentException(
- "router ID doesn't exist");
- }
- Router router = routerStore.get(routerId);
- routerStore.remove(routerId, router);
- if (routerStore.containsKey(routerId)) {
- log.debug("The router deleted is failed whose identifier is {}",
- routerId.toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void addListener(RouterListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(RouterListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-
- /**
- * Verifies validity of Router data.
- *
- * @param routers router instance
- */
- private void verifyRouterData(Router routers) {
- checkNotNull(routers, ROUTER_NOT_NULL);
- if (routers.gatewayPortid() != null
- && !virtualPortService.exists(routers.gatewayPortid())) {
- log.debug("The gateway port ID is not exist whose identifier is {}",
- routers.gatewayPortid().toString());
- throw new IllegalArgumentException("gateway port ID doesn't exist");
- }
-
- if (routers.externalGatewayInfo() != null) {
- RouterGateway routerGateway = routers.externalGatewayInfo();
- if (!tenantNetworkService.exists(routerGateway.networkId())) {
- log.debug("The network ID of gateway info is not exist whose identifier is {}",
- routers.id().toString());
- throw new IllegalArgumentException(
- "network ID of gateway info doesn't exist");
- }
- Iterable<FixedIp> fixedIps = routerGateway.externalFixedIps();
- for (FixedIp fixedIp : fixedIps) {
- if (!subnetService.exists(fixedIp.subnetId())) {
- log.debug("The subnet ID of gateway info is not exist whose identifier is {}",
- routers.id().toString());
- throw new IllegalArgumentException(
- "subnet ID of gateway info doesn't exist");
- }
- }
- }
- }
-
- private class InnerRouterStoreListener
- implements EventuallyConsistentMapListener<RouterId, Router> {
-
- @Override
- public void event(EventuallyConsistentMapEvent<RouterId, Router> event) {
- checkNotNull(event, EVENT_NOT_NULL);
- Router router = event.value();
- if (EventuallyConsistentMapEvent.Type.PUT == event.type()) {
- notifyListeners(new RouterEvent(RouterEvent.Type.ROUTER_PUT,
- router));
- }
- if (EventuallyConsistentMapEvent.Type.REMOVE == event.type()) {
- notifyListeners(new RouterEvent(RouterEvent.Type.ROUTER_DELETE,
- router));
- }
- }
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event Floating IP event
- */
- private void notifyListeners(RouterEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- listeners.forEach(listener -> listener.event(event));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/impl/package-info.java
deleted file mode 100644
index 1254f982..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/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 Router service.
- */
-package org.onosproject.vtnrsc.router.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/package-info.java
deleted file mode 100644
index fb6834aa..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/router/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 interacting with the inventory of Router.
- */
-package org.onosproject.vtnrsc.router;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceEvent.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceEvent.java
deleted file mode 100644
index 7f5cfa13..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceEvent.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.vtnrsc.routerinterface;
-
-import org.onosproject.event.AbstractEvent;
-import org.onosproject.vtnrsc.RouterInterface;
-
-/**
- * Describes network Router Interface event.
- */
-public class RouterInterfaceEvent
- extends AbstractEvent<RouterInterfaceEvent.Type, RouterInterface> {
-
- /**
- * Type of Router Interface events.
- */
- public enum Type {
- /**
- * Signifies that router interface has been added.
- */
- ROUTER_INTERFACE_PUT,
- /**
- * Signifies that router interface has been removed.
- */
- ROUTER_INTERFACE_DELETE
- }
-
- /**
- * Creates an event of a given type and for the specified Router Interface.
- *
- * @param type Router Interface event type
- * @param routerInterface Router Interface subject
- */
- public RouterInterfaceEvent(Type type, RouterInterface routerInterface) {
- super(type, routerInterface);
- }
-
- /**
- * Creates an event of a given type and for the specified Router Interface.
- *
- * @param type Router Interface event type.
- * @param routerInterface Router Interface subject
- * @param time occurrence time
- */
- public RouterInterfaceEvent(Type type, RouterInterface routerInterface,
- long time) {
- super(type, routerInterface, time);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceListener.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceListener.java
deleted file mode 100644
index 1d0dab6f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceListener.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.vtnrsc.routerinterface;
-
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of Router Interface related events.
- */
-public interface RouterInterfaceListener
- extends EventListener<RouterInterfaceEvent> {
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceService.java
deleted file mode 100644
index 8cf147a5..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/RouterInterfaceService.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.vtnrsc.routerinterface;
-
-import java.util.Collection;
-
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-
-/**
- * Service for interacting with the inventory of Router interface.
- */
-public interface RouterInterfaceService {
- /**
- * Returns exists or not of specific subnet identifier.
- *
- * @param subnetId subnet identifier
- * @return true or false
- */
- boolean exists(SubnetId subnetId);
-
- /**
- * Returns a collection of the currently known Router interface.
- *
- * @return collection of RouterInterface
- */
- Collection<RouterInterface> getRouterInterfaces();
-
- /**
- * Returns the Router interface with the specified subnet identifier.
- *
- * @param subnetId subnet identifier
- * @return RouterInterface or null if one with the given identifier is not
- * known
- */
- RouterInterface getRouterInterface(SubnetId subnetId);
-
- /**
- * Adds the specified RouterInterface.
- *
- * @param routerInterface the interface add to router
- * @return true if add router interface successfully
- */
- boolean addRouterInterface(RouterInterface routerInterface);
-
- /**
- * Removes the specified RouterInterface.
- *
- * @param routerInterface the interface remove from router
- * @return true if remove router interface successfully
- */
- boolean removeRouterInterface(RouterInterface routerInterface);
-
- /**
- * Adds the specified listener to Router Interface manager.
- *
- * @param listener Router Interface listener
- */
- void addListener(RouterInterfaceListener listener);
-
- /**
- * Removes the specified listener to RouterInterface manager.
- *
- * @param listener Router Interface listener
- */
- void removeListener(RouterInterfaceListener listener);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/RouterInterfaceManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/RouterInterfaceManager.java
deleted file mode 100644
index 244a5c03..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/RouterInterfaceManager.java
+++ /dev/null
@@ -1,235 +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.vtnrsc.routerinterface.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.Collection;
-import java.util.Collections;
-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.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapEvent;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.store.service.WallClockTimestamp;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceEvent;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceListener;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.slf4j.Logger;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides implementation of the Router interface service.
- */
-@Component(immediate = true)
-@Service
-public class RouterInterfaceManager implements RouterInterfaceService {
- private static final String SUBNET_ID_NULL = "Subnet ID cannot be null";
- private static final String ROUTER_INTERFACE_NULL = "Router Interface cannot be null";
- private static final String ROUTER_INTERFACE = "vtn-router-interface-store";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
- private static final String LISTENER_NOT_NULL = "Listener cannot be null";
- private static final String EVENT_NOT_NULL = "event cannot be null";
-
- private final Logger log = getLogger(getClass());
- private final Set<RouterInterfaceListener> listeners = Sets
- .newCopyOnWriteArraySet();
- private EventuallyConsistentMapListener<SubnetId, RouterInterface> routerInterfaceListener =
- new InnerRouterInterfaceStoreListener();
- protected EventuallyConsistentMap<SubnetId, RouterInterface> routerInterfaceStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected SubnetService subnetService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterService routerService;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication(VTNRSC_APP);
- KryoNamespace.Builder serializer = KryoNamespace
- .newBuilder()
- .register(KryoNamespaces.API)
- .register(RouterId.class, TenantId.class, VirtualPortId.class,
- RouterInterface.class, SubnetId.class);
- routerInterfaceStore = storageService
- .<SubnetId, RouterInterface>eventuallyConsistentMapBuilder()
- .withName(ROUTER_INTERFACE).withSerializer(serializer)
- .withTimestampProvider((k, v) -> new WallClockTimestamp())
- .build();
- routerInterfaceStore.addListener(routerInterfaceListener);
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- routerInterfaceStore.removeListener(routerInterfaceListener);
- routerInterfaceStore.destroy();
- listeners.clear();
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(SubnetId subnetId) {
- checkNotNull(subnetId, SUBNET_ID_NULL);
- return routerInterfaceStore.containsKey(subnetId);
- }
-
- @Override
- public Collection<RouterInterface> getRouterInterfaces() {
- return Collections
- .unmodifiableCollection(routerInterfaceStore.values());
- }
-
- @Override
- public RouterInterface getRouterInterface(SubnetId subnetId) {
- checkNotNull(subnetId, SUBNET_ID_NULL);
- return routerInterfaceStore.get(subnetId);
- }
-
- @Override
- public boolean addRouterInterface(RouterInterface routerInterface) {
- checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
- verifyRouterInterfaceData(routerInterface);
- routerInterfaceStore.put(routerInterface.subnetId(), routerInterface);
- if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) {
- log.debug("The router interface is created failed whose identifier is {}",
- routerInterface.subnetId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public boolean removeRouterInterface(RouterInterface routerInterface) {
- checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
- if (!routerInterfaceStore.containsKey(routerInterface.subnetId())) {
- log.debug("The router interface is not exist whose identifier is {}",
- routerInterface.subnetId().toString());
- throw new IllegalArgumentException("subnet ID doesn't exist");
- }
- verifyRouterInterfaceData(routerInterface);
- routerInterfaceStore
- .remove(routerInterface.subnetId(), routerInterface);
- if (routerInterfaceStore.containsKey(routerInterface.subnetId())) {
- log.debug("The router interface deleted is failed whose identifier is {}",
- routerInterface.subnetId().toString());
- return false;
- }
- return true;
- }
-
- @Override
- public void addListener(RouterInterfaceListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(RouterInterfaceListener listener) {
- checkNotNull(listener, LISTENER_NOT_NULL);
- listeners.remove(listener);
- }
-
- /**
- * Verifies validity of Router interface data.
- *
- * @param routers router instance
- */
- private void verifyRouterInterfaceData(RouterInterface routerInterface) {
- checkNotNull(routerInterface, ROUTER_INTERFACE_NULL);
- if (!subnetService.exists(routerInterface.subnetId())) {
- log.debug("The subnet ID of interface is not exist whose identifier is {}",
- routerInterface.subnetId().toString());
- throw new IllegalArgumentException(
- "subnet ID of interface doesn't exist");
- }
- if (!virtualPortService.exists(routerInterface.portId())) {
- log.debug("The port ID of interface is not exist whose identifier is {}",
- routerInterface.portId().toString());
- throw new IllegalArgumentException(
- "port ID of interface doesn't exist");
- }
- if (!routerService.exists(routerInterface.routerId())) {
- log.debug("The router ID of interface is not exist whose identifier is {}",
- routerInterface.routerId().toString());
- throw new IllegalArgumentException(
- "router ID of interface doesn't exist");
- }
- }
-
- private class InnerRouterInterfaceStoreListener
- implements
- EventuallyConsistentMapListener<SubnetId, RouterInterface> {
-
- @Override
- public void event(EventuallyConsistentMapEvent<SubnetId, RouterInterface> event) {
- checkNotNull(event, EVENT_NOT_NULL);
- RouterInterface routerInterface = event.value();
- if (EventuallyConsistentMapEvent.Type.PUT == event.type()) {
- notifyListeners(new RouterInterfaceEvent(
- RouterInterfaceEvent.Type.ROUTER_INTERFACE_PUT,
- routerInterface));
- }
- if (EventuallyConsistentMapEvent.Type.REMOVE == event.type()) {
- notifyListeners(new RouterInterfaceEvent(
- RouterInterfaceEvent.Type.ROUTER_INTERFACE_DELETE,
- routerInterface));
- }
- }
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event Floating IP event
- */
- private void notifyListeners(RouterInterfaceEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- listeners.forEach(listener -> listener.event(event));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/impl/package-info.java
deleted file mode 100644
index 71db9dc5..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/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 RouterInterface service.
- */
-package org.onosproject.vtnrsc.routerinterface.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/package-info.java
deleted file mode 100644
index 3804089a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/routerinterface/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 interacting with the inventory of RouterInterface.
- */
-package org.onosproject.vtnrsc.routerinterface;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/VtnRscService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/VtnRscService.java
deleted file mode 100644
index bc9f4e68..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/VtnRscService.java
+++ /dev/null
@@ -1,82 +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.vtnrsc.service;
-
-import java.util.Iterator;
-
-import org.onlab.packet.MacAddress;
-import org.onosproject.event.ListenerService;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.HostId;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.event.VtnRscEvent;
-import org.onosproject.vtnrsc.event.VtnRscListener;
-
-/**
- * Service for interacting with the inventory of Vtn resource.
- */
-public interface VtnRscService extends ListenerService<VtnRscEvent, VtnRscListener> {
- /**
- * Returns the SegmentationId of tenant.
- *
- * @param tenantId tenant identifier
- * @return SegmentationId the SegmentationId of tenant
- */
- SegmentationId getL3vni(TenantId tenantId);
-
- /**
- * Returns Classifier Ovs list of the specific tenant.
- *
- * @param tenantId tenant identifier
- * @return iterable collection of Device
- */
- Iterator<Device> getClassifierOfTenant(TenantId tenantId);
-
- /**
- * Returns Service function forwarders Ovs list of the specific tenant.
- *
- * @param tenantId tenant identifier
- * @return iterable collection of Device
- */
- Iterator<Device> getSFFOfTenant(TenantId tenantId);
-
- /**
- * Returns gateway mac address of the specific host.
- *
- * @param hostId host identifier
- * @return MacAddress of host
- */
- MacAddress getGatewayMac(HostId hostId);
-
- /**
- * Checks if a specific port is a service function.
- *
- * @param portId port identifier
- * @return true or false
- */
- boolean isServiceFunction(VirtualPortId portId);
-
- /**
- * Returns device identifier mapping to the specific port.
- *
- * @param portId port identifier
- * @return device identifier
- */
- DeviceId getSFToSFFMaping(VirtualPortId portId);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/VtnRscManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/VtnRscManager.java
deleted file mode 100644
index b21ad200..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/VtnRscManager.java
+++ /dev/null
@@ -1,582 +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.vtnrsc.service.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.util.HashSet;
-import java.util.Iterator;
-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.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.util.KryoNamespace;
-import org.onosproject.core.CoreService;
-import org.onosproject.event.AbstractListenerManager;
-import org.onosproject.net.Device;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Host;
-import org.onosproject.net.HostId;
-import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.host.HostListener;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.device.DeviceService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.LogicalClockService;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.event.VtnRscEvent;
-import org.onosproject.vtnrsc.event.VtnRscEventFeedback;
-import org.onosproject.vtnrsc.event.VtnRscListener;
-import org.onosproject.vtnrsc.floatingip.FloatingIpEvent;
-import org.onosproject.vtnrsc.floatingip.FloatingIpListener;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-import org.onosproject.vtnrsc.router.RouterEvent;
-import org.onosproject.vtnrsc.router.RouterListener;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceEvent;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceListener;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-import org.onosproject.vtnrsc.service.VtnRscService;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.onosproject.vtnrsc.portpair.PortPairEvent;
-import org.onosproject.vtnrsc.portpair.PortPairListener;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupEvent;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupListener;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierEvent;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierListener;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-import org.onosproject.vtnrsc.portchain.PortChainEvent;
-import org.onosproject.vtnrsc.portchain.PortChainListener;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.slf4j.Logger;
-
-/**
- * Provides implementation of the VtnRsc service.
- */
-@Component(immediate = true)
-@Service
-public class VtnRscManager extends AbstractListenerManager<VtnRscEvent, VtnRscListener>
- implements VtnRscService {
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected LogicalClockService clockService;
-
- private final Logger log = getLogger(getClass());
- private HostListener hostListener = new InnerHostListener();
- private FloatingIpListener floatingIpListener = new InnerFloatingIpListener();
- private RouterListener routerListener = new InnerRouterListener();
- private RouterInterfaceListener routerInterfaceListener = new InnerRouterInterfaceListener();
- private PortPairListener portPairListener = new InnerPortPairListener();
- private PortPairGroupListener portPairGroupListener = new InnerPortPairGroupListener();
- private FlowClassifierListener flowClassifierListener = new InnerFlowClassifierListener();
- private PortChainListener portChainListener = new InnerPortChainListener();
-
- private EventuallyConsistentMap<TenantId, SegmentationId> l3vniMap;
- private EventuallyConsistentMap<TenantId, Set<DeviceId>> classifierOvsMap;
- private EventuallyConsistentMap<TenantId, Set<DeviceId>> sffOvsMap;
-
- private static final String IFACEID = "ifaceid";
- private static final String RUNNELOPTOPOIC = "tunnel-ops-ids";
- private static final String LISTENER_NOT_NULL = "listener cannot be null";
- private static final String EVENT_NOT_NULL = "event cannot be null";
- private static final String TENANTID_NOT_NULL = "tenantId cannot be null";
- private static final String DEVICEID_NOT_NULL = "deviceId cannot be null";
- private static final String OVSMAP_NOT_NULL = "ovsMap cannot be null";
- private static final String L3VNIMAP = "l3vniMap";
- private static final String CLASSIFIEROVSMAP = "classifierOvsMap";
- private static final String SFFOVSMAP = "sffOvsMap";
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterService routerService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected FloatingIpService floatingIpService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected RouterInterfaceService routerInterfaceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected VirtualPortService virtualPortService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected HostService hostService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected SubnetService subnetService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService tenantNetworkService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected DeviceService deviceService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortPairService portPairService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortPairGroupService portPairGroupService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected FlowClassifierService flowClassifierService;
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PortChainService portChainService;
-
- @Activate
- public void activate() {
- hostService.addListener(hostListener);
- floatingIpService.addListener(floatingIpListener);
- routerService.addListener(routerListener);
- routerInterfaceService.addListener(routerInterfaceListener);
- portPairService.addListener(portPairListener);
- portPairGroupService.addListener(portPairGroupListener);
- flowClassifierService.addListener(flowClassifierListener);
- portChainService.addListener(portChainListener);
-
- KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
- .register(KryoNamespaces.API)
- .register(TenantId.class, DeviceId.class);
- l3vniMap = storageService
- .<TenantId, SegmentationId>eventuallyConsistentMapBuilder()
- .withName(L3VNIMAP).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- classifierOvsMap = storageService
- .<TenantId, Set<DeviceId>>eventuallyConsistentMapBuilder()
- .withName(CLASSIFIEROVSMAP).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
-
- sffOvsMap = storageService
- .<TenantId, Set<DeviceId>>eventuallyConsistentMapBuilder()
- .withName(SFFOVSMAP).withSerializer(serializer)
- .withTimestampProvider((k, v) -> clockService.getTimestamp())
- .build();
- }
-
- @Deactivate
- public void deactivate() {
- hostService.removeListener(hostListener);
- floatingIpService.removeListener(floatingIpListener);
- routerService.removeListener(routerListener);
- routerInterfaceService.removeListener(routerInterfaceListener);
- portPairService.removeListener(portPairListener);
- portPairGroupService.removeListener(portPairGroupListener);
- flowClassifierService.removeListener(flowClassifierListener);
- portChainService.removeListener(portChainListener);
-
- l3vniMap.destroy();
- classifierOvsMap.destroy();
- sffOvsMap.destroy();
- log.info("Stopped");
- }
-
- @Override
- public SegmentationId getL3vni(TenantId tenantId) {
- checkNotNull(tenantId, "tenantId cannot be null");
- SegmentationId l3vni = l3vniMap.get(tenantId);
- if (l3vni == null) {
- long segmentationId = coreService.getIdGenerator(RUNNELOPTOPOIC)
- .getNewId();
- l3vni = SegmentationId.segmentationId(String
- .valueOf(segmentationId));
- l3vniMap.put(tenantId, l3vni);
- }
- return l3vni;
- }
-
- private class InnerHostListener implements HostListener {
-
- @Override
- public void event(HostEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- Host host = event.subject();
- String ifaceId = host.annotations().value(IFACEID);
- VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
- TenantId tenantId = virtualPortService.getPort(hPortId).tenantId();
- DeviceId deviceId = host.location().deviceId();
- if (HostEvent.Type.HOST_ADDED == event.type()) {
- if (isServiceFunction(hPortId)) {
- addDeviceIdOfOvsMap(tenantId, deviceId, sffOvsMap);
- } else {
- addDeviceIdOfOvsMap(tenantId, deviceId, classifierOvsMap);
- }
- } else if (HostEvent.Type.HOST_REMOVED == event.type()) {
- if (isLastSFHostOfTenant(host, deviceId, tenantId)) {
- removeDeviceIdOfOvsMap(tenantId, deviceId, sffOvsMap);
- }
- if (isLastClassifierHostOfTenant(host, deviceId, tenantId)) {
- removeDeviceIdOfOvsMap(tenantId, deviceId, classifierOvsMap);
- }
- }
- }
- }
-
- private class InnerFloatingIpListener implements FloatingIpListener {
-
- @Override
- public void event(FloatingIpEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- FloatingIp floatingIp = event.subject();
- if (FloatingIpEvent.Type.FLOATINGIP_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.FLOATINGIP_PUT,
- new VtnRscEventFeedback(
- floatingIp)));
- }
- if (FloatingIpEvent.Type.FLOATINGIP_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.FLOATINGIP_DELETE,
- new VtnRscEventFeedback(
- floatingIp)));
- }
- }
- }
-
- private class InnerRouterListener implements RouterListener {
-
- @Override
- public void event(RouterEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- Router router = event.subject();
- if (RouterEvent.Type.ROUTER_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(VtnRscEvent.Type.ROUTER_PUT,
- new VtnRscEventFeedback(router)));
- }
- if (RouterEvent.Type.ROUTER_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(VtnRscEvent.Type.ROUTER_DELETE,
- new VtnRscEventFeedback(router)));
- }
- }
- }
-
- private class InnerRouterInterfaceListener
- implements RouterInterfaceListener {
-
- @Override
- public void event(RouterInterfaceEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- RouterInterface routerInterface = event.subject();
- if (RouterInterfaceEvent.Type.ROUTER_INTERFACE_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.ROUTER_INTERFACE_PUT,
- new VtnRscEventFeedback(
- routerInterface)));
- }
- if (RouterInterfaceEvent.Type.ROUTER_INTERFACE_DELETE == event
- .type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.ROUTER_INTERFACE_DELETE,
- new VtnRscEventFeedback(
- routerInterface)));
- }
- }
- }
-
- private class InnerPortPairListener implements PortPairListener {
-
- @Override
- public void event(PortPairEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- PortPair portPair = event.subject();
- if (PortPairEvent.Type.PORT_PAIR_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(VtnRscEvent.Type.PORT_PAIR_PUT,
- new VtnRscEventFeedback(portPair)));
- } else if (PortPairEvent.Type.PORT_PAIR_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_PAIR_DELETE,
- new VtnRscEventFeedback(portPair)));
- } else if (PortPairEvent.Type.PORT_PAIR_UPDATE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_PAIR_UPDATE,
- new VtnRscEventFeedback(portPair)));
- }
- }
- }
-
- private class InnerPortPairGroupListener implements PortPairGroupListener {
-
- @Override
- public void event(PortPairGroupEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- PortPairGroup portPairGroup = event.subject();
- if (PortPairGroupEvent.Type.PORT_PAIR_GROUP_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_PAIR_GROUP_PUT,
- new VtnRscEventFeedback(portPairGroup)));
- } else if (PortPairGroupEvent.Type.PORT_PAIR_GROUP_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_PAIR_GROUP_DELETE,
- new VtnRscEventFeedback(portPairGroup)));
- } else if (PortPairGroupEvent.Type.PORT_PAIR_GROUP_UPDATE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_PAIR_GROUP_UPDATE,
- new VtnRscEventFeedback(portPairGroup)));
- }
- }
- }
-
- private class InnerFlowClassifierListener implements FlowClassifierListener {
-
- @Override
- public void event(FlowClassifierEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- FlowClassifier flowClassifier = event.subject();
- if (FlowClassifierEvent.Type.FLOW_CLASSIFIER_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.FLOW_CLASSIFIER_PUT,
- new VtnRscEventFeedback(flowClassifier)));
- } else if (FlowClassifierEvent.Type.FLOW_CLASSIFIER_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.FLOW_CLASSIFIER_DELETE,
- new VtnRscEventFeedback(flowClassifier)));
- } else if (FlowClassifierEvent.Type.FLOW_CLASSIFIER_UPDATE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.FLOW_CLASSIFIER_UPDATE,
- new VtnRscEventFeedback(flowClassifier)));
- }
- }
- }
-
- private class InnerPortChainListener implements PortChainListener {
-
- @Override
- public void event(PortChainEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- PortChain portChain = event.subject();
- if (PortChainEvent.Type.PORT_CHAIN_PUT == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_CHAIN_PUT,
- new VtnRscEventFeedback(portChain)));
- } else if (PortChainEvent.Type.PORT_CHAIN_DELETE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_CHAIN_DELETE,
- new VtnRscEventFeedback(portChain)));
- } else if (PortChainEvent.Type.PORT_CHAIN_UPDATE == event.type()) {
- notifyListeners(new VtnRscEvent(
- VtnRscEvent.Type.PORT_CHAIN_UPDATE,
- new VtnRscEventFeedback(portChain)));
- }
- }
- }
-
- @Override
- public Iterator<Device> getClassifierOfTenant(TenantId tenantId) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- Set<DeviceId> deviceIdSet = classifierOvsMap.get(tenantId);
- Set<Device> deviceSet = new HashSet<>();
- if (deviceIdSet != null) {
- for (DeviceId deviceId : deviceIdSet) {
- deviceSet.add(deviceService.getDevice(deviceId));
- }
- }
- return deviceSet.iterator();
- }
-
- @Override
- public Iterator<Device> getSFFOfTenant(TenantId tenantId) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- Set<DeviceId> deviceIdSet = sffOvsMap.get(tenantId);
- Set<Device> deviceSet = new HashSet<>();
- if (deviceIdSet != null) {
- for (DeviceId deviceId : deviceIdSet) {
- deviceSet.add(deviceService.getDevice(deviceId));
- }
- }
- return deviceSet.iterator();
- }
-
- @Override
- public MacAddress getGatewayMac(HostId hostId) {
- checkNotNull(hostId, "hostId cannot be null");
- Host host = hostService.getHost(hostId);
- String ifaceId = host.annotations().value(IFACEID);
- VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
- VirtualPort hPort = virtualPortService.getPort(hPortId);
- SubnetId subnetId = hPort.fixedIps().iterator().next().subnetId();
- Subnet subnet = subnetService.getSubnet(subnetId);
- IpAddress gatewayIp = subnet.gatewayIp();
- Iterable<VirtualPort> virtualPorts = virtualPortService.getPorts();
- MacAddress macAddress = null;
- for (VirtualPort port : virtualPorts) {
- Set<FixedIp> fixedIpSet = port.fixedIps();
- for (FixedIp fixedIp : fixedIpSet) {
- if (fixedIp.ip().equals(gatewayIp)) {
- macAddress = port.macAddress();
- }
- }
- }
- return macAddress;
- }
-
- @Override
- public boolean isServiceFunction(VirtualPortId portId) {
- return portPairService.exists(PortPairId.of(portId.portId()));
- }
-
- @Override
- public DeviceId getSFToSFFMaping(VirtualPortId portId) {
- checkNotNull(portId, "portId cannot be null");
- VirtualPort vmPort = virtualPortService.getPort(portId);
- Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
- for (Host host : hostSet) {
- if (host.annotations().value(IFACEID).equals(vmPort.portId().portId())) {
- return host.location().deviceId();
- }
- }
- return null;
- }
-
- /**
- * Checks whether the last Service Function host of a specific tenant in
- * this device.
- *
- * @param host the host on device
- * @param deviceId the device identifier
- * @param tenantId the tenant identifier
- * @return true or false
- */
- private boolean isLastSFHostOfTenant(Host host, DeviceId deviceId,
- TenantId tenantId) {
- checkNotNull(host, "host cannot be null");
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- Set<Host> hostSet = hostService.getConnectedHosts(deviceId);
- for (Host h : hostSet) {
- String ifaceId = h.annotations().value(IFACEID);
- VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
- if (virtualPortService.getPort(hPortId).tenantId() != tenantId) {
- hostSet.remove(h);
- } else {
- if (!isServiceFunction(hPortId)) {
- hostSet.remove(h);
- }
- }
- }
- if (hostSet.size() == 1 && hostSet.contains(host)) {
- return true;
- }
- return false;
- }
-
- /**
- * Checks whether the last Classifier host of a specific tenant in this
- * device.
- *
- * @param host the host on device
- * @param deviceId the device identifier
- * @param tenantId the tenant identifier
- * @return true or false
- */
- private boolean isLastClassifierHostOfTenant(Host host, DeviceId deviceId,
- TenantId tenantId) {
- checkNotNull(host, "host cannot be null");
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- Set<Host> hostSet = hostService.getConnectedHosts(deviceId);
- for (Host h : hostSet) {
- String ifaceId = h.annotations().value(IFACEID);
- VirtualPortId hPortId = VirtualPortId.portId(ifaceId);
- if (virtualPortService.getPort(hPortId).tenantId() != tenantId) {
- hostSet.remove(h);
- } else {
- if (isServiceFunction(hPortId)) {
- hostSet.remove(h);
- }
- }
- }
- if (hostSet.size() == 1 && hostSet.contains(host)) {
- return true;
- }
- return false;
- }
-
- /**
- * Adds specify Device identifier to OvsMap.
- *
- * @param tenantId the tenant identifier
- * @param deviceId the device identifier
- * @param ovsMap the instance of map to store device identifier
- */
- private void addDeviceIdOfOvsMap(TenantId tenantId,
- DeviceId deviceId,
- EventuallyConsistentMap<TenantId, Set<DeviceId>> ovsMap) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- checkNotNull(ovsMap, OVSMAP_NOT_NULL);
- if (ovsMap.containsKey(tenantId)) {
- Set<DeviceId> deviceIdSet = ovsMap.get(tenantId);
- deviceIdSet.add(deviceId);
- ovsMap.put(tenantId, deviceIdSet);
- } else {
- Set<DeviceId> deviceIdSet = new HashSet<>();
- deviceIdSet.add(deviceId);
- ovsMap.put(tenantId, deviceIdSet);
- }
- }
-
- /**
- * Removes specify Device identifier from OvsMap.
- *
- * @param tenantId the tenant identifier
- * @param deviceId the device identifier
- * @param ovsMap the instance of map to store device identifier
- */
- private void removeDeviceIdOfOvsMap(TenantId tenantId,
- DeviceId deviceId,
- EventuallyConsistentMap<TenantId, Set<DeviceId>> ovsMap) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- checkNotNull(ovsMap, OVSMAP_NOT_NULL);
- Set<DeviceId> deviceIdSet = ovsMap.get(tenantId);
- if (deviceIdSet.size() > 1) {
- deviceIdSet.remove(deviceId);
- ovsMap.put(tenantId, deviceIdSet);
- } else {
- ovsMap.remove(tenantId);
- }
- }
-
- /**
- * Notifies specify event to all listeners.
- *
- * @param event VtnRsc event
- */
- private void notifyListeners(VtnRscEvent event) {
- checkNotNull(event, EVENT_NOT_NULL);
- post(event);
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/impl/package-info.java
deleted file mode 100644
index aaea08b3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/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 VtnRsc service.
- */
-package org.onosproject.vtnrsc.service.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/package-info.java
deleted file mode 100644
index 37af604a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/service/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 interacting with the inventory of Vtn resource.
- */
-package org.onosproject.vtnrsc.service;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/SubnetService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/SubnetService.java
deleted file mode 100644
index 82eb9611..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/SubnetService.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.vtnrsc.subnet;
-
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.SubnetId;
-
-
-/**
- * Service for interacting with the inventory of subnets.
- */
-public interface SubnetService {
- /**
- * Returns the subnet with the specified identifier.
- *
- * @param subnetId subnet identifier
- * @return true or false
- */
- boolean exists(SubnetId subnetId);
- /**
- * Returns a collection of the currently known subnets.
- *
- * @return iterable collection of subnets
- */
- Iterable<Subnet> getSubnets();
-
- /**
- * Returns the subnet with the specified identifier.
- *
- * @param subnetId subnet identifier
- * @return subnet or null if one with the given identifier is not known
- */
- Subnet getSubnet(SubnetId subnetId);
- /**
- * Creates new subnets.
- *
- * @param subnets the iterable collection of subnets
- * @return true if the identifier subnet has been created right
- */
- boolean createSubnets(Iterable<Subnet> subnets);
-
- /**
- * Updates existing subnets.
- *
- * @param subnets the iterable collection of subnets
- * @return true if all subnets were updated successfully
- */
- boolean updateSubnets(Iterable<Subnet> subnets);
-
- /**
- * Administratively removes the specified subnets from the store.
- *
- * @param subnetIds the iterable collection of subnets identifier
- * @return true if remove identifier subnets successfully
- */
- boolean removeSubnets(Iterable<SubnetId> subnetIds);
-
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/SubnetManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/SubnetManager.java
deleted file mode 100644
index 94430389..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/SubnetManager.java
+++ /dev/null
@@ -1,179 +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.vtnrsc.subnet.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.IpAddress;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtnrsc.AllocationPool;
-import org.onosproject.vtnrsc.DefaultAllocationPool;
-import org.onosproject.vtnrsc.DefaultHostRoute;
-import org.onosproject.vtnrsc.DefaultSubnet;
-import org.onosproject.vtnrsc.HostRoute;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.slf4j.Logger;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Provides implementation of the Subnet service.
- */
-@Component(immediate = true)
-@Service
-public class SubnetManager implements SubnetService {
-
- private static final String SUBNET_ID_NULL = "Subnet ID cannot be null";
- private static final String SUBNET_NOT_NULL = "Subnet cannot be null";
- private static final String SUBNET = "vtn-subnet-store";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
-
-
- private final Logger log = getLogger(getClass());
-
- protected Map<SubnetId, Subnet> subnetStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService tenantNetworkService;
-
- @Activate
- public void activate() {
-
- appId = coreService.registerApplication(VTNRSC_APP);
-
- subnetStore = storageService.<SubnetId, Subnet>consistentMapBuilder()
- .withName(SUBNET)
- .withApplicationId(appId)
- .withPurgeOnUninstall()
- .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
- Subnet.class,
- SubnetId.class,
- TenantNetworkId.class,
- TenantId.class,
- HostRoute.class,
- DefaultHostRoute.class,
- Subnet.Mode.class,
- AllocationPool.class,
- DefaultAllocationPool.class,
- DefaultSubnet.class,
- IpAddress.Version.class))
- .build().asJavaMap();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- log.info("Stopped");
- }
-
- @Override
- public Iterable<Subnet> getSubnets() {
- return Collections.unmodifiableCollection(subnetStore.values());
- }
-
- @Override
- public Subnet getSubnet(SubnetId subnetId) {
- checkNotNull(subnetId, SUBNET_ID_NULL);
- return subnetStore.get(subnetId);
- }
-
- @Override
- public boolean exists(SubnetId subnetId) {
- checkNotNull(subnetId, SUBNET_ID_NULL);
- return subnetStore.containsKey(subnetId);
- }
-
- @Override
- public boolean createSubnets(Iterable<Subnet> subnets) {
- checkNotNull(subnets, SUBNET_NOT_NULL);
- for (Subnet subnet : subnets) {
- if (!tenantNetworkService.exists(subnet.networkId())) {
- log.debug("The network identifier that the subnet {} belong to is not exist",
- subnet.networkId().toString(), subnet.id().toString());
- return false;
- }
- subnetStore.put(subnet.id(), subnet);
- if (!subnetStore.containsKey(subnet.id())) {
- log.debug("The identified subnet whose identifier is {} create failed",
- subnet.id().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updateSubnets(Iterable<Subnet> subnets) {
- checkNotNull(subnets, SUBNET_NOT_NULL);
- for (Subnet subnet : subnets) {
- if (!subnetStore.containsKey(subnet.id())) {
- log.debug("The subnet is not exist whose identifier is {}",
- subnet.id().toString());
- return false;
- }
-
- subnetStore.put(subnet.id(), subnet);
-
- if (!subnet.equals(subnetStore.get(subnet.id()))) {
- log.debug("The subnet is updated failed whose identifier is {}",
- subnet.id().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean removeSubnets(Iterable<SubnetId> subnetIds) {
- checkNotNull(subnetIds, SUBNET_ID_NULL);
- for (SubnetId subnetId : subnetIds) {
- subnetStore.remove(subnetId);
- if (subnetStore.containsKey(subnetId)) {
- log.debug("The subnet created is failed whose identifier is {}",
- subnetId.toString());
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/impl/package-info.java
deleted file mode 100644
index 79040d8d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/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 Subnet service.
- */
-package org.onosproject.vtnrsc.subnet.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/package-info.java
deleted file mode 100644
index 7b2bdb90..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/subnet/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 interacting with the inventory of subnets.
- */
-package org.onosproject.vtnrsc.subnet;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkService.java
deleted file mode 100644
index e246cc4e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkService.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.vtnrsc.tenantnetwork;
-
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-
-/**
- * Service for interacting with the inventory of tenantNetwork.
- */
-public interface TenantNetworkService {
-
- /**
- * Returns if the tenantNetwork is existed.
- *
- * @param networkId tenantNetwork identifier
- * @return true or false if one with the given identifier exists.
- */
- boolean exists(TenantNetworkId networkId);
-
- /**
- * Returns the number of tenantNetwork known to the system.
- *
- * @return number of tenantNetwork.
- */
- int getNetworkCount();
-
- /**
- * Returns an iterable collection of the currently known tenantNetwork.
- *
- * @return collection of tenantNetwork.
- */
- Iterable<TenantNetwork> getNetworks();
-
- /**
- * Returns the tenantNetwork with the identifier.
- *
- * @param networkId TenantNetwork identifier
- * @return TenantNetwork or null if one with the given identifier is not
- * known.
- */
- TenantNetwork getNetwork(TenantNetworkId networkId);
-
- /**
- * Creates tenantNetworks by networks.
- *
- * @param networks the collection of tenantNetworks
- * @return true if all given identifiers created successfully.
- */
- boolean createNetworks(Iterable<TenantNetwork> networks);
-
- /**
- * Updates tenantNetworks by tenantNetworks.
- *
- * @param networks the collection of tenantNetworks
- * @return true if all given identifiers updated successfully.
- */
- boolean updateNetworks(Iterable<TenantNetwork> networks);
-
- /**
- * Deletes tenantNetwork by tenantNetworkIds.
- *
- * @param networksIds the collection of tenantNetworkIds
- * @return true if the specified tenantNetworks deleted successfully.
- */
- boolean removeNetworks(Iterable<TenantNetworkId> networksIds);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/TenantNetworkManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/TenantNetworkManager.java
deleted file mode 100644
index 0dfc99e2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/TenantNetworkManager.java
+++ /dev/null
@@ -1,167 +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.vtnrsc.tenantnetwork.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.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtnrsc.DefaultTenantNetwork;
-import org.onosproject.vtnrsc.PhysicalNetwork;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.slf4j.Logger;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Map;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Provides implementation of the tenantNetworkService.
- */
-@Component(immediate = true)
-@Service
-public class TenantNetworkManager implements TenantNetworkService {
-
- private static final String NETWORK_ID_NULL = "Network ID cannot be null";
- private static final String NETWORK_NOT_NULL = "Network ID cannot be null";
- private static final String TENANTNETWORK = "vtn-tenant-network-store";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
-
- protected Map<TenantNetworkId, TenantNetwork> networkIdAsKeyStore;
- protected ApplicationId appId;
-
- private final Logger log = getLogger(getClass());
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
-
- @Activate
- public void activate() {
-
- appId = coreService.registerApplication(VTNRSC_APP);
-
- networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder()
- .withName(TENANTNETWORK)
- .withApplicationId(appId)
- .withPurgeOnUninstall()
- .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
- TenantNetworkId.class,
- DefaultTenantNetwork.class,
- TenantNetwork.State.class,
- TenantId.class,
- TenantNetwork.Type.class,
- PhysicalNetwork.class,
- SegmentationId.class))
- .build().asJavaMap();
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- log.info("Stopped");
- }
-
- @Override
- public boolean exists(TenantNetworkId networkId) {
- checkNotNull(networkId, NETWORK_ID_NULL);
- return networkIdAsKeyStore.containsKey(networkId);
- }
-
- @Override
- public int getNetworkCount() {
- return networkIdAsKeyStore.size();
- }
-
- @Override
- public Iterable<TenantNetwork> getNetworks() {
- return Collections.unmodifiableCollection(networkIdAsKeyStore.values());
- }
-
- @Override
- public TenantNetwork getNetwork(TenantNetworkId networkId) {
- checkNotNull(networkId, NETWORK_ID_NULL);
- return networkIdAsKeyStore.get(networkId);
- }
-
- @Override
- public boolean createNetworks(Iterable<TenantNetwork> networks) {
- checkNotNull(networks, NETWORK_NOT_NULL);
- for (TenantNetwork network : networks) {
- networkIdAsKeyStore.put(network.id(), network);
- if (!networkIdAsKeyStore.containsKey(network.id())) {
- log.debug("The tenantNetwork is created failed which identifier was {}", network.id()
- .toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updateNetworks(Iterable<TenantNetwork> networks) {
- checkNotNull(networks, NETWORK_NOT_NULL);
- for (TenantNetwork network : networks) {
- if (!networkIdAsKeyStore.containsKey(network.id())) {
- log.debug("The tenantNetwork is not exist whose identifier was {} ",
- network.id().toString());
- return false;
- }
-
- networkIdAsKeyStore.put(network.id(), network);
-
- if (!network.equals(networkIdAsKeyStore.get(network.id()))) {
- log.debug("The tenantNetwork is updated failed whose identifier was {} ",
- network.id().toString());
- return false;
- }
-
- }
- return true;
- }
-
- @Override
- public boolean removeNetworks(Iterable<TenantNetworkId> networkIds) {
- checkNotNull(networkIds, NETWORK_NOT_NULL);
- for (TenantNetworkId networkId : networkIds) {
- networkIdAsKeyStore.remove(networkId);
- if (networkIdAsKeyStore.containsKey(networkId)) {
- log.debug("The tenantNetwork is removed failed whose identifier was {}",
- networkId.toString());
- return false;
- }
- }
- return true;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/impl/package-info.java
deleted file mode 100644
index f381fda6..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/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 the inventory of tenant networks.
- */
-package org.onosproject.vtnrsc.tenantnetwork.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/package-info.java
deleted file mode 100644
index 1489c973..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/tenantnetwork/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 interacting with the inventory of tenant networks.
- */
-package org.onosproject.vtnrsc.tenantnetwork;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/VirtualPortService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/VirtualPortService.java
deleted file mode 100644
index 19548db8..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/VirtualPortService.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.vtnrsc.virtualport;
-
-import java.util.Collection;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.DeviceId;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-/**
- * Service for interacting with the inventory of virtualPort.
- */
-public interface VirtualPortService {
- /**
- * Returns if the virtualPort is existed.
- *
- * @param virtualPortId virtualPort identifier
- * @return true or false if one with the given identifier is not existed.
- */
- boolean exists(VirtualPortId virtualPortId);
-
- /**
- * Returns the virtualPort with the identifier.
- *
- * @param virtualPortId virtualPort ID
- * @return VirtualPort or null if one with the given ID is not know.
- */
- VirtualPort getPort(VirtualPortId virtualPortId);
-
- /**
- * Returns the virtualPort associated with the fixedIP.
- *
- * @param fixedIP the fixedIP identifier
- * @return virtualPort.
- */
- VirtualPort getPort(FixedIp fixedIP);
-
- /**
- * Returns the virtualPort associated with the networkId and ip.
- *
- * @param networkId the TenantNetworkId identifier
- * @param ip the ip identifier
- * @return virtualPort.
- */
- VirtualPort getPort(TenantNetworkId networkId, IpAddress ip);
-
- /**
- * Returns the collection of the currently known virtualPort.
- * @return collection of VirtualPort.
- */
- Collection<VirtualPort> getPorts();
-
- /**
- * Returns the collection of the virtualPorts associated with the networkId.
- *
- * @param networkId the network identifer
- * @return collection of virtualPort.
- */
- Collection<VirtualPort> getPorts(TenantNetworkId networkId);
-
- /**
- * Returns the collection of the virtualPorts associated with the tenantId.
- *
- * @param tenantId the tenant identifier
- * @return collection of virtualPorts.
- */
- Collection<VirtualPort> getPorts(TenantId tenantId);
-
- /**
- * Returns the collection of the virtualPorts associated with the deviceId.
- *
- * @param deviceId the device identifier
- * @return collection of virtualPort.
- */
- Collection<VirtualPort> getPorts(DeviceId deviceId);
-
- /**
- * Creates virtualPorts by virtualPorts.
- *
- * @param virtualPorts the iterable collection of virtualPorts
- * @return true if all given identifiers created successfully.
- */
- boolean createPorts(Iterable<VirtualPort> virtualPorts);
-
- /**
- * Updates virtualPorts by virtualPorts.
- *
- * @param virtualPorts the iterable collection of virtualPorts
- * @return true if all given identifiers updated successfully.
- */
- boolean updatePorts(Iterable<VirtualPort> virtualPorts);
-
- /**
- * Deletes virtualPortIds by virtualPortIds.
- *
- * @param virtualPortIds the iterable collection of virtualPort identifiers
- * @return true or false if one with the given identifier to delete is
- * successfully.
- */
- boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java
deleted file mode 100644
index 9639e086..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/VirtualPortManager.java
+++ /dev/null
@@ -1,249 +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.vtnrsc.virtualport.impl;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-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.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.net.DeviceId;
-import org.onosproject.store.serializers.KryoNamespaces;
-import org.onosproject.store.service.Serializer;
-import org.onosproject.store.service.StorageService;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Provides implementation of the VirtualPort APIs.
- */
-@Component(immediate = true)
-@Service
-public class VirtualPortManager implements VirtualPortService {
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- private static final String VIRTUALPORT = "vtn-virtual-port";
- private static final String VTNRSC_APP = "org.onosproject.vtnrsc";
-
- private static final String VIRTUALPORT_ID_NULL = "VirtualPort ID cannot be null";
- private static final String VIRTUALPORT_NOT_NULL = "VirtualPort cannot be null";
- private static final String TENANTID_NOT_NULL = "TenantId cannot be null";
- private static final String NETWORKID_NOT_NULL = "NetworkId cannot be null";
- private static final String DEVICEID_NOT_NULL = "DeviceId cannot be null";
- private static final String FIXEDIP_NOT_NULL = "FixedIp cannot be null";
- private static final String IP_NOT_NULL = "Ip cannot be null";
-
- protected Map<VirtualPortId, VirtualPort> vPortStore;
- protected ApplicationId appId;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected StorageService storageService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected TenantNetworkService networkService;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- @Activate
- public void activate() {
-
- appId = coreService.registerApplication(VTNRSC_APP);
-
- vPortStore = storageService.<VirtualPortId, VirtualPort>consistentMapBuilder()
- .withName(VIRTUALPORT)
- .withApplicationId(appId)
- .withPurgeOnUninstall()
- .withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
- VirtualPortId.class,
- TenantNetworkId.class,
- VirtualPort.State.class,
- TenantId.class,
- AllowedAddressPair.class,
- FixedIp.class,
- BindingHostId.class,
- SecurityGroup.class,
- SubnetId.class,
- IpAddress.class,
- DefaultVirtualPort.class))
- .build().asJavaMap();
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- vPortStore.clear();
- log.info("Stoppped");
- }
-
- @Override
- public boolean exists(VirtualPortId vPortId) {
- checkNotNull(vPortId, VIRTUALPORT_ID_NULL);
- return vPortStore.containsKey(vPortId);
- }
-
- @Override
- public VirtualPort getPort(VirtualPortId vPortId) {
- checkNotNull(vPortId, VIRTUALPORT_ID_NULL);
- return vPortStore.get(vPortId);
- }
-
- @Override
- public VirtualPort getPort(FixedIp fixedIP) {
- checkNotNull(fixedIP, FIXEDIP_NOT_NULL);
- List<VirtualPort> vPorts = new ArrayList<>();
- vPortStore.values().stream().forEach(p -> {
- Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
- while (fixedIps.hasNext()) {
- if (fixedIps.next().equals(fixedIP)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
-
- @Override
- public VirtualPort getPort(TenantNetworkId networkId, IpAddress ip) {
- checkNotNull(networkId, NETWORKID_NOT_NULL);
- checkNotNull(ip, IP_NOT_NULL);
- List<VirtualPort> vPorts = new ArrayList<>();
- vPortStore.values().stream().filter(p -> p.networkId().equals(networkId))
- .forEach(p -> {
- Iterator<FixedIp> fixedIps = p.fixedIps().iterator();
- while (fixedIps.hasNext()) {
- if (fixedIps.next().ip().equals(ip)) {
- vPorts.add(p);
- break;
- }
- }
- });
- if (vPorts.size() == 0) {
- return null;
- }
- return vPorts.get(0);
- }
-
- @Override
- public Collection<VirtualPort> getPorts() {
- return Collections.unmodifiableCollection(vPortStore.values());
- }
-
- @Override
- public Collection<VirtualPort> getPorts(TenantNetworkId networkId) {
- checkNotNull(networkId, NETWORKID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.networkId().equals(networkId))
- .collect(Collectors.toList());
- }
-
- @Override
- public Collection<VirtualPort> getPorts(TenantId tenantId) {
- checkNotNull(tenantId, TENANTID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.tenantId().equals(tenantId))
- .collect(Collectors.toList());
- }
-
- @Override
- public Collection<VirtualPort> getPorts(DeviceId deviceId) {
- checkNotNull(deviceId, DEVICEID_NOT_NULL);
- return vPortStore.values().stream().filter(d -> d.deviceId().equals(deviceId))
- .collect(Collectors.toList());
- }
-
- @Override
- public boolean createPorts(Iterable<VirtualPort> vPorts) {
- checkNotNull(vPorts, VIRTUALPORT_NOT_NULL);
- for (VirtualPort vPort : vPorts) {
- log.debug("vPortId is {} ", vPort.portId().toString());
- vPortStore.put(vPort.portId(), vPort);
- if (!vPortStore.containsKey(vPort.portId())) {
- log.debug("The virtualPort is created failed whose identifier is {} ",
- vPort.portId().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean updatePorts(Iterable<VirtualPort> vPorts) {
- checkNotNull(vPorts, VIRTUALPORT_NOT_NULL);
- for (VirtualPort vPort : vPorts) {
- vPortStore.put(vPort.portId(), vPort);
- if (!vPortStore.containsKey(vPort.portId())) {
- log.debug("The virtualPort is not exist whose identifier is {}",
- vPort.portId().toString());
- return false;
- }
-
- vPortStore.put(vPort.portId(), vPort);
-
- if (!vPort.equals(vPortStore.get(vPort.portId()))) {
- log.debug("The virtualPort is updated failed whose identifier is {}",
- vPort.portId().toString());
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean removePorts(Iterable<VirtualPortId> vPortIds) {
- checkNotNull(vPortIds, VIRTUALPORT_ID_NULL);
- for (VirtualPortId vPortId : vPortIds) {
- vPortStore.remove(vPortId);
- if (vPortStore.containsKey(vPortId)) {
- log.debug("The virtualPort is removed failed whose identifier is {}",
- vPortId.toString());
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/impl/package-info.java
deleted file mode 100644
index 24eb0d3f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/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 the inventory of virtual ports.
- */
-package org.onosproject.vtnrsc.virtualport.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/package-info.java
deleted file mode 100644
index 06a01a04..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/virtualport/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 interacting with the inventory of virtual ports.
- */
-package org.onosproject.vtnrsc.virtualport;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/framework/src/onos/apps/vtn/vtnrsc/src/main/resources/OSGI-INF/blueprint/shell-config.xml
deleted file mode 100644
index f7a1bf44..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ /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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.onosproject.vtnrsc.cli.network.TenantNetworkCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.network.TenantNetworkQueryCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.network.TenantNetworkRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.network.TenantNetworkUpdateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.subnet.SubnetCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.subnet.SubnetQueryCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.subnet.SubnetRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.subnet.SubnetUpdateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.virtualport.VirtualPortCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.virtualport.VirtualPortQueryCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.virtualport.VirtualPortRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.virtualport.VirtualPortUpdateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.floatingip.FloatingIpCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.floatingip.FloatingIpQueryCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.floatingip.FloatingIpRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.floatingip.FloatingIpUpdateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.router.RouterCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.router.RouterQueryCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.router.RouterRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.router.RouterUpdateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.routerinterface.RouterInterfaceCreateCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.routerinterface.RouterInterfaceRemoveCommand"/>
- </command>
- <command>
- <action class="org.onosproject.vtnrsc.cli.routerinterface.RouterInterfaceQueryCommand"/>
- </command>
- </command-bundle>
-</blueprint>
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java
deleted file mode 100644
index 05152359..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.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.vtnrsc;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for AllowedAddressPair class.
- */
-public class AllowedAddressPairTest {
-
- final IpAddress ip1 = IpAddress.valueOf("192.168.0.1");
- final IpAddress ip2 = IpAddress.valueOf("192.168.0.2");
- final MacAddress mac1 = MacAddress.valueOf("fa:16:3e:76:83:88");
- final MacAddress mac2 = MacAddress.valueOf("aa:16:3e:76:83:88");
-
- /**
- * Checks that the AllowedAddressPair class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(AllowedAddressPair.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- AllowedAddressPair p1 = AllowedAddressPair
- .allowedAddressPair(ip1, mac1);
- AllowedAddressPair p2 = AllowedAddressPair
- .allowedAddressPair(ip1, mac1);
- AllowedAddressPair p3 = AllowedAddressPair
- .allowedAddressPair(ip2, mac2);
- new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a AllowedAddressPair object.
- */
- @Test
- public void testConstruction() {
- AllowedAddressPair allowedAddressPair = AllowedAddressPair
- .allowedAddressPair(ip1, mac1);
- assertThat(ip1, is(notNullValue()));
- assertThat(ip1, is(allowedAddressPair.ip()));
- assertThat(mac1, is(notNullValue()));
- assertThat(mac1, is(allowedAddressPair.mac()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java
deleted file mode 100644
index 9e7d3c1c..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.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.vtnrsc;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultAllocationPool class.
- */
-public class DefaultAllocationPoolTest {
-
- final IpAddress startIP1 = IpAddress.valueOf("192.168.1.1");
- final IpAddress startIP2 = IpAddress.valueOf("192.168.1.2");
- final IpAddress endIP1 = IpAddress.valueOf("192.168.1.1");
- final IpAddress endIP2 = IpAddress.valueOf("192.168.1.2");
-
- /**
- * Checks that the DefaultAllocationPool class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultAllocationPool.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- AllocationPool pool1 = new DefaultAllocationPool(startIP1, endIP1);
- AllocationPool pool2 = new DefaultAllocationPool(startIP1, endIP1);
- AllocationPool pool3 = new DefaultAllocationPool(startIP2, endIP2);
- new EqualsTester().addEqualityGroup(pool1, pool2)
- .addEqualityGroup(pool3).testEquals();
- }
-
- /**
- * Checks the construction of a DefaultAllocationPool object.
- */
- @Test
- public void testConstruction() {
- final AllocationPool apool = new DefaultAllocationPool(startIP1, endIP1);
- assertThat(startIP1, is(apool.startIp()));
- assertThat(endIP1, is(apool.endIp()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java
deleted file mode 100644
index 7032c216..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.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.vtnrsc;
-
-import org.junit.Test;
-import org.onlab.packet.IpPrefix;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultFlowClassifier class.
- */
-public class DefaultFlowClassifierTest {
- /**
- * Checks that the DefaultFlowClassifier class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultFlowClassifier.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- // Create same two flow classifier objects.
- final String name = "FlowClassifier1";
- final String description = "FlowClassifier1";
- final String ethType = "IPv4";
- final String protocol = "tcp";
- final int minSrcPortRange = 5;
- final int maxSrcPortRange = 10;
- final int minDstPortRange = 5;
- final int maxDstPortRange = 10;
- final FlowClassifierId flowClassifierId = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix = IpPrefix.valueOf("10.10.10.10/0");
- final VirtualPortId virtualSrcPort = VirtualPortId.portId("1");
- final VirtualPortId virtualDstPort = VirtualPortId.portId("2");
-
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- final FlowClassifier flowClassifier1 = flowClassifierBuilder.setFlowClassifierId(flowClassifierId)
- .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType)
- .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
-
- flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- final FlowClassifier sameAsFlowClassifier1 = flowClassifierBuilder.setFlowClassifierId(flowClassifierId)
- .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType)
- .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
-
- // Create different classifier object.
- final String name2 = "FlowClassifier2";
- final String description2 = "FlowClassifier2";
- final String ethType2 = "IPv6";
- final String protocol2 = "udp";
- final int minSrcPortRange2 = 5;
- final int maxSrcPortRange2 = 10;
- final int minDstPortRange2 = 5;
- final int maxDstPortRange2 = 10;
- final FlowClassifierId flowClassifierId2 = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId2 = TenantId.tenantId("2");
- final IpPrefix srcIpPrefix2 = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix2 = IpPrefix.valueOf("10.10.10.10/0");
- final VirtualPortId virtualSrcPort2 = VirtualPortId.portId("3");
- final VirtualPortId virtualDstPort2 = VirtualPortId.portId("4");
-
- DefaultFlowClassifier.Builder flowClassifierBuilder3 = new DefaultFlowClassifier.Builder();
- final FlowClassifier flowClassifier2 = flowClassifierBuilder3.setFlowClassifierId(flowClassifierId2)
- .setTenantId(tenantId2).setName(name2).setDescription(description2).setEtherType(ethType2)
- .setProtocol(protocol2).setMinSrcPortRange(minSrcPortRange2).setMaxSrcPortRange(maxSrcPortRange2)
- .setMinDstPortRange(minDstPortRange2).setMaxDstPortRange(maxDstPortRange2).setSrcIpPrefix(srcIpPrefix2)
- .setDstIpPrefix(dstIpPrefix2).setSrcPort(virtualSrcPort2).setDstPort(virtualDstPort2).build();
-
- new EqualsTester().addEqualityGroup(flowClassifier1, sameAsFlowClassifier1).addEqualityGroup(flowClassifier2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a DefaultFlowClassifier object.
- */
- @Test
- public void testConstruction() {
- final String name = "FlowClassifier";
- final String description = "FlowClassifier";
- final String ethType = "IPv4";
- final String protocol = "tcp";
- final int minSrcPortRange = 5;
- final int maxSrcPortRange = 10;
- final int minDstPortRange = 5;
- final int maxDstPortRange = 10;
- final FlowClassifierId flowClassifierId = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix = IpPrefix.valueOf("10.10.10.10/0");
- final VirtualPortId virtualSrcPort = VirtualPortId.portId("1");
- final VirtualPortId virtualDstPort = VirtualPortId.portId("2");
-
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- final FlowClassifier flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId)
- .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType)
- .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
-
- assertThat(flowClassifierId, is(flowClassifier.flowClassifierId()));
- assertThat(tenantId, is(flowClassifier.tenantId()));
- assertThat(name, is(flowClassifier.name()));
- assertThat(description, is(flowClassifier.description()));
- assertThat(ethType, is(flowClassifier.etherType()));
- assertThat(protocol, is(flowClassifier.protocol()));
- assertThat(minSrcPortRange, is(flowClassifier.minSrcPortRange()));
- assertThat(maxSrcPortRange, is(flowClassifier.maxSrcPortRange()));
- assertThat(minDstPortRange, is(flowClassifier.minDstPortRange()));
- assertThat(maxDstPortRange, is(flowClassifier.maxDstPortRange()));
- assertThat(srcIpPrefix, is(flowClassifier.srcIpPrefix()));
- assertThat(dstIpPrefix, is(flowClassifier.dstIpPrefix()));
- assertThat(virtualSrcPort, is(flowClassifier.srcPort()));
- assertThat(virtualDstPort, is(flowClassifier.dstPort()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java
deleted file mode 100644
index 53ead67f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.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.vtnrsc;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultHostRoute class.
- */
-public class DefaultHostRouteTest {
- final IpAddress nexthop1 = IpAddress.valueOf("192.168.1.1");
- final IpAddress nexthop2 = IpAddress.valueOf("192.168.1.2");
- final IpPrefix destination1 = IpPrefix.valueOf("1.1.1.1/1");
- final IpPrefix destination2 = IpPrefix.valueOf("1.1.1.1/2");
-
- /**
- * Checks that the DefaultHostRoute class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultHostRoute.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- HostRoute route1 = new DefaultHostRoute(nexthop1, destination1);
- HostRoute route2 = new DefaultHostRoute(nexthop1, destination1);
- HostRoute route3 = new DefaultHostRoute(nexthop2, destination2);
- new EqualsTester().addEqualityGroup(route1, route2)
- .addEqualityGroup(route3).testEquals();
- }
-
- /**
- * Checks the construction of a DefaultHostRoute object.
- */
- @Test
- public void testConstruction() {
- final HostRoute host = new DefaultHostRoute(nexthop1, destination1);
- assertThat(nexthop1, is(host.nexthop()));
- assertThat(destination1, is(host.destination()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java
deleted file mode 100644
index 7f186a1d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultNeutronNetwork class.
- */
-public class DefaultNeutronNetworkTest {
-
- private String networkIdStr1 = "123";
- private String networkIdStr2 = "234";
- private String physicalNetworkStr = "1234";
- private String tenantIdStr = "345";
- private String segmentationIdStr = "1";
- private String name = "456";
-
- /**
- * Checks that the DefaultNeutronNetwork class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultTenantNetwork.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquality() {
- TenantNetworkId networkid1 = TenantNetworkId.networkId(networkIdStr1);
- TenantNetworkId networkid2 = TenantNetworkId.networkId(networkIdStr2);
- PhysicalNetwork physicalNetwork = PhysicalNetwork
- .physicalNetwork(physicalNetworkStr);
- TenantId tenantId = TenantId.tenantId(tenantIdStr);
- SegmentationId segmentationID = SegmentationId
- .segmentationId(segmentationIdStr);
- TenantNetwork p1 = new DefaultTenantNetwork(networkid1, name, false,
- TenantNetwork.State.ACTIVE,
- false, tenantId, false,
- TenantNetwork.Type.LOCAL,
- physicalNetwork,
- segmentationID);
- TenantNetwork p2 = new DefaultTenantNetwork(networkid1, name, false,
- TenantNetwork.State.ACTIVE,
- false, tenantId, false,
- TenantNetwork.Type.LOCAL,
- physicalNetwork,
- segmentationID);
- TenantNetwork p3 = new DefaultTenantNetwork(networkid2, name, false,
- TenantNetwork.State.ACTIVE,
- false, tenantId, false,
- TenantNetwork.Type.LOCAL,
- physicalNetwork,
- segmentationID);
- new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java
deleted file mode 100644
index 27234ac3..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java
+++ /dev/null
@@ -1,134 +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.vtnrsc;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultPortChain class.
- */
-public class DefaultPortChainTest {
- /**
- * Checks that the DefaultPortChain class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultPortChain.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- // Create same two port chain objects.
- final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortChain1";
- final String description = "PortChain1";
- // create list of Port Pair Groups.
- final List<PortPairGroupId> portPairGroups = new LinkedList<PortPairGroupId>();
- PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroups.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroups.add(portPairGroupId);
- // create list of Flow classifiers.
- final List<FlowClassifierId> flowClassifiers = new LinkedList<FlowClassifierId>();
- FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifiers.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifiers.add(flowClassifierId);
-
- DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
- final PortChain portChain1 = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers)
- .build();
-
- portChainBuilder = new DefaultPortChain.Builder();
- final PortChain samePortChain1 = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers)
- .build();
-
- // Create different port chain object.
- final PortChainId portChainId2 = PortChainId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortChain2";
- final String description2 = "PortChain2";
- // create list of Port Pair Groups.
- final List<PortPairGroupId> portPairGroups2 = new LinkedList<PortPairGroupId>();
- portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroups2.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroups2.add(portPairGroupId);
- // create list of Flow classifiers.
- final List<FlowClassifierId> flowClassifiers2 = new LinkedList<FlowClassifierId>();
- flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifiers2.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifiers2.add(flowClassifierId);
-
- portChainBuilder = new DefaultPortChain.Builder();
- final PortChain portChain2 = portChainBuilder.setId(portChainId2).setTenantId(tenantId2).setName(name2)
- .setDescription(description2).setPortPairGroups(portPairGroups2).setFlowClassifiers(flowClassifiers2)
- .build();
-
- new EqualsTester().addEqualityGroup(portChain1, samePortChain1).addEqualityGroup(portChain2).testEquals();
- }
-
- /**
- * Checks the construction of a DefaultPortChain object.
- */
- @Test
- public void testConstruction() {
- final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortChain";
- final String description = "PortChain";
- // create list of Port Pair Groups.
- final List<PortPairGroupId> portPairGroups = new LinkedList<PortPairGroupId>();
- PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroups.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroups.add(portPairGroupId);
- // create list of Flow classifiers.
- final List<FlowClassifierId> flowClassifiers = new LinkedList<FlowClassifierId>();
- FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifiers.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifiers.add(flowClassifierId);
-
- DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
- final PortChain portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers)
- .build();
-
- assertThat(portChainId, is(portChain.portChainId()));
- assertThat(tenantId, is(portChain.tenantId()));
- assertThat(name, is(portChain.name()));
- assertThat(description, is(portChain.description()));
- assertThat(portPairGroups, is(portChain.portPairGroups()));
- assertThat(flowClassifiers, is(portChain.flowClassifiers()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java
deleted file mode 100644
index 1b484e94..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java
+++ /dev/null
@@ -1,112 +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.vtnrsc;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultPortPairGroup class.
- */
-public class DefaultPortPairGroupTest {
- /**
- * Checks that the DefaultPortPairGroup class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultPortPairGroup.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- // Create same two port-pair-group objects.
- final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPairGroup1";
- final String description = "PortPairGroup1";
- // create port-pair-id list
- final List<PortPairId> portPairList = new LinkedList<PortPairId>();
- PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList.add(portPairId);
- portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList.add(portPairId);
-
- DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- final PortPairGroup portPairGroup1 = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId)
- .setName(name).setDescription(description).setPortPairs(portPairList).build();
-
- portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- final PortPairGroup samePortPairGroup1 = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId)
- .setName(name).setDescription(description).setPortPairs(portPairList).build();
-
- // Create different port-pair-group object.
- final PortPairGroupId portPairGroupId2 = PortPairGroupId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortPairGroup2";
- final String description2 = "PortPairGroup2";
- // create port-pair-id list
- final List<PortPairId> portPairList2 = new LinkedList<PortPairId>();
- portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList2.add(portPairId);
- portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList2.add(portPairId);
-
- portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- final PortPairGroup portPairGroup2 = portPairGroupBuilder.setId(portPairGroupId2).setTenantId(tenantId2)
- .setName(name2).setDescription(description2).setPortPairs(portPairList2).build();
-
- new EqualsTester().addEqualityGroup(portPairGroup1, samePortPairGroup1).addEqualityGroup(portPairGroup2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a DefaultPortPairGroup object.
- */
- @Test
- public void testConstruction() {
- final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPairGroup";
- final String description = "PortPairGroup";
- // create port-pair-id list
- final List<PortPairId> portPairList = new LinkedList<PortPairId>();
- PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList.add(portPairId);
- portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairList.add(portPairId);
-
- DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- final PortPairGroup portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId)
- .setName(name).setDescription(description).setPortPairs(portPairList).build();
-
- assertThat(portPairGroupId, is(portPairGroup.portPairGroupId()));
- assertThat(tenantId, is(portPairGroup.tenantId()));
- assertThat(name, is(portPairGroup.name()));
- assertThat(description, is(portPairGroup.description()));
- assertThat(portPairList, is(portPairGroup.portPairs()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java
deleted file mode 100644
index c8004ce6..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java
+++ /dev/null
@@ -1,97 +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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultPortPair class.
- */
-public class DefaultPortPairTest {
- /**
- * Checks that the DefaultPortPair class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultPortPair.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- // Create same two port pair objects.
- final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPair1";
- final String description = "PortPair1";
- final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
-
- DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
- final PortPair portPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
- .setDescription(description).setIngress(ingress).setEgress(egress).build();
-
- portPairBuilder = new DefaultPortPair.Builder();
- final PortPair samePortPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
- .setDescription(description).setIngress(ingress).setEgress(egress).build();
-
- // Create different port pair object.
- final PortPairId portPairId2 = PortPairId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortPair2";
- final String description2 = "PortPair2";
- final String ingress2 = "d5555555-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress2 = "a6666666-4a56-2a6e-cd3a-9dee4e2ec345";
-
- portPairBuilder = new DefaultPortPair.Builder();
- final PortPair portPair2 = portPairBuilder.setId(portPairId2).setTenantId(tenantId2).setName(name2)
- .setDescription(description2).setIngress(ingress2).setEgress(egress2).build();
-
- new EqualsTester().addEqualityGroup(portPair1, samePortPair1).addEqualityGroup(portPair2).testEquals();
- }
-
- /**
- * Checks the construction of a DefaultPortPair object.
- */
- @Test
- public void testConstruction() {
- final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPair";
- final String description = "PortPair";
- final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
-
- DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
- final PortPair portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
- .setDescription(description).setIngress(ingress).setEgress(egress).build();
-
- assertThat(portPairId, is(portPair.portPairId()));
- assertThat(tenantId, is(portPair.tenantId()));
- assertThat(name, is(portPair.name()));
- assertThat(description, is(portPair.description()));
- assertThat(ingress, is(portPair.ingress()));
- assertThat(egress, is(portPair.egress()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java
deleted file mode 100644
index 81d8b14d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java
+++ /dev/null
@@ -1,132 +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.vtnrsc;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.DeviceId;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.testing.EqualsTester;
-
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-/**
- * Unit tests for DefaultVirtualPort class.
- */
-public class DefaultVirtualPortTest {
-
- private Set<FixedIp> fixedIps;
- private Map<String, String> propertyMap;
- private Set<AllowedAddressPair> allowedAddressPairs;
- private Set<SecurityGroup> securityGroups;
- private VirtualPortId id1;
- private VirtualPortId id2;
- private String macAddressStr = "fa:12:3e:56:ee:a2";
- private String ipAddress = "10.1.1.1";
- private String deviceStr = "of:000000000000001";
- private String tenantIdStr = "123";
- private String portId1 = "1241";
- private String portId2 = "1242";
- private String tenantNetworkId = "1234567";
- private String subnet = "1212";
- private String hostIdStr = "fa:e2:3e:56:ee:a2";
-
- private void initVirtualPortId() {
- id1 = VirtualPortId.portId(portId1);
- id2 = VirtualPortId.portId(portId2);
- }
-
- private void initFixedIpSet() {
- FixedIp fixedIp = FixedIp.fixedIp(SubnetId.subnetId(subnet),
- IpAddress.valueOf(ipAddress));
- fixedIps = Sets.newHashSet();
- fixedIps.add(fixedIp);
- }
-
- private void initPropertyMap() {
- String deviceOwner = "james";
- propertyMap = Maps.newHashMap();
- propertyMap.putIfAbsent("deviceOwner", deviceOwner);
- }
-
- private void initAddressPairSet() {
- allowedAddressPairs = Sets.newHashSet();
- AllowedAddressPair allowedAddressPair = AllowedAddressPair
- .allowedAddressPair(IpAddress.valueOf(ipAddress),
- MacAddress.valueOf(macAddressStr));
- allowedAddressPairs.add(allowedAddressPair);
- }
-
- private void initSecurityGroupSet() {
- securityGroups = Sets.newHashSet();
- }
-
- /**
- * Checks that the DefaultVirtualPort class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(SecurityGroup.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- initVirtualPortId();
- initFixedIpSet();
- initPropertyMap();
- initAddressPairSet();
- initSecurityGroupSet();
- TenantNetworkId networkId = TenantNetworkId.networkId(tenantNetworkId);
- MacAddress macAddress = MacAddress.valueOf(macAddressStr);
- TenantId tenantId = TenantId.tenantId(tenantIdStr);
- DeviceId deviceId = DeviceId.deviceId(deviceStr);
- BindingHostId bindingHostId = BindingHostId.bindingHostId(hostIdStr);
-
- VirtualPort d1 = new DefaultVirtualPort(id1, networkId, true,
- propertyMap,
- VirtualPort.State.ACTIVE,
- macAddress, tenantId, deviceId,
- fixedIps, bindingHostId,
- allowedAddressPairs,
- securityGroups);
- VirtualPort d2 = new DefaultVirtualPort(id1, networkId, true,
- propertyMap,
- VirtualPort.State.ACTIVE,
- macAddress, tenantId, deviceId,
- fixedIps, bindingHostId,
- allowedAddressPairs,
- securityGroups);
- VirtualPort d3 = new DefaultVirtualPort(id2, networkId, true,
- propertyMap,
- VirtualPort.State.ACTIVE,
- macAddress, tenantId, deviceId,
- fixedIps, bindingHostId,
- allowedAddressPairs,
- securityGroups);
- new EqualsTester().addEqualityGroup(d1, d2).addEqualityGroup(d3)
- .testEquals();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java
deleted file mode 100644
index d77532a7..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.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.vtnrsc;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for FixedIp class.
- */
-public class FixedIpTest {
-
- final SubnetId subnetId1 = SubnetId.subnetId("lef11-95w-4er-9c9c");
- final SubnetId subnetId2 = SubnetId.subnetId("lefaa-95w-4er-9c9c");
- final IpAddress ip1 = IpAddress.valueOf("192.168.0.1");
- final IpAddress ip2 = IpAddress.valueOf("192.168.1.1");
-
- /**
- * Checks that the FixedIp class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(FixedIp.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- FixedIp fixedIp1 = FixedIp.fixedIp(subnetId1, ip1);
- FixedIp fixedIp2 = FixedIp.fixedIp(subnetId1, ip1);
- FixedIp fixedIp3 = FixedIp.fixedIp(subnetId2, ip2);
- new EqualsTester().addEqualityGroup(fixedIp1, fixedIp2)
- .addEqualityGroup(fixedIp3).testEquals();
- }
-
- /**
- * Checks the construction of a FixedIp object.
- */
- @Test
- public void testConstruction() {
- FixedIp fixedIp = FixedIp.fixedIp(subnetId1, ip1);
- assertThat(ip1, is(notNullValue()));
- assertThat(ip1, is(fixedIp.ip()));
- assertThat(subnetId1, is(notNullValue()));
- assertThat(subnetId1, is(fixedIp.subnetId()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java
deleted file mode 100644
index 0bef00fc..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java
+++ /dev/null
@@ -1,68 +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.vtnrsc;
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for FlowClassifierId class.
- */
-public class FlowClassifierIdTest {
-
- final FlowClassifierId flowClassifierId1 = FlowClassifierId
- .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final FlowClassifierId sameAsFlowClassifierId1 = FlowClassifierId
- .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final FlowClassifierId flowClassifierId2 = FlowClassifierId
- .of("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
-
- /**
- * Checks that the FlowClassifierId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(FlowClassifierId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(flowClassifierId1, sameAsFlowClassifierId1)
- .addEqualityGroup(flowClassifierId2).testEquals();
- }
-
- /**
- * Checks the construction of a FlowClassifierId object.
- */
- @Test
- public void testConstruction() {
- final String flowClassifierIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1";
- final FlowClassifierId flowClassifierId = FlowClassifierId.of(flowClassifierIdValue);
- assertThat(flowClassifierId, is(notNullValue()));
- assertThat(flowClassifierId.value(), is(UUID.fromString(flowClassifierIdValue)));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java
deleted file mode 100644
index c4f591e7..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for PhysicalNetwork class.
- */
-public class PhysicalNetworkTest {
-
- final PhysicalNetwork physicalNetwork1 = PhysicalNetwork.physicalNetwork("1");
- final PhysicalNetwork sameAsPhysicalNetwork1 = PhysicalNetwork.physicalNetwork("1");
- final PhysicalNetwork physicalNetwork2 = PhysicalNetwork.physicalNetwork("2");
-
- /**
- * Checks that the PhysicalNetwork class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PhysicalNetwork.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(physicalNetwork1, sameAsPhysicalNetwork1)
- .addEqualityGroup(physicalNetwork2).testEquals();
- }
-
- /**
- * Checks the construction of a PhysicalNetwork object.
- */
- @Test
- public void testConstruction() {
- final String physicalNetworkValue = "s";
- final PhysicalNetwork physicalNetwork = PhysicalNetwork
- .physicalNetwork(physicalNetworkValue);
- assertThat(physicalNetwork, is(notNullValue()));
- assertThat(physicalNetwork.physicalNetwork(), is(physicalNetworkValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java
deleted file mode 100644
index 1e84fc5d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.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.vtnrsc;
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for PortChainId class.
- */
-public class PortChainIdTest {
-
- final PortChainId portChainId1 = PortChainId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortChainId sameAsPortChainId1 = PortChainId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortChainId portChainId2 = PortChainId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
-
- /**
- * Checks that the PortChainId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PortChainId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(portChainId1, sameAsPortChainId1).addEqualityGroup(portChainId2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a PortChainId object.
- */
- @Test
- public void testConstruction() {
- final String portChainIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1";
- final PortChainId portChainId = PortChainId.of(portChainIdValue);
- assertThat(portChainId, is(notNullValue()));
- assertThat(portChainId.value(), is(UUID.fromString(portChainIdValue)));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java
deleted file mode 100644
index 20eb24a5..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.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.vtnrsc;
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for PortPairGroupId class.
- */
-public class PortPairGroupIdTest {
-
- final PortPairGroupId portPairGroupId1 = PortPairGroupId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortPairGroupId sameAsPortPairGroupId1 = PortPairGroupId
- .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortPairGroupId portPairGroupId2 = PortPairGroupId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
-
- /**
- * Checks that the PortPairGroupId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PortPairGroupId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(portPairGroupId1, sameAsPortPairGroupId1)
- .addEqualityGroup(portPairGroupId2).testEquals();
- }
-
- /**
- * Checks the construction of a PortPairGroupId object.
- */
- @Test
- public void testConstruction() {
- final String portPairGroupIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1";
- final PortPairGroupId portPairGroupId = PortPairGroupId.of(portPairGroupIdValue);
- assertThat(portPairGroupId, is(notNullValue()));
- assertThat(portPairGroupId.value(), is(UUID.fromString(portPairGroupIdValue)));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java
deleted file mode 100644
index 757d3a69..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.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.vtnrsc;
-
-import java.util.UUID;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for PortPairId class.
- */
-public class PortPairIdTest {
-
- final PortPairId portPairId1 = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortPairId sameAsPortPairId1 = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final PortPairId portPairId2 = PortPairId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
-
- /**
- * Checks that the PortPairId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(PortPairId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(portPairId1, sameAsPortPairId1).addEqualityGroup(portPairId2).testEquals();
- }
-
- /**
- * Checks the construction of a PortPairId object.
- */
- @Test
- public void testConstruction() {
- final String portPairIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1";
- final PortPairId portPairId = PortPairId.of(portPairIdValue);
- assertThat(portPairId, is(notNullValue()));
- assertThat(portPairId.value(), is(UUID.fromString(portPairIdValue)));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java
deleted file mode 100644
index 9f60de8f..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.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.vtnrsc;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for RouterGateway class.
- */
-public class RouterGatewayTest {
- final TenantNetworkId networkId1 = TenantNetworkId.networkId("1");
- final TenantNetworkId networkId2 = TenantNetworkId.networkId("2");
- final Set<FixedIp> fixedIpSet1 = new HashSet<>();
- final Set<FixedIp> fixedIpSet2 = new HashSet<>();
-
- /**
- * Checks that the RouterGateway class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(RouterGateway.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- RouterGateway routerGateway1 = RouterGateway.routerGateway(networkId1,
- true,
- fixedIpSet1);
- RouterGateway routerGateway2 = RouterGateway.routerGateway(networkId1,
- true,
- fixedIpSet1);
- RouterGateway routerGateway3 = RouterGateway.routerGateway(networkId2,
- true,
- fixedIpSet2);
- new EqualsTester().addEqualityGroup(routerGateway1, routerGateway2)
- .addEqualityGroup(routerGateway3).testEquals();
- }
-
- /**
- * Checks the construction of a RouterGateway object.
- */
- @Test
- public void testConstruction() {
- RouterGateway routerGateway = RouterGateway.routerGateway(networkId1,
- true,
- fixedIpSet1);
- assertThat(fixedIpSet1, is(notNullValue()));
- assertThat(fixedIpSet1, is(routerGateway.externalFixedIps()));
- assertThat(networkId1, is(notNullValue()));
- assertThat(networkId1, is(routerGateway.networkId()));
- assertThat(routerGateway.enableSnat(), is(true));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.java
deleted file mode 100644
index 225211b9..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for RouterId class.
- */
-public class RouterIdTest {
- final RouterId routerId1 = RouterId.valueOf("1");
- final RouterId sameAsRouterId1 = RouterId.valueOf("1");
- final RouterId routerId2 = RouterId.valueOf("2");
-
- /**
- * Checks that the RouterId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(RouterId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(routerId1, sameAsRouterId1).addEqualityGroup(routerId2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a RouterId object.
- */
- @Test
- public void testConstruction() {
- final String routerIdValue = "s";
- final RouterId routerId = RouterId.valueOf(routerIdValue);
- assertThat(routerId, is(notNullValue()));
- assertThat(routerId.routerId(), is(routerIdValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java
deleted file mode 100644
index 20871c02..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for SecurityGroup class.
- */
-public class SecurityGroupTest {
-
- final SecurityGroup securityGroup1 = SecurityGroup.securityGroup("1");
- final SecurityGroup sameAssecurityGroup = SecurityGroup.securityGroup("1");
- final SecurityGroup securityGroup2 = SecurityGroup.securityGroup("2");
-
- /**
- * Checks that the SecurityGroup class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(SecurityGroup.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(securityGroup1, sameAssecurityGroup)
- .addEqualityGroup(securityGroup2).testEquals();
- }
-
- /**
- * Checks the construction of a SecurityGroup object.
- */
- @Test
- public void testConstruction() {
- final String securityGroupValue = "1";
- final SecurityGroup securityGroup = SecurityGroup.securityGroup(securityGroupValue);
- assertThat(securityGroup, is(notNullValue()));
- assertThat(securityGroup.securityGroup(), is(securityGroupValue));
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java
deleted file mode 100644
index dfb3dcf8..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for SegmentationId class.
- */
-public class SegmentationIdTest {
-
- final SegmentationId segmentationID1 = SegmentationId.segmentationId("1");
- final SegmentationId sameAsSegmentationID1 = SegmentationId.segmentationId("1");
- final SegmentationId segmentationID2 = SegmentationId.segmentationId("2");
-
- /**
- * Checks that the SegmentationId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(SegmentationId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(segmentationID1, sameAsSegmentationID1)
- .addEqualityGroup(segmentationID2).testEquals();
- }
-
- /**
- * Checks the construction of a segmentationId object.
- */
- @Test
- public void testConstruction() {
- final String segmentationIdValue = "s";
- final SegmentationId segmentationId = SegmentationId.segmentationId(segmentationIdValue);
- assertThat(segmentationId, is(notNullValue()));
- assertThat(segmentationId.segmentationId(), is(segmentationIdValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java
deleted file mode 100644
index 5a1809ce..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for SubnetId class.
- */
-public class SubnetIdTest {
-
- final SubnetId subnetId1 = SubnetId.subnetId("1");
- final SubnetId sameAsSubnetId1 = SubnetId.subnetId("1");
- final SubnetId subnetId2 = SubnetId.subnetId("2");
-
- /**
- * Checks that the SubnetId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(SubnetId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(subnetId1, sameAsSubnetId1).addEqualityGroup(subnetId2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a SubnetId object.
- */
- @Test
- public void testConstruction() {
- final String subnetIdValue = "s";
- final SubnetId subnetId = SubnetId.subnetId(subnetIdValue);
- assertThat(subnetId, is(notNullValue()));
- assertThat(subnetId.subnetId(), is(subnetIdValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java
deleted file mode 100644
index f601d427..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for TenantId class.
- */
-public class TenantIdTest {
-
- final TenantId tenantId1 = TenantId.tenantId("1");
- final TenantId sameAsTenantId1 = TenantId.tenantId("1");
- final TenantId tenantId2 = TenantId.tenantId("2");
-
- /**
- * Checks that the TenantId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(TenantId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(tenantId1, sameAsTenantId1).addEqualityGroup(tenantId2)
- .testEquals();
- }
-
- /**
- * Checks the construction of a TenantId object.
- */
- @Test
- public void testConstruction() {
- final String tenantIdValue = "s";
- final TenantId tenantId = TenantId.tenantId(tenantIdValue);
- assertThat(tenantId, is(notNullValue()));
- assertThat(tenantId.tenantId(), is(tenantIdValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java
deleted file mode 100644
index 3bd72026..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for TenantNetworkId class.
- */
-public class TenantNetworkIdTest {
-
- final TenantNetworkId networkId1 = TenantNetworkId.networkId("1");
- final TenantNetworkId sameAsnetworkId1 = TenantNetworkId.networkId("1");
- final TenantNetworkId networkId2 = TenantNetworkId.networkId("2");
-
- /**
- * Checks that the TenantNetworkId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(TenantNetworkId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(networkId1, sameAsnetworkId1)
- .addEqualityGroup(networkId2).testEquals();
- }
-
- /**
- * Checks the construction of a TenantNetworkId object.
- */
- @Test
- public void testConstruction() {
- final String networkIdValue = "s";
- final TenantNetworkId networkId = TenantNetworkId.networkId(networkIdValue);
- assertThat(networkId, is(notNullValue()));
- assertThat(networkId.networkId(), is(networkIdValue));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java
deleted file mode 100644
index 70966118..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.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.vtnrsc;
-
-import org.junit.Test;
-
-import com.google.common.testing.EqualsTester;
-
-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;
-
-/**
- * Unit tests for VirtualPortId class.
- */
-public class VirtualPortIdTest {
-
- final VirtualPortId virtualPortId1 = VirtualPortId.portId("1");
- final VirtualPortId sameAsVirtualPortId1 = VirtualPortId.portId("1");
- final VirtualPortId virtualPortId2 = VirtualPortId.portId("2");
-
- /**
- * Checks that the VirtualPortId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(VirtualPortId.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- new EqualsTester().addEqualityGroup(virtualPortId1, sameAsVirtualPortId1)
- .addEqualityGroup(virtualPortId2).testEquals();
- }
-
- /**
- * Checks the construction of a VirtualPortId object.
- */
- @Test
- public void testConstruction() {
- final String vPortIdValue = "aaa";
- final VirtualPortId virtualPortId = VirtualPortId.portId(vPortIdValue);
- assertThat(virtualPortId, is(notNullValue()));
- assertThat(virtualPortId.portId(), is(vPortIdValue));
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java
deleted file mode 100644
index d6826f5d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java
+++ /dev/null
@@ -1,125 +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.vtnrsc.floatingip;
-
-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.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Unit tests for DefaultFloatingIp class.
- */
-public class DefaultFloatingIpTest {
-
- private String floatingIpIdStr1 = "5fb63824-4d5c-4b85-9f2f-ebb93c9ce3df";
- private String floatingIpIdStr2 = "fa44f585-fe02-40d3-afe7-d1d7e5782c99";
- private String floatingIpStr = "10.1.1.2";
- private String fixedIpStr = "192.168.1.2";
- private String tenantIdStr = "123";
- private String tenantNetworkId = "1234567";
- private String virtualPortId = "1212";
- private String routerIdStr = "123";
-
- /**
- * Checks that the DefaultFloatingIp class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultFloatingIp.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final TenantNetworkId networkId = TenantNetworkId
- .networkId(tenantNetworkId);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId = RouterId.valueOf(routerIdStr);
- final FloatingIpId id1 = FloatingIpId.of(floatingIpIdStr1);
- final FloatingIpId id2 = FloatingIpId.of(floatingIpIdStr2);
- final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr);
- final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr);
-
- FloatingIp fip1 = new DefaultFloatingIp(id1, tenantId, networkId,
- portId, routerId,
- floatingIpAddress,
- fixedIpAddress,
- FloatingIp.Status.ACTIVE);
- FloatingIp fip2 = new DefaultFloatingIp(id1, tenantId, networkId,
- portId, routerId,
- floatingIpAddress,
- fixedIpAddress,
- FloatingIp.Status.ACTIVE);
- FloatingIp fip3 = new DefaultFloatingIp(id2, tenantId, networkId,
- portId, routerId,
- floatingIpAddress,
- fixedIpAddress,
- FloatingIp.Status.ACTIVE);
-
- new EqualsTester().addEqualityGroup(fip1, fip2).addEqualityGroup(fip3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a DefaultFloatingIp object.
- */
- @Test
- public void testConstruction() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final TenantNetworkId networkId = TenantNetworkId
- .networkId(tenantNetworkId);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId = RouterId.valueOf(routerIdStr);
- final FloatingIpId id = FloatingIpId.of(floatingIpIdStr1);
- final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr);
- final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr);
-
- FloatingIp fip = new DefaultFloatingIp(id, tenantId, networkId, portId,
- routerId, floatingIpAddress,
- fixedIpAddress,
- FloatingIp.Status.ACTIVE);
- assertThat(id, is(notNullValue()));
- assertThat(id, is(fip.id()));
- assertThat(tenantId, is(notNullValue()));
- assertThat(tenantId, is(fip.tenantId()));
- assertThat(networkId, is(notNullValue()));
- assertThat(networkId, is(fip.networkId()));
- assertThat(portId, is(notNullValue()));
- assertThat(portId, is(fip.portId()));
- assertThat(routerId, is(notNullValue()));
- assertThat(routerId, is(fip.routerId()));
- assertThat(floatingIpAddress, is(notNullValue()));
- assertThat(floatingIpAddress, is(fip.floatingIp()));
- assertThat(fixedIpAddress, is(notNullValue()));
- assertThat(fixedIpAddress, is(fip.fixedIp()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java
deleted file mode 100644
index 6ae27e9e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.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.vtnrsc.floatingip;
-
-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.onosproject.vtnrsc.FloatingIpId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Unit tests for FloatingIpId class.
- */
-public class FloatingIpIdTest {
- private String floatingIpIdStr1 = "5fb63824-4d5c-4b85-9f2f-ebb93c9ce3df";
- private String floatingIpIdStr2 = "fa44f585-fe02-40d3-afe7-d1d7e5782c99";
-
- /**
- * Checks that the FloatingIpId class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(FloatingIpId.class);
- }
-
- /**
- * Checks the operation of equals() methods.
- */
- @Test
- public void testEquals() {
- FloatingIpId id1 = FloatingIpId.of(floatingIpIdStr1);
- FloatingIpId id2 = FloatingIpId.of(floatingIpIdStr1);
- FloatingIpId id3 = FloatingIpId.of(floatingIpIdStr2);
- new EqualsTester().addEqualityGroup(id1, id2).addEqualityGroup(id3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a FloatingIpId object.
- */
- @Test
- public void testConstruction() {
- final FloatingIpId id = FloatingIpId.of(floatingIpIdStr1);
- assertThat(id, is(notNullValue()));
- assertThat(id.floatingIpId().toString(), is(floatingIpIdStr1));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java
deleted file mode 100644
index 8283a52b..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java
+++ /dev/null
@@ -1,146 +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.vtnrsc.flowclassifier.impl;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import org.junit.Test;
-
-import org.onlab.packet.IpPrefix;
-
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.DefaultFlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.util.VtnStorageServiceTest;
-
-/**
- * Unit tests for FlowClassifierManager class.
- */
-public class FlowClassifierManagerTest {
-
- final String name = "FlowClassifier";
- final String description = "FlowClassifier";
- final String ethType = "IPv4";
- final String protocol = "udp";
- final int minSrcPortRange = 1024;
- final int maxSrcPortRange = 5000;
- final int minDstPortRange = 1024;
- final int maxDstPortRange = 5000;
- final FlowClassifierId flowClassifierId = FlowClassifierId.of("71111111-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("8");
- final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0");
- final IpPrefix dstIpPrefix = IpPrefix.valueOf("100.100.100.100/0");
- final VirtualPortId virtualSrcPort = VirtualPortId.portId("100");
- final VirtualPortId virtualDstPort = VirtualPortId.portId("200");
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- FlowClassifierManager flowClassifierMgr = new FlowClassifierManager();
- FlowClassifier flowClassifier = null;
- private final VtnStorageServiceTest storageService = new VtnStorageServiceTest();
-
- /**
- * Checks the operation of createFlowClassifier() method.
- */
- @Test
- public void testCreateFlowClassifier() {
- // initialize flow classifier manager
- flowClassifierMgr.storageService = storageService;
- flowClassifierMgr.activate();
-
- // create flow classifier
- flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId).setTenantId(tenantId)
- .setName(name).setDescription(description).setEtherType(ethType).setProtocol(protocol)
- .setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build();
- assertThat(flowClassifierMgr.createFlowClassifier(flowClassifier), is(true));
- }
-
- /**
- * Checks the operation of exists() method.
- */
- @Test
- public void testExists() {
- testCreateFlowClassifier();
- assertThat(flowClassifierMgr.exists(flowClassifierId), is(true));
- }
-
- /**
- * Checks the operation of getFlowClassifierCount() method.
- */
- @Test
- public void testGetFlowClassifierCount() {
- testCreateFlowClassifier();
- assertThat(flowClassifierMgr.getFlowClassifierCount(), is(1));
- }
-
- /**
- * Checks the operation of getFlowClassifiers() method.
- */
- @Test
- public void testGetFlowClassifiers() {
- testCreateFlowClassifier();
- final Iterable<FlowClassifier> flowClassifierList = flowClassifierMgr.getFlowClassifiers();
- assertThat(flowClassifierList, is(notNullValue()));
- assertThat(flowClassifierList.iterator().hasNext(), is(true));
- }
-
- /**
- * Checks the operation of getFlowClassifier() method.
- */
- @Test
- public void testGetFlowClassifier() {
- testCreateFlowClassifier();
- assertThat(flowClassifier, is(notNullValue()));
- assertThat(flowClassifierMgr.getFlowClassifier(flowClassifierId), is(flowClassifier));
- }
-
- /**
- * Checks the operation of updateFlowClassifier() method.
- */
- @Test
- public void testUpdateFlowClassifier() {
- // create a flow classifier
- testCreateFlowClassifier();
-
- // new updates
- final String name2 = "FlowClassifier2";
- final String description2 = "FlowClassifier2";
- final String ethType2 = "IPv6";
- final String protocol2 = "tcp";
- final TenantId tenantId2 = TenantId.tenantId("10");
- final VirtualPortId virtualSrcPort2 = VirtualPortId.portId("300");
- final VirtualPortId virtualDstPort2 = VirtualPortId.portId("400");
- flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId)
- .setTenantId(tenantId2).setName(name2).setDescription(description2).setEtherType(ethType2)
- .setProtocol(protocol2).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange)
- .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix)
- .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort2).setDstPort(virtualDstPort2).build();
- assertThat(flowClassifierMgr.updateFlowClassifier(flowClassifier), is(true));
- }
-
- /**
- * Checks the operation of removeFlowClassifier() method.
- */
- @Test
- public void testRemoveFlowClassifier() {
- testCreateFlowClassifier();
- assertThat(flowClassifierMgr.removeFlowClassifier(flowClassifierId), is(true));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java
deleted file mode 100644
index 0831ec9c..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.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.vtnrsc.portchain.impl;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import org.junit.Test;
-import java.util.List;
-import java.util.LinkedList;
-
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.DefaultPortChain;
-import org.onosproject.vtnrsc.DefaultFlowClassifier;
-import org.onosproject.vtnrsc.util.VtnStorageServiceTest;
-
-/**
- * Unit tests for PortChainManager class.
- */
-public class PortChainManagerTest {
- final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortChain";
- final String description = "PortChain";
- final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>();
- final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>();
- DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder();
- DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder();
- PortChainManager portChainMgr = new PortChainManager();
- PortChain portChain = null;
- private final VtnStorageServiceTest storageService = new VtnStorageServiceTest();
-
- /**
- * Checks the operation of createPortChain() method.
- */
- @Test
- public void testCreatePortChain() {
- // initialize port chain manager
- portChainMgr.storageService = storageService;
- portChainMgr.activate();
-
- // create list of Port Pair Groups.
- PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroupList.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroupList.add(portPairGroupId);
-
- // create list of Flow classifiers.
- FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifierList.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifierList.add(flowClassifierId);
-
- // create port chain
- portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name).setDescription(description)
- .setPortPairGroups(portPairGroupList).setFlowClassifiers(flowClassifierList).build();
- assertThat(portChainMgr.createPortChain(portChain), is(true));
- }
-
- /**
- * Checks the operation of exists() method.
- */
- @Test
- public void testExists() {
- testCreatePortChain();
- assertThat(portChainMgr.exists(portChainId), is(true));
- }
-
- /**
- * Checks the operation of getPortChainCount() method.
- */
- @Test
- public void testGetPortChainCount() {
- testCreatePortChain();
- assertThat(portChainMgr.getPortChainCount(), is(1));
- }
-
- /**
- * Checks the operation of getPortChains() method.
- */
- @Test
- public void testGetPortChains() {
- testCreatePortChain();
- final Iterable<PortChain> portChainList = portChainMgr.getPortChains();
- assertThat(portChainList, is(notNullValue()));
- assertThat(portChainList.iterator().hasNext(), is(true));
- }
-
- /**
- * Checks the operation of getPortChain() method.
- */
- @Test
- public void testGetPortChain() {
- testCreatePortChain();
- assertThat(portChain, is(notNullValue()));
- assertThat(portChainMgr.getPortChain(portChainId), is(portChain));
- }
-
- /**
- * Checks the operation of updatePortChain() method.
- */
- @Test
- public void testUpdatePortChain() {
- // create a port chain
- testCreatePortChain();
-
- // new updates
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortChain2";
- final String description2 = "PortChain2";
- // create list of Port Pair Groups.
- final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>();
- PortPairGroupId portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairGroupList.add(portPairGroupId);
- portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3af");
- portPairGroupList.add(portPairGroupId);
- // create list of Flow classifiers.
- final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>();
- FlowClassifierId flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae");
- flowClassifierList.add(flowClassifierId);
- flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3af");
- flowClassifierList.add(flowClassifierId);
- portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId2).setName(name2)
- .setDescription(description2).setPortPairGroups(portPairGroupList)
- .setFlowClassifiers(flowClassifierList).build();
- assertThat(portChainMgr.updatePortChain(portChain), is(true));
- }
-
- /**
- * Checks the operation of removePortChain() method.
- */
- @Test
- public void testRemovePortChain() {
- testCreatePortChain();
- assertThat(portChainMgr.removePortChain(portChainId), is(true));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java
deleted file mode 100644
index c936d7cc..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java
+++ /dev/null
@@ -1,126 +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.vtnrsc.portpair.impl;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import org.junit.Test;
-
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.DefaultPortPair;
-import org.onosproject.vtnrsc.util.VtnStorageServiceTest;
-
-/**
- * Unit tests for PortPairManager class.
- */
-public class PortPairManagerTest {
- final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPair";
- final String description = "PortPair";
- final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345";
- DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder();
- PortPairManager portPairMgr = new PortPairManager();
- PortPair portPair = null;
- private final VtnStorageServiceTest storageService = new VtnStorageServiceTest();
-
- /**
- * Checks the operation of createPortPair() method.
- */
- @Test
- public void testCreatePortPair() {
- // initialize port pair manager
- portPairMgr.storageService = storageService;
- portPairMgr.activate();
-
- // create port pair
- portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name)
- .setDescription(description).setIngress(ingress).setEgress(egress).build();
- assertThat(portPairMgr.createPortPair(portPair), is(true));
- }
-
- /**
- * Checks the operation of exists() method.
- */
- @Test
- public void testExists() {
- testCreatePortPair();
- assertThat(portPairMgr.exists(portPairId), is(true));
- }
-
- /**
- * Checks the operation of getPortPairCount() method.
- */
- @Test
- public void testGetPortPairCount() {
- testCreatePortPair();
- assertThat(portPairMgr.getPortPairCount(), is(1));
- }
-
- /**
- * Checks the operation of getPortPairs() method.
- */
- @Test
- public void testGetPortPairs() {
- testCreatePortPair();
- final Iterable<PortPair> portPairList = portPairMgr.getPortPairs();
- assertThat(portPairList, is(notNullValue()));
- assertThat(portPairList.iterator().hasNext(), is(true));
- }
-
- /**
- * Checks the operation of getPortPair() method.
- */
- @Test
- public void testGetPortPair() {
- testCreatePortPair();
- assertThat(portPair, is(notNullValue()));
- assertThat(portPairMgr.getPortPair(portPairId), is(portPair));
- }
-
- /**
- * Checks the operation of updatePortPair() method.
- */
- @Test
- public void testUpdatePortPair() {
- // create a port pair
- testCreatePortPair();
-
- // new updates
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortPair2";
- final String description2 = "PortPair2";
- final String ingress2 = "d5555555-24fc-4fae-af4b-321c5e2eb3d1";
- final String egress2 = "a6666666-4a56-2a6e-cd3a-9dee4e2ec345";
- portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId2).setName(name2)
- .setDescription(description2).setIngress(ingress2).setEgress(egress2).build();
- assertThat(portPairMgr.updatePortPair(portPair), is(true));
- }
-
- /**
- * Checks the operation of removePortPair() method.
- */
- @Test
- public void testRemovePortPair() {
- testCreatePortPair();
- assertThat(portPairMgr.removePortPair(portPairId), is(true));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java
deleted file mode 100644
index 95bcd09a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java
+++ /dev/null
@@ -1,140 +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.vtnrsc.portpairgroup.impl;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import org.junit.Test;
-import java.util.List;
-import java.util.LinkedList;
-
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.DefaultPortPairGroup;
-import org.onosproject.vtnrsc.util.VtnStorageServiceTest;
-
-/**
- * Unit tests for PortPairGroupManager class.
- */
-public class PortPairGroupManagerTest {
- final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae");
- final TenantId tenantId = TenantId.tenantId("1");
- final String name = "PortPairGroup";
- final String description = "PortPairGroup";
- final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
- DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder();
- PortPairGroupManager portPairGroupMgr = new PortPairGroupManager();
- PortPairGroup portPairGroup = null;
- private final VtnStorageServiceTest storageService = new VtnStorageServiceTest();
-
- /**
- * Checks the operation of createPortPairGroup() method.
- */
- @Test
- public void testCreatePortPairGroup() {
- // initialize port pair group manager
- portPairGroupMgr.storageService = storageService;
- portPairGroupMgr.activate();
-
- // create port-pair-id list
- PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
- portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
-
- // create port pair
- portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name)
- .setDescription(description).setPortPairs(portPairIdList).build();
- assertThat(portPairGroupMgr.createPortPairGroup(portPairGroup), is(true));
- }
-
- /**
- * Checks the operation of exists() method.
- */
- @Test
- public void testExists() {
- testCreatePortPairGroup();
- assertThat(portPairGroupMgr.exists(portPairGroupId), is(true));
- }
-
- /**
- * Checks the operation of getPortPairGroupCount() method.
- */
- @Test
- public void testGetPortPairGroupCount() {
- testCreatePortPairGroup();
- assertThat(portPairGroupMgr.getPortPairGroupCount(), is(1));
- }
-
- /**
- * Checks the operation of getPortPairGroups() method.
- */
- @Test
- public void testGetPortPairGroups() {
- testCreatePortPairGroup();
- final Iterable<PortPairGroup> portPairGroupList = portPairGroupMgr.getPortPairGroups();
- assertThat(portPairGroupList, is(notNullValue()));
- assertThat(portPairGroupList.iterator().hasNext(), is(true));
- }
-
- /**
- * Checks the operation of getPortPairGroup() method.
- */
- @Test
- public void testGetPortPairGroup() {
- testCreatePortPairGroup();
- assertThat(portPairGroup, is(notNullValue()));
- assertThat(portPairGroupMgr.getPortPairGroup(portPairGroupId), is(portPairGroup));
- }
-
- /**
- * Checks the operation of updatePortPairGroup() method.
- */
- @Test
- public void testUpdatePortPairGroup() {
- // create a port pair group
- testCreatePortPairGroup();
-
- // new updates
- // create port-pair-id list
- final TenantId tenantId2 = TenantId.tenantId("2");
- final String name2 = "PortPairGroup2";
- final String description2 = "PortPairGroup2";
- final List<PortPairId> portPairIdList = new LinkedList<PortPairId>();
- PortPairId portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
- portPairId = PortPairId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae");
- portPairIdList.add(portPairId);
-
- // create port pair
- portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId2).setName(name2)
- .setDescription(description2).setPortPairs(portPairIdList).build();
- assertThat(portPairGroupMgr.updatePortPairGroup(portPairGroup), is(true));
- }
-
- /**
- * Checks the operation of removePortPairGroup() method.
- */
- @Test
- public void testRemovePortPairGroup() {
- testCreatePortPairGroup();
- assertThat(portPairGroupMgr.removePortPairGroup(portPairGroupId), is(true));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java
deleted file mode 100644
index ecc80658..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java
+++ /dev/null
@@ -1,114 +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.vtnrsc.router;
-
-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 java.util.Collections;
-
-import org.junit.Test;
-import org.onosproject.vtnrsc.DefaultRouter;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.RouterGateway;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Unit tests for DefaultRouter class.
- */
-public class DefaultRouterTest {
-
- private String tenantIdStr = "123";
- private String virtualPortId = "1212";
- private String routeIdStr1 = "1";
- private String routeIdStr2 = "2";
- private String routerName = "router";
- private String tenantNetworkId = "1234567";
-
- /**
- * Checks that the DefaultRouter class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(DefaultRouter.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
- final RouterId routerId2 = RouterId.valueOf(routeIdStr2);
- final TenantNetworkId networkId = TenantNetworkId
- .networkId(tenantNetworkId);
- final RouterGateway routerGateway = RouterGateway.routerGateway(
- networkId,
- true,
- Collections
- .emptySet());
-
- Router r1 = new DefaultRouter(routerId1, routerName, false,
- Router.Status.ACTIVE, false,
- routerGateway, portId, tenantId, null);
- Router r2 = new DefaultRouter(routerId1, routerName, false,
- Router.Status.ACTIVE, false,
- routerGateway, portId, tenantId, null);
- Router r3 = new DefaultRouter(routerId2, routerName, false,
- Router.Status.ACTIVE, false,
- routerGateway, portId, tenantId, null);
-
- new EqualsTester().addEqualityGroup(r1, r2).addEqualityGroup(r3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a DefaultRouter object.
- */
- @Test
- public void testConstruction() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId = RouterId.valueOf(routeIdStr1);
- final TenantNetworkId networkId = TenantNetworkId
- .networkId(tenantNetworkId);
- final RouterGateway routerGateway = RouterGateway.routerGateway(
- networkId,
- true,
- Collections
- .emptySet());
-
- Router r1 = new DefaultRouter(routerId, routerName, false,
- Router.Status.ACTIVE, false,
- routerGateway, portId, tenantId, null);
- assertThat(routerId, is(notNullValue()));
- assertThat(routerId, is(r1.id()));
- assertThat(tenantId, is(notNullValue()));
- assertThat(tenantId, is(r1.tenantId()));
- assertThat(routerGateway, is(notNullValue()));
- assertThat(routerGateway, is(r1.externalGatewayInfo()));
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java
deleted file mode 100644
index 53ea037d..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java
+++ /dev/null
@@ -1,97 +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.vtnrsc.router;
-
-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.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * Unit tests for RouterInterface class.
- */
-public class RouterInterfaceTest {
- private String tenantIdStr = "123";
- private String virtualPortId = "1212";
- private String routeIdStr1 = "1";
- private String routeIdStr2 = "2";
- private String subnetIdStr = "1234567";
-
- /**
- * Checks that the RouterInterface class is immutable.
- */
- @Test
- public void testImmutability() {
- assertThatClassIsImmutable(RouterInterface.class);
- }
-
- /**
- * Checks the operation of equals().
- */
- @Test
- public void testEquals() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
- final RouterId routerId2 = RouterId.valueOf(routeIdStr2);
- final SubnetId subnet = SubnetId.subnetId(subnetIdStr);
-
- RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId,
- routerId1,
- tenantId);
- RouterInterface ri2 = RouterInterface.routerInterface(subnet, portId,
- routerId1,
- tenantId);
- RouterInterface ri3 = RouterInterface.routerInterface(subnet, portId,
- routerId2,
- tenantId);
-
- new EqualsTester().addEqualityGroup(ri1, ri2).addEqualityGroup(ri3)
- .testEquals();
- }
-
- /**
- * Checks the construction of a RouterInterface object.
- */
- @Test
- public void testConstruction() {
- final TenantId tenantId = TenantId.tenantId(tenantIdStr);
- final VirtualPortId portId = VirtualPortId.portId(virtualPortId);
- final RouterId routerId1 = RouterId.valueOf(routeIdStr1);
- final SubnetId subnet = SubnetId.subnetId(subnetIdStr);
-
- RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId,
- routerId1,
- tenantId);
- assertThat(portId, is(notNullValue()));
- assertThat(portId, is(ri1.portId()));
- assertThat(tenantId, is(notNullValue()));
- assertThat(tenantId, is(ri1.tenantId()));
- assertThat(routerId1, is(notNullValue()));
- assertThat(routerId1, is(ri1.routerId()));
- assertThat(subnet, is(notNullValue()));
- assertThat(subnet, is(ri1.subnetId()));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java
deleted file mode 100644
index 0631f865..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java
+++ /dev/null
@@ -1,114 +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.vtnrsc.util;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-
-/**
- * Testing adapter for EventuallyConsistentMap.
- */
-public class VtnEventuallyConsistentMapAdapter<K, V> implements EventuallyConsistentMap<K, V> {
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public boolean isEmpty() {
- return false;
- }
-
- @Override
- public boolean containsKey(K key) {
- return false;
- }
-
- @Override
- public boolean containsValue(V value) {
- return false;
- }
-
- @Override
- public V get(K key) {
- return null;
- }
-
- @Override
- public void put(K key, V value) {
-
- }
-
- @Override
- public V remove(K key) {
- return null;
- }
-
- @Override
- public void remove(K key, V value) {
-
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return null;
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
-
- }
-
- @Override
- public void clear() {
-
- }
-
- @Override
- public Set<K> keySet() {
- return null;
- }
-
- @Override
- public Collection<V> values() {
- return null;
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return null;
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java
deleted file mode 100644
index 68b7d689..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java
+++ /dev/null
@@ -1,242 +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.vtnrsc.util;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiFunction;
-
-import org.onlab.util.KryoNamespace;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.store.Timestamp;
-
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.*;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-import org.onosproject.store.service.EventuallyConsistentMapEvent;
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.EventuallyConsistentMap;
-
-/**
- * Testing version of an Eventually Consistent Map.
- */
-
-public final class VtnEventuallyConsistentMapTest<K, V> extends VtnEventuallyConsistentMapAdapter<K, V> {
-
- private final HashMap<K, V> map;
- private final String mapName;
- private final List<EventuallyConsistentMapListener<K, V>> listeners;
- private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- private VtnEventuallyConsistentMapTest(String mapName,
- BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- map = new HashMap<>();
- listeners = new LinkedList<>();
- this.mapName = mapName;
- this.peerUpdateFunction = peerUpdateFunction;
- }
-
- /**
- * Notify all listeners of an event.
- */
- private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) {
- listeners.forEach(
- listener -> listener.event(event)
- );
- }
-
- @Override
- public int size() {
- return map.size();
- }
-
- @Override
- public boolean isEmpty() {
- return map.isEmpty();
- }
-
- @Override
- public boolean containsKey(K key) {
- return map.containsKey(key);
- }
-
- @Override
- public boolean containsValue(V value) {
- return map.containsValue(value);
- }
-
- @Override
- public V get(K key) {
- return map.get(key);
- }
-
- @Override
- public void put(K key, V value) {
- map.put(key, value);
- EventuallyConsistentMapEvent<K, V> addEvent =
- new EventuallyConsistentMapEvent<>(mapName, PUT, key, value);
- notifyListeners(addEvent);
- if (peerUpdateFunction != null) {
- peerUpdateFunction.apply(key, value);
- }
- }
-
- @Override
- public V remove(K key) {
- V result = map.remove(key);
- if (result != null) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE,
- key, map.get(key));
- notifyListeners(removeEvent);
- }
- return result;
- }
-
- @Override
- public void remove(K key, V value) {
- boolean removed = map.remove(key, value);
- if (removed) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value);
- notifyListeners(removeEvent);
- }
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return map.compute(key, recomputeFunction);
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
- map.putAll(m);
- }
-
- @Override
- public void clear() {
- map.clear();
- }
-
- @Override
- public Set<K> keySet() {
- return map.keySet();
- }
-
- @Override
- public Collection<V> values() {
- return map.values();
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return map.entrySet();
- }
-
- public static <K, V> Builder<K, V> builder() {
- return new Builder<>();
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.remove(listener);
- }
-
- public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> {
- private String name;
- private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- this.peerUpdateFunction = peerUpdateFunction;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withPersistence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMap<K, V> build() {
- if (name == null) {
- name = "test";
- }
- return new VtnEventuallyConsistentMapTest<>(name, peerUpdateFunction);
- }
- }
-
-}
-
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java
deleted file mode 100644
index efb1a791..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.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.vtnrsc.util;
-
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.ConsistentMapBuilder;
-import org.onosproject.store.service.DistributedSetBuilder;
-import org.onosproject.store.service.DistributedQueueBuilder;
-import org.onosproject.store.service.AtomicCounterBuilder;
-import org.onosproject.store.service.AtomicValueBuilder;
-import org.onosproject.store.service.TransactionContextBuilder;
-import org.onosproject.store.service.StorageService;
-
-/**
- * Adapter for the storage service.
- */
-public class VtnStorageServiceAdapter implements StorageService {
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return null;
- }
-
- @Override
- public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedSetBuilder<E> setBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedQueueBuilder<E> queueBuilder() {
- return null;
- }
-
- @Override
- public AtomicCounterBuilder atomicCounterBuilder() {
- return null;
- }
-
- @Override
- public <V> AtomicValueBuilder<V> atomicValueBuilder() {
- return null;
- }
-
- @Override
- public TransactionContextBuilder transactionContextBuilder() {
- return null;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java
deleted file mode 100644
index 1f0f1835..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java
+++ /dev/null
@@ -1,25 +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.vtnrsc.util;
-
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-
-public class VtnStorageServiceTest extends VtnStorageServiceAdapter {
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return VtnEventuallyConsistentMapTest.builder();
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/pom.xml b/framework/src/onos/apps/vtn/vtnweb/pom.xml
deleted file mode 100644
index 0aa1f616..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.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.
- -->
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
-
- <artifactId>onos-app-vtn-web</artifactId>
- <packaging>bundle</packaging>
- <properties>
- <web.context>/onos/vtn</web.context>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-app-vtn-rsc</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <_wab>src/main/webapp/</_wab>
- <Bundle-SymbolicName>
- ${project.groupId}.${project.artifactId}
- </Bundle-SymbolicName>
- <Import-Package>
- org.slf4j,
- org.osgi.framework,
- javax.ws.rs,
- javax.ws.rs.core,
- com.sun.jersey.api.core,
- com.sun.jersey.spi.container.servlet,
- com.sun.jersey.server.impl.container.servlet,
- com.fasterxml.jackson.databind,
- com.fasterxml.jackson.databind.node,
- com.fasterxml.jackson.core,
- org.apache.karaf.shell.commands,
- org.apache.commons.lang.math.*,
- com.google.common.*,
- org.onlab.packet.*,
- org.onlab.rest.*,
- org.onosproject.*,
- org.onlab.util.*,
- org.jboss.netty.util.*
- </Import-Package>
- <Web-ContextPath>${web.context}</Web-ContextPath>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project> \ No newline at end of file
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
deleted file mode 100644
index f7e97d5d..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FloatingIpWebResource.java
+++ /dev/null
@@ -1,285 +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.vtnweb.resources;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
-import static javax.ws.rs.core.Response.Status.CREATED;
-import static javax.ws.rs.core.Response.Status.CONFLICT;
-import static javax.ws.rs.core.Response.Status.NO_CONTENT;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.DefaultFloatingIp;
-import org.onosproject.vtnrsc.FloatingIp;
-import org.onosproject.vtnrsc.FloatingIpId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.FloatingIp.Status;
-import org.onosproject.vtnrsc.floatingip.FloatingIpService;
-import org.onosproject.vtnweb.web.FloatingIpCodec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Sets;
-
-@Path("floatingips")
-public class FloatingIpWebResource extends AbstractWebResource {
- private final Logger log = LoggerFactory
- .getLogger(FloatingIpWebResource.class);
- public static final String CREATE_FAIL = "Floating IP is failed to create!";
- public static final String UPDATE_FAIL = "Floating IP is failed to update!";
- public static final String GET_FAIL = "Floating IP is failed to get!";
- public static final String NOT_EXIST = "Floating IP does not exist!";
- public static final String DELETE_SUCCESS = "Floating IP delete success!";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response listFloatingIps() {
- Collection<FloatingIp> floatingIps = get(FloatingIpService.class)
- .getFloatingIps();
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("floatingips",
- new FloatingIpCodec().encode(floatingIps, this));
- return ok(result.toString()).build();
- }
-
- @GET
- @Path("{floatingIpUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getFloatingIp(@PathParam("floatingIpUUID") String id,
- @QueryParam("fields") List<String> fields) {
-
- if (!get(FloatingIpService.class).exists(FloatingIpId.of(id))) {
- return Response.status(NOT_FOUND).entity(NOT_EXIST).build();
- }
- FloatingIp sub = nullIsNotFound(get(FloatingIpService.class)
- .getFloatingIp(FloatingIpId.of(id)), GET_FAIL);
-
- ObjectNode result = new ObjectMapper().createObjectNode();
- if (fields.size() > 0) {
- result.set("floatingip",
- new FloatingIpCodec().extracFields(sub, this, fields));
- } else {
- result.set("floatingip", new FloatingIpCodec().encode(sub, this));
- }
- return ok(result.toString()).build();
- }
-
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response createFloatingIp(final InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Collection<FloatingIp> floatingIps = createOrUpdateByInputStream(subnode);
- Boolean result = nullIsNotFound((get(FloatingIpService.class)
- .createFloatingIps(floatingIps)),
- CREATE_FAIL);
- if (!result) {
- return Response.status(CONFLICT).entity(CREATE_FAIL).build();
- }
- return Response.status(CREATED).entity(result.toString()).build();
-
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @PUT
- @Path("{floatingIpUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updateFloatingIp(@PathParam("floatingIpUUID") String id,
- final InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Collection<FloatingIp> floatingIps = createOrUpdateByInputStream(subnode);
- Boolean result = nullIsNotFound(get(FloatingIpService.class)
- .updateFloatingIps(floatingIps), UPDATE_FAIL);
- if (!result) {
- return Response.status(CONFLICT).entity(UPDATE_FAIL).build();
- }
- return ok(result.toString()).build();
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @Path("{floatingIpUUID}")
- @DELETE
- public Response deleteSingleFloatingIp(@PathParam("floatingIpUUID") String id)
- throws IOException {
- try {
- FloatingIpId floatingIpId = FloatingIpId.of(id);
- Set<FloatingIpId> floatingIpIds = Sets.newHashSet(floatingIpId);
- get(FloatingIpService.class).removeFloatingIps(floatingIpIds);
- return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build();
- } catch (Exception e) {
- return Response.status(NOT_FOUND).entity(e.getMessage()).build();
- }
- }
-
- private Collection<FloatingIp> createOrUpdateByInputStream(JsonNode subnode)
- throws Exception {
- checkNotNull(subnode, JSON_NOT_NULL);
- Collection<FloatingIp> floatingIps = null;
- JsonNode floatingIpNodes = subnode.get("floatingips");
- if (floatingIpNodes == null) {
- floatingIpNodes = subnode.get("floatingip");
- }
- log.debug("floatingNodes is {}", floatingIpNodes.toString());
-
- if (floatingIpNodes.isArray()) {
- throw new IllegalArgumentException("only singleton requests allowed");
- } else {
- floatingIps = changeJsonToSub(floatingIpNodes);
- }
- return floatingIps;
- }
-
- /**
- * Returns a collection of floatingIps from floatingIpNodes.
- *
- * @param floatingIpNodes the floatingIp json node
- * @return floatingIps a collection of floatingIp
- * @throws Exception when any argument is illegal
- */
- public Collection<FloatingIp> changeJsonToSub(JsonNode floatingIpNodes)
- throws Exception {
- checkNotNull(floatingIpNodes, JSON_NOT_NULL);
- Map<FloatingIpId, FloatingIp> subMap = new HashMap<FloatingIpId, FloatingIp>();
- if (!floatingIpNodes.hasNonNull("id")) {
- throw new IllegalArgumentException("id should not be null");
- } else if (floatingIpNodes.get("id").asText().isEmpty()) {
- throw new IllegalArgumentException("id should not be empty");
- }
- FloatingIpId id = FloatingIpId.of(floatingIpNodes.get("id")
- .asText());
-
- if (!floatingIpNodes.hasNonNull("tenant_id")) {
- throw new IllegalArgumentException("tenant_id should not be null");
- } else if (floatingIpNodes.get("tenant_id").asText().isEmpty()) {
- throw new IllegalArgumentException("tenant_id should not be empty");
- }
- TenantId tenantId = TenantId.tenantId(floatingIpNodes.get("tenant_id")
- .asText());
-
- if (!floatingIpNodes.hasNonNull("floating_network_id")) {
- throw new IllegalArgumentException(
- "floating_network_id should not be null");
- } else if (floatingIpNodes.get("floating_network_id").asText()
- .isEmpty()) {
- throw new IllegalArgumentException(
- "floating_network_id should not be empty");
- }
- TenantNetworkId networkId = TenantNetworkId.networkId(floatingIpNodes
- .get("floating_network_id").asText());
-
- VirtualPortId portId = null;
- if (floatingIpNodes.hasNonNull("port_id")) {
- portId = VirtualPortId.portId(floatingIpNodes.get("port_id")
- .asText());
- }
-
- RouterId routerId = null;
- if (floatingIpNodes.hasNonNull("router_id")) {
- routerId = RouterId.valueOf(floatingIpNodes.get("router_id")
- .asText());
- }
-
- IpAddress fixedIp = null;
- if (floatingIpNodes.hasNonNull("fixed_ip_address")) {
- fixedIp = IpAddress.valueOf(floatingIpNodes.get("fixed_ip_address")
- .asText());
- }
-
- if (!floatingIpNodes.hasNonNull("floating_ip_address")) {
- throw new IllegalArgumentException(
- "floating_ip_address should not be null");
- } else if (floatingIpNodes.get("floating_ip_address").asText()
- .isEmpty()) {
- throw new IllegalArgumentException(
- "floating_ip_address should not be empty");
- }
- IpAddress floatingIp = IpAddress.valueOf(floatingIpNodes
- .get("floating_ip_address").asText());
-
- if (!floatingIpNodes.hasNonNull("status")) {
- throw new IllegalArgumentException("status should not be null");
- } else if (floatingIpNodes.get("status").asText().isEmpty()) {
- throw new IllegalArgumentException("status should not be empty");
- }
- Status status = Status.valueOf(floatingIpNodes.get("status").asText());
-
- DefaultFloatingIp floatingIpObj = new DefaultFloatingIp(id, tenantId,
- networkId,
- portId,
- routerId,
- floatingIp,
- fixedIp, status);
- subMap.put(id, floatingIpObj);
- return Collections.unmodifiableCollection(subMap.values());
- }
-
- /**
- * Returns the specified item if that items is null; otherwise throws not
- * found exception.
- *
- * @param item item to check
- * @param <T> item type
- * @param message not found message
- * @return item if not null
- * @throws org.onlab.util.ItemNotFoundException if item is null
- */
- protected <T> T nullIsNotFound(T item, String message) {
- if (item == null) {
- throw new ItemNotFoundException(message);
- }
- return item;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java
deleted file mode 100644
index 4fd3fa48..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/FlowClassifierWebResource.java
+++ /dev/null
@@ -1,164 +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.vtnweb.resources;
-
-import static javax.ws.rs.core.Response.Status.OK;
-import static org.onlab.util.Tools.nullIsNotFound;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Query and program flow classifier.
- */
-@Path("flow_classifiers")
-public class FlowClassifierWebResource extends AbstractWebResource {
-
- private final Logger log = LoggerFactory.getLogger(FlowClassifierWebResource.class);
-
- public static final String FLOW_CLASSIFIER_NOT_FOUND = "Flow classifier not found";
-
- /**
- * Get all flow classifiers created.
- *
- * @return 200 OK
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getFlowClassifiers() {
- Iterable<FlowClassifier> flowClassifiers = get(FlowClassifierService.class).getFlowClassifiers();
- ObjectNode result = mapper().createObjectNode();
- ArrayNode flowClassifierEntry = result.putArray("flow_classifiers");
- if (flowClassifiers != null) {
- for (final FlowClassifier flowClassifier : flowClassifiers) {
- flowClassifierEntry.add(codec(FlowClassifier.class).encode(flowClassifier, this));
- }
- }
- return ok(result.toString()).build();
- }
-
- /**
- * Get details of a flow classifier.
- *
- * @param id
- * flow classifier id
- * @return 200 OK , 404 if given identifier does not exist
- */
- @GET
- @Path("{flow_id}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getFlowClassifier(@PathParam("flow_id") String id) {
- FlowClassifier flowClassifier = nullIsNotFound(get(FlowClassifierService.class)
- .getFlowClassifier(FlowClassifierId.of(id)), FLOW_CLASSIFIER_NOT_FOUND);
-
- ObjectNode result = mapper().createObjectNode();
- result.set("flow_classifier", codec(FlowClassifier.class).encode(flowClassifier, this));
-
- return ok(result.toString()).build();
- }
-
- /**
- * Creates and stores a new flow classifier.
- *
- * @param stream
- * flow classifier from JSON
- * @return status of the request - CREATED if the JSON is correct,
- * BAD_REQUEST if the JSON is invalid
- */
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response createFlowClassifier(InputStream stream) {
- try {
- ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- JsonNode flow = jsonTree.get("flow_classifier");
-
- FlowClassifier flowClassifier = codec(FlowClassifier.class).decode((ObjectNode) flow, this);
- Boolean issuccess = nullIsNotFound(get(FlowClassifierService.class).createFlowClassifier(flowClassifier),
- FLOW_CLASSIFIER_NOT_FOUND);
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (IOException ex) {
- log.error("Exception while creating flow classifier {}.", ex.toString());
- throw new IllegalArgumentException(ex);
- }
- }
-
- /**
- * Update details of a flow classifier.
- *
- * @param id
- * flow classifier id
- * @param stream
- * InputStream
- * @return 200 OK, 404 if given identifier does not exist
- */
- @PUT
- @Path("{flow_id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updateFlowClassifier(@PathParam("flow_id") String id, final InputStream stream) {
- try {
-
- JsonNode jsonTree = mapper().readTree(stream);
- JsonNode flow = jsonTree.get("flow_classifier");
- FlowClassifier flowClassifier = codec(FlowClassifier.class).decode((ObjectNode) flow, this);
- Boolean result = nullIsNotFound(get(FlowClassifierService.class).updateFlowClassifier(flowClassifier),
- FLOW_CLASSIFIER_NOT_FOUND);
- return Response.status(OK).entity(result.toString()).build();
- } catch (IOException e) {
- log.error("Update flow classifier failed because of exception {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Delete details of a flow classifier.
- *
- * @param id
- * flow classifier id
- */
- @Path("{flow_id}")
- @DELETE
- public void deleteFlowClassifier(@PathParam("flow_id") String id) {
- log.debug("Deletes flow classifier by identifier {}.", id);
- FlowClassifierId flowClassifierId = FlowClassifierId.of(id);
- Boolean issuccess = nullIsNotFound(get(FlowClassifierService.class).removeFlowClassifier(flowClassifierId),
- FLOW_CLASSIFIER_NOT_FOUND);
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java
deleted file mode 100644
index e7b908b7..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortChainWebResource.java
+++ /dev/null
@@ -1,162 +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.vtnweb.resources;
-
-import static javax.ws.rs.core.Response.Status.OK;
-import static org.onlab.util.Tools.nullIsNotFound;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Query and program port chain.
- */
-
-@Path("port_chains")
-public class PortChainWebResource extends AbstractWebResource {
-
- private final Logger log = LoggerFactory.getLogger(PortChainWebResource.class);
- public static final String PORT_CHAIN_NOT_FOUND = "Port chain not found";
- public static final String PORT_CHAIN_ID_EXIST = "Port chain exists";
- public static final String PORT_CHAIN_ID_NOT_EXIST = "Port chain does not exist with identifier";
-
- /**
- * Get details of all port chains created.
- *
- * @return 200 OK
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortChains() {
- Iterable<PortChain> portChains = get(PortChainService.class).getPortChains();
- ObjectNode result = mapper().createObjectNode();
- ArrayNode portChainEntry = result.putArray("port_chains");
- if (portChains != null) {
- for (final PortChain portChain : portChains) {
- portChainEntry.add(codec(PortChain.class).encode(portChain, this));
- }
- }
- return ok(result.toString()).build();
- }
-
- /**
- * Get details of a specified port chain id.
- *
- * @param id port chain id
- * @return 200 OK, 404 if given identifier does not exist
- */
- @GET
- @Path("{chain_id}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortPain(@PathParam("chain_id") String id) {
-
- PortChain portChain = nullIsNotFound(get(PortChainService.class).getPortChain(PortChainId.of(id)),
- PORT_CHAIN_NOT_FOUND);
- ObjectNode result = mapper().createObjectNode();
- result.set("port_chain", codec(PortChain.class).encode(portChain, this));
- return ok(result.toString()).build();
- }
-
- /**
- * Creates a new port chain.
- *
- * @param stream port chain from JSON
- * @return status of the request - CREATED if the JSON is correct,
- * BAD_REQUEST if the JSON is invalid
- */
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response createPortChain(InputStream stream) {
- try {
- ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- JsonNode port = jsonTree.get("port_chain");
- PortChain portChain = codec(PortChain.class).decode((ObjectNode) port, this);
- Boolean issuccess = nullIsNotFound(get(PortChainService.class).createPortChain(portChain),
- PORT_CHAIN_NOT_FOUND);
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (IOException e) {
- log.error("Exception while creating port chain {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Update details of a specified port chain id.
- *
- * @param id port chain id
- * @param stream port chain json
- * @return 200 OK, 404 if given identifier does not exist
- */
- @PUT
- @Path("{chain_id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updatePortPain(@PathParam("chain_id") String id,
- final InputStream stream) {
- try {
- ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- JsonNode port = jsonTree.get("port_chain");
- PortChain portChain = codec(PortChain.class).decode((ObjectNode) port, this);
- Boolean result = nullIsNotFound(get(PortChainService.class).updatePortChain(portChain),
- PORT_CHAIN_NOT_FOUND);
- return Response.status(OK).entity(result.toString()).build();
- } catch (IOException e) {
- log.error("Update port chain failed because of exception {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Delete details of a specified port chain id.
- *
- * @param id port chain id
- */
- @Path("{chain_id}")
- @DELETE
- public void deletePortPain(@PathParam("chain_id") String id) {
- log.debug("Deletes port chain by identifier {}.", id);
- PortChainId portChainId = PortChainId.of(id);
-
- Boolean issuccess = nullIsNotFound(get(PortChainService.class).removePortChain(portChainId),
- PORT_CHAIN_NOT_FOUND);
- if (!issuccess) {
- log.debug("Port Chain identifier {} does not exist", id);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
deleted file mode 100644
index dc5328a2..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairGroupWebResource.java
+++ /dev/null
@@ -1,168 +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.vtnweb.resources;
-
-import static javax.ws.rs.core.Response.Status.OK;
-import static org.onlab.util.Tools.nullIsNotFound;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Query and program port pair group.
- */
-
-@Path("port_pair_groups")
-public class PortPairGroupWebResource extends AbstractWebResource {
-
- private final Logger log = LoggerFactory.getLogger(PortPairGroupWebResource.class);
- public static final String PORT_PAIR_GROUP_NOT_FOUND = "Port pair group not found";
- public static final String PORT_PAIR_GROUP_ID_EXIST = "Port pair group exists";
- public static final String PORT_PAIR_GROUP_ID_NOT_EXIST = "Port pair group does not exist with identifier";
-
- /**
- * Get details of all port pair groups created.
- *
- * @return 200 OK
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortPairGroups() {
- Iterable<PortPairGroup> portPairGroups = get(PortPairGroupService.class).getPortPairGroups();
- ObjectNode result = mapper().createObjectNode();
- ArrayNode portPairGroupEntry = result.putArray("port_pair_groups");
- if (portPairGroups != null) {
- for (final PortPairGroup portPairGroup : portPairGroups) {
- portPairGroupEntry.add(codec(PortPairGroup.class).encode(portPairGroup, this));
- }
- }
- return ok(result.toString()).build();
- }
-
- /**
- * Get details of a specified port pair group id.
- *
- * @param id port pair group id
- * @return 200 OK, 404 if given identifier does not exist
- */
- @GET
- @Path("{group_id}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortPairGroup(@PathParam("group_id") String id) {
- PortPairGroup portPairGroup = nullIsNotFound(get(PortPairGroupService.class)
- .getPortPairGroup(PortPairGroupId.of(id)),
- PORT_PAIR_GROUP_NOT_FOUND);
-
- ObjectNode result = mapper().createObjectNode();
- result.set("port_pair_group", codec(PortPairGroup.class).encode(portPairGroup, this));
- return ok(result.toString()).build();
- }
-
- /**
- * Creates a new port pair group.
- *
- * @param stream port pair group from JSON
- * @return status of the request - CREATED if the JSON is correct,
- * BAD_REQUEST if the JSON is invalid
- */
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response createPortPairGroup(InputStream stream) {
-
- try {
- ObjectMapper mapper = new ObjectMapper();
- ObjectNode jsonTree = (ObjectNode) mapper.readTree(stream);
- JsonNode port = jsonTree.get("port_pair_group");
-
- PortPairGroup portPairGroup = codec(PortPairGroup.class).decode((ObjectNode) port, this);
- Boolean issuccess = nullIsNotFound(get(PortPairGroupService.class).createPortPairGroup(portPairGroup),
- PORT_PAIR_GROUP_NOT_FOUND);
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (IOException e) {
- log.error("Exception while creating port pair group {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Update details of a specified port pair group id.
- *
- * @param id port pair group id
- * @param stream port pair group from json
- * @return 200 OK, 404 if given identifier does not exist
- */
- @PUT
- @Path("{group_id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updatePortPairGroup(@PathParam("group_id") String id,
- final InputStream stream) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- ObjectNode jsonTree = (ObjectNode) mapper.readTree(stream);
- JsonNode port = jsonTree.get("port_pair_group");
- PortPairGroup portPairGroup = codec(PortPairGroup.class).decode((ObjectNode) port, this);
- Boolean isSuccess = nullIsNotFound(get(PortPairGroupService.class).updatePortPairGroup(portPairGroup),
- PORT_PAIR_GROUP_NOT_FOUND);
- return Response.status(OK).entity(isSuccess.toString()).build();
- } catch (IOException e) {
- log.error("Update port pair group failed because of exception {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Delete details of a specified port pair group id.
- *
- * @param id port pair group id
- */
- @Path("{group_id}")
- @DELETE
- public void deletePortPairGroup(@PathParam("group_id") String id) {
- log.debug("Deletes port pair group by identifier {}.", id);
- PortPairGroupId portPairGroupId = PortPairGroupId.of(id);
- Boolean issuccess = nullIsNotFound(get(PortPairGroupService.class).removePortPairGroup(portPairGroupId),
- PORT_PAIR_GROUP_NOT_FOUND);
- if (!issuccess) {
- log.debug("Port pair group identifier {} does not exist", id);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java
deleted file mode 100644
index 4ed8ecd8..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/PortPairWebResource.java
+++ /dev/null
@@ -1,159 +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.vtnweb.resources;
-
-import static javax.ws.rs.core.Response.Status.OK;
-import static org.onlab.util.Tools.nullIsNotFound;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Query and program port pair.
- */
-@Path("port_pairs")
-public class PortPairWebResource extends AbstractWebResource {
-
- private final Logger log = LoggerFactory.getLogger(PortPairWebResource.class);
- public static final String PORT_PAIR_NOT_FOUND = "Port pair not found";
- public static final String PORT_PAIR_ID_EXIST = "Port pair exists";
- public static final String PORT_PAIR_ID_NOT_EXIST = "Port pair does not exist with identifier";
-
- /**
- * Get details of all port pairs created.
- *
- * @return 200 OK
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortPairs() {
- Iterable<PortPair> portPairs = get(PortPairService.class).getPortPairs();
- ObjectNode result = mapper().createObjectNode();
- ArrayNode portPairEntry = result.putArray("port_pairs");
- if (portPairs != null) {
- for (final PortPair portPair : portPairs) {
- portPairEntry.add(codec(PortPair.class).encode(portPair, this));
- }
- }
- return ok(result.toString()).build();
- }
-
- /**
- * Get details of a specified port pair id.
- *
- * @param id port pair id
- * @return 200 OK, 404 if given identifier does not exist
- */
- @GET
- @Path("{pair_id}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getPortPair(@PathParam("pair_id") String id) {
- PortPair portPair = nullIsNotFound(get(PortPairService.class).getPortPair(PortPairId.of(id)),
- PORT_PAIR_NOT_FOUND);
- ObjectNode result = mapper().createObjectNode();
- result.set("port_pair", codec(PortPair.class).encode(portPair, this));
- return ok(result.toString()).build();
- }
-
- /**
- * Creates a new port pair.
- *
- * @param stream port pair from JSON
- * @return status of the request - CREATED if the JSON is correct,
- * BAD_REQUEST if the JSON is invalid
- */
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response createPortPair(InputStream stream) {
- try {
- ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- JsonNode port = jsonTree.get("port_pair");
- PortPair portPair = codec(PortPair.class).decode((ObjectNode) port, this);
- Boolean isSuccess = nullIsNotFound(get(PortPairService.class).createPortPair(portPair),
- PORT_PAIR_NOT_FOUND);
- return Response.status(OK).entity(isSuccess.toString()).build();
- } catch (IOException e) {
- log.error("Exception while creating port pair {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Update details of a specified port pair id.
- *
- * @param id port pair id
- * @param stream port pair from json
- * @return 200 OK, 404 if the given identifier does not exist
- */
- @PUT
- @Path("{pair_id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updatePortPair(@PathParam("pair_id") String id,
- final InputStream stream) {
- try {
- ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
- JsonNode port = jsonTree.get("port_pair");
- PortPair portPair = codec(PortPair.class).decode((ObjectNode) port, this);
- Boolean isSuccess = nullIsNotFound(get(PortPairService.class).updatePortPair(portPair),
- PORT_PAIR_NOT_FOUND);
- return Response.status(OK).entity(isSuccess.toString()).build();
- } catch (IOException e) {
- log.error("Update port pair failed because of exception {}.", e.toString());
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * Delete details of a specified port pair id.
- *
- * @param id port pair id
- */
- @Path("{pair_id}")
- @DELETE
- public void deletePortPair(@PathParam("pair_id") String id) {
-
- PortPairId portPairId = PortPairId.of(id);
- Boolean isSuccess = nullIsNotFound(get(PortPairService.class).removePortPair(portPairId), PORT_PAIR_NOT_FOUND);
- if (!isSuccess) {
- log.debug("Port pair identifier {} does not exist", id);
- }
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
deleted file mode 100644
index 6f80dd15..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/RouterWebResource.java
+++ /dev/null
@@ -1,447 +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.vtnweb.resources;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
-import static javax.ws.rs.core.Response.Status.CONFLICT;
-import static javax.ws.rs.core.Response.Status.CREATED;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
-import static javax.ws.rs.core.Response.Status.NO_CONTENT;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.DefaultRouter;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.Router;
-import org.onosproject.vtnrsc.Router.Status;
-import org.onosproject.vtnrsc.RouterGateway;
-import org.onosproject.vtnrsc.RouterId;
-import org.onosproject.vtnrsc.RouterInterface;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.router.RouterService;
-import org.onosproject.vtnrsc.routerinterface.RouterInterfaceService;
-import org.onosproject.vtnweb.web.RouterCodec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-@Path("routers")
-public class RouterWebResource extends AbstractWebResource {
- private final Logger log = LoggerFactory.getLogger(RouterWebResource.class);
- public static final String CREATE_FAIL = "Router is failed to create!";
- public static final String UPDATE_FAIL = "Router is failed to update!";
- public static final String GET_FAIL = "Router is failed to get!";
- public static final String NOT_EXIST = "Router does not exist!";
- public static final String DELETE_SUCCESS = "Router delete success!";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
- public static final String INTFACR_ADD_SUCCESS = "Interface add success";
- public static final String INTFACR_DEL_SUCCESS = "Interface delete success";
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response listRouters() {
- Collection<Router> routers = get(RouterService.class).getRouters();
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("routers", new RouterCodec().encode(routers, this));
- return ok(result.toString()).build();
- }
-
- @GET
- @Path("{routerUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getRouter(@PathParam("routerUUID") String id,
- @QueryParam("fields") List<String> fields) {
-
- if (!get(RouterService.class).exists(RouterId.valueOf(id))) {
- return Response.status(NOT_FOUND)
- .entity("The Router does not exists").build();
- }
- Router sub = nullIsNotFound(get(RouterService.class)
- .getRouter(RouterId.valueOf(id)),
- NOT_EXIST);
-
- ObjectNode result = new ObjectMapper().createObjectNode();
- if (fields.size() > 0) {
- result.set("router",
- new RouterCodec().extracFields(sub, this, fields));
- } else {
- result.set("router", new RouterCodec().encode(sub, this));
- }
- return ok(result.toString()).build();
- }
-
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response createRouter(final InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Collection<Router> routers = createOrUpdateByInputStream(subnode);
-
- Boolean result = nullIsNotFound((get(RouterService.class)
- .createRouters(routers)),
- CREATE_FAIL);
- if (!result) {
- return Response.status(CONFLICT).entity(CREATE_FAIL).build();
- }
- return Response.status(CREATED).entity(result.toString()).build();
-
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @PUT
- @Path("{routerUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updateRouter(@PathParam("routerUUID") String id,
- final InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Collection<Router> routers = createOrUpdateByInputStream(subnode);
- Boolean result = nullIsNotFound(get(RouterService.class)
- .updateRouters(routers), UPDATE_FAIL);
- if (!result) {
- return Response.status(CONFLICT).entity(UPDATE_FAIL).build();
- }
- return ok(result.toString()).build();
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @Path("{routerUUID}")
- @DELETE
- public Response deleteSingleRouter(@PathParam("routerUUID") String id)
- throws IOException {
- try {
- RouterId routerId = RouterId.valueOf(id);
- Set<RouterId> routerIds = Sets.newHashSet(routerId);
- get(RouterService.class).removeRouters(routerIds);
- return Response.status(NO_CONTENT).entity(DELETE_SUCCESS).build();
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @PUT
- @Path("{routerUUID}/add_router_interface")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response addRouterInterface(@PathParam("routerUUID") String id,
- final InputStream input) {
- if (!get(RouterService.class).exists(RouterId.valueOf(id))) {
- return Response.status(NOT_FOUND).entity(NOT_EXIST).build();
- }
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- if (!subnode.hasNonNull("id")) {
- throw new IllegalArgumentException("id should not be null");
- } else if (subnode.get("id").asText().isEmpty()) {
- throw new IllegalArgumentException("id should not be empty");
- }
- RouterId routerId = RouterId.valueOf(id);
- if (!subnode.hasNonNull("subnet_id")) {
- throw new IllegalArgumentException("subnet_id should not be null");
- } else if (subnode.get("subnet_id").asText().isEmpty()) {
- throw new IllegalArgumentException("subnet_id should not be empty");
- }
- SubnetId subnetId = SubnetId.subnetId(subnode.get("subnet_id")
- .asText());
- if (!subnode.hasNonNull("tenant_id")) {
- throw new IllegalArgumentException("tenant_id should not be null");
- } else if (subnode.get("tenant_id").asText().isEmpty()) {
- throw new IllegalArgumentException("tenant_id should not be empty");
- }
- TenantId tenentId = TenantId.tenantId(subnode.get("tenant_id")
- .asText());
- if (!subnode.hasNonNull("port_id")) {
- throw new IllegalArgumentException("port_id should not be null");
- } else if (subnode.get("port_id").asText().isEmpty()) {
- throw new IllegalArgumentException("port_id should not be empty");
- }
- VirtualPortId portId = VirtualPortId.portId(subnode.get("port_id")
- .asText());
- RouterInterface routerInterface = RouterInterface
- .routerInterface(subnetId, portId, routerId, tenentId);
- get(RouterInterfaceService.class)
- .addRouterInterface(routerInterface);
- return ok(INTFACR_ADD_SUCCESS).build();
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- @PUT
- @Path("{routerUUID}/remove_router_interface")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response removeRouterInterface(@PathParam("routerUUID") String id,
- final InputStream input) {
- if (!get(RouterService.class).exists(RouterId.valueOf(id))) {
- return Response.status(NOT_FOUND).entity(NOT_EXIST).build();
- }
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- if (!subnode.hasNonNull("id")) {
- throw new IllegalArgumentException("id should not be null");
- } else if (subnode.get("id").asText().isEmpty()) {
- throw new IllegalArgumentException("id should not be empty");
- }
- RouterId routerId = RouterId.valueOf(id);
- if (!subnode.hasNonNull("subnet_id")) {
- throw new IllegalArgumentException("subnet_id should not be null");
- } else if (subnode.get("subnet_id").asText().isEmpty()) {
- throw new IllegalArgumentException("subnet_id should not be empty");
- }
- SubnetId subnetId = SubnetId.subnetId(subnode.get("subnet_id")
- .asText());
- if (!subnode.hasNonNull("port_id")) {
- throw new IllegalArgumentException("port_id should not be null");
- } else if (subnode.get("port_id").asText().isEmpty()) {
- throw new IllegalArgumentException("port_id should not be empty");
- }
- VirtualPortId portId = VirtualPortId.portId(subnode.get("port_id")
- .asText());
- if (!subnode.hasNonNull("tenant_id")) {
- throw new IllegalArgumentException("tenant_id should not be null");
- } else if (subnode.get("tenant_id").asText().isEmpty()) {
- throw new IllegalArgumentException("tenant_id should not be empty");
- }
- TenantId tenentId = TenantId.tenantId(subnode.get("tenant_id")
- .asText());
- RouterInterface routerInterface = RouterInterface
- .routerInterface(subnetId, portId, routerId, tenentId);
- get(RouterInterfaceService.class)
- .removeRouterInterface(routerInterface);
- return ok(INTFACR_DEL_SUCCESS).build();
- } catch (Exception e) {
- return Response.status(BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- private Collection<Router> createOrUpdateByInputStream(JsonNode subnode)
- throws Exception {
- checkNotNull(subnode, JSON_NOT_NULL);
- JsonNode routerNode = subnode.get("routers");
- if (routerNode == null) {
- routerNode = subnode.get("router");
- }
- log.debug("routerNode is {}", routerNode.toString());
-
- if (routerNode.isArray()) {
- throw new Exception("only singleton requests allowed");
- } else {
- return changeJsonToSub(routerNode);
- }
- }
-
- /**
- * Returns a collection of floatingIps from floatingIpNodes.
- *
- * @param routerNode the router json node
- * @return routers a collection of router
- * @throws Exception when any argument is illegal
- */
- public Collection<Router> changeJsonToSub(JsonNode routerNode)
- throws Exception {
- checkNotNull(routerNode, JSON_NOT_NULL);
- Map<RouterId, Router> subMap = new HashMap<RouterId, Router>();
- if (!routerNode.hasNonNull("id")) {
- new IllegalArgumentException("id should not be null");
- } else if (routerNode.get("id").asText().isEmpty()) {
- throw new IllegalArgumentException("id should not be empty");
- }
- RouterId id = RouterId.valueOf(routerNode.get("id").asText());
-
- if (!routerNode.hasNonNull("tenant_id")) {
- throw new IllegalArgumentException("tenant_id should not be null");
- } else if (routerNode.get("tenant_id").asText().isEmpty()) {
- throw new IllegalArgumentException("tenant_id should not be empty");
- }
- TenantId tenantId = TenantId.tenantId(routerNode.get("tenant_id")
- .asText());
-
- VirtualPortId gwPortId = null;
- if (routerNode.hasNonNull("gw_port_id")) {
- gwPortId = VirtualPortId.portId(routerNode.get("gw_port_id")
- .asText());
- }
-
- if (!routerNode.hasNonNull("status")) {
- throw new IllegalArgumentException("status should not be null");
- } else if (routerNode.get("status").asText().isEmpty()) {
- throw new IllegalArgumentException("status should not be empty");
- }
- Status status = Status.valueOf(routerNode.get("status").asText());
-
- String routerName = null;
- if (routerNode.hasNonNull("name")) {
- routerName = routerNode.get("name").asText();
- }
-
- boolean adminStateUp = true;
- checkArgument(routerNode.get("admin_state_up").isBoolean(),
- "admin_state_up should be boolean");
- if (routerNode.hasNonNull("admin_state_up")) {
- adminStateUp = routerNode.get("admin_state_up").asBoolean();
- }
- boolean distributed = false;
- if (routerNode.hasNonNull("distributed")) {
- distributed = routerNode.get("distributed").asBoolean();
- }
- RouterGateway gateway = null;
- if (routerNode.hasNonNull("external_gateway_info")) {
- gateway = jsonNodeToGateway(routerNode.get("external_gateway_info"));
- }
- List<String> routes = new ArrayList<String>();
- DefaultRouter routerObj = new DefaultRouter(id, routerName,
- adminStateUp, status,
- distributed, gateway,
- gwPortId, tenantId, routes);
- subMap.put(id, routerObj);
- return Collections.unmodifiableCollection(subMap.values());
- }
-
- /**
- * Changes JsonNode Gateway to the Gateway.
- *
- * @param gateway the gateway JsonNode
- * @return gateway
- */
- private RouterGateway jsonNodeToGateway(JsonNode gateway) {
- checkNotNull(gateway, JSON_NOT_NULL);
- if (!gateway.hasNonNull("network_id")) {
- throw new IllegalArgumentException("network_id should not be null");
- } else if (gateway.get("network_id").asText().isEmpty()) {
- throw new IllegalArgumentException("network_id should not be empty");
- }
- TenantNetworkId networkId = TenantNetworkId.networkId(gateway
- .get("network_id").asText());
-
- if (!gateway.hasNonNull("enable_snat")) {
- throw new IllegalArgumentException("enable_snat should not be null");
- } else if (gateway.get("enable_snat").asText().isEmpty()) {
- throw new IllegalArgumentException("enable_snat should not be empty");
- }
- checkArgument(gateway.get("enable_snat").isBoolean(),
- "enable_snat should be boolean");
- boolean enableSnat = gateway.get("enable_snat").asBoolean();
-
- if (!gateway.hasNonNull("external_fixed_ips")) {
- throw new IllegalArgumentException(
- "external_fixed_ips should not be null");
- } else if (gateway.get("external_fixed_ips").isNull()) {
- throw new IllegalArgumentException(
- "external_fixed_ips should not be empty");
- }
- Collection<FixedIp> fixedIpList = jsonNodeToFixedIp(gateway
- .get("external_fixed_ips"));
- RouterGateway gatewayObj = RouterGateway.routerGateway(networkId,
- enableSnat,
- fixedIpList);
- return gatewayObj;
- }
-
- /**
- * Changes JsonNode fixedIp to a collection of the fixedIp.
- *
- * @param fixedIp the allocationPools JsonNode
- * @return a collection of fixedIp
- */
- private Collection<FixedIp> jsonNodeToFixedIp(JsonNode fixedIp) {
- checkNotNull(fixedIp, JSON_NOT_NULL);
- ConcurrentMap<Integer, FixedIp> fixedIpMaps = Maps.newConcurrentMap();
- Integer i = 0;
- for (JsonNode node : fixedIp) {
- if (!node.hasNonNull("subnet_id")) {
- throw new IllegalArgumentException("subnet_id should not be null");
- } else if (node.get("subnet_id").asText().isEmpty()) {
- throw new IllegalArgumentException("subnet_id should not be empty");
- }
- SubnetId subnetId = SubnetId.subnetId(node.get("subnet_id")
- .asText());
- if (!node.hasNonNull("ip_address")) {
- throw new IllegalArgumentException("ip_address should not be null");
- } else if (node.get("ip_address").asText().isEmpty()) {
- throw new IllegalArgumentException("ip_address should not be empty");
- }
- IpAddress ipAddress = IpAddress.valueOf(node.get("ip_address")
- .asText());
- FixedIp fixedIpObj = FixedIp.fixedIp(subnetId, ipAddress);
-
- fixedIpMaps.putIfAbsent(i, fixedIpObj);
- i++;
- }
- return Collections.unmodifiableCollection(fixedIpMaps.values());
- }
-
- /**
- * Returns the specified item if that items is null; otherwise throws not
- * found exception.
- *
- * @param item item to check
- * @param <T> item type
- * @param message not found message
- * @return item if not null
- * @throws org.onlab.util.ItemNotFoundException if item is null
- */
- protected <T> T nullIsNotFound(T item, String message) {
- if (item == null) {
- throw new ItemNotFoundException(message);
- }
- return item;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
deleted file mode 100644
index 0cc59a4e..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/SubnetWebResource.java
+++ /dev/null
@@ -1,379 +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.vtnweb.resources;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpAddress.Version;
-import org.onlab.packet.IpPrefix;
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.AllocationPool;
-import org.onosproject.vtnrsc.DefaultAllocationPool;
-import org.onosproject.vtnrsc.DefaultHostRoute;
-import org.onosproject.vtnrsc.DefaultSubnet;
-import org.onosproject.vtnrsc.HostRoute;
-import org.onosproject.vtnrsc.Subnet;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.Subnet.Mode;
-import org.onosproject.vtnrsc.subnet.SubnetService;
-import org.onosproject.vtnweb.web.SubnetCodec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-@Path("subnets")
-public class SubnetWebResource extends AbstractWebResource {
- private final Logger log = LoggerFactory.getLogger(SubnetWebResource.class);
- public static final String SUBNET_NOT_CREATED = "Subnet failed to create!";
- public static final String SUBNET_NOT_FOUND = "Subnet is not found";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- public Response listSubnets() {
- Iterable<Subnet> subnets = get(SubnetService.class).getSubnets();
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("subnets", new SubnetCodec().encode(subnets, this));
- return ok(result.toString()).build();
- }
-
- @GET
- @Path("{subnetUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response getSubnet(@PathParam("subnetUUID") String id) {
-
- if (!get(SubnetService.class).exists(SubnetId.subnetId(id))) {
- return Response.status(NOT_FOUND)
- .entity(SUBNET_NOT_FOUND).build();
- }
- Subnet sub = nullIsNotFound(get(SubnetService.class)
- .getSubnet(SubnetId.subnetId(id)),
- SUBNET_NOT_FOUND);
-
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("subnet", new SubnetCodec().encode(sub, this));
- return ok(result.toString()).build();
- }
-
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response createSubnet(final InputStream input) {
-
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Iterable<Subnet> subnets = createOrUpdateByInputStream(subnode);
- Boolean result = nullIsNotFound((get(SubnetService.class)
- .createSubnets(subnets)),
- SUBNET_NOT_CREATED);
-
- if (!result) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(SUBNET_NOT_CREATED).build();
- }
- return Response.status(202).entity(result.toString()).build();
- } catch (Exception e) {
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @PUT
- @Path("{subnetUUID}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updateSubnet(@PathParam("id") String id,
- final InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode subnode = mapper.readTree(input);
- Iterable<Subnet> subnets = createOrUpdateByInputStream(subnode);
- Boolean result = nullIsNotFound(get(SubnetService.class)
- .updateSubnets(subnets), SUBNET_NOT_FOUND);
- if (!result) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(SUBNET_NOT_FOUND).build();
- }
- return Response.status(203).entity(result.toString()).build();
- } catch (Exception e) {
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @Path("{subnetUUID}")
- @DELETE
- public Response deleteSingleSubnet(@PathParam("subnetUUID") String id)
- throws IOException {
- try {
- SubnetId subId = SubnetId.subnetId(id);
- Set<SubnetId> subIds = new HashSet<>();
- subIds.add(subId);
- get(SubnetService.class).removeSubnets(subIds);
- return Response.status(201).entity("SUCCESS").build();
- } catch (Exception e) {
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- private Iterable<Subnet> createOrUpdateByInputStream(JsonNode subnode) {
- checkNotNull(subnode, JSON_NOT_NULL);
- Iterable<Subnet> subnets = null;
- JsonNode subnetNodes = subnode.get("subnets");
- if (subnetNodes == null) {
- subnetNodes = subnode.get("subnet");
- }
- log.debug("subnetNodes is {}", subnetNodes.toString());
- if (subnetNodes.isArray()) {
- subnets = changeJsonToSubs(subnetNodes);
- } else {
- subnets = changeJsonToSub(subnetNodes);
- }
- return subnets;
- }
-
- /**
- * Returns a collection of subnets from subnetNodes.
- *
- * @param subnetNodes the subnet json node
- * @return subnets a collection of subnets
- */
- public Iterable<Subnet> changeJsonToSubs(JsonNode subnetNodes) {
- checkNotNull(subnetNodes, JSON_NOT_NULL);
- Map<SubnetId, Subnet> subMap = new HashMap<>();
- for (JsonNode subnetNode : subnetNodes) {
- if (!subnetNode.hasNonNull("id")) {
- return null;
- }
- SubnetId id = SubnetId.subnetId(subnetNode.get("id").asText());
- String subnetName = subnetNode.get("name").asText();
- TenantId tenantId = TenantId
- .tenantId(subnetNode.get("tenant_id").asText());
- TenantNetworkId networkId = TenantNetworkId
- .networkId(subnetNode.get("network_id").asText());
- String version = subnetNode.get("ip_version").asText();
- Version ipVersion;
- switch (version) {
- case "4":
- ipVersion = Version.INET;
- break;
- case "6":
- ipVersion = Version.INET;
- break;
- default:
- throw new IllegalArgumentException("ipVersion should be 4 or 6.");
- }
- IpPrefix cidr = IpPrefix.valueOf(subnetNode.get("cidr").asText());
- IpAddress gatewayIp = IpAddress
- .valueOf(subnetNode.get("gateway_ip").asText());
- Boolean dhcpEnabled = subnetNode.get("enable_dhcp").asBoolean();
- Boolean shared = subnetNode.get("shared").asBoolean();
- JsonNode hostRoutes = subnetNode.get("host_routes");
- Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes);
- JsonNode allocationPools = subnetNode.get("allocation_pools");
- Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools);
- Mode ipV6AddressMode = Mode
- .valueOf(subnetNode.get("ipv6_address_mode").asText());
- Mode ipV6RaMode = Mode
- .valueOf(subnetNode.get("ipv6_ra_mode").asText());
- Subnet subnet = new DefaultSubnet(id, subnetName, networkId,
- tenantId, ipVersion, cidr,
- gatewayIp, dhcpEnabled, shared,
- Sets.newHashSet(hostRoutesIt), ipV6AddressMode,
- ipV6RaMode, Sets.newHashSet(allocationPoolsIt));
- subMap.put(id, subnet);
- }
- return Collections.unmodifiableCollection(subMap.values());
- }
-
- /**
- * Returns a collection of subnets from subnetNodes.
- *
- * @param subnetNodes the subnet json node
- * @return subnets a collection of subnets
- */
- public Iterable<Subnet> changeJsonToSub(JsonNode subnetNodes) {
- checkNotNull(subnetNodes, JSON_NOT_NULL);
- checkArgument(subnetNodes.get("enable_dhcp").isBoolean(), "enable_dhcp should be boolean");
- checkArgument(subnetNodes.get("shared").isBoolean(), "shared should be boolean");
- Map<SubnetId, Subnet> subMap = new HashMap<>();
- if (!subnetNodes.hasNonNull("id")) {
- return null;
- }
- SubnetId id = SubnetId.subnetId(subnetNodes.get("id").asText());
- String subnetName = subnetNodes.get("name").asText();
- TenantId tenantId = TenantId
- .tenantId(subnetNodes.get("tenant_id").asText());
- TenantNetworkId networkId = TenantNetworkId
- .networkId(subnetNodes.get("network_id").asText());
- String version = subnetNodes.get("ip_version").asText();
- Version ipVersion;
- switch (version) {
- case "4":
- ipVersion = Version.INET;
- break;
- case "6":
- ipVersion = Version.INET;
- break;
- default:
- throw new IllegalArgumentException("ipVersion should be 4 or 6.");
- }
-
- IpPrefix cidr = IpPrefix.valueOf(subnetNodes.get("cidr").asText());
- IpAddress gatewayIp = IpAddress
- .valueOf(subnetNodes.get("gateway_ip").asText());
- Boolean dhcpEnabled = subnetNodes.get("enable_dhcp").asBoolean();
- Boolean shared = subnetNodes.get("shared").asBoolean();
- JsonNode hostRoutes = subnetNodes.get("host_routes");
- Iterable<HostRoute> hostRoutesIt = jsonNodeToHostRoutes(hostRoutes);
- JsonNode allocationPools = subnetNodes.get("allocation_pools");
- Iterable<AllocationPool> allocationPoolsIt = jsonNodeToAllocationPools(allocationPools);
-
- Mode ipV6AddressMode = getMode(subnetNodes.get("ipv6_address_mode")
- .asText());
- Mode ipV6RaMode = getMode(subnetNodes.get("ipv6_ra_mode").asText());
-
- Subnet subnet = new DefaultSubnet(id, subnetName, networkId, tenantId,
- ipVersion, cidr, gatewayIp,
- dhcpEnabled, shared, Sets.newHashSet(hostRoutesIt),
- ipV6AddressMode, ipV6RaMode,
- Sets.newHashSet(allocationPoolsIt));
- subMap.put(id, subnet);
- return Collections.unmodifiableCollection(subMap.values());
- }
-
- /**
- * Gets ipv6_address_mode or ipv6_ra_mode type.
- *
- * @param mode the String value in JsonNode
- * @return ipV6Mode Mode of the ipV6Mode
- */
- private Mode getMode(String mode) {
- Mode ipV6Mode;
- if (mode == null) {
- return null;
- }
- switch (mode) {
- case "dhcpv6-stateful":
- ipV6Mode = Mode.DHCPV6_STATEFUL;
- break;
- case "dhcpv6-stateless":
- ipV6Mode = Mode.DHCPV6_STATELESS;
- break;
- case "slaac":
- ipV6Mode = Mode.SLAAC;
- break;
- default:
- ipV6Mode = null;
- }
- return ipV6Mode;
- }
-
- /**
- * Changes JsonNode alocPools to a collection of the alocPools.
- *
- * @param allocationPools the allocationPools JsonNode
- * @return a collection of allocationPools
- */
- public Iterable<AllocationPool> jsonNodeToAllocationPools(JsonNode allocationPools) {
- checkNotNull(allocationPools, JSON_NOT_NULL);
- ConcurrentMap<Integer, AllocationPool> alocplMaps = Maps
- .newConcurrentMap();
- Integer i = 0;
- for (JsonNode node : allocationPools) {
- IpAddress startIp = IpAddress.valueOf(node.get("start").asText());
- IpAddress endIp = IpAddress.valueOf(node.get("end").asText());
- AllocationPool alocPls = new DefaultAllocationPool(startIp, endIp);
- alocplMaps.putIfAbsent(i, alocPls);
- i++;
- }
- return Collections.unmodifiableCollection(alocplMaps.values());
- }
-
- /**
- * Changes hostRoutes JsonNode to a collection of the hostRoutes.
- *
- * @param hostRoutes the hostRoutes json node
- * @return a collection of hostRoutes
- */
- public Iterable<HostRoute> jsonNodeToHostRoutes(JsonNode hostRoutes) {
- checkNotNull(hostRoutes, JSON_NOT_NULL);
- ConcurrentMap<Integer, HostRoute> hostRouteMaps = Maps
- .newConcurrentMap();
- Integer i = 0;
- for (JsonNode node : hostRoutes) {
- IpAddress nexthop = IpAddress.valueOf(node.get("nexthop").asText());
- IpPrefix destination = IpPrefix.valueOf(node.get("destination")
- .asText());
- HostRoute hostRoute = new DefaultHostRoute(nexthop, destination);
- hostRouteMaps.putIfAbsent(i, hostRoute);
- i++;
- }
- return Collections.unmodifiableCollection(hostRouteMaps.values());
- }
-
- /**
- * Returns the specified item if that items is null; otherwise throws not
- * found exception.
- *
- * @param item item to check
- * @param <T> item type
- * @param message not found message
- * @return item if not null
- * @throws org.onlab.util.ItemNotFoundException if item is null
- */
- protected <T> T nullIsNotFound(T item, String message) {
- if (item == null) {
- throw new ItemNotFoundException(message);
- }
- return item;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java
deleted file mode 100644
index fd2c4790..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/TenantNetworkWebResource.java
+++ /dev/null
@@ -1,364 +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.vtnweb.resources;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkArgument;
-import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
-import static javax.ws.rs.core.Response.Status.OK;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
-
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.DefaultTenantNetwork;
-import org.onosproject.vtnrsc.PhysicalNetwork;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.TenantNetwork.State;
-import org.onosproject.vtnrsc.TenantNetwork.Type;
-import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
-import org.onosproject.vtnweb.web.TenantNetworkCodec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Maps;
-
-/**
- * REST resource for interacting with the inventory of networks.
- */
-@Path("networks")
-public class TenantNetworkWebResource extends AbstractWebResource {
- public static final String NETWORK_NOT_FOUND = "Network is not found";
- public static final String NETWORK_ID_EXIST = "Network id is existed";
- public static final String NETWORK_ID_NOT_EXIST = "Network id is not existed";
- public static final String CREATE_NETWORK = "create network";
- public static final String UPDATE_NETWORK = "update network";
- public static final String DELETE_NETWORK = "delete network";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
-
- protected static final Logger log = LoggerFactory
- .getLogger(TenantNetworkWebResource.class);
- private final ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps
- .newConcurrentMap();
-
- @GET
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getNetworks(@QueryParam("id") String queryId,
- @QueryParam("name") String queryName,
- @QueryParam("admin_state_up") String queryadminStateUp,
- @QueryParam("status") String querystate,
- @QueryParam("shared") String queryshared,
- @QueryParam("tenant_id") String querytenantId,
- @QueryParam("router:external") String routerExternal,
- @QueryParam("provider:network_type") String type,
- @QueryParam("provider:physical_network") String physicalNetwork,
- @QueryParam("provider:segmentation_id") String segmentationId) {
- Iterable<TenantNetwork> networks = get(TenantNetworkService.class)
- .getNetworks();
- Iterator<TenantNetwork> networkors = networks.iterator();
- while (networkors.hasNext()) {
- TenantNetwork network = networkors.next();
- if ((queryId == null || queryId.equals(network.id().toString()))
- && (queryName == null || queryName.equals(network.name()))
- && (queryadminStateUp == null || queryadminStateUp
- .equals(Boolean.toString(network.adminStateUp())))
- && (querystate == null || querystate.equals(network.state()
- .toString()))
- && (queryshared == null || queryshared.equals(Boolean.toString(network
- .shared())))
- && (querytenantId == null || querytenantId.equals(network
- .tenantId().toString()))
- && (routerExternal == null || routerExternal.equals(Boolean.toString(network
- .routerExternal())))
- && (type == null || type.equals(network.type().toString()))
- && (physicalNetwork == null || physicalNetwork
- .equals(network.physicalNetwork().toString()))
- && (segmentationId == null || segmentationId.equals(network
- .segmentationId().toString()))) {
- networksMap.putIfAbsent(network.id(), network);
- }
- }
- networks = Collections.unmodifiableCollection(networksMap.values());
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("networks", new TenantNetworkCodec().encode(networks, this));
-
- return ok(result.toString()).build();
- }
-
- private State isState(String state) {
- if (state.equals("ACTIVE")) {
- return TenantNetwork.State.ACTIVE;
- } else if (state.equals("BUILD")) {
- return TenantNetwork.State.BUILD;
- } else if (state.equals("DOWN")) {
- return TenantNetwork.State.DOWN;
- } else if (state.equals("ERROR")) {
- return TenantNetwork.State.ERROR;
- } else {
- return null;
- }
- }
-
- private Type isType(String type) {
- if (type.equals("LOCAL")) {
- return TenantNetwork.Type.LOCAL;
- } else {
- return null;
- }
- }
-
- @GET
- @Path("{id}")
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getNetwork(@PathParam("id") String id) {
-
- if (!get(TenantNetworkService.class).exists(TenantNetworkId
- .networkId(id))) {
- return Response.status(NOT_FOUND)
- .entity(NETWORK_NOT_FOUND).build();
- }
- TenantNetwork network = nullIsNotFound(get(TenantNetworkService.class)
- .getNetwork(TenantNetworkId.networkId(id)), NETWORK_NOT_FOUND);
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("network", new TenantNetworkCodec().encode(network, this));
-
- return ok(result.toString()).build();
-
- }
-
- @POST
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response createNetworks(InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode cfg = mapper.readTree(input);
- JsonNode nodes = null;
- Iterable<TenantNetwork> networks = null;
- if (cfg.get("network") != null) {
- nodes = cfg.get("network");
- if (nodes.isArray()) {
- networks = changeJson2objs(nodes);
- } else {
- networks = changeJson2obj(CREATE_NETWORK, null, nodes);
- }
- } else if (cfg.get("networks") != null) {
- nodes = cfg.get("networks");
- networks = changeJson2objs(nodes);
- }
- Boolean issuccess = nullIsNotFound((get(TenantNetworkService.class)
- .createNetworks(networks)),
- NETWORK_NOT_FOUND);
-
- if (!issuccess) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(NETWORK_ID_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (Exception e) {
- log.error("Creates tenantNetwork exception {}.", e.toString());
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @PUT
- @Path("{id}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- public Response updateNetworks(@PathParam("id") String id, InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode cfg = mapper.readTree(input);
- JsonNode nodes = null;
- Iterable<TenantNetwork> networks = null;
- if (cfg.get("network") != null) {
- nodes = cfg.get("network");
- if (nodes.isArray()) {
- networks = changeJson2objs(nodes);
- } else {
- networks = changeJson2obj(UPDATE_NETWORK,
- TenantNetworkId.networkId(id),
- nodes);
- }
- } else if (cfg.get("networks") != null) {
- nodes = cfg.get("networks");
- networks = changeJson2objs(nodes);
- }
- Boolean issuccess = nullIsNotFound((get(TenantNetworkService.class)
- .updateNetworks(networks)),
- NETWORK_NOT_FOUND);
- if (!issuccess) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(NETWORK_ID_NOT_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (Exception e) {
- log.error("Updates tenantNetwork failed because of exception {}.",
- e.toString());
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @DELETE
- @Path("{id}")
- public Response deleteNetworks(@PathParam("id") String id) {
- log.debug("Deletes network by identifier {}.", id);
- Set<TenantNetworkId> networkSet = new HashSet<>();
- networkSet.add(TenantNetworkId.networkId(id));
- Boolean issuccess = nullIsNotFound(get(TenantNetworkService.class)
- .removeNetworks(networkSet), NETWORK_NOT_FOUND);
- if (!issuccess) {
- log.debug("Network identifier {} is not existed", id);
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(NETWORK_ID_NOT_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- }
-
- /**
- * Returns a collection of tenantNetworks.
- *
- * @param flag the flag
- * @param networkId network identifier
- * @param node the network json node
- * @return a collection of tenantNetworks
- */
- public Iterable<TenantNetwork> changeJson2obj(String flag,
- TenantNetworkId networkId,
- JsonNode node) {
- checkNotNull(node, JSON_NOT_NULL);
- TenantNetwork network = null;
- ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps
- .newConcurrentMap();
- checkArgument(node.get("admin_state_up").isBoolean(), "admin_state_up should be boolean");
- checkArgument(node.get("shared").isBoolean(), "shared should be boolean");
- checkArgument(node.get("router:external").isBoolean(), "router:external should be boolean");
- String name = node.get("name").asText();
- boolean adminStateUp = node.get("admin_state_up").asBoolean();
- String state = node.get("status").asText();
- boolean shared = node.get("shared").asBoolean();
- String tenantId = node.get("tenant_id").asText();
- boolean routerExternal = node.get("router:external").asBoolean();
- String type = node.get("provider:network_type").asText();
- String physicalNetwork = node.get("provider:physical_network").asText();
- String segmentationId = node.get("provider:segmentation_id").asText();
- TenantNetworkId id = null;
- if (flag.equals(CREATE_NETWORK)) {
- id = TenantNetworkId.networkId(node.get("id").asText());
- } else if (flag.equals(UPDATE_NETWORK)) {
- id = networkId;
- }
- network = new DefaultTenantNetwork(
- id,
- name,
- adminStateUp,
- isState(state),
- shared,
- TenantId.tenantId(tenantId),
- routerExternal,
- isType(type),
- PhysicalNetwork
- .physicalNetwork(physicalNetwork),
- SegmentationId
- .segmentationId(segmentationId));
- networksMap.putIfAbsent(id, network);
-
- return Collections.unmodifiableCollection(networksMap.values());
- }
-
- /**
- * Returns a collection of tenantNetworks.
- *
- * @param nodes the network jsonnodes
- * @return a collection of tenantNetworks
- */
- public Iterable<TenantNetwork> changeJson2objs(JsonNode nodes) {
- checkNotNull(nodes, JSON_NOT_NULL);
- TenantNetwork network = null;
- ConcurrentMap<TenantNetworkId, TenantNetwork> networksMap = Maps
- .newConcurrentMap();
- for (JsonNode node : nodes) {
- String id = node.get("id").asText();
- String name = node.get("name").asText();
- boolean adminStateUp = node.get("admin_state_up").asBoolean();
- String state = node.get("status").asText();
- boolean shared = node.get("shared").asBoolean();
- String tenantId = node.get("tenant_id").asText();
- boolean routerExternal = node.get("router:external")
- .asBoolean();
- String type = node.get("provider:network_type").asText();
- String physicalNetwork = node.get("provider:physical_network").asText();
- String segmentationId = node.get("provider:segmentation_id").asText();
- network = new DefaultTenantNetwork(
- TenantNetworkId.networkId(id),
- name,
- adminStateUp,
- isState(state),
- shared,
- TenantId.tenantId(tenantId),
- routerExternal,
- isType(type),
- PhysicalNetwork.physicalNetwork(physicalNetwork),
- SegmentationId.segmentationId(segmentationId));
- networksMap.putIfAbsent(TenantNetworkId.networkId(id), network);
- }
-
- return Collections.unmodifiableCollection(networksMap.values());
- }
-
- /**
- * Returns the specified item if that items is null; otherwise throws not
- * found exception.
- *
- * @param item item to check
- * @param <T> item type
- * @param message not found message
- * @return item if not null
- * @throws org.onlab.util.ItemNotFoundException if item is null
- */
- protected <T> T nullIsNotFound(T item, String message) {
- if (item == null) {
- throw new ItemNotFoundException(message);
- }
- return item;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
deleted file mode 100644
index e47a57df..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java
+++ /dev/null
@@ -1,412 +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.vtnweb.resources;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
-import static javax.ws.rs.core.Response.Status.OK;
-import static javax.ws.rs.core.Response.Status.NOT_FOUND;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.util.ItemNotFoundException;
-import org.onosproject.net.DeviceId;
-import org.onosproject.rest.AbstractWebResource;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPort.State;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.virtualport.VirtualPortService;
-import org.onosproject.vtnweb.web.VirtualPortCodec;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * REST resource for interacting with the inventory of infrastructure
- * virtualPort.
- */
-@Path("ports")
-public class VirtualPortWebResource extends AbstractWebResource {
- public static final String VPORT_NOT_FOUND = "VirtualPort is not found";
- public static final String VPORT_ID_EXIST = "VirtualPort id is exist";
- public static final String VPORT_ID_NOT_EXIST = "VirtualPort id is not exist";
- public static final String JSON_NOT_NULL = "JsonNode can not be null";
- protected static final Logger log = LoggerFactory
- .getLogger(VirtualPortService.class);
-
- @GET
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getPorts() {
- Iterable<VirtualPort> virtualPorts = get(VirtualPortService.class)
- .getPorts();
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("ports", new VirtualPortCodec().encode(virtualPorts, this));
- return ok(result.toString()).build();
- }
-
- @GET
- @Path("{id}")
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getportsById(@PathParam("id") String id) {
-
- if (!get(VirtualPortService.class).exists(VirtualPortId.portId(id))) {
- return Response.status(NOT_FOUND)
- .entity(VPORT_NOT_FOUND).build();
- }
- VirtualPort virtualPort = nullIsNotFound(get(VirtualPortService.class)
- .getPort(VirtualPortId.portId(id)), VPORT_NOT_FOUND);
- ObjectNode result = new ObjectMapper().createObjectNode();
- result.set("port", new VirtualPortCodec().encode(virtualPort, this));
- return ok(result.toString()).build();
- }
-
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response createPorts(InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode cfg = mapper.readTree(input);
- Iterable<VirtualPort> vPorts = createOrUpdateByInputStream(cfg);
- Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
- .createPorts(vPorts), VPORT_NOT_FOUND);
- if (!issuccess) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(VPORT_ID_NOT_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (Exception e) {
- log.error("Creates VirtualPort failed because of exception {}",
- e.toString());
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @Path("{portUUID}")
- @DELETE
- public Response deletePorts(@PathParam("portUUID") String id) {
- Set<VirtualPortId> vPortIds = new HashSet<>();
- try {
- if (id != null) {
- vPortIds.add(VirtualPortId.portId(id));
- }
- Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
- .removePorts(vPortIds), VPORT_NOT_FOUND);
- if (!issuccess) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(VPORT_ID_NOT_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (Exception e) {
- log.error("Deletes VirtualPort failed because of exception {}",
- e.toString());
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- @PUT
- @Path("{id}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- public Response updatePorts(@PathParam("id") String id, InputStream input) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode cfg = mapper.readTree(input);
- Iterable<VirtualPort> vPorts = createOrUpdateByInputStream(cfg);
- Boolean issuccess = nullIsNotFound(get(VirtualPortService.class)
- .updatePorts(vPorts), VPORT_NOT_FOUND);
- if (!issuccess) {
- return Response.status(INTERNAL_SERVER_ERROR)
- .entity(VPORT_ID_NOT_EXIST).build();
- }
- return Response.status(OK).entity(issuccess.toString()).build();
- } catch (Exception e) {
- log.error("Updates failed because of exception {}", e.toString());
- return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString())
- .build();
- }
- }
-
- /**
- * Returns a Object of the currently known infrastructure virtualPort.
- *
- * @param vPortNode the virtualPort json node
- * @return a collection of virtualPorts
- */
- public Iterable<VirtualPort> createOrUpdateByInputStream(JsonNode vPortNode) {
- checkNotNull(vPortNode, JSON_NOT_NULL);
- JsonNode vPortNodes = vPortNode.get("ports");
- if (vPortNodes == null) {
- vPortNodes = vPortNode.get("port");
- }
- if (vPortNodes.isArray()) {
- return changeJsonToPorts(vPortNodes);
- } else {
- return changeJsonToPort(vPortNodes);
- }
- }
-
- /**
- * Returns the iterable collection of virtualports from subnetNodes.
- *
- * @param vPortNodes the virtualPort json node
- * @return virtualPorts a collection of virtualPorts
- */
- public Iterable<VirtualPort> changeJsonToPorts(JsonNode vPortNodes) {
- checkNotNull(vPortNodes, JSON_NOT_NULL);
- Map<VirtualPortId, VirtualPort> portMap = new HashMap<>();
- Map<String, String> strMap = new HashMap<>();
- for (JsonNode vPortnode : vPortNodes) {
- VirtualPortId id = VirtualPortId.portId(vPortnode.get("id")
- .asText());
- String name = vPortnode.get("name").asText();
- TenantId tenantId = TenantId.tenantId(vPortnode.get("tenant_id")
- .asText());
- TenantNetworkId networkId = TenantNetworkId.networkId(vPortnode
- .get("network_id").asText());
- checkArgument(vPortnode.get("admin_state_up").isBoolean(), "admin_state_up should be boolean");
- Boolean adminStateUp = vPortnode.get("admin_state_up").asBoolean();
- String state = vPortnode.get("status").asText();
- MacAddress macAddress = MacAddress.valueOf(vPortnode
- .get("mac_address").asText());
- DeviceId deviceId = DeviceId.deviceId(vPortnode.get("device_id")
- .asText());
- String deviceOwner = vPortnode.get("device_owner").asText();
- JsonNode fixedIpNodes = vPortNodes.get("fixed_ips");
- Set<FixedIp> fixedIps = new HashSet<>();
- for (JsonNode fixedIpNode : fixedIpNodes) {
- FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode);
- fixedIps.add(fixedIp);
- }
-
- BindingHostId bindingHostId = BindingHostId
- .bindingHostId(vPortnode.get("binding:host_id").asText());
- String bindingVnicType = vPortnode.get("binding:vnic_type")
- .asText();
- String bindingVifType = vPortnode.get("binding:vif_type").asText();
- String bindingVifDetails = vPortnode.get("binding:vif_details")
- .asText();
- JsonNode allowedAddressPairJsonNode = vPortnode
- .get("allowed_address_pairs");
- Collection<AllowedAddressPair> allowedAddressPairs =
- jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode);
- JsonNode securityGroupNode = vPortnode.get("security_groups");
- Collection<SecurityGroup> securityGroups = jsonNodeToSecurityGroup(securityGroupNode);
- strMap.put("name", name);
- strMap.put("deviceOwner", deviceOwner);
- strMap.put("bindingVnicType", bindingVnicType);
- strMap.put("bindingVifType", bindingVifType);
- strMap.put("bindingVifDetails", bindingVifDetails);
- VirtualPort vPort = new DefaultVirtualPort(id, networkId,
- adminStateUp, strMap,
- isState(state),
- macAddress, tenantId,
- deviceId, fixedIps,
- bindingHostId,
- Sets.newHashSet(allowedAddressPairs),
- Sets.newHashSet(securityGroups));
- portMap.put(id, vPort);
- }
- return Collections.unmodifiableCollection(portMap.values());
- }
-
- /**
- * Returns a collection of virtualPorts from subnetNodes.
- *
- * @param vPortNodes the virtualPort json node
- * @return virtualPorts a collection of virtualPorts
- */
- public Iterable<VirtualPort> changeJsonToPort(JsonNode vPortNodes) {
- checkNotNull(vPortNodes, JSON_NOT_NULL);
- Map<VirtualPortId, VirtualPort> vportMap = new HashMap<>();
- Map<String, String> strMap = new HashMap<>();
- VirtualPortId id = VirtualPortId.portId(vPortNodes.get("id").asText());
- String name = vPortNodes.get("name").asText();
- TenantId tenantId = TenantId.tenantId(vPortNodes.get("tenant_id")
- .asText());
- TenantNetworkId networkId = TenantNetworkId.networkId(vPortNodes
- .get("network_id").asText());
- Boolean adminStateUp = vPortNodes.get("admin_state_up").asBoolean();
- String state = vPortNodes.get("status").asText();
- MacAddress macAddress = MacAddress.valueOf(vPortNodes
- .get("mac_address").asText());
- DeviceId deviceId = DeviceId.deviceId(vPortNodes.get("device_id")
- .asText());
- String deviceOwner = vPortNodes.get("device_owner").asText();
- JsonNode fixedIpNodes = vPortNodes.get("fixed_ips");
- Set<FixedIp> fixedIps = new HashSet<>();
- for (JsonNode fixedIpNode : fixedIpNodes) {
- FixedIp fixedIp = jsonNodeToFixedIps(fixedIpNode);
- fixedIps.add(fixedIp);
- }
-
- BindingHostId bindingHostId = BindingHostId
- .bindingHostId(vPortNodes.get("binding:host_id").asText());
- String bindingVnicType = vPortNodes.get("binding:vnic_type").asText();
- String bindingVifType = vPortNodes.get("binding:vif_type").asText();
- String bindingVifDetails = vPortNodes.get("binding:vif_details")
- .asText();
- JsonNode allowedAddressPairJsonNode = vPortNodes
- .get("allowed_address_pairs");
- Collection<AllowedAddressPair> allowedAddressPairs =
- jsonNodeToAllowedAddressPair(allowedAddressPairJsonNode);
- JsonNode securityGroupNode = vPortNodes.get("security_groups");
- Collection<SecurityGroup> securityGroups = jsonNodeToSecurityGroup(securityGroupNode);
- strMap.put("name", name);
- strMap.put("deviceOwner", deviceOwner);
- strMap.put("bindingVnicType", bindingVnicType);
- strMap.put("bindingVifType", bindingVifType);
- strMap.put("bindingVifDetails", bindingVifDetails);
- VirtualPort vPort = new DefaultVirtualPort(id, networkId, adminStateUp,
- strMap, isState(state),
- macAddress, tenantId,
- deviceId, fixedIps,
- bindingHostId,
- Sets.newHashSet(allowedAddressPairs),
- Sets.newHashSet(securityGroups));
- vportMap.put(id, vPort);
-
- return Collections.unmodifiableCollection(vportMap.values());
- }
-
- /**
- * Returns a Object of the currently known infrastructure virtualPort.
- *
- * @param allowedAddressPairs the allowedAddressPairs json node
- * @return a collection of allowedAddressPair
- */
- public Collection<AllowedAddressPair> jsonNodeToAllowedAddressPair(JsonNode allowedAddressPairs) {
- checkNotNull(allowedAddressPairs, JSON_NOT_NULL);
- ConcurrentMap<Integer, AllowedAddressPair> allowMaps = Maps
- .newConcurrentMap();
- int i = 0;
- for (JsonNode node : allowedAddressPairs) {
- IpAddress ip = IpAddress.valueOf(node.get("ip_address").asText());
- MacAddress mac = MacAddress.valueOf(node.get("mac_address")
- .asText());
- AllowedAddressPair allows = AllowedAddressPair
- .allowedAddressPair(ip, mac);
- allowMaps.put(i, allows);
- i++;
- }
- log.debug("The jsonNode of allowedAddressPairallow is {}"
- + allowedAddressPairs.toString());
- return Collections.unmodifiableCollection(allowMaps.values());
- }
-
- /**
- * Returns a collection of virtualPorts.
- *
- * @param securityGroups the virtualPort jsonnode
- * @return a collection of securityGroups
- */
- public Collection<SecurityGroup> jsonNodeToSecurityGroup(JsonNode securityGroups) {
- checkNotNull(securityGroups, JSON_NOT_NULL);
- ConcurrentMap<Integer, SecurityGroup> securMaps = Maps
- .newConcurrentMap();
- int i = 0;
- for (JsonNode node : securityGroups) {
- SecurityGroup securityGroup = SecurityGroup
- .securityGroup(node.asText());
- securMaps.put(i, securityGroup);
- i++;
- }
- return Collections.unmodifiableCollection(securMaps.values());
- }
-
- /**
- * Returns a collection of fixedIps.
- *
- * @param fixedIpNode the fixedIp jsonnode
- * @return a collection of SecurityGroup
- */
- public FixedIp jsonNodeToFixedIps(JsonNode fixedIpNode) {
- SubnetId subnetId = SubnetId.subnetId(fixedIpNode.get("subnet_id")
- .asText());
- IpAddress ipAddress = IpAddress.valueOf(fixedIpNode.get("ip_address")
- .asText());
- FixedIp fixedIps = FixedIp.fixedIp(subnetId, ipAddress);
- return fixedIps;
- }
-
- /**
- * Returns VirtualPort State.
- *
- * @param state the virtualport state
- * @return the virtualPort state
- */
- private State isState(String state) {
- if (state.equals("ACTIVE")) {
- return VirtualPort.State.ACTIVE;
- } else {
- return VirtualPort.State.DOWN;
- }
-
- }
-
- /**
- * Returns the specified item if that items is null; otherwise throws not
- * found exception.
- *
- * @param item item to check
- * @param <T> item type
- * @param message not found message
- * @return item if not null
- * @throws org.onlab.util.ItemNotFoundException if item is null
- */
- protected <T> T nullIsNotFound(T item, String message) {
- if (item == null) {
- throw new ItemNotFoundException(message);
- }
- return item;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/package-info.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/package-info.java
deleted file mode 100644
index c81fc3d8..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/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.
- */
-
-/**
- * VTN web that used rest to creat vtn resources.
- */
-package org.onosproject.vtnweb.resources;
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllocationPoolsCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllocationPoolsCodec.java
deleted file mode 100644
index 4b6b662f..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllocationPoolsCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.AllocationPool;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Subnet AllocationPool codec.
- */
-public final class AllocationPoolsCodec extends JsonCodec<AllocationPool> {
-
- @Override
- public ObjectNode encode(AllocationPool alocPool, CodecContext context) {
- checkNotNull(alocPool, "AllocationPools cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("start", alocPool.startIp().toString())
- .put("end", alocPool.endIp().toString());
- return result;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllowedAddressPairCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllowedAddressPairCodec.java
deleted file mode 100644
index 8ffc4e91..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/AllowedAddressPairCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * VirtualPort AllowedAddressPair codec.
- */
-public final class AllowedAddressPairCodec extends JsonCodec<AllowedAddressPair> {
-
- @Override
- public ObjectNode encode(AllowedAddressPair alocAddPair, CodecContext context) {
- checkNotNull(alocAddPair, "AllowedAddressPair cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("ip_address", alocAddPair.ip().toString())
- .put("mac_address", alocAddPair.mac().toString());
- return result;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FixedIpCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FixedIpCodec.java
deleted file mode 100644
index 559de685..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FixedIpCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.FixedIp;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * VirtualPort FixedIp codec.
- */
-public final class FixedIpCodec extends JsonCodec<FixedIp> {
-
- @Override
- public ObjectNode encode(FixedIp fixIp, CodecContext context) {
- checkNotNull(fixIp, "FixedIp cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("subnet_id", fixIp.subnetId().toString())
- .put("ip_address", fixIp.ip().toString());
- return result;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FloatingIpCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FloatingIpCodec.java
deleted file mode 100644
index ff5aebb4..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FloatingIpCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.FloatingIp;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * FloatingIp JSON codec.
- */
-public final class FloatingIpCodec extends JsonCodec<FloatingIp> {
- @Override
- public ObjectNode encode(FloatingIp floatingIp, CodecContext context) {
- checkNotNull(floatingIp, "floatingIp cannot be null");
- ObjectNode result = context
- .mapper()
- .createObjectNode()
- .put("id", floatingIp.id().floatingIpId().toString())
- .put("floating_network_id", floatingIp.networkId().toString())
- .put("router_id",
- floatingIp.routerId() == null ? null : floatingIp
- .routerId().routerId())
- .put("tenant_id", floatingIp.tenantId().toString())
- .put("port_id",
- floatingIp.portId() == null ? null : floatingIp.portId()
- .toString())
- .put("fixed_ip_address",
- floatingIp.fixedIp() == null ? null : floatingIp.fixedIp()
- .toString())
- .put("floating_ip_address", floatingIp.floatingIp().toString())
- .put("status", floatingIp.status().toString());
- return result;
- }
-
- public ObjectNode extracFields(FloatingIp floatingIp, CodecContext context,
- List<String> fields) {
- checkNotNull(floatingIp, "floatingIp cannot be null");
- ObjectNode result = context.mapper().createObjectNode();
- Iterator<String> i = fields.iterator();
- while (i.hasNext()) {
- String s = i.next();
- if (s.equals("floating_network_id")) {
- result.put("floating_network_id", floatingIp.networkId()
- .toString());
- }
- if (s.equals("router_id")) {
- result.put("router_id",
- floatingIp.routerId() == null ? null : floatingIp
- .routerId().routerId());
- }
- if (s.equals("tenant_id")) {
- result.put("tenant_id", floatingIp.tenantId().toString());
- }
- if (s.equals("port_id")) {
- result.put("port_id",
- floatingIp.portId() == null ? null : floatingIp
- .portId().toString());
- }
- if (s.equals("id")) {
- result.put("id", floatingIp.id().floatingIpId().toString());
- }
- if (s.equals("fixed_ip_address")) {
- result.put("fixed_ip_address",
- floatingIp.fixedIp() == null ? null : floatingIp
- .fixedIp().toString());
- }
- if (s.equals("floating_ip_address")) {
- result.put("floating_ip_address", floatingIp.floatingIp()
- .toString());
- }
- if (s.equals("status")) {
- result.put("status", floatingIp.status().toString());
- }
- }
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FlowClassifierCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FlowClassifierCodec.java
deleted file mode 100644
index a18ca362..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/FlowClassifierCodec.java
+++ /dev/null
@@ -1,134 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.nullIsIllegal;
-
-import org.onlab.packet.IpPrefix;
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.DefaultFlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Flow Classifier JSON codec.
- */
-public final class FlowClassifierCodec extends JsonCodec<FlowClassifier> {
-
- private static final String FLOW_CLASSIFIER_ID = "id";
- private static final String TENANT_ID = "tenant_id";
- private static final String NAME = "name";
- private static final String DESCRIPTION = "description";
- private static final String ETHER_TYPE = "ethertype";
- private static final String PROTOCOL = "protocol";
- private static final String MIN_SRC_PORT_RANGE = "source_port_range_min";
- private static final String MAX_SRC_PORT_RANGE = "source_port_range_max";
- private static final String MIN_DST_PORT_RANGE = "destination_port_range_min";
- private static final String MAX_DST_PORT_RANGE = "destination_port_range_max";
- private static final String SRC_IP_PREFIX = "source_ip_prefix";
- private static final String DST_IP_PREFIX = "destination_ip_prefix";
- private static final String SRC_PORT = "logical_source_port";
- private static final String DST_PORT = "logical_destination_port";
- private static final String MISSING_MEMBER_MESSAGE = " member is required in Flow Classifier.";
-
- @Override
- public FlowClassifier decode(ObjectNode json, CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- FlowClassifier.Builder resultBuilder = new DefaultFlowClassifier.Builder();
-
- String flowClassifierId = nullIsIllegal(json.get(FLOW_CLASSIFIER_ID),
- FLOW_CLASSIFIER_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setFlowClassifierId(FlowClassifierId.of(flowClassifierId));
-
- String tenantId = nullIsIllegal(json.get(TENANT_ID), TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setTenantId(TenantId.tenantId(tenantId));
-
- String flowClassiferName = nullIsIllegal(json.get(NAME), NAME + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setName(flowClassiferName);
-
- String flowClassiferDescription = (json.get(DESCRIPTION)).asText();
- resultBuilder.setDescription(flowClassiferDescription);
-
- String etherType = nullIsIllegal(json.get(ETHER_TYPE), ETHER_TYPE + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setEtherType(etherType);
-
- String protocol = (json.get(PROTOCOL)).asText();
- resultBuilder.setProtocol(protocol);
-
- int minSrcPortRange = (json.get(MIN_SRC_PORT_RANGE)).asInt();
- resultBuilder.setMinSrcPortRange(minSrcPortRange);
-
- int maxSrcPortRange = (json.get(MAX_SRC_PORT_RANGE)).asInt();
- resultBuilder.setMaxSrcPortRange(maxSrcPortRange);
-
- int minDstPortRange = (json.get(MIN_DST_PORT_RANGE)).asInt();
- resultBuilder.setMinDstPortRange(minDstPortRange);
-
- int maxDstPortRange = (json.get(MAX_DST_PORT_RANGE)).asInt();
- resultBuilder.setMaxDstPortRange(maxDstPortRange);
-
- String srcIpPrefix = (json.get(SRC_IP_PREFIX)).asText();
- if (!srcIpPrefix.isEmpty()) {
- resultBuilder.setSrcIpPrefix(IpPrefix.valueOf(srcIpPrefix));
- }
-
- String dstIpPrefix = (json.get(DST_IP_PREFIX)).asText();
- if (!dstIpPrefix.isEmpty()) {
- resultBuilder.setDstIpPrefix(IpPrefix.valueOf(dstIpPrefix));
- }
-
- String srcPort = json.get(SRC_PORT) != null ? (json.get(SRC_PORT)).asText() : "";
- if (!srcPort.isEmpty()) {
- resultBuilder.setSrcPort(VirtualPortId.portId(srcPort));
- }
-
- String dstPort = json.get(DST_PORT) != null ? (json.get(DST_PORT)).asText() : "";
- if (!dstPort.isEmpty()) {
- resultBuilder.setDstPort(VirtualPortId.portId(dstPort));
- }
- return resultBuilder.build();
- }
-
- @Override
- public ObjectNode encode(FlowClassifier flowClassifier, CodecContext context) {
- checkNotNull(flowClassifier, "flowClassifier cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put(FLOW_CLASSIFIER_ID, flowClassifier.flowClassifierId().toString())
- .put(TENANT_ID, flowClassifier.tenantId().toString())
- .put(NAME, flowClassifier.name())
- .put(DESCRIPTION, flowClassifier.description())
- .put(ETHER_TYPE, flowClassifier.etherType())
- .put(PROTOCOL, flowClassifier.protocol())
- .put(MIN_SRC_PORT_RANGE, flowClassifier.minSrcPortRange())
- .put(MAX_SRC_PORT_RANGE, flowClassifier.maxSrcPortRange())
- .put(MIN_DST_PORT_RANGE, flowClassifier.minDstPortRange())
- .put(MAX_DST_PORT_RANGE, flowClassifier.maxDstPortRange())
- .put(SRC_IP_PREFIX, flowClassifier.srcIpPrefix().toString())
- .put(DST_IP_PREFIX, flowClassifier.dstIpPrefix().toString())
- .put(SRC_PORT, flowClassifier.srcPort().toString())
- .put(DST_PORT, flowClassifier.dstPort().toString());
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/HostRoutesCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/HostRoutesCodec.java
deleted file mode 100644
index 815a0d02..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/HostRoutesCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.HostRoute;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Subnet HostRoute codec.
- */
-public final class HostRoutesCodec extends JsonCodec<HostRoute> {
-
- @Override
- public ObjectNode encode(HostRoute hostRoute, CodecContext context) {
- checkNotNull(hostRoute, "HostRoute cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("nexthop", hostRoute.nexthop().toString())
- .put("destination", hostRoute.destination().toString());
- return result;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java
deleted file mode 100644
index 1e9cf009..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortChainCodec.java
+++ /dev/null
@@ -1,105 +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.vtnweb.web;
-
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.nullIsIllegal;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.DefaultPortChain;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.PortPairGroupId;
-
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-
-/**
- * Port chain JSON codec.
- */
-public final class PortChainCodec extends JsonCodec<PortChain> {
-
- private static final String ID = "id";
- private static final String TENANT_ID = "tenant_id";
- private static final String NAME = "name";
- private static final String DESCRIPTION = "description";
- private static final String PORT_PAIR_GROUPS = "port_pair_groups";
- private static final String FLOW_CLASSIFIERS = "flow_classifiers";
- private static final String MISSING_MEMBER_MESSAGE =
- " member is required in PortChain";
-
- @Override
- public PortChain decode(ObjectNode json, CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- PortChain.Builder resultBuilder = new DefaultPortChain.Builder();
-
- String id = nullIsIllegal(json.get(ID),
- ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setId(PortChainId.of(id));
-
- String tenantId = nullIsIllegal(json.get(TENANT_ID),
- TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setTenantId(TenantId.tenantId(tenantId));
-
- String name = nullIsIllegal(json.get(NAME),
- NAME + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setName(name);
-
- String description = nullIsIllegal(json.get(DESCRIPTION),
- DESCRIPTION + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setDescription(description);
-
- ArrayNode arrayNode = (ArrayNode) json.path(PORT_PAIR_GROUPS);
- if (arrayNode != null) {
- List<PortPairGroupId> list = Lists.newArrayList();
- arrayNode.forEach(i -> list.add(PortPairGroupId.of(i.asText())));
- resultBuilder.setPortPairGroups(list);
- }
-
- arrayNode = (ArrayNode) json.path(FLOW_CLASSIFIERS);
- if (arrayNode != null) {
- List<FlowClassifierId> list = Lists.newArrayList();
- arrayNode.forEach(i -> list.add(FlowClassifierId.of(UUID.fromString(i.asText()))));
- resultBuilder.setFlowClassifiers(list);
- }
-
- return resultBuilder.build();
- }
-
- @Override
- public ObjectNode encode(PortChain portChain, CodecContext context) {
- checkNotNull(portChain, "port pair cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put(ID, portChain.portChainId().toString())
- .put(TENANT_ID, portChain.tenantId().toString())
- .put(NAME, portChain.name())
- .put(DESCRIPTION, portChain.description())
- .put(PORT_PAIR_GROUPS, portChain.portPairGroups().toString())
- .put(FLOW_CLASSIFIERS, portChain.flowClassifiers().toString());
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairCodec.java
deleted file mode 100644
index 691536f4..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairCodec.java
+++ /dev/null
@@ -1,94 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.nullIsIllegal;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.core.CoreService;
-import org.onosproject.vtnrsc.DefaultPortPair;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Port Pair JSON codec.
- */
-public final class PortPairCodec extends JsonCodec<PortPair> {
-
- private static final String ID = "id";
- private static final String TENANT_ID = "tenant_id";
- private static final String NAME = "name";
- private static final String DESCRIPTION = "description";
- private static final String INGRESS = "ingress";
- private static final String EGRESS = "egress";
- private static final String MISSING_MEMBER_MESSAGE =
- " member is required in PortPair";
-
- @Override
- public PortPair decode(ObjectNode json, CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- PortPair.Builder resultBuilder = new DefaultPortPair.Builder();
-
- CoreService coreService = context.getService(CoreService.class);
-
- String id = nullIsIllegal(json.get(ID),
- ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setId(PortPairId.of(id));
-
- String tenantId = nullIsIllegal(json.get(TENANT_ID),
- TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setTenantId(TenantId.tenantId(tenantId));
-
- String name = nullIsIllegal(json.get(NAME),
- NAME + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setName(name);
-
- String description = nullIsIllegal(json.get(DESCRIPTION),
- DESCRIPTION + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setDescription(description);
-
- String ingressPort = nullIsIllegal(json.get(INGRESS),
- INGRESS + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setIngress(ingressPort);
-
- String egressPort = nullIsIllegal(json.get(EGRESS),
- EGRESS + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setEgress(egressPort);
-
- return resultBuilder.build();
- }
-
- @Override
- public ObjectNode encode(PortPair portPair, CodecContext context) {
- checkNotNull(portPair, "port pair cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put(ID, portPair.portPairId().toString())
- .put(TENANT_ID, portPair.tenantId().toString())
- .put(NAME, portPair.name())
- .put(DESCRIPTION, portPair.description())
- .put(INGRESS, portPair.ingress())
- .put(EGRESS, portPair.egress());
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java
deleted file mode 100644
index b5ae266b..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/PortPairGroupCodec.java
+++ /dev/null
@@ -1,95 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.nullIsIllegal;
-
-import java.util.List;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.core.CoreService;
-import org.onosproject.vtnrsc.DefaultPortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.Lists;
-
-/**
- * Port Pair Group JSON codec.
- */
-public final class PortPairGroupCodec extends JsonCodec<PortPairGroup> {
-
- private static final String ID = "id";
- private static final String TENANT_ID = "tenant_id";
- private static final String NAME = "name";
- private static final String DESCRIPTION = "description";
- private static final String PORT_PAIRS = "port_pairs";
- private static final String MISSING_MEMBER_MESSAGE =
- " member is required in PortPairGroup";
-
- @Override
- public PortPairGroup decode(ObjectNode json, CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- PortPairGroup.Builder resultBuilder = new DefaultPortPairGroup.Builder();
-
- CoreService coreService = context.getService(CoreService.class);
-
- String id = nullIsIllegal(json.get(ID),
- ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setId(PortPairGroupId.of(id));
-
- String tenantId = nullIsIllegal(json.get(TENANT_ID),
- TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setTenantId(TenantId.tenantId(tenantId));
-
- String name = nullIsIllegal(json.get(NAME),
- NAME + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setName(name);
-
- String description = nullIsIllegal(json.get(DESCRIPTION),
- DESCRIPTION + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setDescription(description);
-
- List<PortPairId> list = Lists.newArrayList();
- ArrayNode arrayNode = (ArrayNode) json.path(PORT_PAIRS);
- arrayNode.forEach(i -> list.add(PortPairId.of(i.asText())));
- resultBuilder.setPortPairs(list);
-
- return resultBuilder.build();
- }
-
- @Override
- public ObjectNode encode(PortPairGroup portPairGroup, CodecContext context) {
- checkNotNull(portPairGroup, "port pair group cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put(ID, portPairGroup.portPairGroupId().toString())
- .put(TENANT_ID, portPairGroup.tenantId().toString())
- .put(NAME, portPairGroup.name())
- .put(DESCRIPTION, portPairGroup.description())
- .put(PORT_PAIRS, portPairGroup.portPairs().toString());
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterCodec.java
deleted file mode 100644
index 61f7e955..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterCodec.java
+++ /dev/null
@@ -1,91 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.Router;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Router JSON codec.
- */
-public class RouterCodec extends JsonCodec<Router> {
- @Override
- public ObjectNode encode(Router router, CodecContext context) {
- checkNotNull(router, "router cannot be null");
- ObjectNode result = context
- .mapper()
- .createObjectNode()
- .put("id", router.id().routerId())
- .put("status", router.status().toString())
- .put("name", router.name().toString())
- .put("admin_state_up", router.adminStateUp())
- .put("tenant_id", router.tenantId().toString())
- .put("routes",
- router.routes() == null ? null : router.routes()
- .toString());
- result.set("external_gateway_info",
- router.externalGatewayInfo() == null ? null
- : new RouterGatewayInfoCodec()
- .encode(router.externalGatewayInfo(), context));
-
- return result;
- }
-
- public ObjectNode extracFields(Router router, CodecContext context,
- List<String> fields) {
- checkNotNull(router, "router cannot be null");
- ObjectNode result = context.mapper().createObjectNode();
- Iterator<String> i = fields.iterator();
- while (i.hasNext()) {
- String s = i.next();
- if (s.equals("id")) {
- result.put("id", router.id().routerId());
- }
- if (s.equals("status")) {
- result.put("status", router.status().toString());
- }
- if (s.equals("name")) {
- result.put("name", router.name().toString());
- }
- if (s.equals("admin_state_up")) {
- result.put("admin_state_up", router.adminStateUp());
- }
- if (s.equals("tenant_id")) {
- result.put("tenant_id", router.tenantId().toString());
- }
- if (s.equals("routes")) {
- result.put("routes", router.routes() == null ? null : router
- .routes().toString());
- }
- if (s.equals("external_gateway_info")) {
- result.set("external_gateway_info",
- router.externalGatewayInfo() == null ? null
- : new RouterGatewayInfoCodec()
- .encode(router.externalGatewayInfo(),
- context));
- }
- }
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterGatewayInfoCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterGatewayInfoCodec.java
deleted file mode 100644
index cb9fb67d..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/RouterGatewayInfoCodec.java
+++ /dev/null
@@ -1,39 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.RouterGateway;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Subnet Router Gateway Info codec.
- */
-public class RouterGatewayInfoCodec extends JsonCodec<RouterGateway> {
- @Override
- public ObjectNode encode(RouterGateway routerGateway, CodecContext context) {
- checkNotNull(routerGateway, "routerGateway cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("network_id", routerGateway.networkId().toString());
- result.set("external_fixed_ips", new FixedIpCodec()
- .encode(routerGateway.externalFixedIps(), context));
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SecurityGroupCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SecurityGroupCodec.java
deleted file mode 100644
index 18ed61ba..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SecurityGroupCodec.java
+++ /dev/null
@@ -1,39 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.SecurityGroup;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Virtualport SecurityGroup codec.
- */
-public final class SecurityGroupCodec extends JsonCodec<SecurityGroup> {
-
- @Override
- public ObjectNode encode(SecurityGroup securGroup, CodecContext context) {
- checkNotNull(securGroup, "SecurityGroup cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("security_group", securGroup.securityGroup());
- return result;
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SubnetCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SubnetCodec.java
deleted file mode 100644
index e3d92fea..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/SubnetCodec.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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.Subnet;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Subnet JSON codec.
- */
-public final class SubnetCodec extends JsonCodec<Subnet> {
- @Override
- public ObjectNode encode(Subnet subnet, CodecContext context) {
- checkNotNull(subnet, "Subnet cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("id", subnet.id().toString())
- .put("gateway_ip", subnet.gatewayIp().toString())
- .put("network_id", subnet.networkId().toString())
- .put("name", subnet.subnetName())
- .put("ip_version", subnet.ipVersion().toString())
- .put("cidr", subnet.cidr().toString())
- .put("shared", subnet.shared())
- .put("enabled_dchp", subnet.dhcpEnabled())
- .put("tenant_id", subnet.tenantId().toString())
- .put("ipv6_address_mode", subnet.ipV6AddressMode() == null ? null
- : subnet.ipV6AddressMode().toString())
- .put("ipv6_ra_mode", subnet.ipV6RaMode() == null ? null
- : subnet.ipV6RaMode().toString());
- result.set("allocation_pools", new AllocationPoolsCodec().encode(subnet
- .allocationPools(), context));
- result.set("host_routes",
- new HostRoutesCodec().encode(subnet.hostRoutes(), context));
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/TenantNetworkCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/TenantNetworkCodec.java
deleted file mode 100644
index 8adba034..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/TenantNetworkCodec.java
+++ /dev/null
@@ -1,47 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.TenantNetwork;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * TenantNetwork JSON codec.
- */
-public final class TenantNetworkCodec extends JsonCodec<TenantNetwork> {
-
- @Override
- public ObjectNode encode(TenantNetwork network, CodecContext context) {
- checkNotNull(network, "Network cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("id", network.id().toString())
- .put("name", network.name())
- .put("admin_state_up", network.adminStateUp())
- .put("status", "" + network.state())
- .put("shared", network.shared())
- .put("tenant_id", network.tenantId().toString())
- .put("router:external", network.routerExternal())
- .put("provider:network_type", "" + network.type())
- .put("provider:physical_network", network.physicalNetwork().toString())
- .put("provider:segmentation_id", network.segmentationId().toString());
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VirtualPortCodec.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VirtualPortCodec.java
deleted file mode 100644
index 5cea5327..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VirtualPortCodec.java
+++ /dev/null
@@ -1,57 +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.vtnweb.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.VirtualPort;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * VirtualPort JSON codec.
- */
-public final class VirtualPortCodec extends JsonCodec<VirtualPort> {
- @Override
- public ObjectNode encode(VirtualPort vPort, CodecContext context) {
- checkNotNull(vPort, "VPort cannot be null");
- ObjectNode result = context
- .mapper()
- .createObjectNode()
- .put("id", vPort.portId().toString())
- .put("network_id", vPort.networkId().toString())
- .put("admin_state_up", vPort.adminStateUp())
- .put("name", vPort.name())
- .put("status", vPort.state().toString())
- .put("mac_address", vPort.macAddress().toString())
- .put("tenant_id", vPort.tenantId().toString())
- .put("device_id", vPort.deviceId().toString())
- .put("device_owner", vPort.deviceOwner())
- .put("binding:vnic_type", vPort.bindingVnicType())
- .put("binding:Vif_type", vPort.bindingVifType())
- .put("binding:host_id", vPort.bindingHostId().toString())
- .put("binding:vif_details", vPort.bindingVifDetails());
- result.set("allowed_address_pairs", new AllowedAddressPairCodec().encode(
- vPort.allowedAddressPairs(), context));
- result.set("fixed_ips", new FixedIpCodec().encode(
- vPort.fixedIps(), context));
- result.set("security_groups", new SecurityGroupCodec().encode(
- vPort.securityGroups(), context));
- return result;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VtnCodecRegistrator.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VtnCodecRegistrator.java
deleted file mode 100644
index e2defe59..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/VtnCodecRegistrator.java
+++ /dev/null
@@ -1,56 +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.vtnweb.web;
-
-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.codec.CodecService;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of the JSON codec brokering service for VTN app.
- */
-@Component(immediate = true)
-public class VtnCodecRegistrator {
-
- private static Logger log = LoggerFactory.getLogger(VtnCodecRegistrator.class);
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CodecService codecService;
-
- @Activate
- public void activate() {
- codecService.registerCodec(PortPair.class, new PortPairCodec());
- codecService.registerCodec(PortPairGroup.class, new PortPairGroupCodec());
- codecService.registerCodec(FlowClassifier.class, new FlowClassifierCodec());
- codecService.registerCodec(PortChain.class, new PortChainCodec());
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- log.info("Stopped");
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/package-info.java b/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/package-info.java
deleted file mode 100644
index 3a609435..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/web/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.
- */
-
-/**
- * Codecs for virtual tenant objects.
- */
-package org.onosproject.vtnweb.web;
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/main/webapp/WEB-INF/web.xml b/framework/src/onos/apps/vtn/vtnweb/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 13b377bf..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="ONOS" version="2.5">
- <display-name>VTNRSC REST API v1.0</display-name>
-
- <servlet>
- <servlet-name>JAX-RS Service</servlet-name>
- <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
- <init-param>
- <param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
- <param-value>com.sun.jersey.api.core.ClassNamesResourceConfig</param-value>
- </init-param>
- <init-param>
- <param-name>com.sun.jersey.config.property.classnames</param-name>
- <param-value>
- org.onosproject.vtnweb.resources.TenantNetworkWebResource,
- org.onosproject.vtnweb.resources.SubnetWebResource,
- org.onosproject.vtnweb.resources.VirtualPortWebResource
- org.onosproject.vtnweb.resources.FlowClassifierWebResource
- org.onosproject.vtnweb.resources.PortChainWebResource
- org.onosproject.vtnweb.resources.PortPairGroupWebResource
- org.onosproject.vtnweb.resources.PortPairWebResource
- org.onosproject.vtnweb.resources.FloatingIpWebResource
- org.onosproject.vtnweb.resources.RouterWebResource
- </param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>JAX-RS Service</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/FlowClassifierResourceTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/FlowClassifierResourceTest.java
deleted file mode 100644
index db08d7c4..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/FlowClassifierResourceTest.java
+++ /dev/null
@@ -1,301 +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.vtnweb.resources;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.osgi.TestServiceDirectory;
-import org.onlab.packet.IpPrefix;
-import org.onlab.rest.BaseResource;
-import org.onosproject.codec.CodecService;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
-import org.onosproject.vtnweb.web.SfcCodecContext;
-
-import com.eclipsesource.json.JsonObject;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-/**
- * Unit tests for flow classifier REST APIs.
- */
-public class FlowClassifierResourceTest extends VtnResourceTest {
-
- final FlowClassifierService flowClassifierService = createMock(FlowClassifierService.class);
-
- FlowClassifierId flowClassifierId1 = FlowClassifierId.of("4a334cd4-fe9c-4fae-af4b-321c5e2eb051");
- TenantId tenantId1 = TenantId.tenantId("1814726e2d22407b8ca76db5e567dcf1");
- VirtualPortId srcPortId1 = VirtualPortId.portId("dace4513-24fc-4fae-af4b-321c5e2eb3d1");
- VirtualPortId dstPortId1 = VirtualPortId.portId("aef3478a-4a56-2a6e-cd3a-9dee4e2ec345");
-
- final MockFlowClassifier flowClassifier1 = new MockFlowClassifier(flowClassifierId1, tenantId1, "flowClassifier1",
- "Mock flow classifier", "IPv4", "IP", 1001, 1500,
- 5001, 6000, IpPrefix.valueOf("1.1.1.1/16"),
- IpPrefix.valueOf("22.12.34.45/16"),
- srcPortId1, dstPortId1);
-
- /**
- * Mock class for a flow classifier.
- */
- private static class MockFlowClassifier implements FlowClassifier {
-
- private final FlowClassifierId flowClassifierId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final String etherType;
- private final String protocol;
- private final int minSrcPortRange;
- private final int maxSrcPortRange;
- private final int minDstPortRange;
- private final int maxDstPortRange;
- private final IpPrefix srcIpPrefix;
- private final IpPrefix dstIpPrefix;
- private final VirtualPortId srcPort;
- private final VirtualPortId dstPort;
-
- public MockFlowClassifier(FlowClassifierId flowClassifierId, TenantId tenantId, String name,
- String description, String etherType, String protocol, int minSrcPortRange,
- int maxSrcPortRange, int minDstPortRange, int maxDstPortRange, IpPrefix srcIpPrefix,
- IpPrefix dstIpPrefix, VirtualPortId srcPort, VirtualPortId dstPort) {
- this.flowClassifierId = flowClassifierId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.etherType = etherType;
- this.protocol = protocol;
- this.minSrcPortRange = minSrcPortRange;
- this.maxSrcPortRange = maxSrcPortRange;
- this.minDstPortRange = minDstPortRange;
- this.maxDstPortRange = maxDstPortRange;
- this.srcIpPrefix = srcIpPrefix;
- this.dstIpPrefix = dstIpPrefix;
- this.srcPort = srcPort;
- this.dstPort = dstPort;
- }
-
-
- @Override
- public FlowClassifierId flowClassifierId() {
- return flowClassifierId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public String etherType() {
- return etherType;
- }
-
- @Override
- public String protocol() {
- return protocol;
- }
-
- @Override
- public int minSrcPortRange() {
- return minSrcPortRange;
- }
-
- @Override
- public int maxSrcPortRange() {
- return maxSrcPortRange;
- }
-
- @Override
- public int minDstPortRange() {
- return minDstPortRange;
- }
-
- @Override
- public int maxDstPortRange() {
- return maxDstPortRange;
- }
-
- @Override
- public IpPrefix srcIpPrefix() {
- return srcIpPrefix;
- }
-
- @Override
- public IpPrefix dstIpPrefix() {
- return dstIpPrefix;
- }
-
- @Override
- public VirtualPortId srcPort() {
- return srcPort;
- }
-
- @Override
- public VirtualPortId dstPort() {
- return dstPort;
- }
-
- @Override
- public boolean exactMatch(FlowClassifier flowClassifier) {
- return this.equals(flowClassifier) &&
- Objects.equals(this.flowClassifierId, flowClassifier.flowClassifierId()) &&
- Objects.equals(this.tenantId, flowClassifier.tenantId());
- }
- }
-
- /**
- * Sets up the global values for all the tests.
- */
- @Before
- public void setUpTest() {
- SfcCodecContext context = new SfcCodecContext();
-
- ServiceDirectory testDirectory = new TestServiceDirectory()
- .add(FlowClassifierService.class, flowClassifierService)
- .add(CodecService.class, context.codecManager());
- BaseResource.setServiceDirectory(testDirectory);
-
- }
-
- /**
- * Cleans up.
- */
- @After
- public void tearDownTest() {
- }
-
- /**
- * Tests the result of the rest api GET when there are no flow classifiers.
- */
- @Test
- public void testFlowClassifiersEmpty() {
-
- expect(flowClassifierService.getFlowClassifiers()).andReturn(null).anyTimes();
- replay(flowClassifierService);
- final WebResource rs = resource();
- final String response = rs.path("flow_classifiers").get(String.class);
- assertThat(response, is("{\"flow_classifiers\":[]}"));
- }
-
- /**
- * Tests the result of a rest api GET for flow classifier id.
- */
- @Test
- public void testGetFlowClassifierId() {
-
- final Set<FlowClassifier> flowClassifiers = new HashSet<>();
- flowClassifiers.add(flowClassifier1);
-
- expect(flowClassifierService.exists(anyObject())).andReturn(true).anyTimes();
- expect(flowClassifierService.getFlowClassifier(anyObject())).andReturn(flowClassifier1).anyTimes();
- replay(flowClassifierService);
-
- final WebResource rs = resource();
- final String response = rs.path("flow_classifiers/4a334cd4-fe9c-4fae-af4b-321c5e2eb051").get(String.class);
- final JsonObject result = JsonObject.readFrom(response);
- assertThat(result, notNullValue());
- }
-
- /**
- * Tests that a fetch of a non-existent flow classifier object throws an exception.
- */
- @Test
- public void testBadGet() {
- expect(flowClassifierService.getFlowClassifier(anyObject()))
- .andReturn(null).anyTimes();
- replay(flowClassifierService);
- WebResource rs = resource();
- try {
- rs.path("flow_classifiers/78dcd363-fc23-aeb6-f44b-56dc5aafb3ae").get(String.class);
- fail("Fetch of non-existent flow classifier did not throw an exception");
- } catch (UniformInterfaceException ex) {
- assertThat(ex.getMessage(),
- containsString("returned a response status of"));
- }
- }
-
- /**
- * Tests creating a flow classifier with POST.
- */
- @Test
- public void testPost() {
-
- expect(flowClassifierService.createFlowClassifier(anyObject()))
- .andReturn(true).anyTimes();
- replay(flowClassifierService);
-
- WebResource rs = resource();
- InputStream jsonStream = FlowClassifierResourceTest.class.getResourceAsStream("post-FlowClassifier.json");
-
- ClientResponse response = rs.path("flow_classifiers")
- .type(MediaType.APPLICATION_JSON_TYPE)
- .post(ClientResponse.class, jsonStream);
- assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
- }
-
- /**
- * Tests deleting a flow classifier.
- */
- @Test
- public void testDelete() {
- expect(flowClassifierService.removeFlowClassifier(anyObject()))
- .andReturn(true).anyTimes();
- replay(flowClassifierService);
-
- WebResource rs = resource();
-
- String location = "flow_classifiers/4a334cd4-fe9c-4fae-af4b-321c5e2eb051";
-
- ClientResponse deleteResponse = rs.path(location)
- .type(MediaType.APPLICATION_JSON_TYPE)
- .delete(ClientResponse.class);
- assertThat(deleteResponse.getStatus(),
- is(HttpURLConnection.HTTP_NO_CONTENT));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortChainResourceTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortChainResourceTest.java
deleted file mode 100644
index 3cb2c83f..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortChainResourceTest.java
+++ /dev/null
@@ -1,247 +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.vtnweb.resources;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.osgi.TestServiceDirectory;
-import org.onlab.rest.BaseResource;
-import org.onosproject.codec.CodecService;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.portchain.PortChainService;
-import org.onosproject.vtnweb.web.SfcCodecContext;
-
-import com.eclipsesource.json.JsonObject;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-
-/**
- * Unit tests for port chain REST APIs.
- */
-public class PortChainResourceTest extends VtnResourceTest {
-
- final PortChainService portChainService = createMock(PortChainService.class);
-
- PortChainId portChainId1 = PortChainId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- TenantId tenantId1 = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
- private final List<PortPairGroupId> portPairGroupList1 = Lists.newArrayList();
- private final List<FlowClassifierId> flowClassifierList1 = Lists.newArrayList();
-
-
- final MockPortChain portChain1 = new MockPortChain(portChainId1, tenantId1, "portChain1",
- "Mock port chain", portPairGroupList1,
- flowClassifierList1);
-
- /**
- * Mock class for a port chain.
- */
- private static class MockPortChain implements PortChain {
-
- private final PortChainId portChainId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final List<PortPairGroupId> portPairGroupList;
- private final List<FlowClassifierId> flowClassifierList;
-
- public MockPortChain(PortChainId portChainId, TenantId tenantId,
- String name, String description,
- List<PortPairGroupId> portPairGroupList,
- List<FlowClassifierId> flowClassifierList) {
-
- this.portChainId = portChainId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.portPairGroupList = portPairGroupList;
- this.flowClassifierList = flowClassifierList;
- }
-
- @Override
- public PortChainId portChainId() {
- return portChainId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public List<PortPairGroupId> portPairGroups() {
- return ImmutableList.copyOf(portPairGroupList);
- }
-
- @Override
- public List<FlowClassifierId> flowClassifiers() {
- return ImmutableList.copyOf(flowClassifierList);
- }
-
- @Override
- public boolean exactMatch(PortChain portChain) {
- return this.equals(portChain) &&
- Objects.equals(this.portChainId, portChain.portChainId()) &&
- Objects.equals(this.tenantId, portChain.tenantId());
- }
- }
-
- /**
- * Sets up the global values for all the tests.
- */
- @Before
- public void setUpTest() {
- SfcCodecContext context = new SfcCodecContext();
- ServiceDirectory testDirectory = new TestServiceDirectory()
- .add(PortChainService.class, portChainService)
- .add(CodecService.class, context.codecManager());
- BaseResource.setServiceDirectory(testDirectory);
-
- }
-
- /**
- * Cleans up.
- */
- @After
- public void tearDownTest() {
- }
-
- /**
- * Tests the result of the rest api GET when there are no port chains.
- */
- @Test
- public void testPortChainsEmpty() {
-
- expect(portChainService.getPortChains()).andReturn(null).anyTimes();
- replay(portChainService);
- final WebResource rs = resource();
- final String response = rs.path("port_chains").get(String.class);
- assertThat(response, is("{\"port_chains\":[]}"));
- }
-
- /**
- * Tests the result of a rest api GET for port chain id.
- */
- @Test
- public void testGetPortChainId() {
-
- final Set<PortChain> portChains = new HashSet<>();
- portChains.add(portChain1);
-
- expect(portChainService.exists(anyObject())).andReturn(true).anyTimes();
- expect(portChainService.getPortChain(anyObject())).andReturn(portChain1).anyTimes();
- replay(portChainService);
-
- final WebResource rs = resource();
- final String response = rs.path("port_chains/1278dcd4-459f-62ed-754b-87fc5e4a6751").get(String.class);
- final JsonObject result = JsonObject.readFrom(response);
- assertThat(result, notNullValue());
- }
-
- /**
- * Tests that a fetch of a non-existent port chain object throws an exception.
- */
- @Test
- public void testBadGet() {
- expect(portChainService.getPortChain(anyObject()))
- .andReturn(null).anyTimes();
- replay(portChainService);
- WebResource rs = resource();
- try {
- rs.path("port_chains/78dcd363-fc23-aeb6-f44b-56dc5aafb3ae").get(String.class);
- fail("Fetch of non-existent port chain did not throw an exception");
- } catch (UniformInterfaceException ex) {
- assertThat(ex.getMessage(),
- containsString("returned a response status of"));
- }
- }
-
- /**
- * Tests creating a port chain with POST.
- */
- @Test
- public void testPost() {
-
- expect(portChainService.createPortChain(anyObject()))
- .andReturn(true).anyTimes();
- replay(portChainService);
-
- WebResource rs = resource();
- InputStream jsonStream = PortChainResourceTest.class.getResourceAsStream("post-PortChain.json");
-
- ClientResponse response = rs.path("port_chains")
- .type(MediaType.APPLICATION_JSON_TYPE)
- .post(ClientResponse.class, jsonStream);
- assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
- }
-
- /**
- * Tests deleting a port chain.
- */
- @Test
- public void testDelete() {
- expect(portChainService.removePortChain(anyObject()))
- .andReturn(true).anyTimes();
- replay(portChainService);
-
- WebResource rs = resource();
-
- String location = "port_chains/1278dcd4-459f-62ed-754b-87fc5e4a6751";
-
- ClientResponse deleteResponse = rs.path(location)
- .type(MediaType.APPLICATION_JSON_TYPE)
- .delete(ClientResponse.class);
- assertThat(deleteResponse.getStatus(),
- is(HttpURLConnection.HTTP_NO_CONTENT));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairGroupResourceTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairGroupResourceTest.java
deleted file mode 100644
index c13f2141..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairGroupResourceTest.java
+++ /dev/null
@@ -1,234 +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.vtnweb.resources;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.osgi.TestServiceDirectory;
-import org.onlab.rest.BaseResource;
-import org.onosproject.codec.CodecService;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
-import org.onosproject.vtnweb.web.SfcCodecContext;
-
-import com.eclipsesource.json.JsonObject;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-/**
- * Unit tests for port pair group REST APIs.
- */
-public class PortPairGroupResourceTest extends VtnResourceTest {
-
- final PortPairGroupService portPairGroupService = createMock(PortPairGroupService.class);
-
- PortPairGroupId portPairGroupId1 = PortPairGroupId.of("4512d643-24fc-4fae-af4b-321c5e2eb3d1");
- TenantId tenantId1 = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
- private final List<PortPairId> portPairList1 = Lists.newArrayList();
-
- final MockPortPairGroup portPairGroup1 = new MockPortPairGroup(portPairGroupId1, tenantId1, "portPairGroup1",
- "Mock port pair group", portPairList1);
-
- /**
- * Mock class for a port pair group.
- */
- private static class MockPortPairGroup implements PortPairGroup {
-
- private final PortPairGroupId portPairGroupId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final List<PortPairId> portPairList;
-
- public MockPortPairGroup(PortPairGroupId portPairGroupId, TenantId tenantId,
- String name, String description,
- List<PortPairId> portPairList) {
-
- this.portPairGroupId = portPairGroupId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.portPairList = portPairList;
- }
-
- @Override
- public PortPairGroupId portPairGroupId() {
- return portPairGroupId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public List<PortPairId> portPairs() {
- return ImmutableList.copyOf(portPairList);
- }
-
- @Override
- public boolean exactMatch(PortPairGroup portPairGroup) {
- return this.equals(portPairGroup) &&
- Objects.equals(this.portPairGroupId, portPairGroup.portPairGroupId()) &&
- Objects.equals(this.tenantId, portPairGroup.tenantId());
- }
- }
-
- /**
- * Sets up the global values for all the tests.
- */
- @Before
- public void setUpTest() {
- SfcCodecContext context = new SfcCodecContext();
- ServiceDirectory testDirectory = new TestServiceDirectory()
- .add(PortPairGroupService.class, portPairGroupService)
- .add(CodecService.class, context.codecManager());
- BaseResource.setServiceDirectory(testDirectory);
-
- }
-
- /**
- * Cleans up.
- */
- @After
- public void tearDownTest() {
- }
-
- /**
- * Tests the result of the rest api GET when there are no port pair groups.
- */
- @Test
- public void testPortPairGroupsEmpty() {
-
- expect(portPairGroupService.getPortPairGroups()).andReturn(null).anyTimes();
- replay(portPairGroupService);
- final WebResource rs = resource();
- final String response = rs.path("port_pair_groups").get(String.class);
- assertThat(response, is("{\"port_pair_groups\":[]}"));
- }
-
- /**
- * Tests the result of a rest api GET for port pair group id.
- */
- @Test
- public void testGetPortPairGroupId() {
-
- final Set<PortPairGroup> portPairGroups = new HashSet<>();
- portPairGroups.add(portPairGroup1);
-
- expect(portPairGroupService.exists(anyObject())).andReturn(true).anyTimes();
- expect(portPairGroupService.getPortPairGroup(anyObject())).andReturn(portPairGroup1).anyTimes();
- replay(portPairGroupService);
-
- final WebResource rs = resource();
- final String response = rs.path("port_pair_groups/4512d643-24fc-4fae-af4b-321c5e2eb3d1").get(String.class);
- final JsonObject result = JsonObject.readFrom(response);
- assertThat(result, notNullValue());
- }
-
- /**
- * Tests that a fetch of a non-existent port pair group object throws an exception.
- */
- @Test
- public void testBadGet() {
- expect(portPairGroupService.getPortPairGroup(anyObject()))
- .andReturn(null).anyTimes();
- replay(portPairGroupService);
- WebResource rs = resource();
- try {
- rs.path("port_pair_groups/78dcd363-fc23-aeb6-f44b-56dc5aafb3ae").get(String.class);
- fail("Fetch of non-existent port pair group did not throw an exception");
- } catch (UniformInterfaceException ex) {
- assertThat(ex.getMessage(),
- containsString("returned a response status of"));
- }
- }
-
- /**
- * Tests creating a port pair group with POST.
- */
- @Test
- public void testPost() {
-
- expect(portPairGroupService.createPortPairGroup(anyObject()))
- .andReturn(true).anyTimes();
- replay(portPairGroupService);
-
- WebResource rs = resource();
- InputStream jsonStream = PortPairGroupResourceTest.class.getResourceAsStream("post-PortPairGroup.json");
-
- ClientResponse response = rs.path("port_pair_groups")
- .type(MediaType.APPLICATION_JSON_TYPE)
- .post(ClientResponse.class, jsonStream);
- assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
- }
-
- /**
- * Tests deleting a port pair group.
- */
- @Test
- public void testDelete() {
- expect(portPairGroupService.removePortPairGroup(anyObject()))
- .andReturn(true).anyTimes();
- replay(portPairGroupService);
-
- WebResource rs = resource();
-
- String location = "port_pair_groups/4512d643-24fc-4fae-af4b-321c5e2eb3d1";
-
- ClientResponse deleteResponse = rs.path(location)
- .type(MediaType.APPLICATION_JSON_TYPE)
- .delete(ClientResponse.class);
- assertThat(deleteResponse.getStatus(),
- is(HttpURLConnection.HTTP_NO_CONTENT));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairResourceTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairResourceTest.java
deleted file mode 100644
index 36014ec5..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/PortPairResourceTest.java
+++ /dev/null
@@ -1,237 +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.vtnweb.resources;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.osgi.ServiceDirectory;
-import org.onlab.osgi.TestServiceDirectory;
-import org.onlab.rest.BaseResource;
-import org.onosproject.codec.CodecService;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.portpair.PortPairService;
-import org.onosproject.vtnweb.web.SfcCodecContext;
-
-import com.eclipsesource.json.JsonObject;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-/**
- * Unit tests for port pair REST APIs.
- */
-public class PortPairResourceTest extends VtnResourceTest {
-
- final PortPairService portPairService = createMock(PortPairService.class);
-
- PortPairId portPairId1 = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- TenantId tenantId1 = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
-
- final MockPortPair portPair1 = new MockPortPair(portPairId1, tenantId1, "portPair1",
- "Mock port pair", "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
- "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345");
-
- /**
- * Mock class for a port pair.
- */
- private static class MockPortPair implements PortPair {
-
- private final PortPairId portPairId;
- private final TenantId tenantId;
- private final String name;
- private final String description;
- private final String ingress;
- private final String egress;
-
- public MockPortPair(PortPairId portPairId, TenantId tenantId,
- String name, String description,
- String ingress, String egress) {
-
- this.portPairId = portPairId;
- this.tenantId = tenantId;
- this.name = name;
- this.description = description;
- this.ingress = ingress;
- this.egress = egress;
- }
-
- @Override
- public PortPairId portPairId() {
- return portPairId;
- }
-
- @Override
- public TenantId tenantId() {
- return tenantId;
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public String description() {
- return description;
- }
-
- @Override
- public String ingress() {
- return ingress;
- }
-
- @Override
- public String egress() {
- return egress;
- }
-
- @Override
- public boolean exactMatch(PortPair portPair) {
- return this.equals(portPair) &&
- Objects.equals(this.portPairId, portPair.portPairId()) &&
- Objects.equals(this.tenantId, portPair.tenantId());
- }
- }
-
- /**
- * Sets up the global values for all the tests.
- */
- @Before
- public void setUpTest() {
-
- SfcCodecContext context = new SfcCodecContext();
- ServiceDirectory testDirectory = new TestServiceDirectory().add(PortPairService.class, portPairService)
- .add(CodecService.class, context.codecManager());
- BaseResource.setServiceDirectory(testDirectory);
-
- }
-
- /**
- * Cleans up.
- */
- @After
- public void tearDownTest() {
- }
-
- /**
- * Tests the result of the rest api GET when there are no port pairs.
- */
- @Test
- public void testPortPairsEmpty() {
-
- expect(portPairService.getPortPairs()).andReturn(null).anyTimes();
- replay(portPairService);
- final WebResource rs = resource();
- final String response = rs.path("port_pairs").get(String.class);
- assertThat(response, is("{\"port_pairs\":[]}"));
- }
-
- /**
- * Tests the result of a rest api GET for port pair id.
- */
- @Test
- public void testGetPortPairId() {
-
- final Set<PortPair> portPairs = new HashSet<>();
- portPairs.add(portPair1);
-
- expect(portPairService.exists(anyObject())).andReturn(true).anyTimes();
- expect(portPairService.getPortPair(anyObject())).andReturn(portPair1).anyTimes();
- replay(portPairService);
-
- final WebResource rs = resource();
- final String response = rs.path("port_pairs/78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae").get(String.class);
- final JsonObject result = JsonObject.readFrom(response);
- assertThat(result, notNullValue());
- }
-
- /**
- * Tests that a fetch of a non-existent port pair object throws an exception.
- */
- @Test
- public void testBadGet() {
- expect(portPairService.getPortPair(anyObject()))
- .andReturn(null).anyTimes();
- replay(portPairService);
- WebResource rs = resource();
- try {
- rs.path("port_pairs/78dcd363-fc23-aeb6-f44b-56dc5aafb3ae").get(String.class);
- fail("Fetch of non-existent port pair did not throw an exception");
- } catch (UniformInterfaceException ex) {
- assertThat(ex.getMessage(),
- containsString("returned a response status of"));
- }
- }
-
- /**
- * Tests creating a port pair with POST.
- */
- @Test
- public void testPost() {
-
- expect(portPairService.createPortPair(anyObject()))
- .andReturn(true).anyTimes();
- replay(portPairService);
-
- WebResource rs = resource();
- InputStream jsonStream = PortPairResourceTest.class.getResourceAsStream("post-PortPair.json");
-
- ClientResponse response = rs.path("port_pairs")
- .type(MediaType.APPLICATION_JSON_TYPE)
- .post(ClientResponse.class, jsonStream);
- assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
- }
-
- /**
- * Tests deleting a port pair.
- */
- @Test
- public void testDelete() {
- expect(portPairService.removePortPair(anyObject()))
- .andReturn(true).anyTimes();
- replay(portPairService);
-
- WebResource rs = resource();
-
- String location = "port_pairs/78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae";
-
- ClientResponse deleteResponse = rs.path(location)
- .type(MediaType.APPLICATION_JSON_TYPE)
- .delete(ClientResponse.class);
- assertThat(deleteResponse.getStatus(),
- is(HttpURLConnection.HTTP_NO_CONTENT));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/VtnResourceTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/VtnResourceTest.java
deleted file mode 100644
index 4b95844d..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/resources/VtnResourceTest.java
+++ /dev/null
@@ -1,54 +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.vtnweb.resources;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-
-/**
- * Base class for VTN REST API tests. Performs common configuration operations.
- */
-public class VtnResourceTest extends JerseyTest {
-
- /**
- * Assigns an available port for the test.
- *
- * @param defaultPort If a port cannot be determined, this one is used.
- * @return free port
- */
- @Override
- public int getPort(int defaultPort) {
- try {
- ServerSocket socket = new ServerSocket(0);
- socket.setReuseAddress(true);
- int port = socket.getLocalPort();
- socket.close();
- return port;
- } catch (IOException ioe) {
- return defaultPort;
- }
- }
-
- @Override
- public AppDescriptor configure() {
- return new WebAppDescriptor.Builder("org.onosproject.vtnweb.resources").build();
- }
-
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/FlowClassifierCodecTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/FlowClassifierCodecTest.java
deleted file mode 100644
index be36aa83..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/FlowClassifierCodecTest.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.vtnweb.web;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Flow classifier codec unit tests.
- */
-public class FlowClassifierCodecTest {
-
- SfcCodecContext context;
- JsonCodec<FlowClassifier> flowClassifierCodec;
- /**
- * Sets up for each test. Creates a context and fetches the flow classifier
- * codec.
- */
- @Before
- public void setUp() {
- context = new SfcCodecContext();
- flowClassifierCodec = context.codec(FlowClassifier.class);
- assertThat(flowClassifierCodec, notNullValue());
- }
-
- /**
- * Reads in a flow classifier from the given resource and decodes it.
- *
- * @param resourceName resource to use to read the JSON for the flow classifier
- * @return decoded flow classifier
- * @throws IOException if processing the resource fails
- */
- private FlowClassifier getFlowClassifier(String resourceName) throws IOException {
- InputStream jsonStream = FlowClassifierCodecTest.class
- .getResourceAsStream(resourceName);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode json = mapper.readTree(jsonStream);
- assertThat(json, notNullValue());
- FlowClassifier flowClassifier = flowClassifierCodec.decode((ObjectNode) json, context);
- assertThat(flowClassifier, notNullValue());
- return flowClassifier;
- }
-
- /**
- * Checks that a simple flow classifier decodes properly.
- *
- * @throws IOException if the resource cannot be processed
- */
- @Test
- public void codecFlowClassifierTest() throws IOException {
-
- FlowClassifier flowClassifier = getFlowClassifier("flowClassifier.json");
-
- assertThat(flowClassifier, notNullValue());
-
- FlowClassifierId flowClassifierId = FlowClassifierId.of("4a334cd4-fe9c-4fae-af4b-321c5e2eb051");
- TenantId tenantId = TenantId.tenantId("1814726e2d22407b8ca76db5e567dcf1");
-
- assertThat(flowClassifier.flowClassifierId().toString(), is(flowClassifierId.toString()));
- assertThat(flowClassifier.name(), is("flow1"));
- assertThat(flowClassifier.tenantId().toString(), is(tenantId.toString()));
- assertThat(flowClassifier.description(), is("flow classifier"));
- assertThat(flowClassifier.protocol(), is("tcp"));
- assertThat(flowClassifier.minSrcPortRange(), is(22));
- assertThat(flowClassifier.maxSrcPortRange(), is(4000));
- assertThat(flowClassifier.minDstPortRange(), is(80));
- assertThat(flowClassifier.maxDstPortRange(), is(80));
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortChainCodecTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortChainCodecTest.java
deleted file mode 100644
index 02681db3..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortChainCodecTest.java
+++ /dev/null
@@ -1,95 +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.vtnweb.web;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.PortChain;
-import org.onosproject.vtnrsc.PortChainId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Flow rule codec unit tests.
- */
-public class PortChainCodecTest {
-
- SfcCodecContext context;
- JsonCodec<PortChain> portChainCodec;
- /**
- * Sets up for each test. Creates a context and fetches the flow rule
- * codec.
- */
- @Before
- public void setUp() {
- context = new SfcCodecContext();
- portChainCodec = context.codec(PortChain.class);
- assertThat(portChainCodec, notNullValue());
- }
-
- /**
- * Reads in a rule from the given resource and decodes it.
- *
- * @param resourceName resource to use to read the JSON for the rule
- * @return decoded flow rule
- * @throws IOException if processing the resource fails
- */
- private PortChain getPortChain(String resourceName) throws IOException {
- InputStream jsonStream = PortChainCodecTest.class
- .getResourceAsStream(resourceName);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode json = mapper.readTree(jsonStream);
- assertThat(json, notNullValue());
- PortChain portChain = portChainCodec.decode((ObjectNode) json, context);
- assertThat(portChain, notNullValue());
- return portChain;
- }
-
- /**
- * Checks that a simple rule decodes properly.
- *
- * @throws IOException if the resource cannot be processed
- */
- @Test
- public void codecPortChainTest() throws IOException {
-
- PortChain portChain = getPortChain("portChain.json");
-
- assertThat(portChain, notNullValue());
-
- PortChainId portChainId = PortChainId.of("1278dcd4-459f-62ed-754b-87fc5e4a6751");
- TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
-
- assertThat(portChain.portChainId().toString(), is(portChainId.toString()));
- assertThat(portChain.name(), is("PC2"));
- assertThat(portChain.tenantId().toString(), is(tenantId.toString()));
- assertThat(portChain.description(), is("Two flows and two port-pair-groups"));
-
- assertThat(portChain.flowClassifiers(), notNullValue());
- assertThat(portChain.portPairGroups(), notNullValue());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairCodecTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairCodecTest.java
deleted file mode 100644
index 7651e098..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairCodecTest.java
+++ /dev/null
@@ -1,94 +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.vtnweb.web;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.PortPair;
-import org.onosproject.vtnrsc.PortPairId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Port pair codec unit tests.
- */
-public class PortPairCodecTest {
-
- SfcCodecContext context;
- JsonCodec<PortPair> portPairCodec;
- /**
- * Sets up for each test. Creates a context and fetches the port pair
- * codec.
- */
- @Before
- public void setUp() {
- context = new SfcCodecContext();
- portPairCodec = context.codec(PortPair.class);
- assertThat(portPairCodec, notNullValue());
- }
-
- /**
- * Reads in a port pair from the given resource and decodes it.
- *
- * @param resourceName resource to use to read the JSON for the port pair
- * @return decoded port pair
- * @throws IOException if processing the resource fails
- */
- private PortPair getPortPair(String resourceName) throws IOException {
- InputStream jsonStream = PortPairCodecTest.class
- .getResourceAsStream(resourceName);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode json = mapper.readTree(jsonStream);
- assertThat(json, notNullValue());
- PortPair portPair = portPairCodec.decode((ObjectNode) json, context);
- assertThat(portPair, notNullValue());
- return portPair;
- }
-
- /**
- * Checks that a simple port pair decodes properly.
- *
- * @throws IOException if the resource cannot be processed
- */
- @Test
- public void codecPortPairTest() throws IOException {
-
- PortPair portPair = getPortPair("portPair.json");
-
- assertThat(portPair, notNullValue());
-
- PortPairId portPairId = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
-
- assertThat(portPair.portPairId().toString(), is(portPairId.toString()));
- assertThat(portPair.name(), is("PP1"));
- assertThat(portPair.tenantId().toString(), is(tenantId.toString()));
- assertThat(portPair.description(), is("SF-A"));
- assertThat(portPair.ingress().toString(), is("dace4513-24fc-4fae-af4b-321c5e2eb3d1"));
- assertThat(portPair.egress().toString(), is("aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"));
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairGroupCodecTest.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairGroupCodecTest.java
deleted file mode 100644
index de2ee001..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/PortPairGroupCodecTest.java
+++ /dev/null
@@ -1,93 +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.vtnweb.web;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.PortPairGroup;
-import org.onosproject.vtnrsc.PortPairGroupId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Flow rule codec unit tests.
- */
-public class PortPairGroupCodecTest {
-
- SfcCodecContext context;
- JsonCodec<PortPairGroup> portPairGroupCodec;
- /**
- * Sets up for each test. Creates a context and fetches the flow rule
- * codec.
- */
- @Before
- public void setUp() {
- context = new SfcCodecContext();
- portPairGroupCodec = context.codec(PortPairGroup.class);
- assertThat(portPairGroupCodec, notNullValue());
- }
-
- /**
- * Reads in a rule from the given resource and decodes it.
- *
- * @param resourceName resource to use to read the JSON for the rule
- * @return decoded flow rule
- * @throws IOException if processing the resource fails
- */
- private PortPairGroup getPortPairGroup(String resourceName) throws IOException {
- InputStream jsonStream = PortPairGroupCodecTest.class
- .getResourceAsStream(resourceName);
- ObjectMapper mapper = new ObjectMapper();
- JsonNode json = mapper.readTree(jsonStream);
- assertThat(json, notNullValue());
- PortPairGroup portPairGroup = portPairGroupCodec.decode((ObjectNode) json, context);
- assertThat(portPairGroup, notNullValue());
- return portPairGroup;
- }
-
- /**
- * Checks that a simple rule decodes properly.
- *
- * @throws IOException if the resource cannot be processed
- */
- @Test
- public void codecPortPairGroupTest() throws IOException {
-
- PortPairGroup portPairGroup = getPortPairGroup("portPairGroup.json");
-
- assertThat(portPairGroup, notNullValue());
-
- PortPairGroupId portPairGroupId = PortPairGroupId.of("4512d643-24fc-4fae-af4b-321c5e2eb3d1");
- TenantId tenantId = TenantId.tenantId("d382007aa9904763a801f68ecf065cf5");
-
- assertThat(portPairGroup.portPairGroupId().toString(), is(portPairGroupId.toString()));
- assertThat(portPairGroup.name(), is("PG1"));
- assertThat(portPairGroup.tenantId().toString(), is(tenantId.toString()));
- assertThat(portPairGroup.description(), is("Two port-pairs"));
- assertThat(portPairGroup.portPairs(), notNullValue());
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/SfcCodecContext.java b/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/SfcCodecContext.java
deleted file mode 100644
index c56a4fcb..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/java/org/onosproject/vtnweb/web/SfcCodecContext.java
+++ /dev/null
@@ -1,68 +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.vtnweb.web;
-
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.CodecService;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.codec.impl.CodecManager;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Mock codec context for use in codec unit tests.
- */
-public class SfcCodecContext implements CodecContext {
-
- private final ObjectMapper mapper = new ObjectMapper();
- private final CodecManager codecManager = new CodecManager();
- private final VtnCodecRegistrator manager = new VtnCodecRegistrator();
-
- /**
- * Constructs a new mock codec context.
- */
- public SfcCodecContext() {
- codecManager.activate();
- manager.codecService = codecManager;
- manager.activate();
- }
-
- @Override
- public ObjectMapper mapper() {
- return mapper;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getService(Class<T> serviceClass) {
- // TODO
- return null;
- }
-
- @Override
- public <T> JsonCodec<T> codec(Class<T> entityClass) {
- return codecManager.getCodec(entityClass);
- }
-
- /**
- * Get the codec manager.
- *
- * @return instance of codec manager
- */
- public CodecService codecManager() {
- return codecManager;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-FlowClassifier.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-FlowClassifier.json
deleted file mode 100644
index 6e72e8fd..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-FlowClassifier.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{"flow_classifier": {
- "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
- "name": "flow1",
- "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
- "description": "flow classifier",
- "ethertype": "IPv4",
- "protocol": "tcp",
- "source_port_range_min": 22, "source_port_range_max": 4000,
- "destination_port_range_min": 80, "destination_port_range_max": 80,
- "source_ip_prefix": "1.1.1.1/16" , "destination_ip_prefix": "22.12.34.45/16",
- "logical_destination_port": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
- "logical_source_port": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortChain.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortChain.json
deleted file mode 100644
index 488e290f..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortChain.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{"port_pair": {
- "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751",
- "name": "PC2",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "Two flows and two port-pair-groups",
- "flow_classifiers": [
- "456a4a34-2e9c-14ae-37fb-765feae2eb05",
- "4a334cd4-fe9c-4fae-af4b-321c5e2eb051"
- ],
- "port_pair_groups": [
- "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
- "4a634d49-76dc-4fae-af4b-321c5e23d651"
- ]
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPair.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPair.json
deleted file mode 100644
index 2a774e31..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPair.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{"port_pair": {
- "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae",
- "name": "PP1",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "SF-A",
- "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
- "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPairGroup.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPairGroup.json
deleted file mode 100644
index f6a888d9..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/resources/post-PortPairGroup.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{"port_pair_group": {
- "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
- "name": "portPairGroup1",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "Mock port pair group",
- "port_pairs": [
- "875dfeda-43ed-23fe-454b-764feab2c342",
- "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
- ]
-}
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/flowClassifier.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/flowClassifier.json
deleted file mode 100644
index 0fc0b74e..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/flowClassifier.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "id": "4a334cd4-fe9c-4fae-af4b-321c5e2eb051",
- "name": "flow1",
- "tenant_id": "1814726e2d22407b8ca76db5e567dcf1",
- "description": "flow classifier",
- "ethertype": "IPv4",
- "protocol": "tcp",
- "source_port_range_min": 22, "source_port_range_max": 4000,
- "destination_port_range_min": 80, "destination_port_range_max": 80,
- "source_ip_prefix": "1.1.1.1/16" , "destination_ip_prefix": "22.12.34.45/16"
- }
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portChain.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portChain.json
deleted file mode 100644
index 07a1bc21..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portChain.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "id": "1278dcd4-459f-62ed-754b-87fc5e4a6751",
- "name": "PC2",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "Two flows and two port-pair-groups",
- "flow_classifiers": [
- "456a4a34-2e9c-14ae-37fb-765feae2eb05",
- "4a334cd4-fe9c-4fae-af4b-321c5e2eb051"
- ],
- "port_pair_groups": [
- "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
- "4a634d49-76dc-4fae-af4b-321c5e23d651"
- ]
-}
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPair.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPair.json
deleted file mode 100644
index f858c88c..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPair.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "id": "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae",
- "name": "PP1",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "SF-A",
- "ingress": "dace4513-24fc-4fae-af4b-321c5e2eb3d1",
- "egress": "aef3478a-4a56-2a6e-cd3a-9dee4e2ec345"
-}
-
diff --git a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPairGroup.json b/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPairGroup.json
deleted file mode 100644
index e19a66fc..00000000
--- a/framework/src/onos/apps/vtn/vtnweb/src/test/resources/org/onosproject/vtnweb/web/portPairGroup.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "id": "4512d643-24fc-4fae-af4b-321c5e2eb3d1",
- "name": "PG1",
- "tenant_id": "d382007aa9904763a801f68ecf065cf5",
- "description": "Two port-pairs",
- "port_pairs": [
- "875dfeda-43ed-23fe-454b-764feab2c342",
- "78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"
- ]
-}