@Test public void testInstallFlowClassifier() { ApplicationId appId = new DefaultApplicationId(1, "test"); SfcFlowRuleInstallerImpl flowClassifierInstaller = new SfcFlowRuleInstallerImpl(); flowClassifierInstaller.virtualPortService = virtualPortService; flowClassifierInstaller.vtnRscService = vtnRscService; flowClassifierInstaller.portPairService = portPairService; flowClassifierInstaller.portPairGroupService = portPairGroupService; flowClassifierInstaller.flowClassifierService = flowClassifierService; flowClassifierInstaller.driverService = driverService; flowClassifierInstaller.deviceService = deviceService; flowClassifierInstaller.hostService = hostService; flowClassifierInstaller.flowObjectiveService = flowObjectiveService; flowClassifierInstaller.appId = appId; final PortChain portChain = createPortChain(); NshServicePathId nshSpiId = NshServicePathId.of(10); portPairGroupService.createPortPairGroup(createPortPairGroup(portPairGroupId1)); portPairGroupService.createPortPairGroup(createPortPairGroup(portPairGroupId2)); portPairService.createPortPair(createPortPair(portPairId1)); portPairService.createPortPair(createPortPair(portPairId2)); FlowClassifier fc1 = createFlowClassifier(flowClassifierId1); FlowClassifier fc2 = createFlowClassifier(flowClassifierId2); flowClassifierService.createFlowClassifier(fc1); flowClassifierService.createFlowClassifier(fc2); List<VirtualPort> virtualPortList = Lists.newArrayList(); virtualPortList.add(createVirtualPort(VirtualPortId.portId(ingress))); virtualPortService.createPorts(virtualPortList); expect(driverService.createHandler(deviceId)).andReturn(driverHandler).anyTimes(); replay(driverService); ConnectPoint connectPoint = flowClassifierInstaller.installFlowClassifier(portChain, nshSpiId); assertThat(connectPoint, is(HostLocation.NONE)); }
@Override public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) { checkNotNull(portChain, PORT_CHAIN_NOT_NULL); List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups(); ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator(); PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next(); PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId); List<PortPairId> llPortPairIdList = portPairGroup.portPairs(); ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator(); PortPairId portPairId = portPairListIterator.next(); PortPair portPair = portPairService.getPortPair(portPairId); return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD); }
SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService { @Override public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) { checkNotNull(portChain, PORT_CHAIN_NOT_NULL); List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups(); ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator(); PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next(); PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId); List<PortPairId> llPortPairIdList = portPairGroup.portPairs(); ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator(); PortPairId portPairId = portPairListIterator.next(); PortPair portPair = portPairService.getPortPair(portPairId); return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD); } }
SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService { @Override public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) { checkNotNull(portChain, PORT_CHAIN_NOT_NULL); List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups(); ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator(); PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next(); PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId); List<PortPairId> llPortPairIdList = portPairGroup.portPairs(); ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator(); PortPairId portPairId = portPairListIterator.next(); PortPair portPair = portPairService.getPortPair(portPairId); return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD); } SfcFlowRuleInstallerImpl();  SfcFlowRuleInstallerImpl(ApplicationId appId); }
SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService { @Override public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) { checkNotNull(portChain, PORT_CHAIN_NOT_NULL); List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups(); ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator(); PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next(); PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId); List<PortPairId> llPortPairIdList = portPairGroup.portPairs(); ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator(); PortPairId portPairId = portPairListIterator.next(); PortPair portPair = portPairService.getPortPair(portPairId); return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD); } SfcFlowRuleInstallerImpl();  SfcFlowRuleInstallerImpl(ApplicationId appId); @Override ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); @Override ConnectPoint unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); @Override ConnectPoint installLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); @Override ConnectPoint unInstallLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); @Override ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); ConnectPoint installSfcFlowRules(PortChain portChain, FiveTuple fiveTuple, NshServicePathId nshSpiId,
            Objective.Operation type); void installSfcTunnelReceiveRule(DeviceId deviceId, NshServicePathId nshSpiId, Objective.Operation type); void installSfcTunnelSendRule(DeviceId deviceId, NshServicePathId nshSpiId, Objective.Operation type); void installSfcEndRule(PortPair portPair, NshServicePathId nshSpiId, Objective.Operation type); void installSfcForwardRule(PortPair portPair, PortPair nextPortPair, NshServicePathId nshSpiId,
            Objective.Operation type); void installSfcEncapOutputRule(PortPair portPair, NshServicePathId nshSpiId, Objective.Operation type); ConnectPoint installSfcClassifierRules(PortChain portChain, PortPair portPair, NshServicePathId nshSpiId,
            FiveTuple fiveTuple, Objective.Operation type); TrafficSelector.Builder packClassifierSelector(FlowClassifier flowClassifier, FiveTuple fiveTuple); TrafficTreatment.Builder packClassifierTreatment(DeviceId deviceId, VirtualPort virtualPort,
            PortNumber port, NshServicePathId nshSpi, FlowClassifier flowClassifier); DeviceId getControllerId(Device device, Iterable<Device> devices); String getControllerIpOfSwitch(Device device); void sendSfcRule(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment, DeviceId deviceId,
            Objective.Operation type, int priority); }
SfcFlowRuleInstallerImpl implements SfcFlowRuleInstallerService { @Override public ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId) { checkNotNull(portChain, PORT_CHAIN_NOT_NULL); List<PortPairGroupId> llPortPairGroupIdList = portChain.portPairGroups(); ListIterator<PortPairGroupId> portPairGroupIdListIterator = llPortPairGroupIdList.listIterator(); PortPairGroupId portPairGroupId = portPairGroupIdListIterator.next(); PortPairGroup portPairGroup = portPairGroupService.getPortPairGroup(portPairGroupId); List<PortPairId> llPortPairIdList = portPairGroup.portPairs(); ListIterator<PortPairId> portPairListIterator = llPortPairIdList.listIterator(); PortPairId portPairId = portPairListIterator.next(); PortPair portPair = portPairService.getPortPair(portPairId); return installSfcClassifierRules(portChain, portPair, nshSpiId, null, Objective.Operation.ADD); } SfcFlowRuleInstallerImpl();  SfcFlowRuleInstallerImpl(ApplicationId appId); @Override ConnectPoint installFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); @Override ConnectPoint unInstallFlowClassifier(PortChain portChain, NshServicePathId nshSpiId); @Override ConnectPoint installLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); @Override ConnectPoint unInstallLoadBalancedFlowRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); @Override ConnectPoint unInstallLoadBalancedClassifierRules(PortChain portChain, FiveTuple fiveTuple,
            NshServicePathId nshSpiId); ConnectPoint installSfcFlowRules(PortChain portChain, FiveTuple fiveTuple, NshServicePathId nshSpiId,
            Objective.Operation type); void installSfcTunnelReceiveRule(DeviceId deviceId, NshServicePathId nshSpiId, Objective.Operation type); void installSfcTunnelSendRule(DeviceId deviceId, NshServicePathId nshSpiId, Objective.Operation type); void installSfcEndRule(PortPair portPair, NshServicePathId nshSpiId, Objective.Operation type); void installSfcForwardRule(PortPair portPair, PortPair nextPortPair, NshServicePathId nshSpiId,
            Objective.Operation type); void installSfcEncapOutputRule(PortPair portPair, NshServicePathId nshSpiId, Objective.Operation type); ConnectPoint installSfcClassifierRules(PortChain portChain, PortPair portPair, NshServicePathId nshSpiId,
            FiveTuple fiveTuple, Objective.Operation type); TrafficSelector.Builder packClassifierSelector(FlowClassifier flowClassifier, FiveTuple fiveTuple); TrafficTreatment.Builder packClassifierTreatment(DeviceId deviceId, VirtualPort virtualPort,
            PortNumber port, NshServicePathId nshSpi, FlowClassifier flowClassifier); DeviceId getControllerId(Device device, Iterable<Device> devices); String getControllerIpOfSwitch(Device device); void sendSfcRule(TrafficSelector.Builder selector, TrafficTreatment.Builder treatment, DeviceId deviceId,
            Objective.Operation type, int priority);  }