/** * Function for JMX testing. * Creates a new sfService function with fixed parameters. * * @return Boolean */ @Override public Boolean testAPutSf() { // printTraceStart(LOG); return putSf(new SfName("firewall-test"), new SftTypeName("firewall"), "10.0.0.2", "192.168.0.2", 5050); }
private RenderedServicePath createRsp(ServiceFunctionPath sfcPath, RspName rspName) { CreateRenderedPathInput rspInput = new CreateRenderedPathInputBuilder().setParentServiceFunctionPath(sfcPath.getName().getValue()) .setName(rspName.getValue()) .setSymmetric(sfcPath.isSymmetric()) .build(); return SfcProviderRenderedPathAPI.createRenderedServicePathAndState(sfcPath, rspInput); }
private ObjectNode getSfDataPlaneLocatorObjectNode(SfDataPlaneLocator locator) { ObjectNode sfLocatorNode = ExporterUtil.getDataPlaneLocatorObjectNode(locator); if (sfLocatorNode == null) { sfLocatorNode = mapper.createObjectNode(); } sfLocatorNode.put(_NAME, locator.getName().getValue()); sfLocatorNode.put(_SERVICE_FUNCTION_FORWARDER, locator.getServiceFunctionForwarder().getValue()); return sfLocatorNode; } }
public static CreateRenderedPathInput buildCreateRenderedServicePathInput(ServiceFunctionPath sfp) { CreateRenderedPathInputBuilder rpInputBuilder = new CreateRenderedPathInputBuilder(); rpInputBuilder.setName(sfp.getName().getValue()); rpInputBuilder.setSymmetric(sfp.isSymmetric()); rpInputBuilder.setParentServiceFunctionPath(sfp.getName().getValue()); return rpInputBuilder.build(); }
private SfName getServiceFunctionByType(ServiceFunctionType serviceFunctionType) { List<SftServiceFunctionName> sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName(); int countRoundRobin = 0; if (mapCountRoundRobin.size() != 0) { for (SftTypeName sfType : mapCountRoundRobin.keySet()) { if (sfType.equals(serviceFunctionType.getType())) { countRoundRobin = mapCountRoundRobin.get(sfType); LOG.debug("countRoundRobin: {}", countRoundRobin); break; } } } SftServiceFunctionName sftServiceFunctionName = sftServiceFunctionNameList.get(countRoundRobin); countRoundRobin = (countRoundRobin + 1) % sftServiceFunctionNameList.size(); mapCountRoundRobin.put(serviceFunctionType.getType(), countRoundRobin); return new SfName(sftServiceFunctionName.getName()); }
public static ServiceFunctionPath buildServiceFunctionPath(ServiceFunctionChain sfc) { Preconditions.checkNotNull(sfc, "Service Function Chain must not be null"); ServiceFunctionPathBuilder sfpBuilder = new ServiceFunctionPathBuilder(); //Set the name sfpBuilder.setName(new SfpName(SFP_NAME_PREFIX + sfc.getName().getValue())); sfpBuilder.setSymmetric(sfc.isSymmetric()); //Set related SFC name sfpBuilder.setServiceChainName(sfc.getName()); return sfpBuilder.build(); }
public static ServiceFunctionKey getSFKey(PortPair portPair) { return new ServiceFunctionKey(new SfName(portPair.getName())); } }
public static ServiceFunctionChainKey getSFCKey(PortChain portChain) { return new ServiceFunctionChainKey(new SfcName(portChain.getName())); }
protected static ObjectNode getSffSfDataPlaneLocatorObjectNode(SffSfDataPlaneLocator sffSfDpl) { if (sffSfDpl == null) { return null; } ObjectMapper mapper = new ObjectMapper(); ObjectNode sffSfDplNode = mapper.createObjectNode(); if(sffSfDpl.getSfDplName() != null) { sffSfDplNode.put(_SF_DPL_NAME, sffSfDpl.getSfDplName().getValue()); } if(sffSfDpl.getSffDplName() != null) { sffSfDplNode.put(_SFF_DPL_NAME, sffSfDpl.getSffDplName().getValue()); } return sffSfDplNode; }
@Override public void removeRsp(RenderedServicePath change) { sfcClassifierService.clearFlows(dataBroker, change.getName().getValue()); }
public static ServiceFunctionPath getSfcPath(SfcName chainName) { ServiceFunctionPaths paths = SfcProviderServicePathAPI.readAllServiceFunctionPaths(); if (paths != null) { for (ServiceFunctionPath path : paths.getServiceFunctionPath()) { if (path.getServiceChainName().equals(chainName)) { return path; } } } return null; }
public static ServiceFunctionPathKey getSFPKey(PortChain portChain) { return new ServiceFunctionPathKey(new SfpName(SFP_NAME_PREFIX + portChain.getName())); } }
public IpAddress getSfIpAddress(String sfname) { ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(SfName.getDefaultInstance(sfname)); if (serviceFunction == null) { LOG.info("Failed to read ServiceFunction: {}", sfname); return null; } return getSfIpAddress(serviceFunction); }
private RenderedServicePath createRsp(ServiceFunctionPath sfcPath, RspName rspName) { CreateRenderedPathInput rspInput = new CreateRenderedPathInputBuilder().setParentServiceFunctionPath(sfcPath.getName().getValue()) .setName(rspName.getValue()) .setSymmetric(sfcPath.isSymmetric()) .build(); return SfcProviderRenderedPathAPI.createRenderedServicePathAndState(sfcPath, rspInput); }
/** * Function for JMX testing. * Creates multiple Service Functions with fixed parameters. * * @return Boolean */ @Override public Boolean testBPutSfs() { // printTraceStart(LOG); Boolean res = putSf(new SfName("firewall-testB"), new SftTypeName("firewall"), "10.0.0.101", "192.168.0.101", 5050); res = putSf(new SfName("dpi-testB"), new SftTypeName("dpi"), "10.0.0.102", "192.168.0.102", 5050) && res; res = putSf(new SfName("napt44-testB"), new SftTypeName("napt44"), "10.0.0.103", "192.168.0.102", 5050) && res; return res; }
public static DeleteRenderedPathInput buildDeleteRenderedServicePathInput(ServiceFunctionPathKey sfpKey) { DeleteRenderedPathInputBuilder rpInputBuilder = new DeleteRenderedPathInputBuilder(); rpInputBuilder.setName(sfpKey.getName().getValue()); return rpInputBuilder.build(); } public static ServiceFunctionChainKey getSFCKey(PortChain portChain) {
private ServiceFunctionPath getSfcPath(SfcName chainName) { ServiceFunctionPaths paths = SfcProviderServicePathAPI.readAllServiceFunctionPaths(); for (ServiceFunctionPath path : paths.getServiceFunctionPath()) { if (path.getServiceChainName().equals(chainName)) { return path; } } return null; }
public InstanceIdentifier<ServiceFunction> getSfId(String sfName) { return InstanceIdentifier.builder(ServiceFunctions.class) .child(ServiceFunction.class, new ServiceFunctionKey(SfName.getDefaultInstance(sfName))).build(); }