Cleaned up the code, added javadoc for utils and mapper. 20/29520/2
authorGabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
Tue, 10 Nov 2015 19:47:05 +0000 (14:47 -0500)
committerGabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
Tue, 10 Nov 2015 21:44:05 +0000 (16:44 -0500)
Change-Id: I4712df4f8f4be11f6a1bc46fb6c6ea9204455ebb
Signed-off-by: Gabriel Robitaille-Montpetit <grmontpetit@inocybe.com>
impl/src/main/java/org/opendaylight/unimgr/command/EvcCreateCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/EvcDeleteCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/UniDeleteCommand.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrMapper.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrUtils.java

index 5827d2403254308bf212c1f26b89d6c22997cc4f..d4ccafb75513ee630ff07bf32556884bd98e1bbd 100644 (file)
@@ -55,6 +55,8 @@ public class EvcCreateCommand extends AbstractCreateCommand {
                 }
                 InstanceIdentifier<Node> sourceUniIid;
                 InstanceIdentifier<Node> destinationUniIid;
+                //FIXME we are assuming that there is only 1 UNI source and destination
+                // per evc
                 if (evc.getUniSource().iterator().next().getUni() != null) {
                     sourceUniIid = evc.getUniSource().iterator().next().getUni().firstIdentifierOf(Node.class);
                 } else {
index 8f8cf9394011e558109096dc1b801585402ae357..a2cd4c26368de02862b212acf08ddd7e89201746 100644 (file)
@@ -7,7 +7,7 @@
  */
 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;
@@ -16,8 +16,11 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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;
@@ -38,80 +41,79 @@ public class EvcDeleteCommand extends AbstractDeleteCommand {
 
     @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.");
         }
     }
 }
index 7451b9fdf8987322ca562e746b91ab8c1bb3f74b..2308cbd29400e60b8624c1fe2ee08b9860f2b2e9 100644 (file)
@@ -44,13 +44,13 @@ public class UniDeleteCommand extends AbstractDeleteCommand {
                                                                    LogicalDatastoreType.OPERATIONAL,
                                                                    removedUniIid);
                 if(uniAugmentation != null) {
-                    OvsdbNodeRef ovsNdRef = uniAugmentation.getOvsdbNodeRef();
-                    InstanceIdentifier<Node> iidNode = ovsNdRef.getValue().firstIdentifierOf(Node.class);
-                    Optional<Node> optNode = UnimgrUtils.readNode(dataBroker,
-                                                                  LogicalDatastoreType.OPERATIONAL,
-                                                                  iidNode);
-                    if (optNode.isPresent()) {
-                        Node ovsdbNode = optNode.get();
+                    OvsdbNodeRef ovsNodedRef = uniAugmentation.getOvsdbNodeRef();
+                    InstanceIdentifier<Node> ovsdbNodeIid = ovsNodedRef.getValue().firstIdentifierOf(Node.class);
+                    Optional<Node> optionalNode = UnimgrUtils.readNode(dataBroker,
+                                                                       LogicalDatastoreType.OPERATIONAL,
+                                                                       ovsdbNodeIid);
+                    if (optionalNode.isPresent()) {
+                        Node ovsdbNode = optionalNode.get();
                         InstanceIdentifier<Node> bridgeIid = UnimgrMapper.getOvsdbBridgeNodeIid(ovsdbNode);
                             UnimgrUtils.deleteNode(dataBroker,
                                                    bridgeIid,
index bdc9a88b354b27bc34ed6b550c21f18a0788b0f6..74a744c90d177143bf854795c3146b435a4af0d4 100755 (executable)
@@ -30,6 +30,14 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 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()
@@ -44,6 +52,12 @@ public class UnimgrMapper {
         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)
@@ -54,6 +68,10 @@ public class UnimgrMapper {
         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)
@@ -62,6 +80,10 @@ public class UnimgrMapper {
         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)
@@ -71,8 +93,15 @@ public class UnimgrMapper {
         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()
@@ -83,6 +112,12 @@ public class UnimgrMapper {
         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()
@@ -97,6 +132,12 @@ public class UnimgrMapper {
         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)
@@ -107,6 +148,10 @@ public class UnimgrMapper {
         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)
@@ -115,6 +160,13 @@ public class UnimgrMapper {
         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) {
@@ -129,6 +181,13 @@ public class UnimgrMapper {
         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) {
@@ -144,6 +203,13 @@ public class UnimgrMapper {
         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,
@@ -163,6 +229,14 @@ public class UnimgrMapper {
         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) {
@@ -183,6 +257,10 @@ public class UnimgrMapper {
         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)
@@ -191,6 +269,10 @@ public class UnimgrMapper {
         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)
index 2e30a34d0a2a1d6aa1d4e6cfb4043a76257d81e5..f9bbfa25e1f0d4c13137edd989feed9e88f324bb 100644 (file)
@@ -88,6 +88,13 @@ public class UnimgrUtils {
 
     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,
@@ -116,6 +123,13 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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,
@@ -152,6 +166,12 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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();
@@ -160,6 +180,15 @@ public class UnimgrUtils {
         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,
@@ -191,6 +220,10 @@ public class UnimgrUtils {
         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 =
@@ -200,6 +233,12 @@ public class UnimgrUtils {
         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) {
@@ -217,6 +256,12 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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) {
@@ -239,6 +284,12 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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()));
@@ -263,6 +314,11 @@ public class UnimgrUtils {
         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())
@@ -273,6 +329,11 @@ public class UnimgrUtils {
         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()
@@ -281,6 +342,11 @@ public class UnimgrUtils {
         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);
@@ -292,6 +358,16 @@ public class UnimgrUtils {
         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,
@@ -318,6 +394,13 @@ public class UnimgrUtils {
         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,
@@ -335,6 +418,13 @@ public class UnimgrUtils {
         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,
@@ -357,6 +447,12 @@ public class UnimgrUtils {
         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) {
@@ -370,6 +466,12 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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>();
@@ -390,11 +492,23 @@ public class UnimgrUtils {
         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>>();
@@ -410,6 +524,12 @@ public class UnimgrUtils {
         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);
@@ -431,6 +551,12 @@ public class UnimgrUtils {
         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);
@@ -446,6 +572,13 @@ public class UnimgrUtils {
         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);
@@ -463,8 +596,12 @@ public class UnimgrUtils {
         }
     }
 
-    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,
@@ -481,6 +618,10 @@ public class UnimgrUtils {
         return evcLinks;
     }
 
+    /**
+     * Retrieve the Local IP of the controller
+     * @return The LocalIp object of the Controller
+     */
     public static IpAddress getLocalIp() {
         String ip;
         try {
@@ -494,6 +635,11 @@ public class UnimgrUtils {
         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();
@@ -511,6 +657,11 @@ public class UnimgrUtils {
         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();
@@ -528,6 +679,12 @@ public class UnimgrUtils {
         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<>();
@@ -546,6 +703,14 @@ public class UnimgrUtils {
         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,
@@ -569,6 +734,12 @@ public class UnimgrUtils {
         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) {
@@ -585,6 +756,13 @@ public class UnimgrUtils {
         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) {
@@ -599,6 +777,13 @@ public class UnimgrUtils {
         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) {
@@ -614,6 +799,14 @@ public class UnimgrUtils {
         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,
@@ -640,6 +833,14 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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,
@@ -665,6 +866,15 @@ public class UnimgrUtils {
         }
     }
 
+    /**
+     * 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,