/** * 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 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()); }
serviceFunctionBuilder.setType(SftTypeName.getDefaultInstance(portPairGroup.getName())); serviceFunctionBuilder.setType(new SftTypeName(sfParam.getServiceFunctionParameterValue()));
sfgNode.put(_TYPE, SERVICE_FUNCTION_TYPE_PREFIX + sfg.getType().getValue().toLowerCase());
sfNode.put(_TYPE, SERVICE_FUNCTION_TYPE_PREFIX + sf.getType().getValue().toLowerCase());
/** * 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; }
serviceTypeName = serviceFunctionType.getType().getValue(); if (serviceTypeName == null) { LOG.error("Unknown ServiceFunctionType: {}", serviceFunctionType.getType());
/** * Reads a SFG from the datastore * <p> * * @param serviceFunctionType function type * @return ServiceFunctionGroup object or null if not found */ protected static ServiceFunctionGroup getServiceFunctionGroupByType(SftTypeName serviceFunctionType) { printTraceStart(LOG); ServiceFunctionGroup sfg = null; InstanceIdentifier<ServiceFunctionGroups> sfgIID; sfgIID = InstanceIdentifier.builder(ServiceFunctionGroups.class).build(); ServiceFunctionGroups sfgs = SfcDataStoreAPI.readTransactionAPI(sfgIID, LogicalDatastoreType.CONFIGURATION); if (sfgs != null) { for (ServiceFunctionGroup element : sfgs.getServiceFunctionGroup()) { if (element.getType().equals(serviceFunctionType)) { sfg = element; LOG.debug("found group " + sfg + " that matches type " + serviceFunctionType); break; } } } if (sfg == null) { LOG.debug("didn't found group " + sfg + " that matches type " + serviceFunctionType); } printTraceStop(LOG); return sfg; }
Boolean res = putSf(new SfName("firewall-101-1"), new SftTypeName("firewall"), "10.3.1.101", "10.3.1.101", 10001); res = putSf(new SfName("firewall-101-2"), new SftTypeName("firewall"), "10.3.1.101", "10.3.1.101", 10002) && res; res = putSf(new SfName("dpi-102-1"), new SftTypeName("dpi"), "10.3.1.102", "10.3.1.102", 10001) && res; res = putSf(new SfName("dpi-102-2"), new SftTypeName("dpi"), "10.3.1.102", "10.3.1.102", 10002) && res; res = putSf(new SfName("dpi-102-3"), new SftTypeName("dpi"), "10.3.1.102", "10.3.1.102", 10003) && res; res = putSf(new SfName("napt44-103-1"), new SftTypeName("napt44"), "10.3.1.103", "10.3.1.103", 10001) && res; res = putSf(new SfName("napt44-103-2"), new SftTypeName("napt44"), "10.3.1.103", "10.3.1.103", 10002) && res; res = putSf(new SfName("firewall-104"), new SftTypeName("firewall"), "10.3.1.104", "10.3.1.104", 10001) && res; res = putSf(new SfName("napt44-104"), new SftTypeName("napt44"), "10.3.1.104", "10.3.1.104", 10020) && res; sfRefList.add(sfBuilder.setName("firewall-abstract1").setType(new SftTypeName("firewall")).build()); sfRefList.add(sfBuilder.setName("dpi-abstract1").setType(new SftTypeName("dpi")).build()); sfRefList.add(sfBuilder.setName("napt44-abstract1").setType(new SftTypeName("napt44")).build()); sfRefList.add(sfBuilder.setName("firewall-abstract2").setType(new SftTypeName("firewall")).build()); sfRefList.add(sfBuilder.setName("napt44-abstract2").setType(new SftTypeName("napt44")).build());
if (!updatedServiceFunction.getType().equals(originalServiceFunction.getType())) {
.add(sfcServiceFunctionBuilder.setName("napt44-testB").setType(new SftTypeName("napt44")).build()); sfcServiceFunctionArrayList .add(sfcServiceFunctionBuilder.setName("firewall-testB").setType(new SftTypeName("firewall")).build()); sfcServiceFunctionArrayList .add(sfcServiceFunctionBuilder.setName("dpi-testB").setType(new SftTypeName("dpi")).build());
SfcProviderServiceTypeAPI.readServiceFunctionType(new SftTypeName(type)).getType(); if (sfType == null) { LOG.error("Invalid SF type {}", type);
SftTypeName sftType = new SftTypeName(type); ServiceFunctionTypeBuilder sftBuilder = new ServiceFunctionTypeBuilder() .setKey(new ServiceFunctionTypeKey(sftType))