Merge "Remove unused code"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 11 Apr 2014 14:49:47 +0000 (14:49 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 11 Apr 2014 14:49:47 +0000 (14:49 +0000)
opendaylight/commons/opendaylight/pom.xml
opendaylight/forwardingrulesmanager/api/pom.xml
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/IForwardingRulesManager.java
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObject.java

index e638ba68a7655529ab34d52957b6b883cc5d42ef..1e8d3d26b584fd7b91bfbf340cdda3b3e7296e27 100644 (file)
@@ -95,7 +95,7 @@
     <commons.io.version>2.4</commons.io.version>
     <bundlescanner.version>0.4.2-SNAPSHOT</bundlescanner.version>
     <usermanager.version>0.4.2-SNAPSHOT</usermanager.version>
-    <forwardingrulesmanager.version>0.5.1-SNAPSHOT</forwardingrulesmanager.version>
+    <forwardingrulesmanager.version>0.6.0-SNAPSHOT</forwardingrulesmanager.version>
     <statisticsmanager.version>0.5.1-SNAPSHOT</statisticsmanager.version>
     <clustering.services.version>0.5.1-SNAPSHOT</clustering.services.version>
     <configuration.version>0.4.3-SNAPSHOT</configuration.version>
index 3bd1af3a102ac9f16300606aad216913c510c10c..304a3151deceae104375836931cad2424befb439 100644 (file)
@@ -15,7 +15,7 @@
   </scm>
 
   <artifactId>forwardingrulesmanager</artifactId>
-  <version>0.5.1-SNAPSHOT</version>
+  <version>0.6.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
   <build>
index 9d68f84a3ae62dff4e968acba87cb8a4ec5e9b76..070e8c499800c39068bbb16d2a879a4eb353497b 100644 (file)
@@ -369,6 +369,16 @@ public interface IForwardingRulesManager {
      */
     public Status addStaticFlow(FlowConfig config);
 
+    /**
+     * Add a flow specified by the {@code FlowConfig} object on the current
+     * container, through an asynchronous call.
+     *
+     * @param config
+     *            the {@code FlowConfig} object representing the static flow
+     * @return the {@code Status} object indicating the result of this action.
+     */
+    public Status addStaticFlowAsync(FlowConfig config);
+
     /**
      * Remove a flow specified by the {@code FlowConfig} object on the current
      * container
@@ -379,6 +389,16 @@ public interface IForwardingRulesManager {
      */
     public Status removeStaticFlow(FlowConfig config);
 
+    /**
+     * Remove a flow specified by the {@code FlowConfig} object on the current
+     * container, through an asynchronous call.
+     *
+     * @param config
+     *            the {@code FlowConfig} object representing the static flow
+     * @return the {@code Status} object indicating the result of this action
+     */
+    public Status removeStaticFlowAsync(FlowConfig config);
+
     /**
      * Replace the flow identified by the {@code FlowConfig.name} name for the
      * {@code FlowConfig.node} network node with the new flow specified by
@@ -386,7 +406,7 @@ public interface IForwardingRulesManager {
      *
      * @param config
      *            the {@code FlowConfig} object
-     * @returnthe {@code Status} object indicating the result of this action
+     * @return the {@code Status} object indicating the result of this action
      */
     public Status modifyStaticFlow(FlowConfig config);
 
@@ -401,6 +421,18 @@ public interface IForwardingRulesManager {
      */
     public Status removeStaticFlow(String name, Node node);
 
+    /**
+     * Remove the flow specified by name on the passed network node via an
+     * asynchronous call
+     *
+     * @param name
+     *            for the static flow
+     * @param node
+     *            on which the flow is attached
+     * @return the {@code Status} object indicating the result of this action
+     */
+    public Status removeStaticFlowAsync(String name, Node node);
+
     /**
      * Toggle the installation status of the specified configured flow If the
      * flow configuration status is active, this call will change the flow
index 614c39e0608fe1a7d384b854588d143c0ad5761e..f7b647dd721a1f1f9117d95bc3723867574e5064 100644 (file)
@@ -1590,6 +1590,10 @@ public class ForwardingRulesManager implements
 
     @Override
     public Status addStaticFlow(FlowConfig config) {
+        return addStaticFlow(config, false);
+    }
+
+    private Status addStaticFlow(FlowConfig config, boolean async) {
         // Configuration object validation
         Status status = config.validate();
         if (!status.isSuccess()) {
@@ -1598,7 +1602,13 @@ public class ForwardingRulesManager implements
             config.setStatus(error);
             return new Status(StatusCode.BADREQUEST, error);
         }
-        return addStaticFlowInternal(config, false);
+        return addStaticFlowInternal(config, async, false);
+    }
+
+
+    @Override
+    public Status addStaticFlowAsync(FlowConfig config) {
+        return addStaticFlow(config, true);
     }
 
     /**
@@ -1616,7 +1626,7 @@ public class ForwardingRulesManager implements
      *            installation on the network node was successful
      * @return The status of this request
      */
-    private Status addStaticFlowInternal(FlowConfig config, boolean restore) {
+    private Status addStaticFlowInternal(FlowConfig config, boolean async, boolean restore) {
         boolean multipleFlowPush = false;
         String error;
         Status status;
@@ -1653,7 +1663,7 @@ public class ForwardingRulesManager implements
             // Program hw
             if (config.installInHw()) {
                 FlowEntry entry = config.getFlowEntry();
-                status = this.installFlowEntry(entry);
+                status = async ? this.installFlowEntryAsync(entry) : this.installFlowEntry(entry);
                 if (!status.isSuccess()) {
                     config.setStatus(status.getDescription());
                     if (!restore) {
@@ -1765,6 +1775,15 @@ public class ForwardingRulesManager implements
 
     @Override
     public Status removeStaticFlow(FlowConfig config) {
+        return removeStaticFlow(config, false);
+    }
+
+    @Override
+    public Status removeStaticFlowAsync(FlowConfig config) {
+        return removeStaticFlow(config, true);
+    }
+
+    private Status removeStaticFlow(FlowConfig config, boolean async) {
         /*
          * No config.isInternal() check as NB does not take this path and GUI
          * cannot issue a delete on an internal generated flow. We need this
@@ -1788,7 +1807,8 @@ public class ForwardingRulesManager implements
         }
 
         // Program the network node
-        Status status = this.uninstallFlowEntry(config.getFlowEntry());
+        Status status = async ? this.uninstallFlowEntryAsync(config.getFlowEntry()) : this.uninstallFlowEntry(config
+                .getFlowEntry());
 
         // Update configuration database if programming was successful
         if (status.isSuccess()) {
@@ -1800,6 +1820,15 @@ public class ForwardingRulesManager implements
 
     @Override
     public Status removeStaticFlow(String name, Node node) {
+       return removeStaticFlow(name, node, false);
+    }
+
+    @Override
+    public Status removeStaticFlowAsync(String name, Node node) {
+        return removeStaticFlow(name, node, true);
+    }
+
+    private Status removeStaticFlow(String name, Node node, boolean async) {
         // Look for the target configuration entry
         Integer key = 0;
         FlowConfig target = null;
@@ -1830,7 +1859,7 @@ public class ForwardingRulesManager implements
         }
 
         // Program the network node
-        Status status = this.removeEntry(target.getFlowEntry(), false);
+        Status status = this.removeEntry(target.getFlowEntry(), async);
 
         // Update configuration database if programming was successful
         if (status.isSuccess()) {
@@ -2081,7 +2110,7 @@ public class ForwardingRulesManager implements
         }
 
         for (ConfigurationObject conf : configurationService.retrieveConfiguration(this, STATIC_FLOWS_FILE_NAME)) {
-            addStaticFlowInternal((FlowConfig) conf, true);
+            addStaticFlowInternal((FlowConfig) conf, false, true);
         }
     }
 
@@ -2193,7 +2222,7 @@ public class ForwardingRulesManager implements
                     // check if the frm really needs to act on the notification.
                     // this is to check against duplicate notifications
                     if(programInternalFlow(proactive, fc)) {
-                        Status status = (proactive) ? addStaticFlowInternal(fc, false) : removeStaticFlow(fc);
+                        Status status = (proactive) ? addStaticFlowInternal(fc, false, false) : removeStaticFlow(fc);
                         if (status.isSuccess()) {
                             log.trace("{} Proactive Static flow: {}", (proactive ? "Installed" : "Removed"), fc.getName());
                         } else {
@@ -2376,7 +2405,7 @@ public class ForwardingRulesManager implements
             if ((staticFlow.getNode().equals(node)) && (staticFlow.getPortGroup().equals(config.getName()))) {
                 for (Short port : data.getPorts()) {
                     FlowConfig derivedFlow = getDerivedFlowConfig(staticFlow, config.getName(), port);
-                    addStaticFlowInternal(derivedFlow, false);
+                    addStaticFlowInternal(derivedFlow, false, false);
                 }
             }
         }
@@ -3240,4 +3269,5 @@ public class ForwardingRulesManager implements
         }
         return list;
     }
+
 }
index 4afbc298426e943810f8149a0d17a20ae9e93210..e6cd1aa1ad638716b474fa9570c7d3ace3d767a1 100644 (file)
@@ -14,7 +14,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 import javassist.ClassPool;
@@ -40,8 +39,6 @@ import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 
 public class RuntimeCodeGeneratorTest {
 
@@ -115,7 +112,7 @@ public class RuntimeCodeGeneratorTest {
 
     }
 
-    private void verifyRouting(RpcRouter<FooService> product) {
+    private void verifyRouting(final RpcRouter<FooService> product) {
         assertNotNull("Routing table should be initialized", product.getRoutingTable(BaseIdentity.class));
 
         RpcRoutingTable<BaseIdentity, FooService> routingTable = product.getRoutingTable(BaseIdentity.class);
@@ -159,7 +156,7 @@ public class RuntimeCodeGeneratorTest {
         verify(service[1]).simple(instance_1_input[0]);
     }
 
-    private InstanceIdentifier<?>[][] identifiers(int serviceSize, int instancesPerService) {
+    private InstanceIdentifier<?>[][] identifiers(final int serviceSize, final int instancesPerService) {
         InstanceIdentifier<?>[][] ret = new InstanceIdentifier[serviceSize][];
         int service = 0;
         for (int i = 0; i < serviceSize; i++) {
@@ -175,23 +172,19 @@ public class RuntimeCodeGeneratorTest {
         return ret;
     }
 
-    private InstanceIdentifier<?> referencableIdentifier(int i) {
-        ReferencableObjectKey key = new ReferencableObjectKey(i);
-        IdentifiableItem<ReferencableObject, ReferencableObjectKey> pathArg = new IdentifiableItem<>(
-                ReferencableObject.class, key);
-        return new InstanceIdentifier<ReferencableObject>(Arrays.<PathArgument> asList(pathArg),
-                ReferencableObject.class);
+    private InstanceIdentifier<?> referencableIdentifier(final int i) {
+        return InstanceIdentifier.builder(ReferencableObject.class, new ReferencableObjectKey(i)).build();
     }
 
     private static class SimpleInputImpl implements SimpleInput {
         private final InstanceIdentifier<?> identifier;
 
-        public SimpleInputImpl(InstanceIdentifier<?> _identifier) {
+        public SimpleInputImpl(final InstanceIdentifier<?> _identifier) {
             this.identifier = _identifier;
         }
 
         @Override
-        public <E extends Augmentation<SimpleInput>> E getAugmentation(Class<E> augmentationType) {
+        public <E extends Augmentation<SimpleInput>> E getAugmentation(final Class<E> augmentationType) {
             return null;
         }
 
@@ -230,7 +223,7 @@ public class RuntimeCodeGeneratorTest {
         List<FooUpdate> receivedFoos = new ArrayList<>();
 
         @Override
-        public void onFooUpdate(FooUpdate notification) {
+        public void onFooUpdate(final FooUpdate notification) {
             receivedFoos.add(notification);
         }
 
@@ -242,12 +235,12 @@ public class RuntimeCodeGeneratorTest {
         List<FlowDelete> receivedDeletes = new ArrayList<>();
 
         @Override
-        public void onBarUpdate(BarUpdate notification) {
+        public void onBarUpdate(final BarUpdate notification) {
             receivedBars.add(notification);
         }
 
         @Override
-        public void onFlowDelete(FlowDelete notification) {
+        public void onFlowDelete(final FlowDelete notification) {
             receivedDeletes.add(notification);
         }
 
index 7901bc095546d9bb13956f9429fd2ee8a95e9b83..fa565070b90ea12a9898fb30c3e2731f7944e7e1 100644 (file)
@@ -7,9 +7,12 @@
  */
 package org.opendaylight.controller.sal.binding.test.mock;
 
+import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 
-public interface ReferencableObject extends DataObject,Identifiable<ReferencableObjectKey> {
+public interface ReferencableObject extends DataObject,
+    Identifiable<ReferencableObjectKey>,ChildOf<DataRoot>{
 
 }