*/
package org.opendaylight.unimgr.command;
-import java.util.Map;
+import java.util.List;
import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.unimgr.impl.UnimgrConstants;
import org.opendaylight.unimgr.impl.UnimgrUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.Evc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.EvcAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.UniAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniDest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSource;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@Override
public void execute() {
- Map<InstanceIdentifier<?>, DataObject> originalData = changes.getOriginalData();
- Set<InstanceIdentifier<?>> removedIids = changes.getRemovedPaths();
- for (InstanceIdentifier<?> evcIid : removedIids) {
- DataObject removedDataObject = originalData.get(evcIid);
- if (removedDataObject instanceof Evc) {
- Evc evc = (Evc)removedDataObject;
- Optional<Node> optionalSourceUniNode = UnimgrUtils.readNode(dataBroker,
- LogicalDatastoreType.OPERATIONAL,
- evc.getUniSource()
- .iterator()
- .next()
- .getUni());
- Optional<Node> optionalDestinationUniNode = UnimgrUtils.readNode(dataBroker,
- LogicalDatastoreType.OPERATIONAL,
- evc.getUniDest()
- .iterator()
- .next()
- .getUni());
- if (optionalSourceUniNode.isPresent()
- && optionalDestinationUniNode.isPresent()) {
- Node sourceUniNode = optionalSourceUniNode.get();
- Node destUniNode = optionalDestinationUniNode.get();
- UniAugmentation sourceUniAugmentation = sourceUniNode
- .getAugmentation(UniAugmentation.class);
- UniAugmentation destUniAugmentation = destUniNode
- .getAugmentation(UniAugmentation.class);
- InstanceIdentifier<Node> sourceOvsdbIid =
- sourceUniAugmentation
- .getOvsdbNodeRef()
- .getValue()
- .firstIdentifierOf(Node.class);
- InstanceIdentifier<Node> destOvsdbIid =
- destUniAugmentation
- .getOvsdbNodeRef()
- .getValue()
- .firstIdentifierOf(Node.class);
- Optional<Node> optionalSourceOvsdNode =
- UnimgrUtils.readNode(dataBroker,
- LogicalDatastoreType.OPERATIONAL,
- sourceOvsdbIid);
- Optional<Node> optionalDestinationOvsdbNode =
- UnimgrUtils.readNode(dataBroker,
- LogicalDatastoreType.OPERATIONAL,
- destOvsdbIid);
- if (optionalSourceOvsdNode.isPresent()
- && optionalDestinationOvsdbNode.isPresent()) {
- Node sourceOvsdbNode = optionalSourceOvsdNode.get();
- Node destinationOvsdbNode = optionalDestinationOvsdbNode.get();
- OvsdbNodeAugmentation sourceOvsdbNodeAugmentation = sourceOvsdbNode
- .getAugmentation(OvsdbNodeAugmentation.class);
- OvsdbNodeAugmentation destinationOvsdbNodeAugmentation = destinationOvsdbNode
- .getAugmentation(OvsdbNodeAugmentation.class);
- InstanceIdentifier<Node> sourceBridgeIid = sourceOvsdbNodeAugmentation.getManagedNodeEntry()
- .iterator().next().getBridgeRef().getValue().firstIdentifierOf(Node.class);
- InstanceIdentifier<Node> destinationBridgeIid = destinationOvsdbNodeAugmentation
- .getManagedNodeEntry().iterator().next().getBridgeRef().getValue()
- .firstIdentifierOf(Node.class);
- UnimgrUtils.deleteNode(dataBroker, sourceBridgeIid, LogicalDatastoreType.CONFIGURATION);
- UnimgrUtils.deleteNode(dataBroker, destinationBridgeIid, LogicalDatastoreType.CONFIGURATION);
- UnimgrUtils.createBridgeNode(dataBroker,
- sourceOvsdbIid,
- sourceUniNode.getAugmentation(UniAugmentation.class),
- UnimgrConstants.DEFAULT_BRIDGE_NAME);
- UnimgrUtils.createBridgeNode(dataBroker,
- destOvsdbIid,
- destUniNode.getAugmentation(UniAugmentation.class),
- UnimgrConstants.DEFAULT_BRIDGE_NAME);
- } else {
- LOG.info("Unable to retrieve the Ovsdb node source and/or destination.");
+ Set<InstanceIdentifier<EvcAugmentation>> removedEvcs = UnimgrUtils.extractRemoved(changes,
+ EvcAugmentation.class);
+ if (!removedEvcs.isEmpty()) {
+ for (InstanceIdentifier<EvcAugmentation> removedEvcIid: removedEvcs) {
+ EvcAugmentation evcAugmentation = UnimgrUtils.read(dataBroker,
+ LogicalDatastoreType.OPERATIONAL,
+ removedEvcIid);
+ if (evcAugmentation != null) {
+ List<UniSource> unisSource = evcAugmentation.getUniSource();
+ List<UniDest> unisDest = evcAugmentation.getUniDest();
+ if (unisSource != null && !unisSource.isEmpty()) {
+ for (UniSource source: unisSource) {
+ if (unisSource != null) {
+ Optional<Node> optionalSourceUniNode =
+ UnimgrUtils.readNode(dataBroker,
+ LogicalDatastoreType.OPERATIONAL,
+ source.getUni());
+ deleteEvcData(optionalSourceUniNode);
+ }
+ }
+ }
+ if (unisDest != null && !unisDest.isEmpty()) {
+ for (UniDest dest : unisDest) {
+ if (dest != null) {
+ Optional<Node> optionalDestUniNode =
+ UnimgrUtils.readNode(dataBroker,
+ LogicalDatastoreType.OPERATIONAL,
+ dest.getUni());
+ deleteEvcData(optionalDestUniNode);
+ }
+ }
}
- } else {
- LOG.info("Unable to retrieve the Uni source and/or destination.");
+ }
+ UnimgrUtils.deleteNode(dataBroker,
+ removedEvcIid,
+ LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+ }
+
+ private void deleteEvcData(Optional<Node> optionalUni) {
+ if (optionalUni.isPresent()) {
+ UniAugmentation uniAugmentation =
+ optionalUni
+ .get()
+ .getAugmentation(UniAugmentation.class);
+ InstanceIdentifier<Node> ovsdbNodeIid =
+ uniAugmentation
+ .getOvsdbNodeRef()
+ .getValue()
+ .firstIdentifierOf(Node.class);
+ Optional<Node> optionalOvsdNode =
+ UnimgrUtils.readNode(dataBroker,
+ LogicalDatastoreType.OPERATIONAL,
+ ovsdbNodeIid);
+ if (optionalOvsdNode.isPresent()) {
+ Node ovsdbNode = optionalOvsdNode.get();
+ OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode
+ .getAugmentation(OvsdbNodeAugmentation.class);
+ for (ManagedNodeEntry managedNodeEntry: ovsdbNodeAugmentation.getManagedNodeEntry()) {
+ InstanceIdentifier<Node> bridgeIid = managedNodeEntry
+ .getBridgeRef()
+ .getValue()
+ .firstIdentifierOf(Node.class);
+ UnimgrUtils.deleteNode(dataBroker, bridgeIid, LogicalDatastoreType.CONFIGURATION);
+ UnimgrUtils.createBridgeNode(dataBroker,
+ ovsdbNodeIid,
+ uniAugmentation,
+ UnimgrConstants.DEFAULT_BRIDGE_NAME);
}
}
+ } else {
+ LOG.info("Unable to retrieve UNI from the EVC.");
}
}
}
public class UnimgrMapper {
+ /**
+ * Create an OVSDB Bridge node Instance Identifier by constructing
+ * a nodeId manually. This function is different from
+ * getOvsdbBridgeNodeIid
+ * @param ovsdbNode The OVSDB node that has the OvsdbNodeAugmentation
+ * @param bridgeName The bridge name appended to the URI.
+ * @return An Instance Identifier of a bridge
+ */
public static InstanceIdentifier<Node> createOvsdbBridgeNodeIid(Node ovsdbNode,
String bridgeName) {
String bridgeNodeName = ovsdbNode.getNodeId().getValue()
return bridgeNodePath;
}
+ /**
+ * Generates an Instance Identifier by using a Link ID. The Link Id
+ * is appended as a link key.
+ * @param id The LinkId of a given Link. Similiar to a nodeId.
+ * @return An Instance Identifier for a given Link
+ */
public static InstanceIdentifier<Link> getEvcLinkIid(LinkId id) {
InstanceIdentifier<Link> linkPath = InstanceIdentifier
.create(NetworkTopology.class)
return linkPath;
}
+ /**
+ * Generates an Instance Identifier for the unimgr:evc URI.
+ * @return An Instance Identifier for the EVC topology: unimgr:evc
+ */
public static InstanceIdentifier<Topology> getEvcTopologyIid() {
InstanceIdentifier<Topology> topoPath = InstanceIdentifier
.create(NetworkTopology.class)
return topoPath;
}
+ /**
+ * Generates an Instance Identifier for the EVC nodes.
+ * @return An Instance Identifier for the EVC nodes.
+ */
public static InstanceIdentifier<Node> getEvcTopologyNodeIid() {
InstanceIdentifier<Node> nodePath = InstanceIdentifier
.create(NetworkTopology.class)
return nodePath;
}
- public static InstanceIdentifier<Node> getOvsdbBridgeNodeIid(Node bridgeNode) {
- OvsdbNodeAugmentation ovsdbNodeAugmentation = bridgeNode.getAugmentation(OvsdbNodeAugmentation.class);
+ /**
+ * Generates an Instance Identifier for an OvsdbBridgeNode by retrieving the Iid
+ * via the OvsdbNodeAugmentation's BridgeRef.
+ * the same as createOvsdbBridgeNodeIid.
+ * @param ovsdbNode
+ * @return An Instance Identifier for a bridge associated with an OVSDB node.
+ */
+ public static InstanceIdentifier<Node> getOvsdbBridgeNodeIid(Node ovsdbNode) {
+ OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
InstanceIdentifier<Node> nodePath = ovsdbNodeAugmentation
.getManagedNodeEntry()
.iterator()
return nodePath;
}
+ /**
+ * Generates an Instance Identifier for a specific OVSDB node
+ * by using its IP address.
+ * @param ipAddress The IP address of the OVSDB node. This should be the remote IP
+ * @return An Instance Identifier for a specific OVSDB node
+ */
public static InstanceIdentifier<Node> getOvsdbNodeIid(IpAddress ipAddress) {
String nodeId = UnimgrConstants.OVSDB_PREFIX
+ ipAddress.getIpv4Address().getValue().toString()
return nodePath;
}
+ /**
+ * Generates an Instance Identifier for a specific OVSDB node by
+ * using the node Id
+ * @param nodeId The node ID of a specific OVSDB node.
+ * @return An Instance Identifier for a specific OVSDB node.
+ */
public static InstanceIdentifier<Node> getOvsdbNodeIid(NodeId nodeId) {
InstanceIdentifier<Node> nodePath = InstanceIdentifier
.create(NetworkTopology.class)
return nodePath;
}
+ /**
+ * Generates an Instance Identifier for the OVSDB topology ovsdb:1
+ * @return An Instance Identifier for the OVSDB topology ovsdb:1
+ */
public static InstanceIdentifier<Topology> getOvsdbTopologyIid() {
InstanceIdentifier<Topology> topoPath = InstanceIdentifier
.create(NetworkTopology.class)
return topoPath;
}
+ /**
+ * Generates an Instance Identifier for a Termination Point by using
+ * the Bridge Node and the Port Name.
+ * @param bridgeNode The bridge where the port resides.
+ * @param portName The name of the port, example: eth0
+ * @return
+ */
public static InstanceIdentifier<TerminationPoint> getTerminationPointIid(
Node bridgeNode,
String portName) {
return terminationPointPath;
}
+ /**
+ * Generates an Instance Identifier for a Termination Point
+ * by using the bridge node and the Termination Point ID.
+ * @param bridgeNode The bridge Node to where the TP resides.
+ * @param tpId The termination point ID
+ * @return An Instance Identifier for a specific TP
+ */
public static InstanceIdentifier<TerminationPoint> getTerminationPointIid(
Node bridgeNode,
TpId tpId) {
return terminationPointPath;
}
+ /**
+ * Generates an Instance Identifier for a UNI by querying the datastore.
+ * Query will ask the Operational store by default.
+ * @param dataBroker
+ * @param ip The IP of the UNI
+ * @return An Instance Identifier of a UNI by using its IP address.
+ */
public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker,
IpAddress ip) {
List<Node> uniNodes = UnimgrUtils.getUniNodes(dataBroker,
return null;
}
+ /**
+ * Generates an Instance Identifier for a UNI by querying the datastore
+ * with the IP address of the UNI.
+ * @param dataBroker
+ * @param ip The IP of the UNI
+ * @param store The store where the query should be sent
+ * @return An Instance Identifier of a UNI by using its IP address.
+ */
public static InstanceIdentifier<Node> getUniIid(DataBroker dataBroker,
IpAddress ip,
LogicalDatastoreType store) {
return null;
}
+ /**
+ * Generates an Instance Identifier for the UNI topology: unimgr:uni
+ * @return An Instance Identifier for the UNI topology
+ */
public static InstanceIdentifier<Topology> getUniTopologyIid() {
InstanceIdentifier<Topology> topoPath = InstanceIdentifier
.create(NetworkTopology.class)
return topoPath;
}
+ /**
+ * Generates an Instance Identifier for UNI nodes topology.
+ * @return An Instance Identifier for the UNI nodes topology.
+ */
public static InstanceIdentifier<Node> getUniTopologyNodeIid() {
InstanceIdentifier<Node> nodePath = InstanceIdentifier
.create(NetworkTopology.class)
private static final Logger LOG = LoggerFactory.getLogger(UnimgrUtils.class);
+ /**
+ * Creates and submit a Bridge Node to the Configuration Data Store.
+ * @param dataBroker The Data Broker Instance to create a transaction
+ * @param ovsdbNode The OVSDB node
+ * @param uni The UNI linked to the OVSDB node
+ * @param bridgeName The bridge name (example: br0)
+ */
public static void createBridgeNode(DataBroker dataBroker,
Node ovsdbNode,
UniAugmentation uni,
}
}
+ /**
+ * Creates and submit a Bridge Node to the Configuration Data Store.
+ * @param dataBroker The Data Broker Instance to create a transaction
+ * @param ovsdbNodeIid The OVSDB node Instance Identifier
+ * @param uni The UNI linked to the OVSDB node
+ * @param bridgeName The bridge name (example: br0)
+ */
public static void createBridgeNode(DataBroker dataBroker,
InstanceIdentifier<Node> ovsdbNodeIid,
UniAugmentation uni,
}
}
+ /**
+ * Creates a List of Controller Entry to be used when adding controllers
+ * to a Bridge.
+ * @param targetString The URI in string format of the Controller Entry
+ * @return A List of Controller Entry to be used when adding controllers
+ */
public static List<ControllerEntry> createControllerEntries(String targetString) {
List<ControllerEntry> controllerEntries = new ArrayList<ControllerEntry>();
ControllerEntryBuilder controllerEntryBuilder = new ControllerEntryBuilder();
return controllerEntries;
}
+ /**
+ * Creates a submit a GRE tunnel to the Configuration DataStore.
+ * @param dataBroker An instance of the Data Broker to create a transaction
+ * @param source The source UNI
+ * @param destination The destination UNI
+ * @param bridgeNode The bridge Node
+ * @param bridgeName The bridge name (example br0)
+ * @param portName The Port Name (example: eth0)
+ */
public static void createGreTunnel(DataBroker dataBroker,
Uni source,
Uni destination,
transaction.submit();
}
+ /**
+ * Utility function used to create a protocol entry when creating a bridge node.
+ * @return A List of protocol entry
+ */
public static List<ProtocolEntry> createMdsalProtocols() {
List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
return protocolList;
}
+ /**
+ * Creates a Bridge Augmentation by using a UNI
+ * @param uni Contains data used to create the augmentation
+ * @return A Built OvsdbBridgeAugmentation with data.
+ * @throws Exception if the Ovsdb Node Reference cannot be found.
+ */
public static OvsdbBridgeAugmentation createOvsdbBridgeAugmentation(Uni uni) throws Exception {
OvsdbNodeRef ovsdbNodeRef = uni.getOvsdbNodeRef();
if (ovsdbNodeRef != null && ovsdbNodeRef.getValue() != null) {
}
}
+ /**
+ * Creates a submit an OvsdbNode to the Configuration DataStore.
+ * @param dataBroker The instance of the Data Broker to create transactions.
+ * @param ovsdbNodeId The Ovsdb Node Id to use on creation
+ * @param uni The UNI's data
+ */
public static void createOvsdbNode(DataBroker dataBroker,
NodeId ovsdbNodeId,
Uni uni) {
}
}
+ /**
+ * Creates and submit an OvsdbNode by using the Data contained in the UniAugmentation
+ * @param dataBroker The instance of the DataBroker to create transactions
+ * @param uni The UNI's data
+ * @return The instance of the Node
+ */
public static Node createOvsdbNode(DataBroker dataBroker,
UniAugmentation uni) {
NodeId ovsdbNodeId = new NodeId(createOvsdbNodeId(uni.getIpAddress()));
return null;
}
+ /**
+ * Creates and Build the data for an OvsdbNodeAugmentation.
+ * @param uni The UNI"s data
+ * @return The built OsvdbNodeAugmentation
+ */
public static OvsdbNodeAugmentation createOvsdbNodeAugmentation(Uni uni) {
ConnectionInfo connectionInfos = new ConnectionInfoBuilder()
.setRemoteIp(uni.getIpAddress())
return ovsdbNode;
}
+ /**
+ * Creates an OVSDB node Id with an IP Address.
+ * @param ipAddress The IP address of the UNI (therefo the OVSDB node)
+ * @return A NodeId for a Specific Ovsdb Node Id
+ */
public static NodeId createOvsdbNodeId(IpAddress ipAddress) {
String nodeId = UnimgrConstants.OVSDB_PREFIX
+ ipAddress.getIpv4Address().getValue().toString()
return new NodeId(nodeId);
}
+ /**
+ * Creates a built OvsdbTerminationAugmentation with data
+ * @param uni The UNI's data
+ * @return A Built OvsdbTerminationPointAugmentation with data
+ */
public static OvsdbTerminationPointAugmentation createOvsdbTerminationPointAugmentation(Uni uni) {
// we will use nodeId to set interface port id
VlanId vlanID = new VlanId(1);
return terminationPoint;
}
+ /**
+ * Creates and Submit a termination point Node to the configuration DateStore.
+ * @param dataBroker The instance of the data broker to create transactions
+ * @param uni The UNI's data
+ * @param bridgeNode The Bridge node
+ * @param bridgeName The Bridge name (example: br0)
+ * @param portName The Port name (example: eth0)
+ * @param type The type of termination (example: gre) Refer to OVSDB_INTERFACE_TYPE_MAP
+ * to review the list of available Interface Types.
+ */
public static void createTerminationPointNode(DataBroker dataBroker,
Uni uni,
Node bridgeNode,
transaction.submit();
}
+ /**
+ * Deletes a generic node
+ * @param dataBroker The instance of the data broker to create transactions
+ * @param store The DataStore where the delete
+ * @param path The path to delete
+ * @return An instance of a generic Data Object
+ */
public <D extends org.opendaylight.yangtools.yang.binding.DataObject> boolean delete(
DataBroker dataBroker,
final LogicalDatastoreType store,
return result;
}
+ /**
+ * Deletes a termination Point from the configuration data store.
+ * @param dataBroker The instance of the data broker to create transactions
+ * @param terminationPoint The Termination Point of the OVSDB bridge
+ * @param ovsdbNode The ovsdb Node
+ * @return A checked Future
+ */
public static CheckedFuture<Void,
TransactionCommitFailedException>
deleteTerminationPoint(DataBroker dataBroker,
return future;
}
+ /**
+ * Generic function to delete a node on a specific dataStore
+ * @param dataBroker The instance of the data broker to create transactions.
+ * @param genericNode The instance identifier of a generic node
+ * @param store The dataStore where to send and submit the delete call.
+ */
public static void deleteNode(DataBroker dataBroker,
InstanceIdentifier<?> genericNode,
LogicalDatastoreType store) {
}
}
+ /**
+ * Extract a data object by using its instance indentifier and it's class type.
+ * @param changes Data Change object
+ * @param klazz Class type
+ * @return The extracted DataObject as an Object casted as the class type
+ */
public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extract(
Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz) {
Map<InstanceIdentifier<T>,T> result = new HashMap<InstanceIdentifier<T>,T>();
return result;
}
+ /**
+ * Extract original data from the data store.
+ * @param changes The dataChange object
+ * @param klazz The class type
+ * @return The DataObject casted as a Class type
+ */
public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extractOriginal(
AsyncDataChangeEvent<InstanceIdentifier<?>,DataObject> changes,Class<T> klazz) {
return extract(changes.getOriginalData(),klazz);
}
+ /**
+ * Extracts the removed nodes
+ * @param changes he dataChange object
+ * @param klazz The class type
+ * @return A set to removed nodes as DataObject casted as the class type
+ */
public static <T extends DataObject> Set<InstanceIdentifier<T>> extractRemoved(
AsyncDataChangeEvent<InstanceIdentifier<?>,DataObject> changes,Class<T> klazz) {
Set<InstanceIdentifier<T>> result = new HashSet<InstanceIdentifier<T>>();
return result;
}
+ /**
+ * Search the Operational Datastore for a specific OvsdbNode.
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param uni The UNI's data
+ * @return The Optional OvsdbNode
+ */
public static Optional<Node> findOvsdbNode(DataBroker dataBroker,
UniAugmentation uni) {
List<Node> ovsdbNodes = getOvsdbNodes(dataBroker);
return Optional.absent();
}
+ /**
+ * Search the Operation DataStore for a specific UNI
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param ipAddress The IP address of the UNI
+ * @return An Optional UNI Node
+ */
public static Optional<Node> findUniNode(DataBroker dataBroker,
IpAddress ipAddress) {
List<Node> uniNodes = getUniNodes(dataBroker);
return Optional.absent();
}
+ /**
+ * Retrieves the connection information from an Ovsdb Connection by
+ * using the Ovsdb Node Id
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param ovsdbNodeId The NodeId of the OVSDB node
+ * @return The ConnectionInfo object
+ */
public static ConnectionInfo getConnectionInfo(DataBroker dataBroker,
NodeId ovsdbNodeId) {
InstanceIdentifier<Node> nodeIid = UnimgrMapper.getOvsdbNodeIid(ovsdbNodeId);
}
}
- public static List<Link> getEvcLinks(DataBroker dataBroker,
- IpAddress ipAddress) {
+ /**
+ * Retrieve the list of links in the Operational DataStore
+ * @param dataBroker The dataBroker instance to create transactions
+ * @return A list of Links retrieved from the Operational DataStore
+ */
+ public static List<Link> getEvcLinks(DataBroker dataBroker) {
List<Link> evcLinks = new ArrayList<>();
InstanceIdentifier<Topology> evcTopology = UnimgrMapper.getEvcTopologyIid();
Topology topology = UnimgrUtils.read(dataBroker,
return evcLinks;
}
+ /**
+ * Retrieve the Local IP of the controller
+ * @return The LocalIp object of the Controller
+ */
public static IpAddress getLocalIp() {
String ip;
try {
return new IpAddress(UnimgrConstants.LOCAL_IP);
}
+ /**
+ * Retrieve a list of Ovsdb Nodes from the Operational DataStore
+ * @param dataBroker The dataBroker instance to create transactions
+ * @return The Ovsdb Node retrieved from the Operational DataStore
+ */
public static List<Node> getOvsdbNodes(DataBroker dataBroker) {
List<Node> ovsdbNodes = new ArrayList<>();
InstanceIdentifier<Topology> ovsdbTopoIdentifier = UnimgrMapper.getOvsdbTopologyIid();
return ovsdbNodes;
}
+ /**
+ * Retrieve a list of Uni Nodes from the Configuration DataStore
+ * @param dataBroker The dataBroker instance to create transactions
+ * @return A list of Uni Nodes from the Config dataStore
+ */
public static List<Node> getUniNodes(DataBroker dataBroker) {
List<Node> uniNodes = new ArrayList<>();
InstanceIdentifier<Topology> topologyInstanceIdentifier = UnimgrMapper.getUniTopologyIid();
return uniNodes;
}
+ /**
+ * Retrieve a list of Uni Nodes on a specific DataStore
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param store The store to which to send the read request
+ * @return A List of UNI Nodes.
+ */
public static List<Node> getUniNodes(DataBroker dataBroker,
LogicalDatastoreType store) {
List<Node> uniNodes = new ArrayList<>();
return uniNodes;
}
+ /**
+ * Read a specific datastore type and return a DataObject as a casted
+ * class type Object.
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param store The store type to query
+ * @param path The generic path to query
+ * @return The DataObject as a casted Object
+ */
public static <D extends org.opendaylight.yangtools.yang.binding.DataObject> D read(
DataBroker dataBroker,
final LogicalDatastoreType store,
return result;
}
+ /**
+ * Read a specific node from the Operational Data store by default.
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param genericNode The Instance Identifier of the Node
+ * @return The Optional Node instance
+ */
@Deprecated
public static final Optional<Node> readNode(DataBroker dataBroker,
InstanceIdentifier<?> genericNode) {
return Optional.absent();
}
+ /**
+ * Read a specific Link from a specific datastore
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param store The datastore type.
+ * @param genericNode The Instance Identifier of the Link
+ * @return An Optional Link instance
+ */
public static final Optional<Link> readLink(DataBroker dataBroker,
LogicalDatastoreType store,
InstanceIdentifier<?> genericNode) {
return Optional.absent();
}
+ /**
+ * Read a specific node from a specific data store type.
+ * @param dataBroker The dataBroker instance to create transactions
+ * @param store The data store type
+ * @param genericNode The Instance Identifier of a specific Node
+ * @return An Optional Node instance
+ */
public static final Optional<Node> readNode(DataBroker dataBroker,
LogicalDatastoreType store,
InstanceIdentifier<?> genericNode) {
return Optional.absent();
}
+ /**
+ * Updates a specific Uni Node on a specific DataStore type
+ * @param dataStore The datastore type
+ * @param uniKey The UNI key
+ * @param uni The Uni's data
+ * @param ovsdbNode The Ovsdb Node
+ * @param dataBroker The dataBroker instance to create transactions
+ */
public static void updateUniNode(LogicalDatastoreType dataStore,
InstanceIdentifier<?> uniKey,
UniAugmentation uni,
}
}
+ /**
+ * Update a specific UNI node on a specific datastore type
+ * @param dataStore The datastore type
+ * @param uniKey The UNI key
+ * @param uni The Uni's data
+ * @param ovsdbNodeIid The Ovsdb Node Instance Identifier
+ * @param dataBroker The dataBroker instance to create transactions
+ */
public static void updateUniNode(LogicalDatastoreType dataStore,
InstanceIdentifier<?> uniKey,
UniAugmentation uni,
}
}
+ /**
+ * Updates a specific EVC into a specific DataStore type
+ * @param dataStore The datastore type
+ * @param evcKey The EVC key
+ * @param evcAugmentation The EVC's data
+ * @param sourceUniIid The Source Uni Instance Identifier
+ * @param destinationUniIid The destination Uni Instance Identifier
+ * @param dataBroker The dataBroker instance to create transactions
+ */
public static void updateEvcNode(LogicalDatastoreType dataStore,
InstanceIdentifier<?> evcKey,
EvcAugmentation evcAugmentation,