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); }
private Node readOvsdbNodeByRef(OvsdbNodeRef nodeRef) { Preconditions.checkNotNull(nodeRef, "Cannot READ OVS Node from OVSDB operational store, nodeRef is null."); InstanceIdentifier<Node> bridgeIID = (InstanceIdentifier<Node>) nodeRef.getValue(); return SfcDataStoreAPI.readTransactionAPI(bridgeIID, LogicalDatastoreType.OPERATIONAL); } }
@SuppressWarnings("unused") private ServiceFunctionChain findServiceFunctionChain(SfcName name) { ServiceFunctionChainKey key = new ServiceFunctionChainKey(name); InstanceIdentifier<ServiceFunctionChain> serviceFunctionChainInstanceIdentifier = InstanceIdentifier.builder(ServiceFunctionChains.class).child(ServiceFunctionChain.class, key).build(); ServiceFunctionChain serviceFunctionChain = SfcDataStoreAPI .readTransactionAPI(serviceFunctionChainInstanceIdentifier, LogicalDatastoreType.CONFIGURATION); if (serviceFunctionChain == null) { LOG.error("Failed to find Service Function Chain: {}", name); } return serviceFunctionChain; }
public static ServiceFunctionPaths readAllServiceFunctionPaths() { ServiceFunctionPaths sfps; printTraceStart(LOG); InstanceIdentifier<ServiceFunctionPaths> sfpsIID = InstanceIdentifier.builder(ServiceFunctionPaths.class).build(); sfps = SfcDataStoreAPI.readTransactionAPI(sfpsIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sfps; }
protected static ServiceFunctions readAllServiceFunctions() { ServiceFunctions sfs; printTraceStart(LOG); InstanceIdentifier<ServiceFunctions> sfsIID = InstanceIdentifier.builder(ServiceFunctions.class).build(); sfs = SfcDataStoreAPI.readTransactionAPI(sfsIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sfs; }
public static ServiceFunctionSchedulerTypes readAllServiceFunctionScheduleTypes() { ServiceFunctionSchedulerTypes serviceFunctionSchedulerTypes; printTraceStart(LOG); InstanceIdentifier<ServiceFunctionSchedulerTypes> schedulerTypesIID = InstanceIdentifier.builder(ServiceFunctionSchedulerTypes.class).build(); serviceFunctionSchedulerTypes = SfcDataStoreAPI.readTransactionAPI(schedulerTypesIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return serviceFunctionSchedulerTypes; } }
/** * Read all Service Function Forwarders * devices * <p> * * @return ServiceFunctionForwarders object */ protected static ServiceFunctionForwarders readAllServiceFunctionForwarders() { ServiceFunctionForwarders sffs; printTraceStart(LOG); InstanceIdentifier<ServiceFunctionForwarders> sffsIID = InstanceIdentifier.builder(ServiceFunctionForwarders.class).build(); sffs = SfcDataStoreAPI.readTransactionAPI(sffsIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sffs; }
/** * This method is used to retrieve a Service Function Type from the DataStore * * @param serviceFunctionType Service Function Type abstract class * @return Service Function Type Object which contains a list of SF of this type */ public static ServiceFunctionType readServiceFunctionType(SftTypeName serviceFunctionType) { printTraceStart(LOG); ServiceFunctionType sft; InstanceIdentifier<ServiceFunctionType> sftIID; ServiceFunctionTypeKey serviceFunctionTypeKey = new ServiceFunctionTypeKey(serviceFunctionType); sftIID = InstanceIdentifier.builder(ServiceFunctionTypes.class) .child(ServiceFunctionType.class, serviceFunctionTypeKey) .build(); sft = SfcDataStoreAPI.readTransactionAPI(sftIID, LogicalDatastoreType.CONFIGURATION); if (sft == null) { LOG.error("Could not read Service Function list for Type {} " + "", serviceFunctionType); } printTraceStop(LOG); return sft; }
public static ContextMetadata readContextMetadata(String mdName) { printTraceStart(LOG); ContextMetadata md; InstanceIdentifier<ContextMetadata> mdIID; ContextMetadataKey mdKey = new ContextMetadataKey(mdName); mdIID = InstanceIdentifier.builder(ServiceFunctionMetadata.class) .child(ContextMetadata.class, mdKey).build(); md = SfcDataStoreAPI.readTransactionAPI(mdIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return md; }
public static VariableMetadata readVariableMetadata(String mdName) { VariableMetadata md; InstanceIdentifier<VariableMetadata> mdIID; printTraceStart(LOG); VariableMetadataKey mdKey = new VariableMetadataKey(mdName); mdIID = InstanceIdentifier.builder(ServiceFunctionMetadata.class) .child(VariableMetadata.class, mdKey).build(); md = SfcDataStoreAPI.readTransactionAPI(mdIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return md; }
/** * Check if Pathid is available * * <p> * @param pathid Candidate Path Id * @return True if available, otherwise false. */ public static boolean check_suitable_pathid(long pathid) { ServicePathIdKey servicePathIdKey = new ServicePathIdKey(pathid/Long.SIZE); /* Entry into the bitarray */ long bitEntry = pathid % Long.SIZE; InstanceIdentifier<ServicePathId> spIID; spIID = InstanceIdentifier.builder(ServicePathIds.class) .child(ServicePathId.class, servicePathIdKey) .build(); ServicePathId servicePathId = SfcDataStoreAPI. readTransactionAPI(spIID, LogicalDatastoreType.OPERATIONAL); return ((servicePathId == null) || (((1L << (64 - bitEntry)) & servicePathId.getPathIdBitarray()) == 0)); }
public static ServiceFunctionSchedulerType readServiceFunctionScheduleType( Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerTypeIdentity) { printTraceStart(LOG); ServiceFunctionSchedulerType serviceFunctionSchedulerType; InstanceIdentifier<ServiceFunctionSchedulerType> sfstIID; ServiceFunctionSchedulerTypeKey serviceFunctionSchedulerTypeKey = new ServiceFunctionSchedulerTypeKey(serviceFunctionSchedulerTypeIdentity); sfstIID = InstanceIdentifier.builder(ServiceFunctionSchedulerTypes.class) .child(ServiceFunctionSchedulerType.class, serviceFunctionSchedulerTypeKey) .build(); serviceFunctionSchedulerType = SfcDataStoreAPI.readTransactionAPI(sfstIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return serviceFunctionSchedulerType; }
/** * Reads a SFG Algorithm from the datastore <p> * @param serviceFunctionGroupAlgorithmName name * @return ServiceFunctionGroupAlgorithm object or null if not found */ protected static ServiceFunctionGroupAlgorithm readServiceFunctionGroupAlgorithm(String serviceFunctionGroupAlgorithmName) { printTraceStart(LOG); ServiceFunctionGroupAlgorithm sfgAlg; InstanceIdentifier<ServiceFunctionGroupAlgorithm> sfgAlgIID; ServiceFunctionGroupAlgorithmKey serviceFunctionGroupAlgorithmKey = new ServiceFunctionGroupAlgorithmKey(serviceFunctionGroupAlgorithmName); sfgAlgIID = InstanceIdentifier.builder(ServiceFunctionGroupAlgorithms.class).child(ServiceFunctionGroupAlgorithm.class, serviceFunctionGroupAlgorithmKey).build(); sfgAlg = SfcDataStoreAPI.readTransactionAPI(sfgAlgIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sfgAlg; }
/** * This method reads a SF from the datastore * <p> * * @param serviceFunctionName SF name * @return SF object or null if not found */ public static ServiceFunction readServiceFunction(SfName serviceFunctionName) { printTraceStart(LOG); ServiceFunction sf; InstanceIdentifier<ServiceFunction> sfIID; ServiceFunctionKey serviceFunctionKey = new ServiceFunctionKey(serviceFunctionName); sfIID = InstanceIdentifier.builder(ServiceFunctions.class) .child(ServiceFunction.class, serviceFunctionKey) .build(); sf = SfcDataStoreAPI.readTransactionAPI(sfIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sf; }
/** * This function reads a RSP from the datastore * <p> * * @param rspName RSP name * @return Nothing. */ public static RenderedServicePath readRenderedServicePath(RspName rspName) { printTraceStart(LOG); RenderedServicePathKey renderedServicePathKey = new RenderedServicePathKey(rspName); InstanceIdentifier<RenderedServicePath> rspIID = InstanceIdentifier.builder(RenderedServicePaths.class) .child(RenderedServicePath.class, renderedServicePathKey) .build(); RenderedServicePath rsp = SfcDataStoreAPI.readTransactionAPI(rspIID, LogicalDatastoreType.OPERATIONAL); printTraceStop(LOG); return rsp; }
/** * This function reads a SFP from the datastore * * @param serviceFunctionPathName RSP name * @return Nothing. */ public static ServiceFunctionPath readServiceFunctionPath(SfpName serviceFunctionPathName) { printTraceStart(LOG); ServiceFunctionPath sfp; InstanceIdentifier<ServiceFunctionPath> sfpIID; ServiceFunctionPathKey serviceFunctionPathKey = new ServiceFunctionPathKey(serviceFunctionPathName); sfpIID = InstanceIdentifier.builder(ServiceFunctionPaths.class) .child(ServiceFunctionPath.class, serviceFunctionPathKey) .build(); sfp = SfcDataStoreAPI.readTransactionAPI(sfpIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return sfp; }
/** * This method reads a Access List from DataStore * <p> * @param aclName Acl name * @param aclType Acl type * @return ACL object or null if not found */ public static Acl readAccessList(String aclName, java.lang.Class<? extends AclBase> aclType) { printTraceStart(LOG); Acl acl; InstanceIdentifier<Acl> aclIID; AclKey aclKey = new AclKey(aclName, aclType); aclIID = InstanceIdentifier.builder(AccessLists.class) .child(Acl.class, aclKey).build(); acl = SfcDataStoreAPI.readTransactionAPI(aclIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return acl; }
/** * This method reads a classifier from DataStore * <p> * * @param serviceClassifierName Classifier name * @return SF object or null if not found */ public static ServiceFunctionClassifier readServiceClassifier(String serviceClassifierName) { printTraceStart(LOG); ServiceFunctionClassifier scl; InstanceIdentifier<ServiceFunctionClassifier> sclIID; ServiceFunctionClassifierKey serviceFunctionKey = new ServiceFunctionClassifierKey(serviceClassifierName); sclIID = InstanceIdentifier.builder(ServiceFunctionClassifiers.class) .child(ServiceFunctionClassifier.class, serviceFunctionKey) .build(); scl = SfcDataStoreAPI.readTransactionAPI(sclIID, LogicalDatastoreType.CONFIGURATION); printTraceStop(LOG); return scl; }
/** * This method reads a Access List state from Operational DataStore * <p> * @param aclName Acl name * @param aclType Acl type * @return ACL state object or null if not found */ public static AccessListState readAccessListState(String aclName, java.lang.Class<? extends AclBase> aclType) { printTraceStart(LOG); AccessListState aclState; InstanceIdentifier<AccessListState> aclStateIID; AccessListStateKey accessListStateKey = new AccessListStateKey(aclName, aclType); aclStateIID = InstanceIdentifier.builder(AccessListsState.class) .child(AccessListState.class, accessListStateKey).build(); aclState = SfcDataStoreAPI.readTransactionAPI(aclStateIID, LogicalDatastoreType.OPERATIONAL); printTraceStop(LOG); return aclState; }
public static boolean isSffOpenFlowCapable(final String sffName) { InstanceIdentifier<FlowCapableNode> nodeInstancIdentifier = InstanceIdentifier.builder(Nodes.class) .child(Node.class, new NodeKey(new NodeId(sffName))) .augmentation(FlowCapableNode.class) .build(); // If its not a Flow Capable Node, this should return NULL // TODO need to verify this, once SFC can connect to simple OVS nodes that arent flow capable FlowCapableNode node = SfcDataStoreAPI.readTransactionAPI(nodeInstancIdentifier, LogicalDatastoreType.OPERATIONAL); if(node != null) { return true; } return false; }