private static SfcServiceFunctionSchedulerAPI getServiceFunctionScheduler( Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType) { SfcServiceFunctionSchedulerAPI scheduler; if (serviceFunctionSchedulerType == RoundRobin.class) { scheduler = new SfcServiceFunctionRoundRobinSchedulerAPI(); } else if (serviceFunctionSchedulerType == LoadBalance.class) { scheduler = new SfcServiceFunctionLoadBalanceSchedulerAPI(); } else if (serviceFunctionSchedulerType == Random.class) { scheduler = new SfcServiceFunctionRandomSchedulerAPI(); } else if (serviceFunctionSchedulerType == ShortestPath.class) { scheduler = new SfcServiceFunctionShortestPathSchedulerAPI(); } else { scheduler = new SfcServiceFunctionRandomSchedulerAPI(); } return scheduler; }
private RenderedServicePath createSymmetricRsp(RenderedServicePath rsp) { if (rsp == null) { return null; } return SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(rsp); }
SfcServiceFunctionRandomSchedulerAPI() { super.setSfcServiceFunctionSchedulerType( org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.Random.class); }
public static Acl getServiceFunctionAcl(SfpName sfPathName) { ServiceFunctionPath serviceFunctionPath = SfcProviderServicePathAPI.readServiceFunctionPath(sfPathName); String classifierName = serviceFunctionPath.getClassifier(); Acl acl = null; if (classifierName != null) { ServiceFunctionClassifier classifier = SfcProviderServiceClassifierAPI.readServiceClassifier(classifierName); if (classifier != null && classifier.getAcl() != null) { acl = SfcProviderAclAPI.readAccessList(classifier.getAcl().getName(), classifier.getAcl().getType()); } } return acl; } }
public Ip getSffIp(SffName sffName) { ServiceFunctionForwarder serviceFunctionForwarder = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName); return getSffIp(serviceFunctionForwarder); }
private boolean deleteOvsdbTerminationPoint(InstanceIdentifier<TerminationPoint> ovsdbTerminationPointIID) { Preconditions.checkNotNull(ovsdbTerminationPointIID, "Cannot DELETE Termination Point from OVS configuration store, InstanceIdentifier<TerminationPoint> is null."); return SfcDataStoreAPI.deleteTransactionAPI(ovsdbTerminationPointIID, LogicalDatastoreType.CONFIGURATION); }
/** * Creates a RSP and all the associated operational state based on the * given service function path * <p> * * @param createdServiceFunctionPath Service Function Path * @param createRenderedPathInput CreateRenderedPathInput object * @return RenderedServicePath Created RSP or null */ public static RenderedServicePath createRenderedServicePathAndState(ServiceFunctionPath createdServiceFunctionPath, CreateRenderedPathInput createRenderedPathInput) { return createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput, defaultScheduler); }
/** * Check and allocate Pathid if available * * <p> * @param pathid Candidate Path Id * @return True if allocated, otherwise false. */ public static long check_and_allocate_pathid(long pathid) { if (SfcConcurrencyAPI.getPathIdLock()) { try { if (check_suitable_pathid(pathid) && allocate_pathid(pathid)) { return pathid; } else { return -1; } } finally { SfcConcurrencyAPI.releasePathIdLock(); } } else { return -1; } }
private OvsdbBridgeAugmentation readOvsdbBridge(InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIID) { Preconditions.checkNotNull(bridgeIID, "Cannot READ OVS Bridge from OVS operational store, InstanceIdentifier<OvsdbBridgeAugmentation> is null."); return SfcDataStoreAPI.readTransactionAPI(bridgeIID, LogicalDatastoreType.OPERATIONAL); }
/** * Delete a ServiceFunctionType based on SftType (key) */ public static boolean deleteServiceFunctionType(SftTypeName sftType) { ServiceFunctionType serviceFunctionType = readServiceFunctionType(sftType); if (serviceFunctionType != null) { return deleteServiceFunctionType(serviceFunctionType); } LOG.warn("deleteServiceFunctionType: Could not find ServiceFunctionType for {}", sftType); return false; }
/** * Algorithm to sequentially generate pathIds. * * <p> * @return Pathid or error if none available */ public static int generatePathIdSequentialIncrements() { int pathid; int count = num_pathid; do { next_pathid = next_pathid + 1; pathid = MIN_PATH_ID + next_pathid; if (check_suitable_pathid(pathid) && allocate_pathid(pathid)) { return pathid; } count--; } while (count > 0); return -1; }
private static void initDefaultServiceFunctionScheduler() { java.lang.Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType; try { serviceFunctionSchedulerType = SfcProviderScheduleTypeAPI.readEnabledServiceFunctionScheduleTypeEntry().getType(); } catch (Exception e) { serviceFunctionSchedulerType = Random.class; } defaultScheduler = getServiceFunctionScheduler(serviceFunctionSchedulerType); LOG.info("Selected SF Schdedule Type: {}", serviceFunctionSchedulerType); }
private static void createSFHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder, short posIndex, SfName serviceFunctionName, ServiceFunction serviceFunction) { createHopBuilderInternal(serviceIndex, renderedServicePathHopBuilder, posIndex, serviceFunction); renderedServicePathHopBuilder.setServiceFunctionName(serviceFunctionName); }
/** * Set the PathId Generate-algorithm in the data-store. * * <p> * @param genAlgorithm integer value as taken from service-path-id.yang * @return True if successful, otherwise false */ public static boolean setGenerationAlgorithm(int genAlgorithm) { return setGenerationAlgorithm(GenerationAlgorithmEnum.forValue(genAlgorithm)); }
private RenderedServicePath createSymmetricRsp(RenderedServicePath rsp) { if (rsp == null) { return null; } return SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(rsp); }
private boolean deleteOvsdbNode(InstanceIdentifier<Node> ovsdbNodeIID) { Preconditions.checkNotNull(ovsdbNodeIID, "Cannot DELETE OVS Node from OVS configuration store, InstanceIdentifier<Node> is null."); return SfcDataStoreAPI.deleteTransactionAPI(ovsdbNodeIID, LogicalDatastoreType.CONFIGURATION); }
SfcServiceFunctionShortestPathSchedulerAPI() { super.setSfcServiceFunctionSchedulerType( org.opendaylight.yang.gen.v1.urn.intel.params.xml.ns.yang.sfc.sfst.rev150312.ShortestPath.class); }
private static void createSFGHopBuilder(int serviceIndex, RenderedServicePathHopBuilder renderedServicePathHopBuilder, short posIndex, String serviceFunctionGroupName, ServiceFunction serviceFunction) { createHopBuilderInternal(serviceIndex, renderedServicePathHopBuilder, posIndex, serviceFunction); renderedServicePathHopBuilder.setServiceFunctionGroupName(serviceFunctionGroupName); }
SfcServiceFunctionLoadBalanceSchedulerAPI() { super.setSfcServiceFunctionSchedulerType(LoadBalance.class); }
SfcServiceFunctionRoundRobinSchedulerAPI() { super.setSfcServiceFunctionSchedulerType(RoundRobin.class); }