public static ServiceFunctionKey getSFKey(PortPair portPair) { return new ServiceFunctionKey(new SfName(portPair.getName())); } }
/** * 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); }
/** * 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; }
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()); }
private SfName getServiceFunctionByType(ServiceFunctionType serviceFunctionType) { List<SftServiceFunctionName> sftServiceFunctionNameList = serviceFunctionType.getSftServiceFunctionName(); int maxTries = sftServiceFunctionNameList.size(); Random rad = new Random(); ServiceFunction serviceFunction = null; SfName serviceFunctionName = null; int start = rad.nextInt(sftServiceFunctionNameList.size()); while (maxTries > 0) { serviceFunctionName = new SfName(sftServiceFunctionNameList.get(start).getName()); serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionName); if (serviceFunction != null) { break; } else { LOG.debug("ServiceFunction {} doesn't exist", serviceFunctionName); maxTries--; serviceFunctionName = null; start = (start + 1) % sftServiceFunctionNameList.size(); } } if (serviceFunctionName == null) { LOG.error("Could not find an existing ServiceFunction for {}", serviceFunctionType.getType()); } return serviceFunctionName; }
@Override public void run() { while (true) { printTraceStart(LOG); MonitoringInfo monInfo = SfcNetconfServiceFunctionAPI.getServiceFunctionMonitor(nodeName); if (monInfo != null) { SfName sfNodeName = new SfName(nodeName); SfcNetconfServiceFunctionAPI.putServiceFunctionMonitor(monInfo, sfNodeName); } try { Thread.sleep(5000); } catch (InterruptedException e) { LOG.warn("failed to ....", e); } printTraceStop(LOG); } } }
SfcProviderTopologyNode firstHopNode; while (maxTries > 0) { sfcProviderTopologyNodeName = new SfName(sftServiceFunctionNameList.get(start).getName()); sfcProviderTopologyNodeName = null; for (SftServiceFunctionName sftServiceFunctionName : sftServiceFunctionNameList) { SfName curSfName = new SfName(sftServiceFunctionName.getName()); SfcProviderTopologyNode curSfcProviderTopologyNode = sfcProviderGraph.getNode(curSfName.getValue()); if (curSfcProviderTopologyNode == null) {
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;
.readServiceFunction(new SfName(sfg.getSfcServiceFunction().get(0).getName())); if (serviceFunction == null) { LOG.error("Could not find suitable SF in data store by name: {}",
ServiceFunctionKey sfkey = new ServiceFunctionKey(new SfName(input.getName())); InstanceIdentifier<ServiceFunction> sfIID; sfIID = InstanceIdentifier.builder(ServiceFunctions.class).child(ServiceFunction.class, sfkey).build();
sfName = new SfName(curSftServiceFunctionName.getName());
break; SfName sfNodeName = new SfName(nodeName); ServiceFunction sf = SfcNetconfServiceFunctionAPI.buildServiceFunctionFromNetconf( sfNodeName, descInfo.getDataPlaneIp(), descInfo.getDataPlanePort(), sfType);
LOG.info("Unable to retrieve service info."); } else { SfName sfName = new SfName(serviceName); ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(sfName); List<SfDataPlaneLocator> listOfDPL = serviceFunction.getSfDataPlaneLocator();
SfName sfName = new SfName(serviceFunction.getName().getValue()); SftServiceFunctionNameKey sftServiceFunctionNameKey = new SftServiceFunctionNameKey(sfName);
serviceFunctionBuilder.setName(new SfName(portPair.getName())); serviceFunctionBuilder.setKey(new ServiceFunctionKey(serviceFunctionBuilder.getName())); serviceFunctionBuilder.setTenantId(new TenantId(portPair.getTenantId().getValue()));
/** * This method reads a Service function Type entry from a Service * Function. * * @param serviceFunction Service Function Object * @return Nothing. */ public static SftServiceFunctionName readServiceFunctionTypeEntry(ServiceFunction serviceFunction) { printTraceStart(LOG); ServiceFunctionTypeKey serviceFunctionTypeKey = new ServiceFunctionTypeKey(serviceFunction.getType()); // Build the instance identifier all the way down to the bottom child // TODO as part of typedef refactoring not messing with SFTs SfName sfName = new SfName(serviceFunction.getName().getValue()); SftServiceFunctionNameKey sftServiceFunctionNameKey = new SftServiceFunctionNameKey(sfName); InstanceIdentifier<SftServiceFunctionName> sftentryIID; sftentryIID = InstanceIdentifier.builder(ServiceFunctionTypes.class) .child(ServiceFunctionType.class, serviceFunctionTypeKey) .child(SftServiceFunctionName.class, sftServiceFunctionNameKey) .build(); printTraceStop(LOG); return (SfcDataStoreAPI.readTransactionAPI(sftentryIID, LogicalDatastoreType.CONFIGURATION)); } }
SfName sfName = new SfName(serviceFunction.getName().getValue());