Merge "MD-SAL model for group feature in OF 1.3."
authorEd Warnicke <eaw@cisco.com>
Wed, 18 Sep 2013 14:52:53 +0000 (14:52 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 18 Sep 2013 14:52:53 +0000 (14:52 +0000)
22 files changed:
opendaylight/clustering/integrationtest/pom.xml
opendaylight/clustering/services_implementation/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/containermanager/api/src/main/java/org/opendaylight/controller/containermanager/ContainerConfig.java
opendaylight/containermanager/it.implementation/src/main/java/org/opendaylight/controller/containermanager/internal/ContainerManager.java
opendaylight/forwardingrulesmanager/implementation/pom.xml
opendaylight/forwardingrulesmanager/implementation/src/main/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManager.java
opendaylight/forwardingrulesmanager/integrationtest/pom.xml
opendaylight/hosttracker/implementation/pom.xml
opendaylight/hosttracker/integrationtest/pom.xml
opendaylight/hosttracker_new/implementation/pom.xml
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/ISwitch.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/core/internal/SwitchHandler.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowStatisticsConverter.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java
opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/FlowProgrammerService.java
opendaylight/statisticsmanager/implementation/pom.xml
opendaylight/statisticsmanager/integrationtest/pom.xml
opendaylight/switchmanager/api/pom.xml
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SpanConfig.java
opendaylight/switchmanager/implementation/pom.xml
opendaylight/switchmanager/integrationtest/pom.xml

index 0fadb128901cd16749511f32c58e2ea71973fc75..93b3624c82e69e5b12c2f759ae4211656048b5f2 100644 (file)
@@ -69,7 +69,7 @@
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
-        <version>0.5.3.201107060350</version>
+        <version>${jacoco.version}</version>
         <configuration>
           <destFile>../implementation/target/jacoco-it.exec</destFile>
           <includes>org.opendaylight.controller.*</includes>
index c0a8064493d6d303ba24fb75466751f8f8c75aa0..d6bd287434a499c19b1aa1576b0aa11ee303344d 100644 (file)
@@ -30,7 +30,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index cb1892ae664513667693413eac0fef5824ef35e6..9d7950af7395fd1c1f5a5fa79012574eee321870 100644 (file)
@@ -55,6 +55,7 @@
     <sample-toaster.version>1.0-SNAPSHOT</sample-toaster.version>
     <releaseplugin.version>2.3.2</releaseplugin.version>
     <commons.lang.version>3.1</commons.lang.version>
+    <jacoco.version>0.5.3.201107060350</jacoco.version>
   </properties>
 
   <pluginRepositories>
index a34746949e8d9697251da00b32b442ea0c9147f4..89bf424e67a4465c885c82b2ec3206d559709064 100644 (file)
@@ -386,11 +386,38 @@ public class ContainerConfig implements Serializable {
                             config.getName()));
                 }
             }
+        } else {
+            // Check for conflicting names with existing cFlows
+            List<String> conflicting = new ArrayList<String>(existingNames);
+            conflicting.retainAll(proposedNames);
+            if (!conflicting.isEmpty()) {
+                return new Status(StatusCode.CONFLICT,
+                        "Invalid Flow Spec configuration: flow spec name(s) conflict with existing flow specs: "
+                                + conflicting.toString());
+            }
+
+            /*
+             * Check for conflicting flow spec match (we only check for strict
+             * equality). Remove this in case (*) is reintroduced
+             */
+            if (this.containerFlows != null && !this.containerFlows.isEmpty()) {
+                Set<Match> existingMatches = new HashSet<Match>();
+                for (ContainerFlowConfig existing : this.containerFlows) {
+                    existingMatches.addAll(existing.getMatches());
+                }
+                for (ContainerFlowConfig proposed : cFlowConfigs) {
+                    if (existingMatches.removeAll(proposed.getMatches())) {
+                        return new Status(StatusCode.CONFLICT, String.format(
+                                "Invalid Flow Spec configuration: %s conflicts with existing flow spec",
+                                proposed.getName()));
+                    }
+                }
+            }
         }
+
         /*
          * Revisit the following flow-spec confict validation later based on more testing.
-         */
-         /*
+         * (*)
         if (!delete) {
             // Check for overlapping container flows in the request
             int size = cFlowConfigs.size();
index b5624af6afc8e916572bad446ab1e1438a166b3a..24ef0c08ef9d78a4f3410ded6f998af0281065d3 100644 (file)
@@ -192,8 +192,7 @@ public class ContainerManager implements IContainerManager {
 
     @Override
     public boolean doesContainerExist(String ContainerId) {
-        // TODO Auto-generated method stub
-        return false;
+        return GlobalConstants.DEFAULT.toString().equalsIgnoreCase(ContainerId);
     }
 
     @Override
index ea55ac8b08951f14191cbcd900a6309c7154fcfc..d146eead6f0168e7e25cdd290459fb5ff20be7d2 100644 (file)
@@ -33,7 +33,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index 58d23655cac5a17353989c5cfd36d71a7a14ea74..4e6818c3062511b01c9b8f73d3f5fa610c73134d 100644 (file)
@@ -1867,9 +1867,13 @@ public class ForwardingRulesManager implements
             }
         }
         if (target != null) {
-            // Program the network node
-            Status status = (target.installInHw()) ? this.uninstallFlowEntry(target.getFlowEntry()) : this
-                    .installFlowEntry(target.getFlowEntry());
+            Status status = target.validate(container);
+            if (!status.isSuccess()) {
+                log.warn(status.getDescription());
+                return status;
+            }
+            status = (target.installInHw()) ? this.uninstallFlowEntry(target.getFlowEntry()) : this
+                                    .installFlowEntry(target.getFlowEntry());
             if (status.isSuccess()) {
                 // Update Configuration database
                 target.setStatus(SUCCESS);
index 77792435991ce414a6edf14590b7f9fe071a9b56..770fef03f261dc7f6435eb8ac5644f53afd306ca 100644 (file)
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
-        <version>0.5.3.201107060350</version>
+        <version>${jacoco.version}</version>
         <configuration>
           <destFile>../implementation/target/jacoco-it.exec</destFile>
           <includes>org.opendaylight.controller.*</includes>
index 268dd4f67f6039f9bde419b8a726d4fe23063ac7..e93559b42ccae19ac461607d5680b4a3db1e0ec6 100644 (file)
@@ -33,7 +33,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index 81551650c34fe2a0eb49d0afeb2405ec75de4549..f2fefcdabcc05e7265ba811dbb9acd90fc14e4e1 100644 (file)
       <plugin>\r
         <groupId>org.jacoco</groupId>\r
         <artifactId>jacoco-maven-plugin</artifactId>\r
-        <version>0.5.3.201107060350</version>\r
+        <version>${jacoco.version}</version>\r
         <configuration>\r
           <destFile>../implementation/target/jacoco-it.exec</destFile>\r
           <includes>org.opendaylight.controller.*</includes>\r
index af2ea7b3475970cde2db15dfd660e13cdf177144..a4ff57b7f04348af9b9fbbee2a8b7f345905ef93 100644 (file)
@@ -33,7 +33,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index af3641823c874e485c01e19f627b2963ff9bf953..d924b66a0991d50edd74b925e14a7e1809a7e321 100644 (file)
@@ -232,4 +232,9 @@ public interface ISwitch {
      * until the Barrier reply arrives.
      */
     public Object asyncSendBarrierMessage();
+
+    /**
+     * Send a FLOW_MOD message with a wildcard match and action=DELETE.
+     */
+    public void deleteAllFlows();
 }
index 91909d20f53a5bde5adea2b7020c38a78406f080..6e000022df12909e1f4facdcbcf4236d20d3fd69 100644 (file)
@@ -372,12 +372,6 @@ public class SwitchHandler implements ISwitch {
                 // send feature request
                 OFMessage featureRequest = factory.getMessage(OFType.FEATURES_REQUEST);
                 asyncFastSend(featureRequest);
-                // delete all pre-existing flows
-                OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
-                OFFlowMod flowMod = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD);
-                flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE).setOutPort(OFPort.OFPP_NONE)
-                        .setLength((short) OFFlowMod.MINIMUM_LENGTH);
-                asyncFastSend(flowMod);
                 this.state = SwitchState.WAIT_FEATURES_REPLY;
                 startSwitchTimer();
                 break;
@@ -925,4 +919,14 @@ public class SwitchHandler implements ISwitch {
             return result;
         }
     }
+
+    @Override
+    public void deleteAllFlows() {
+        logger.trace("deleteAllFlows on switch {}", HexString.toHexString(this.sid));
+        OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
+        OFFlowMod flowMod = (OFFlowMod) factory.getMessage(OFType.FLOW_MOD);
+        flowMod.setMatch(match).setCommand(OFFlowMod.OFPFC_DELETE).setOutPort(OFPort.OFPP_NONE)
+                .setLength((short) OFFlowMod.MINIMUM_LENGTH);
+        asyncFastSend(flowMod);
+    }
 }
index 82dbf670a9517ee1b998442f2d524f37628f5815..6873b528a2631f2d01480387f46be430e58b57c0 100644 (file)
@@ -59,6 +59,7 @@ public class FlowStatisticsConverter {
                     flow.setPriority(ofFlowStat.getPriority());
                     flow.setIdleTimeout(ofFlowStat.getIdleTimeout());
                     flow.setHardTimeout(ofFlowStat.getHardTimeout());
+                    flow.setId(ofFlowStat.getCookie());
                     flowOnNode = new FlowOnNode(flow);
                     flowOnNode.setByteCount(ofFlowStat.getByteCount());
                     flowOnNode.setPacketCount(ofFlowStat.getPacketCount());
@@ -74,6 +75,7 @@ public class FlowStatisticsConverter {
                     flow.setPriority(v6StatsReply.getPriority());
                     flow.setIdleTimeout(v6StatsReply.getIdleTimeout());
                     flow.setHardTimeout(v6StatsReply.getHardTimeout());
+                    flow.setId(v6StatsReply.getCookie());
                     flowOnNode = new FlowOnNode(flow);
                     flowOnNode.setByteCount(v6StatsReply.getByteCount());
                     flowOnNode.setPacketCount(v6StatsReply.getPacketCount());
index 8db83f0fc7e2449b99079aadf5dfc709204f2f35..15bba670d2a7b9e4387317e91f12e50e18cb5e29 100644 (file)
@@ -239,6 +239,11 @@ public class InventoryServiceShim implements IContainerListener,
         if (sw == null) {
             return;
         }
+        Node node = NodeCreator.createOFNode(sw.getId());
+        if ((nodeProps.get(node) != null)  && (connectionOutService.isLocal(node))) {
+            logger.debug("Ignore switchAdded {}", sw);
+            return;
+        }
 
         // Add all the nodeConnectors of this switch
         Map<NodeConnector, Set<Property>> ncProps = InventoryServiceHelper
@@ -437,7 +442,6 @@ public class InventoryServiceShim implements IContainerListener,
             for (String container : containers) {
                 notifyInventoryShimInternalListener(container, node, type, props);
             }
-
             // Notify external listener
             notifyInventoryShimExternalListener(node, type, props);
 
@@ -511,6 +515,11 @@ public class InventoryServiceShim implements IContainerListener,
             props.add(b);
         }
 
+        if ((nodeProps.get(node) == null) &&  (connectionOutService.isLocal(node)))  {
+            // The switch is connected for the first time, flush all flows
+            // that may exist on this switch
+            sw.deleteAllFlows();
+       }
         nodeProps.put(node, props);
         // Notify all internal and external listeners
         notifyInventoryShimListener(node, type, props);
index a7bdb9da8bf32072b73b45a3128b412b9f18f88a..854125b3567a196b940556363ed56c82e99d50c0 100644 (file)
@@ -432,6 +432,7 @@ public class FlowProgrammerService implements IFlowProgrammerService,
         Flow flow = new Flow(match, actions);
         flow.setPriority((short) 100);
         flow.setHardTimeout((short) 360);
+        flow.setId(1234L);
 
         return flow;
     }
@@ -489,6 +490,7 @@ public class FlowProgrammerService implements IFlowProgrammerService,
         Flow flow = new Flow(match, actions);
         flow.setPriority((short) 300);
         flow.setHardTimeout((short) 240);
+        flow.setId(65536L);
 
         return flow;
     }
index 8be254e6b5eef24bae8eaf087289a81fbf3a851e..a6c938a2eb4f5137ccb15f22830580a9b613c1eb 100644 (file)
@@ -31,7 +31,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index 527dd0a02b3671451d6e612d3df25d69c7b0d1ba..e0251f8a27c82a852ed9705ce04216a7863b5131 100644 (file)
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
-        <version>0.5.3.201107060350</version>
+        <version>${jacoco.version}</version>
         <configuration>
           <destFile>../implementation/target/jacoco-it.exec</destFile>
           <includes>org.opendaylight.controller.*</includes>
index 607c42858e7b4ee52d8e9974c4d677ce1d61cc2f..14a056d5fee3b50ba27f2fe240d378495dc7ad85 100644 (file)
@@ -32,7 +32,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index 522f45946d98fbdc170db4ec9531d9128df53f97..4bb6438b32ce40a71b89796ecc81e91e7382c543 100644 (file)
@@ -14,10 +14,8 @@ import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
 import org.opendaylight.controller.sal.utils.GUIField;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -116,32 +114,12 @@ public class SpanConfig implements Serializable {
     }
 
     public ArrayList<NodeConnector> getPortArrayList() {
-        Node node = Node.fromString(nodeId);
         ArrayList<NodeConnector> portList = new ArrayList<NodeConnector>();
         String[] elemArray = spanPort.split(",");
         for (String elem : elemArray) {
-            if (elem.contains("-")) {
-                String[] limits = elem.split("-");
-                for (short j = Short.valueOf(limits[0]); j <= Short
-                        .valueOf(limits[1]); j++) {
-                    try {
-                        portList.add(new NodeConnector(
-                                NodeConnectorIDType.OPENFLOW, Short.valueOf(j),
-                                node));
-                    } catch (ConstructionException e) {
-                        logger.error("",e);
-                    }
-                }
-            } else {
-                try {
-                    portList.add(new NodeConnector(
-                            NodeConnectorIDType.OPENFLOW, Short.valueOf(elem),
-                            node));
-                } catch (NumberFormatException e) {
-                    logger.error("",e);
-                } catch (ConstructionException e) {
-                    logger.error("",e);
-                }
+            NodeConnector nodeConnector = NodeConnector.fromString(elem);
+            if (nodeConnector != null) {
+                portList.add(nodeConnector);
             }
         }
         return portList;
index 1b09f3c34d62a26a204288c9143fc8b1e54f3dd4..ee126f3408ce51d6b1036f351f4ffb7a1be218b8 100644 (file)
@@ -32,7 +32,7 @@
         <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
+          <version>${jacoco.version}</version>
         </plugin>
       </plugins>
     </pluginManagement>
index d571d9df532d682650033bdf0ae94eca349d176a..4ebe9bbc9380dab400625d7ed069d971dcd1a81a 100644 (file)
   </properties>
 
   <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.jacoco</groupId>
-          <artifactId>jacoco-maven-plugin</artifactId>
-          <version>0.5.3.201107060350</version>
-        </plugin>
-      </plugins>
-    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
-        <version>0.5.3.201107060350</version>
+        <version>${jacoco.version}</version>
         <configuration>
           <destFile>../implementation/target/jacoco-it.exec</destFile>
           <includes>org.opendaylight.controller.*</includes>