Fix remaining checkstyle warnings. 63/39963/1
authorDonald Hunter <donaldh@cisco.com>
Tue, 7 Jun 2016 15:42:26 +0000 (16:42 +0100)
committerDonald Hunter <donaldh@cisco.com>
Tue, 7 Jun 2016 15:42:26 +0000 (16:42 +0100)
Change-Id: If19ef2816ee7836028a86417e9c71f85ac526fc0
Signed-off-by: Donald Hunter <donaldh@cisco.com>
21 files changed:
cli/src/main/java/org/opendaylight/unimgr/cli/EvcAddShellCommand.java
cli/src/main/java/org/opendaylight/unimgr/cli/UniAddShellCommand.java
cli/src/main/java/org/opendaylight/unimgr/cli/UniListShellCommand.java
cli/src/main/java/org/opendaylight/unimgr/cli/UniUpdateShellCommand.java
cli/src/main/java/org/opendaylight/unimgr/cli/Utils.java
cli/src/test/java/org/opendaylight/unimgr/cli/EvcAddShellCommandTest.java
cli/src/test/java/org/opendaylight/unimgr/cli/UniAddShellCommandTest.java
cli/src/test/java/org/opendaylight/unimgr/cli/UniRemoveShellCommandTest.java
impl/src/main/java/org/opendaylight/unimgr/api/AbstractCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/EvcAddCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/EvcRemoveCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/EvcUpdateCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/UniAddCommand.java
impl/src/main/java/org/opendaylight/unimgr/command/UniUpdateCommand.java
impl/src/main/java/org/opendaylight/unimgr/impl/EvcDataTreeChangeListener.java
impl/src/main/java/org/opendaylight/unimgr/impl/OvsNodeDataTreeChangeListener.java
impl/src/main/java/org/opendaylight/unimgr/impl/UniDataTreeChangeListener.java
impl/src/main/java/org/opendaylight/unimgr/impl/UnimgrMapper.java
impl/src/main/java/org/opendaylight/unimgr/utils/EvcUtils.java
impl/src/main/java/org/opendaylight/unimgr/utils/MdsalUtils.java
impl/src/main/java/org/opendaylight/unimgr/utils/OvsdbUtils.java

index 62aab62f1b15cd54beef6f58d5e91e63235d0f25..952a1324d8ca1c31c2a088f2d791f532891c34fa 100644 (file)
@@ -9,9 +9,8 @@
 package org.opendaylight.unimgr.cli;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
+
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
@@ -28,16 +27,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSource;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSourceBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSourceKey;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Command(name = "evc-add",
-scope = "uni",
-description = "Add evc to the controller.")
-
+    scope = "uni",
+    description = "Add evc to the controller.")
 public class EvcAddShellCommand extends OsgiCommandSupport {
 
-    private static final Logger LOG = LoggerFactory.getLogger(EvcAddShellCommand.class);
     protected IUnimgrConsoleProvider provider;
 
     @Option(name = "-IPs",
@@ -45,14 +40,14 @@ public class EvcAddShellCommand extends OsgiCommandSupport {
             description = "The IP address of the source UNI.\n-IPs / --IP Address source uni",
             required = true,
             multiValued = false)
-    private String IPs = "";
+    private String ipSource = "";
 
     @Option(name = "-IPd",
             aliases = { "--IP-Address-destenation-uni" },
             description = "The IP address of the destenation UNI.\n-IPs / --IP Address destenation uni",
             required = true,
             multiValued = false)
-    private String IPd = "";
+    private String ipDestination = "";
 
     @Option(name = "-egress",
             aliases = { "--egress-speed" },
@@ -75,7 +70,7 @@ public class EvcAddShellCommand extends OsgiCommandSupport {
     @Override
     protected Object doExecute() throws Exception {
         Short order = new Short("0");
-        IpAddress ipAddreSource = new IpAddress(IPs.toCharArray());
+        IpAddress ipAddreSource = new IpAddress(ipSource.toCharArray());
         UniSource uniSource = new UniSourceBuilder()
                                   .setIpAddress(ipAddreSource)
                                   .setKey(new UniSourceKey(order))
@@ -83,7 +78,7 @@ public class EvcAddShellCommand extends OsgiCommandSupport {
                                   .build();
         List<UniSource> uniSourceList = new ArrayList<UniSource>();
         uniSourceList.add(uniSource);
-        IpAddress ipAddreDest = new IpAddress(IPd.toCharArray());
+        IpAddress ipAddreDest = new IpAddress(ipDestination.toCharArray());
         UniDest uniDest = new UniDestBuilder()
                           .setOrder(order)
                           .setKey(new UniDestKey(order))
@@ -99,7 +94,7 @@ public class EvcAddShellCommand extends OsgiCommandSupport {
                                      .setUniSource(uniSourceList)
                                      .build();
         if (provider.addEvc(evcAug)) {
-            return new String("Evc with Source Uni " +IPs+" and destenation Uni " +IPd+" created");
+            return new String("Evc with Source Uni " + ipSource + " and destenation Uni " + ipDestination + " created");
         } else {
             return new String("Error creating new Evc");
         }
index 3b22513820cc243a2f0bdcd7010f22296c2b7609..82d375f689b65face852dd855d2b8cd18cb2334a 100755 (executable)
@@ -8,6 +8,7 @@
 package org.opendaylight.unimgr.cli;
 
 import java.math.BigInteger;
+
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
@@ -17,15 +18,12 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 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.UniAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.uni.SpeedBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 @Command(name = "uni-add",
          scope = "uni",
          description = "Adds an uni to the controller.")
 public class UniAddShellCommand extends OsgiCommandSupport {
 
-    private static final Logger LOG = LoggerFactory.getLogger(UniAddShellCommand.class);
     protected IUnimgrConsoleProvider provider;
 
     @Option(name = "-pm",
@@ -101,7 +99,7 @@ public class UniAddShellCommand extends OsgiCommandSupport {
                         .setIpAddress(new IpAddress(ipAddress.toCharArray()))
                         .build();
         if (provider.addUni(uni)) {
-            return new String("Uni with ip " +ipAddress+" created");
+            return new String("Uni with ip " + ipAddress + " created");
         } else {
             return new String("Error creating new Uni");
         }
index 988c1f7aae8cca4d407affec8f235a8d4ba70bb4..eab46af66676d77bf2eb6a78ef5aeae70723bbc0 100755 (executable)
@@ -15,7 +15,6 @@ import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.unimgr.api.IUnimgrConsoleProvider;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.Uni;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.UniAugmentation;
 
 @Command(name = "uni-list", scope = "uni", description = "Lists all uni in the controller.")
@@ -37,7 +36,8 @@ public class UniListShellCommand extends OsgiCommandSupport {
     @Override
     protected Object doExecute() throws Exception {
 
-        LogicalDatastoreType storeType = isConfigurationData ? LogicalDatastoreType.CONFIGURATION : LogicalDatastoreType.OPERATIONAL; 
+        LogicalDatastoreType storeType =
+                isConfigurationData ? LogicalDatastoreType.CONFIGURATION : LogicalDatastoreType.OPERATIONAL;
         List<UniAugmentation> listUnis = provider.listUnis(storeType);
 
         if (listUnis.size() > 0) {
@@ -45,7 +45,8 @@ public class UniListShellCommand extends OsgiCommandSupport {
             Integer counter = 1;
             for (UniAugmentation uni : listUnis) {
                 // TODO
-                sb.append(String.format("#%d - IpAddress: %s\n", counter, uni.getIpAddress().getIpv4Address().getValue()));
+                sb.append(String.format("#%d - IpAddress: %s\n", counter,
+                        uni.getIpAddress().getIpv4Address().getValue()));
                 counter++;
             }
             return sb.toString();
index e498585076e2787e510ec09e5c0faed2d9b5a2f4..c6e6288ccf9a95d8af601c1785ef6f171bf9019e 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.unimgr.cli;
 
 import java.math.BigInteger;
+
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
@@ -19,9 +20,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.uni.SpeedBuilder;
 
 @Command(name = "uni-update",
-scope = "uni",
-description = "Updates an uni to the controller.")
-public class UniUpdateShellCommand extends OsgiCommandSupport{
+    scope = "uni",
+    description = "Updates an uni to the controller.")
+public class UniUpdateShellCommand extends OsgiCommandSupport {
     @Option(name = "-ip",
             aliases = { "--ipAddress" },
             description = "IpAddress of the Uni",
@@ -97,7 +98,7 @@ public class UniUpdateShellCommand extends OsgiCommandSupport{
                 .setIpAddress(new IpAddress(ipAddress.toCharArray()))
                 .build();
         if (provider.updateUni(uniAug)) {
-            return new String("Uni with ip " +ipAddress+" updated");
+            return new String("Uni with ip " + ipAddress + " updated");
         } else {
             return new String("Error updating new Uni");
         }
index bbfc70effc2d822237c0a2e7d2b8c843b67643ca..2ca8ca195fcdbfc43fdfd25a02859207b0f529e4 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10GBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10MBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1GBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.uni.SpeedBuilder;
 
 public final class Utils {
 
@@ -21,21 +20,23 @@ public final class Utils {
 
     }
 
+    /**
+     * Convert string to Speed.
+     * @param speed string representation of speed
+     * @return schema defined speed object
+     */
     public static final Speed getSpeed(final String speed) {
         Speed speedObject = null;
         if (speed.equals("10M")) {
             speedObject = new Speed10MBuilder().setSpeed10M(true)
                                                .build();
-        }
-        else if (speed.equals("100M")) {
+        } else if (speed.equals("100M")) {
             speedObject = new Speed100MBuilder().setSpeed100M(true)
                                                 .build();
-        }
-        else if (speed.equals("1G")) {
+        } else if (speed.equals("1G")) {
             speedObject = new Speed1GBuilder().setSpeed1G(true)
                                               .build();
-        }
-        else if (speed.equals("10G")) {
+        } else if (speed.equals("10G")) {
             speedObject = new Speed10GBuilder().setSpeed10G(true)
                                                .build();
         }
index d1b038415662e77bd155ccb25629a6c6d16ba231..fc5578799540fe35ea85f6e9087d731f03a7f797 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.unimgr.cli;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.powermock.api.support.membermodification.MemberMatcher.method;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -24,9 +22,7 @@ import org.opendaylight.unimgr.impl.UnimgrConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 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.EvcAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.EgressBw;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.EgressBwBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.IngressBw;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.IngressBwBuilder;
 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.UniDestBuilder;
@@ -34,14 +30,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSource;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSourceBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.evc.UniSourceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed100M;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed100MBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10G;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10GBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10M;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10MBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1G;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1GBuilder;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.api.support.membermodification.MemberModifier;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -75,8 +63,8 @@ public class EvcAddShellCommandTest {
     @Test
     public void testDoExecute() throws Exception {
         final EvcAddShellCommand spyEvc = PowerMockito.spy(new EvcAddShellCommand(provider));
-        Whitebox.setInternalState(spyEvc, "IPs", IPs);
-        Whitebox.setInternalState(spyEvc, "IPd", IPd);
+        Whitebox.setInternalState(spyEvc, "ipSource", IPs);
+        Whitebox.setInternalState(spyEvc, "ipDestination", IPd);
         Whitebox.setInternalState(spyEvc, "egress", egress);
         Whitebox.setInternalState(spyEvc, "ingress", ingress);
         final Short order = new Short("0");
index 9ebc2e478cb8e45bdeb588c898c0d8cfb83bf213..641813e5fd2434076bd5d000756d236b76353e44 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.unimgr.cli;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import java.math.BigInteger;
 
@@ -22,17 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 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.UniAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.Speed;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed100M;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed100MBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10G;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10GBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10M;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed10MBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1G;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.service.speed.speed.Speed1GBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.uni.SpeedBuilder;
-import org.powermock.api.mockito.PowerMockito;
 import org.powermock.api.support.membermodification.MemberModifier;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
index dfa5dcaeb2820b989e5edbbb486508db673ca541..31142551d5135599b3c2e7ac1ebad9d079da24f0 100644 (file)
@@ -10,18 +10,10 @@ package org.opendaylight.unimgr.cli;
 import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
 
-import java.util.List;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.unimgr.api.IUnimgrConsoleProvider;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-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.unimgr.rev151012.EvcAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unimgr.rev151012.UniAugmentation;
 import org.powermock.api.support.membermodification.MemberModifier;
 import org.powermock.reflect.Whitebox;
 
index 645f868e9304cb80eb62dc6dc9a37401876d8506..289e121cdb346d171ad38078cb4bae0b2a95159b 100644 (file)
@@ -19,8 +19,8 @@ public abstract class AbstractCommand<D extends DataObject> {
 
     /**
      * Abstract command basic constructor.
-     * @param dataBroker
-     * @param dataObject
+     * @param dataBroker the data broker
+     * @param dataObject the object change to process
      */
     public AbstractCommand(final DataBroker dataBroker, final DataTreeModification<D> dataObject) {
         this.dataBroker = dataBroker;
index e84a408da7ba6e21e9e8260e2e52cb14b3030b48..cb25e850db3e778b2c06a0bdd3d388ad426abc22 100644 (file)
@@ -123,26 +123,26 @@ public class EvcAddCommand extends AbstractCommand<Link> {
                             sourceBr = optionalSourceBr.get();
                             destinationBr = optionalDestinationBr.get();
                             OvsdbUtils.createTerminationPointNode(dataBroker,
-                                                                   uniSource.getAugmentation(UniAugmentation.class),
-                                                                   sourceBr,
-                                                                   UnimgrConstants.DEFAULT_BRIDGE_NAME,
-                                                                   UnimgrConstants.DEFAULT_TUNNEL_IFACE);
+                                    uniSource.getAugmentation(UniAugmentation.class),
+                                    sourceBr,
+                                    UnimgrConstants.DEFAULT_BRIDGE_NAME,
+                                    UnimgrConstants.DEFAULT_TUNNEL_IFACE);
                             OvsdbUtils.createGreTunnel(dataBroker,
-                                                        uniSource.getAugmentation(UniAugmentation.class),
-                                                        uniDestination.getAugmentation(UniAugmentation.class),
-                                                        sourceBr,
-                                                        UnimgrConstants.DEFAULT_BRIDGE_NAME,
-                                                        UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
+                                    uniSource.getAugmentation(UniAugmentation.class),
+                                    uniDestination.getAugmentation(UniAugmentation.class),
+                                    sourceBr,
+                                    UnimgrConstants.DEFAULT_BRIDGE_NAME,
+                                    UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
                             OvsdbUtils.createTerminationPointNode(dataBroker,
-                                                                   uniDestination.getAugmentation(UniAugmentation.class),
-                                                                   destinationBr,
-                                                                   UnimgrConstants.DEFAULT_BRIDGE_NAME,
-                                                                   UnimgrConstants.DEFAULT_TUNNEL_IFACE);
+                                    uniDestination.getAugmentation(UniAugmentation.class),
+                                    destinationBr,
+                                    UnimgrConstants.DEFAULT_BRIDGE_NAME,
+                                    UnimgrConstants.DEFAULT_TUNNEL_IFACE);
                             OvsdbUtils.createGreTunnel(dataBroker,
-                                                        uniDestination.getAugmentation(UniAugmentation.class),
-                                                        uniSource.getAugmentation(UniAugmentation.class), destinationBr,
-                                                        UnimgrConstants.DEFAULT_BRIDGE_NAME,
-                                                        UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
+                                    uniDestination.getAugmentation(UniAugmentation.class),
+                                    uniSource.getAugmentation(UniAugmentation.class), destinationBr,
+                                    UnimgrConstants.DEFAULT_BRIDGE_NAME,
+                                    UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
                             EvcUtils.updateEvcNode(LogicalDatastoreType.CONFIGURATION,
                                     evcKey,
                                     evc,
@@ -150,11 +150,11 @@ public class EvcAddCommand extends AbstractCommand<Link> {
                                     destinationUniIid,
                                     dataBroker);
                             EvcUtils.updateEvcNode(LogicalDatastoreType.OPERATIONAL,
-                                                      evcKey,
-                                                      evc,
-                                                      sourceUniIid,
-                                                      destinationUniIid,
-                                                      dataBroker);
+                                    evcKey,
+                                    evc,
+                                    sourceUniIid,
+                                    destinationUniIid,
+                                    dataBroker);
                         } else {
                             LOG.info("Unable to retrieve the source and/or destination bridge.");
                         }
index d811aeb24bf8078cc44bddce37003530f1d031eb..8e7457bfcec2a12444ea156e142f57de73fdd179 100644 (file)
@@ -65,8 +65,7 @@ public class EvcRemoveCommand extends AbstractCommand<Link> {
                     }
                 }
             }
-        }
-        else {
+        } else {
             LOG.info("EvcAugmentation is null");
         }
         MdsalUtils.deleteNode(dataBroker, removedEvcIid, LogicalDatastoreType.OPERATIONAL);
index 2941ff772966df7405a1fe493ce3c327dc42ca0b..51abcd4a91c11eb9a194f68c1ad640ef0a505d7e 100644 (file)
@@ -64,35 +64,44 @@ public class EvcUpdateCommand extends AbstractCommand<Link> {
             LOG.trace("New EVC created, source IP: {} destination IP {}.", laterUni1Ip, laterUni2Ip);
 
             final ReadTransaction readTransac = dataBroker.newReadOnlyTransaction();
-            final CheckedFuture<Optional<Link>, ReadFailedException> retFormerEvc = readTransac.read(LogicalDatastoreType.OPERATIONAL, evcKey);
+            final CheckedFuture<Optional<Link>, ReadFailedException> retFormerEvc =
+                    readTransac.read(LogicalDatastoreType.OPERATIONAL, evcKey);
             EvcAugmentation formerEvc;
             try {
                 Optional<Link> optLinks = retFormerEvc.get();
-                if(optLinks != null && optLinks.isPresent()) {
-                formerEvc = optLinks.get().getAugmentation(EvcAugmentation.class);
-                final Ipv4Address formerUni1ip = formerEvc.getUniSource().iterator().next().getIpAddress().getIpv4Address();
-                final Ipv4Address formerUni2ip = formerEvc.getUniDest().iterator().next().getIpAddress().getIpv4Address();
-
-                if (formerUni1ip.equals(laterUni1Ip)) {
-                    // do nothing
-                } else if (formerUni1ip.equals(laterUni2Ip)) {
-                    // do nothing
-                } else {
-                    LOG.info("{} is not part of the EVC, removing configuration", formerUni1ip);
-                    final InstanceIdentifier<?> formerUniIID = UnimgrMapper.getUniIid(dataBroker, new IpAddress(formerUni1ip), LogicalDatastoreType.OPERATIONAL);
-                    final Optional<Node> formerUni = MdsalUtils.readNode(dataBroker, LogicalDatastoreType.OPERATIONAL, formerUniIID);
-                    EvcUtils.deleteEvcData(dataBroker, formerUni);
-                }
-                if (formerUni2ip.equals(laterUni1Ip)) {
-                    // do nothing
-                } else if (formerUni2ip.equals(laterUni2Ip)) {
-                    // do nothing
-                } else {
-                    LOG.info("{} is not part of the EVC, removing configuration", formerUni2ip);
-                    final InstanceIdentifier<?> formerUniIID = UnimgrMapper.getUniIid(dataBroker, new IpAddress(formerUni2ip), LogicalDatastoreType.OPERATIONAL);
-                    final Optional<Node> formerUni = MdsalUtils.readNode(dataBroker, LogicalDatastoreType.OPERATIONAL, formerUniIID);
-                    EvcUtils.deleteEvcData(dataBroker, formerUni);
-                }
+                if (optLinks != null && optLinks.isPresent()) {
+                    formerEvc = optLinks.get().getAugmentation(EvcAugmentation.class);
+                    final Ipv4Address formerUni1ip =
+                            formerEvc.getUniSource().iterator().next().getIpAddress().getIpv4Address();
+                    final Ipv4Address formerUni2ip =
+                            formerEvc.getUniDest().iterator().next().getIpAddress().getIpv4Address();
+
+                    if (formerUni1ip.equals(laterUni1Ip)) {
+                        // do nothing
+                    } else if (formerUni1ip.equals(laterUni2Ip)) {
+                        // do nothing
+                    } else {
+                        LOG.info("{} is not part of the EVC, removing configuration", formerUni1ip);
+                        final InstanceIdentifier<?> formerUniIID =
+                                UnimgrMapper.getUniIid(dataBroker, new IpAddress(formerUni1ip),
+                                        LogicalDatastoreType.OPERATIONAL);
+                        final Optional<Node> formerUni =
+                                MdsalUtils.readNode(dataBroker, LogicalDatastoreType.OPERATIONAL, formerUniIID);
+                        EvcUtils.deleteEvcData(dataBroker, formerUni);
+                    }
+                    if (formerUni2ip.equals(laterUni1Ip)) {
+                        // do nothing
+                    } else if (formerUni2ip.equals(laterUni2Ip)) {
+                        // do nothing
+                    } else {
+                        LOG.info("{} is not part of the EVC, removing configuration", formerUni2ip);
+                        final InstanceIdentifier<?> formerUniIID =
+                                UnimgrMapper.getUniIid(dataBroker, new IpAddress(formerUni2ip),
+                                        LogicalDatastoreType.OPERATIONAL);
+                        final Optional<Node> formerUni =
+                                MdsalUtils.readNode(dataBroker, LogicalDatastoreType.OPERATIONAL, formerUniIID);
+                        EvcUtils.deleteEvcData(dataBroker, formerUni);
+                    }
                 }
             } catch (final InterruptedException | ExecutionException e) {
                 LOG.error("Failed to retrieve former EVC {}", evcKey, e);
index 9533ad3684cd8a15f47d2b8c952ce9ecc58e4c79..e753981adad1efd7090fd072ed949137135cb192 100644 (file)
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Optional;
 
-public class UniAddCommand extends AbstractCommand<Node>{
+public class UniAddCommand extends AbstractCommand<Node> {
 
     private static final Logger LOG = LoggerFactory.getLogger(UniAddCommand.class);
 
@@ -38,7 +38,7 @@ public class UniAddCommand extends AbstractCommand<Node>{
     public void execute() {
         final InstanceIdentifier<?> uniKey = dataObject.getRootPath().getRootIdentifier();
         final Optional<Node> optNode = MdsalUtils.readNode(dataBroker, LogicalDatastoreType.OPERATIONAL, uniKey);
-        if(!optNode.isPresent()) {
+        if (!optNode.isPresent()) {
             final Node uniNode = dataObject.getRootNode().getDataAfter();
             final UniAugmentation uni = uniNode.getAugmentation(UniAugmentation.class);
             if (uni != null) {
@@ -120,5 +120,4 @@ public class UniAddCommand extends AbstractCommand<Node>{
             }
         }
     }
-
 }
index e4295e4ef0a519290a0660259294b3caea1f1a49..6e0b2a7a9635f6082be0b8c9c00e3d2701476eb4 100644 (file)
@@ -35,8 +35,10 @@ public class UniUpdateCommand extends AbstractCommand<Node> {
 
     @Override
     public void execute() {
-        final UniAugmentation updatedUni = dataObject.getRootNode().getDataAfter().getAugmentation(UniAugmentation.class);
-        final UniAugmentation formerUni = dataObject.getRootNode().getDataBefore().getAugmentation(UniAugmentation.class);
+        final UniAugmentation updatedUni =
+                dataObject.getRootNode().getDataAfter().getAugmentation(UniAugmentation.class);
+        final UniAugmentation formerUni =
+                dataObject.getRootNode().getDataBefore().getAugmentation(UniAugmentation.class);
         if (formerUni != null) {
             final String formerUniIp = formerUni.getIpAddress().getIpv4Address().getValue();
             final String updatedUniIp = updatedUni.getIpAddress().getIpv4Address().getValue();
@@ -50,9 +52,10 @@ public class UniUpdateCommand extends AbstractCommand<Node> {
             if (updatedUni.getOvsdbNodeRef() != null) {
                 LOG.info("OVSDB NODE ref retreive for updated UNI {}", updatedUni.getOvsdbNodeRef());
                 final OvsdbNodeRef ovsdbNodeRef = updatedUni.getOvsdbNodeRef();
-                final Optional<Node> optOvsdbNode = MdsalUtils.readNode(dataBroker,LogicalDatastoreType.OPERATIONAL, ovsdbNodeRef.getValue());
-                if(optOvsdbNode.isPresent()) {
-                    ovsdbNode= optOvsdbNode.get();
+                final Optional<Node> optOvsdbNode =
+                        MdsalUtils.readNode(dataBroker,LogicalDatastoreType.OPERATIONAL, ovsdbNodeRef.getValue());
+                if (optOvsdbNode.isPresent()) {
+                    ovsdbNode = optOvsdbNode.get();
                     LOG.info("Retrieved the OVSDB node {}", ovsdbNode.getNodeId());
                     // Update QoS entries to ovsdb if speed is configured to UNI node
                     if (updatedUni.getSpeed() != null) {
@@ -63,7 +66,8 @@ public class UniUpdateCommand extends AbstractCommand<Node> {
                 }  else {
                     // This should never happen, because on creation,
                     // the UNI is assigned and OVSDB node
-                    LOG.error("OVSDB node not found for UNI {}, but got OVSDB ref", uniKey, updatedUni.getOvsdbNodeRef());
+                    LOG.error("OVSDB node not found for UNI {}, but got OVSDB ref {}", uniKey,
+                            updatedUni.getOvsdbNodeRef());
                     return;
                 }
             } else {
index 697be76baa9c86bfdd933cb5f973215472e796db..96765219e31f2d691507b38408204a4ea3a2329b 100644 (file)
@@ -32,14 +32,15 @@ public class EvcDataTreeChangeListener extends UnimgrDataTreeChangeListener<Link
 
     public EvcDataTreeChangeListener(final DataBroker dataBroker) {
         super(dataBroker);
-        final DataTreeIdentifier<Link> dataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getEvcTopologyPath());
+        final DataTreeIdentifier<Link> dataTreeIid =
+                new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getEvcTopologyPath());
         listener = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
         LOG.info("EvcDataTreeChangeListener created and registered");
     }
 
     @Override
     public void add(final DataTreeModification<Link> newDataObject) {
-        if(newDataObject.getRootPath() != null && newDataObject.getRootNode() != null) {
+        if (newDataObject.getRootPath() != null && newDataObject.getRootNode() != null) {
             LOG.info("evc link {} created", newDataObject.getRootNode().getIdentifier());
             final EvcAddCommand evcAddCmd = new EvcAddCommand(dataBroker, newDataObject);
             evcAddCmd.execute();
@@ -53,15 +54,15 @@ public class EvcDataTreeChangeListener extends UnimgrDataTreeChangeListener<Link
 
     private InstanceIdentifier<Link> getEvcTopologyPath() {
         final InstanceIdentifier<Link> evcPath = InstanceIdentifier
-                                                   .create(NetworkTopology.class)
-                                                   .child(Topology.class, new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
-                                                   .child(Link.class);
+                .create(NetworkTopology.class)
+                .child(Topology.class, new TopologyKey(UnimgrConstants.EVC_TOPOLOGY_ID))
+                .child(Link.class);
         return evcPath;
     }
 
     @Override
     public void remove(final DataTreeModification<Link> removedDataObject) {
-        if(removedDataObject.getRootPath() != null && removedDataObject.getRootNode() != null) {
+        if (removedDataObject.getRootPath() != null && removedDataObject.getRootNode() != null) {
             LOG.info("evc link {} deleted", removedDataObject.getRootNode().getIdentifier());
             final EvcRemoveCommand evcRemovedCmd = new EvcRemoveCommand(dataBroker, removedDataObject);
             evcRemovedCmd.execute();
@@ -70,7 +71,7 @@ public class EvcDataTreeChangeListener extends UnimgrDataTreeChangeListener<Link
 
     @Override
     public void update(final DataTreeModification<Link> modifiedDataObject) {
-        if(modifiedDataObject.getRootPath() != null && modifiedDataObject.getRootNode() != null) {
+        if (modifiedDataObject.getRootPath() != null && modifiedDataObject.getRootNode() != null) {
             LOG.info("evc link {} updated", modifiedDataObject.getRootNode().getIdentifier());
             final EvcUpdateCommand evcUpdateCmd = new EvcUpdateCommand(dataBroker, modifiedDataObject);
             evcUpdateCmd.execute();
index 57b0d49f4b817835f9adcf66e5ba98d47f519553..e54d50c5824ead63b7b5f8c2532988faccaaa83c 100644 (file)
@@ -31,7 +31,8 @@ public class OvsNodeDataTreeChangeListener extends UnimgrDataTreeChangeListener<
     public OvsNodeDataTreeChangeListener(final DataBroker dataBroker) {
         super(dataBroker);
         final InstanceIdentifier<Node> nodePath = getOvsNodeTopologyPath();
-        final DataTreeIdentifier<Node> dataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, nodePath);
+        final DataTreeIdentifier<Node> dataTreeIid =
+                new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, nodePath);
         listener = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
         LOG.info("ovsNodeDataTreeChangeListener created and registered");
     }
index 94577503b559a00e4f6ec952ac9efc0f3d019434..4ec33b6f188e545046a2c4d4947125669e559e66 100644 (file)
@@ -34,7 +34,8 @@ public class UniDataTreeChangeListener extends UnimgrDataTreeChangeListener<Node
     public UniDataTreeChangeListener(final DataBroker dataBroker) {
         super(dataBroker);
         final InstanceIdentifier<Node> uniPath = getUniTopologyPath();
-        final DataTreeIdentifier<Node> dataTreeIid = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, uniPath);
+        final DataTreeIdentifier<Node> dataTreeIid =
+                new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, uniPath);
         listener = dataBroker.registerDataTreeChangeListener(dataTreeIid, this);
         LOG.info("UniDataTreeChangeListener created and registered");
     }
@@ -50,7 +51,7 @@ public class UniDataTreeChangeListener extends UnimgrDataTreeChangeListener<Node
 
     @Override
     public void close() throws Exception {
-         listener.close();
+        listener.close();
     }
 
     private InstanceIdentifier<Node> getUniTopologyPath() {
index f03bca14bdead43608725ec8f1965efed7b8e72d..aa4d253b957ddbcfa5035bb9397e1a27d4cd37b2 100755 (executable)
@@ -108,7 +108,7 @@ public class UnimgrMapper {
      * Generates an Instance Identifier for an OvsdbBridgeNode by retrieving the Iid
      * via the OvsdbNodeAugmentation's BridgeRef.
      * the same as createOvsdbBridgeNodeIid.
-     * @param ovsdbNode
+     * @param ovsdbNode the ovsdb node
      * @return An Instance Identifier for a bridge associated with an OVSDB node.
      */
     public static InstanceIdentifier<Node> getOvsdbBridgeNodeIid(Node ovsdbNode) {
@@ -160,7 +160,7 @@ public class UnimgrMapper {
     }
 
     /**
-     * Generates an Instance Identifier for the OVSDB topology ovsdb:1
+     * 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() {
@@ -176,7 +176,7 @@ public class UnimgrMapper {
      * 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
+     * @return instance identifier
      */
     public static InstanceIdentifier<TerminationPoint> getTerminationPointIid(
                                                            Node bridgeNode,
@@ -217,7 +217,7 @@ public class UnimgrMapper {
     /**
      * Generates an Instance Identifier for a UNI by querying the datastore.
      * Query will ask the Operational store by default.
-     * @param dataBroker
+     * @param dataBroker the data broker
      * @param ip The IP of the UNI
      * @return An Instance Identifier of a UNI by using its IP address.
      */
@@ -243,7 +243,7 @@ public class UnimgrMapper {
     /**
      * Generates an Instance Identifier for a UNI by querying the datastore
      * with the IP address of the UNI.
-     * @param dataBroker
+     * @param dataBroker the data broker
      * @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.
@@ -269,7 +269,7 @@ public class UnimgrMapper {
     }
 
     /**
-     * Generates an Instance Identifier for the UNI topology: unimgr:uni
+     * Generates an Instance Identifier for the UNI topology: unimgr:uni.
      * @return An Instance Identifier for the UNI topology
      */
     public static InstanceIdentifier<Topology> getUniTopologyIid() {
@@ -300,16 +300,23 @@ public class UnimgrMapper {
      * @return An Instance Identifier for a specific UNI node.
      */
     public static InstanceIdentifier<Node> getUniNodeIid(NodeId nodeId) {
-    InstanceIdentifier<Node> nodePath = InstanceIdentifier
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
                                             .create(NetworkTopology.class)
                                             .child(Topology.class,
                                                     new TopologyKey(UnimgrConstants.UNI_TOPOLOGY_ID))
                                             .child(Node.class,
                                                     new NodeKey(nodeId));
-    return nodePath;
-}
+        return nodePath;
+    }
 
-    public static InstanceIdentifier<QueueList> getOvsdbQueueListIid (NodeId ovsdbNodeId,
+    /**
+     * Generates an Instance Identifier for an OVSDB QoS queue list entry.
+     * @param ovsdbNodeId the desired node id
+     * @param qosEntryKey the key of the desired QoS entry
+     * @param queueNumber the key of the desired queue entry
+     * @return instance identifier
+     */
+    public static InstanceIdentifier<QueueList> getOvsdbQueueListIid(NodeId ovsdbNodeId,
             QosEntriesKey qosEntryKey,
             Long queueNumber) {
         InstanceIdentifier<QueueList> queueIid = InstanceIdentifier
@@ -322,7 +329,13 @@ public class UnimgrMapper {
         return queueIid;
     }
 
-    public static InstanceIdentifier<QosOtherConfig> getQosOtherConfigIid (NodeId ovsdbNodeId,
+    /**
+     * Generates an Instance Identifier for an OVSDB QoS other config entry.
+     * @param ovsdbNodeId the desired node id
+     * @param qosEntryKey the key of the desired QoS entry
+     * @return instance identifier
+     */
+    public static InstanceIdentifier<QosOtherConfig> getQosOtherConfigIid(NodeId ovsdbNodeId,
             QosEntriesKey qosEntryKey) {
         InstanceIdentifier<QosOtherConfig> qosOtherConfigIid = InstanceIdentifier
                 .create(NetworkTopology.class)
@@ -334,7 +347,13 @@ public class UnimgrMapper {
         return qosOtherConfigIid;
     }
 
-    public static InstanceIdentifier<QueuesOtherConfig> getQueuesOtherConfigIid (NodeId ovsdbNodeId,
+    /**
+     * Generates an Instance Identifier for an OVSDB queue other config entry.
+     * @param ovsdbNodeId the desired node id
+     * @param queuesKey the key of the desired queue entry
+     * @return instance identifier
+     */
+    public static InstanceIdentifier<QueuesOtherConfig> getQueuesOtherConfigIid(NodeId ovsdbNodeId,
             QueuesKey queuesKey) {
         InstanceIdentifier<QueuesOtherConfig> queuesOtherConfig = InstanceIdentifier
                 .create(NetworkTopology.class)
@@ -346,6 +365,12 @@ public class UnimgrMapper {
         return queuesOtherConfig;
     }
 
+    /**
+     * Generates an Instance Identifier for an OVSDB QoS entries list.
+     * @param ovsdbNode the desired node
+     * @param qosEntryKey the key of the desired QoS entry
+     * @return instance identifier
+     */
     public static InstanceIdentifier<QosEntries> getOvsdbQoSEntriesIid(Node ovsdbNode, QosEntriesKey qosEntryKey) {
         InstanceIdentifier<QosEntries> qosEntriesIid = InstanceIdentifier
                 .create(NetworkTopology.class)
@@ -356,6 +381,12 @@ public class UnimgrMapper {
         return qosEntriesIid;
     }
 
+    /**
+     * Generates an Instance Identifier for an OVSDB QoS queue list entry.
+     * @param ovsdbNode the desired node
+     * @param queuesKey the key of the desired queue list
+     * @return instance identifier
+     */
     public static InstanceIdentifier<Queues> getOvsdbQueuesIid(Node ovsdbNode, QueuesKey queuesKey) {
         InstanceIdentifier<Queues> queuesIid = InstanceIdentifier
                 .create(NetworkTopology.class)
index 8fae6430748196b0c9e9a3c85547dabef92a7f87..fe19b4f76db070a17a3e72ec744562889f2d26af 100644 (file)
@@ -44,7 +44,7 @@ public class EvcUtils {
     private static final Logger LOG = LoggerFactory.getLogger(EvcUtils.class);
 
     /**
-     * Delete EVC data from configuration datastore
+     * Delete EVC data from configuration datastore.
      * @param dataBroker The dataBroker instance to create transactions
      * @param optionalUni Optional Uni Node
      */
@@ -65,7 +65,8 @@ public class EvcUtils {
                                          ovsdbNodeIid);
             if (optionalOvsdNode.isPresent()) {
                 final Node ovsdbNode = optionalOvsdNode.get();
-                final OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
+                final OvsdbNodeAugmentation ovsdbNodeAugmentation =
+                        ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
                 for (final ManagedNodeEntry managedNodeEntry: ovsdbNodeAugmentation.getManagedNodeEntry()) {
                     final InstanceIdentifier<Node> bridgeIid = managedNodeEntry
                                                              .getBridgeRef()
@@ -74,10 +75,12 @@ public class EvcUtils {
                     final Optional<Node> optBridgeNode = MdsalUtils.readNode(dataBroker, bridgeIid);
                     if (optBridgeNode.isPresent()) {
                         final Node bridgeNode = optBridgeNode.get();
-                        final InstanceIdentifier<TerminationPoint> iidGreTermPoint = UnimgrMapper.getTerminationPointIid(bridgeNode,
-                                                                                        UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
-                        final InstanceIdentifier<TerminationPoint> iidEthTermPoint = UnimgrMapper.getTerminationPointIid(bridgeNode,
-                                                                                        UnimgrConstants.DEFAULT_TUNNEL_IFACE);
+                        final InstanceIdentifier<TerminationPoint> iidGreTermPoint =
+                                UnimgrMapper.getTerminationPointIid(bridgeNode,
+                                        UnimgrConstants.DEFAULT_GRE_TUNNEL_NAME);
+                        final InstanceIdentifier<TerminationPoint> iidEthTermPoint =
+                                UnimgrMapper.getTerminationPointIid(bridgeNode,
+                                        UnimgrConstants.DEFAULT_TUNNEL_IFACE);
                         MdsalUtils.deleteNode(dataBroker, iidGreTermPoint, LogicalDatastoreType.CONFIGURATION);
                         MdsalUtils.deleteNode(dataBroker, iidEthTermPoint, LogicalDatastoreType.CONFIGURATION);
                     }
@@ -89,7 +92,7 @@ public class EvcUtils {
     }
 
     /**
-     * Retrieve the list of links in the Operational DataStore
+     * 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
      */
@@ -111,7 +114,7 @@ public class EvcUtils {
     }
 
     /**
-     * Updates a specific EVC into a specific DataStore type
+     * 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
index 74bc6fc9ca0176490f198fb95a7c4aecf324f7fd..c6e98f1f402f843fdd9ef6070c89401e0103d734 100644 (file)
@@ -84,6 +84,28 @@ public class MdsalUtils {
         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) {
+        final ReadTransaction read = dataBroker.newReadOnlyTransaction();
+        final InstanceIdentifier<Node> nodeIid = genericNode.firstIdentifierOf(Node.class);
+        final CheckedFuture<Optional<Node>, ReadFailedException> nodeFuture = read
+                .read(store, nodeIid);
+        try {
+            return nodeFuture.checkedGet();
+        } catch (final ReadFailedException e) {
+            LOG.info("Unable to read node with Iid {}", nodeIid, e);
+        }
+        return Optional.absent();
+    }
+
     /**
      * Generic function to delete a node on a specific dataStore
      * @param dataBroker The instance of the data broker to create transactions.
@@ -126,26 +148,4 @@ public class MdsalUtils {
         }
         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) {
-        final ReadTransaction read = dataBroker.newReadOnlyTransaction();
-        final InstanceIdentifier<Node> nodeIid = genericNode.firstIdentifierOf(Node.class);
-        final CheckedFuture<Optional<Node>, ReadFailedException> nodeFuture = read
-                .read(store, nodeIid);
-        try {
-            return nodeFuture.checkedGet();
-        } catch (final ReadFailedException e) {
-            LOG.info("Unable to read node with Iid {}", nodeIid, e);
-        }
-        return Optional.absent();
-    }
 }
index 41ad77de616bd5a84947462c04c1ef8d6e0e6cdb..e0944c62f1ebb3ed98410b4b0b1c90b994bf7e79 100644 (file)
@@ -158,7 +158,8 @@ public class OvsdbUtils {
                         + UnimgrConstants.DEFAULT_BRIDGE_NODE_ID_SUFFIX
                         + bridgeName);
                 bridgeNodeBuilder.setNodeId(bridgeNodeId);
-                final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
+                final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder =
+                        new OvsdbBridgeAugmentationBuilder();
                 ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
                 ovsdbBridgeAugmentationBuilder.setProtocolEntry(OvsdbUtils.createMdsalProtocols());
                 final OvsdbNodeRef ovsdbNodeRef = new OvsdbNodeRef(ovsdbNodeIid);
@@ -243,8 +244,8 @@ public class OvsdbUtils {
         final List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
         final ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
                 SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
-        protocolList.add(new ProtocolEntryBuilder().
-                setProtocol((Class<? extends OvsdbBridgeProtocolBase>) mapper.get("OpenFlow13")).build());
+        protocolList.add(new ProtocolEntryBuilder().setProtocol(
+                (Class<? extends OvsdbBridgeProtocolBase>) mapper.get("OpenFlow13")).build());
         return protocolList;
     }
 
@@ -300,7 +301,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Creates and submit an OvsdbNode by using the Data contained in the UniAugmentation
+     * 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
@@ -344,6 +345,12 @@ public class OvsdbUtils {
         return ovsdbNode;
     }
 
+    /**
+     * Create and build an OvsdbNodeAugmentation.
+     * @param uni the UNI data
+     * @param remotePort port number
+     * @return OvsdbNodeAugmentation
+     */
     public static OvsdbNodeAugmentation createOvsdbNodeAugmentation(UniAugmentation uni,
             PortNumber remotePort) {
         final ConnectionInfo connectionInfos = new ConnectionInfoBuilder()
@@ -358,7 +365,13 @@ public class OvsdbUtils {
         return ovsdbNode;
     }
 
-    public static Node createQoSForOvsdbNode (DataBroker dataBroker, UniAugmentation uni) {
+    /**
+     * Create and write QoS forn an OVSDB node, copying from UNI entry.
+     * @param dataBroker the data broker
+     * @param uni the UNI to copy data from
+     * @return null
+     */
+    public static Node createQoSForOvsdbNode(DataBroker dataBroker, UniAugmentation uni) {
         final Optional<Node> optionalNode = findOvsdbNode(dataBroker, uni);
         if (optionalNode.isPresent()) {
             final NodeId ovsdbNodeId = optionalNode.get().getNodeId();
@@ -378,7 +391,7 @@ public class OvsdbUtils {
             }
             try {
                 future.checkedGet();
-              LOG.trace("Update qos and queues to ovsdb for node {} {}", ovsdbNodeId, ovsdbNodeAugmentationIid);
+                LOG.trace("Update qos and queues to ovsdb for node {} {}", ovsdbNodeId, ovsdbNodeAugmentationIid);
             } catch (final TransactionCommitFailedException e) {
                 LOG.warn("Failed to put {} ", ovsdbNodeAugmentationIid, e);
             }
@@ -402,19 +415,19 @@ public class OvsdbUtils {
     private static List<QosEntries> createQosEntries(Uni uni) {
         // Configure queue for best-effort dscp and max rate
         final List<QosOtherConfig> otherConfig = new ArrayList<>();
-        QosOtherConfig qOtherConfig = new QosOtherConfigBuilder()
+        QosOtherConfig qosOtherConfig = new QosOtherConfigBuilder()
                 .setKey(new QosOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE))
                 .setOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE)
                 .setOtherConfigValue(UnimgrConstants.QOS_DSCP_ATTRIBUTE_VALUE)
                 .build();
-        otherConfig.add(qOtherConfig);
+        otherConfig.add(qosOtherConfig);
 
-        qOtherConfig = new QosOtherConfigBuilder()
+        qosOtherConfig = new QosOtherConfigBuilder()
                 .setKey(new QosOtherConfigKey(UnimgrConstants.QOS_MAX_RATE))
                 .setOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)
                 .setOtherConfigValue(UniUtils.getSpeed(uni.getSpeed().getSpeed()))
                 .build();
-        otherConfig.add(qOtherConfig);
+        otherConfig.add(qosOtherConfig);
 
         final Uuid qosUuid = new Uuid(UUID.randomUUID().toString());
         final QosEntries qosEntry = new QosEntriesBuilder()
@@ -493,14 +506,21 @@ public class OvsdbUtils {
             final CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
             try {
                 future.checkedGet();
-              LOG.info("Update qos-entries to ovsdb for node {} {}", ovsdbNodeId, queueIid);
+                LOG.info("Update qos-entries to ovsdb for node {} {}", ovsdbNodeId, queueIid);
             } catch (final TransactionCommitFailedException e) {
                 LOG.warn("Failed to put {} ", queueIid, e);
             }
         }
     }
 
-    public static void updateMaxRate (DataBroker dataBroker,
+    /**
+     * Write a new max rate into an EVC's objects.
+     * @param dataBroker the data broker
+     * @param sourceUniAugmentation source UNI
+     * @param destinationUniAugmentation destination UNI
+     * @param evc EVC link
+     */
+    public static void updateMaxRate(DataBroker dataBroker,
             UniAugmentation sourceUniAugmentation,
             UniAugmentation destinationUniAugmentation,
             EvcAugmentation evc) {
@@ -554,7 +574,7 @@ public class OvsdbUtils {
         final CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
         try {
             future.checkedGet();
-          LOG.info("Update qos-entries max-rate to ovsdb for node {} {}", ovsdbNodeId, qosOtherConfigIid);;
+            LOG.info("Update qos-entries max-rate to ovsdb for node {} {}", ovsdbNodeId, qosOtherConfigIid);
         } catch (final TransactionCommitFailedException e) {
             LOG.warn("Failed to put {}", qosOtherConfigIid, e);
         }
@@ -583,7 +603,7 @@ public class OvsdbUtils {
         final CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit();
         try {
             future.checkedGet();
-          LOG.info("Update queues max-rate to ovsdb for node {} {}", ovsdbNodeId, queuesOtherConfigIid);;
+            LOG.info("Update queues max-rate to ovsdb for node {} {}", ovsdbNodeId, queuesOtherConfigIid);
         } catch (final TransactionCommitFailedException e) {
             LOG.warn("Failed to put {} ", queuesOtherConfigIid, e);
         }
@@ -603,7 +623,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Creates a built OvsdbTerminationAugmentation with data
+     * Creates a built OvsdbTerminationAugmentation with data.
      * @param uni The UNI's data
      * @return A Built OvsdbTerminationPointAugmentation with data
      */
@@ -626,7 +646,7 @@ public class OvsdbUtils {
      * @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.
+     *     to review the list of available Interface Types.
      */
     public static void createTerminationPointNode(DataBroker dataBroker,
             Uni uni,
@@ -711,7 +731,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Deletes a generic node
+     * 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
@@ -773,13 +793,11 @@ public class OvsdbUtils {
             for (final Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) {
                 if (klazz.isInstance(created.getValue())) {
                     @SuppressWarnings("unchecked")
-                    final
-                    T value = (T) created.getValue();
+                    final T value = (T) created.getValue();
                     final Class<?> type = created.getKey().getTargetType();
                     if (type.equals(klazz)) {
                         @SuppressWarnings("unchecked") // Actually checked above
-                        final
-                        InstanceIdentifier<T> iid = (InstanceIdentifier<T>) created.getKey();
+                        final InstanceIdentifier<T> iid = (InstanceIdentifier<T>) created.getKey();
                         result.put(iid, value);
                     }
                 }
@@ -800,7 +818,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Extracts the removed nodes
+     * 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
@@ -812,8 +830,7 @@ public class OvsdbUtils {
             for (final InstanceIdentifier<?> iid : changes.getRemovedPaths()) {
                 if (iid.getTargetType().equals(klazz)) {
                     @SuppressWarnings("unchecked") // Actually checked above
-                    final
-                    InstanceIdentifier<T> iidn = (InstanceIdentifier<T>)iid;
+                    final InstanceIdentifier<T> iidn = (InstanceIdentifier<T>)iid;
                     result.add(iidn);
                 }
             }
@@ -850,7 +867,7 @@ public class OvsdbUtils {
 
     /**
      * Retrieves the connection information from an Ovsdb Connection by
-     * using the Ovsdb Node Id
+     * 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
@@ -872,7 +889,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Retrieve the Local IP of the controller
+     * Retrieve the Local IP of the controller.
      * @return The LocalIp object of the Controller
      */
     public static IpAddress getLocalIp() {
@@ -888,7 +905,7 @@ public class OvsdbUtils {
     }
 
     /**
-     * Retrieve a list of Ovsdb Nodes from the Operational DataStore
+     * 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
      */
@@ -909,7 +926,8 @@ public class OvsdbUtils {
             topology = MdsalUtils.read(dataBroker, LogicalDatastoreType.CONFIGURATION, ovsdbTopoIdentifier);
             if ((topology != null) && (topology.getNode() != null)) {
                 for (final Node node : topology.getNode()) {
-                    final OvsdbNodeAugmentation ovsdbNodeAugmentation = node.getAugmentation(OvsdbNodeAugmentation.class);
+                    final OvsdbNodeAugmentation ovsdbNodeAugmentation =
+                            node.getAugmentation(OvsdbNodeAugmentation.class);
                     if (ovsdbNodeAugmentation != null) {
                         ovsdbNodes.add(node);
                     }