Merge "Increased version of binding-generator to 0.5.5-SNAPSHOT."
authorGiovanni Meo <gmeo@cisco.com>
Fri, 2 Aug 2013 14:46:34 +0000 (14:46 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 2 Aug 2013 14:46:34 +0000 (14:46 +0000)
48 files changed:
opendaylight/arphandler/pom.xml
opendaylight/configuration/integrationtest/pom.xml
opendaylight/configuration/integrationtest/src/test/java/org/opendaylight/controller/configuration/internal/ConfigurationIT.java
opendaylight/distribution/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/logback.xml
opendaylight/forwardingrulesmanager/api/pom.xml
opendaylight/forwardingrulesmanager/implementation/pom.xml
opendaylight/forwardingrulesmanager/integrationtest/pom.xml
opendaylight/hosttracker/api/pom.xml
opendaylight/hosttracker/implementation/pom.xml
opendaylight/hosttracker/integrationtest/pom.xml
opendaylight/hosttracker_new/api/pom.xml
opendaylight/hosttracker_new/implementation/pom.xml
opendaylight/northbound/flowprogrammer/pom.xml
opendaylight/northbound/hosttracker/pom.xml
opendaylight/northbound/integrationtest/pom.xml
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java
opendaylight/northbound/subnets/pom.xml
opendaylight/northbound/switchmanager/pom.xml
opendaylight/routing/dijkstra_implementation/pom.xml
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java [new file with mode: 0644]
opendaylight/sal/networkconfiguration/api/pom.xml [new file with mode: 0644]
opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java [new file with mode: 0644]
opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java [new file with mode: 0644]
opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java [new file with mode: 0644]
opendaylight/sal/networkconfiguration/implementation/pom.xml [new file with mode: 0644]
opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java [new file with mode: 0644]
opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java [new file with mode: 0644]
opendaylight/samples/loadbalancer/pom.xml
opendaylight/samples/simpleforwarding/pom.xml
opendaylight/statisticsmanager/integrationtest/pom.xml
opendaylight/switchmanager/api/pom.xml
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManager.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java
opendaylight/switchmanager/api/src/test/java/org/opendaylight/controller/switchmanager/SwitchTest.java
opendaylight/switchmanager/implementation/pom.xml
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java
opendaylight/switchmanager/integrationtest/pom.xml
opendaylight/usermanager/api/pom.xml
opendaylight/usermanager/implementation/pom.xml
opendaylight/web/devices/pom.xml
opendaylight/web/devices/src/main/java/org/opendaylight/controller/devices/web/Devices.java
opendaylight/web/flows/pom.xml
opendaylight/web/flows/src/main/java/org/opendaylight/controller/flows/web/Flows.java
opendaylight/web/topology/pom.xml
opendaylight/web/topology/src/main/java/org/opendaylight/controller/topology/web/Topology.java
opendaylight/web/troubleshoot/pom.xml
opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java

index 8df1f4cffa183fe88d49483f265256be60d8c0a9..069ad8d4a3d4e13adbd9df3509dbb7d3a80a3239 100644 (file)
@@ -47,7 +47,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
      <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 037b43515aa3f5a6983d15832f5b52282c701966..39d08c1e3b37b808c54343cbee1991402e14099c 100644 (file)
@@ -60,7 +60,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 8e1f34e612c41986b276e9a2316bed423bf9a679..865c891b6f0af607c0aee42625c1fc0ffa243ab7 100644 (file)
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
 
 @RunWith(PaxExam.class)
 public class ConfigurationIT {
-    private Logger logger = LoggerFactory
+    private final Logger logger = LoggerFactory
             .getLogger(ConfigurationIT.class);
     // get the OSGI bundle context
     @Inject
@@ -91,7 +91,7 @@ public class ConfigurationIT {
                 mavenBundle("org.opendaylight.controller",
                         "containermanager.implementation", "0.4.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "switchmanager",
-                        "0.4.0-SNAPSHOT"),
+                        "0.5.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller",
                         "switchmanager.implementation", "0.4.0-SNAPSHOT"),
                 // needed bundles by configuration
index e6871afa772860e05ba22db915005823af7d6243..807dea52e38de9994d81ba2796c908085cae07fc 100644 (file)
@@ -75,6 +75,8 @@
     <!-- SAL Extension bundles -->
     <module>../../sal/connection/api</module>
     <module>../../sal/connection/implementation</module>
+    <module>../../sal/networkconfiguration/api</module>
+    <module>../../sal/networkconfiguration/implementation</module>
 
     <!--  Web bundles -->
     <module>../../web/root</module>
index de70a52a3118e60fb450cc1cb57905ce996ad67b..08dabdeedbd8ea99bebe3f647a4bfdadbed649fc 100644 (file)
@@ -24,7 +24,7 @@
   </root>
 
   <!--  Base log level  -->
-  <logger name="org.opendaylight.controller" level="INFO"/>
+  <logger name="org.opendaylight" level="INFO"/>
 
   <!-- OSGi logging bridge -->
   <logger name="org.opendaylight.controller.logging.bridge" level="WARN"/>
index b2a124bb4eb21844eaffd2a7e2c6f2fe6679100a..5b4f0dd35a30de4c5c8477cddc060552dcea7cf2 100644 (file)
@@ -79,7 +79,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index df1095c76d64adcaaa327207da772bb305f7d258..3519be452abf385a9fcaf1bb29aa6482d9792776 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index b626b4fdaf3a2095652bd0ad25e214de6e2c33e3..4e9a374c4f9889cd4473af247b6174182585cf19 100644 (file)
@@ -47,7 +47,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 6da648324c0f2a01e92b2b25e67a8667cd6e6fd1..3a35ed06eeebd2d560ffb4e32044d5ff175f2693 100644 (file)
@@ -56,7 +56,7 @@
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
       <artifactId>switchmanager</artifactId>\r
-      <version>0.4.0-SNAPSHOT</version>\r
+      <version>0.5.0-SNAPSHOT</version>\r
     </dependency>\r
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
index a2ebf1aa9d9779e5768eecb53a6dcd45b040fa9c..5507e46035d1ffa18ce3f98da0fd84dc349af274 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index a4e554705941933540ecbc07d9439dc38e7afceb..0a65f53b388d6e613b2705ff8eff863392cb3094 100644 (file)
@@ -65,7 +65,7 @@
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
       <artifactId>switchmanager</artifactId>\r
-      <version>0.4.0-SNAPSHOT</version>\r
+      <version>0.5.0-SNAPSHOT</version>\r
     </dependency>\r
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
index 6a98c71e6ad59ca143afc46ca77b8a0d93654d9a..c8a8dae167dee921b677908168cd835f94e6b998 100644 (file)
@@ -56,7 +56,7 @@
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
       <artifactId>switchmanager</artifactId>\r
-      <version>0.4.0-SNAPSHOT</version>\r
+      <version>0.5.0-SNAPSHOT</version>\r
     </dependency>\r
     <dependency>\r
       <groupId>org.opendaylight.controller</groupId>\r
index 804f5e36381bb549265cebff73010ae16670adbc..a006c74ae109c847f24573aed1c7253f221015db 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index c7e9a771c1d71f7c7913e2c26b1e9fe11264979b..94991c573efa29267d11c6ea800af85a5b99edb6 100644 (file)
@@ -69,7 +69,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index f0caa52d6396bf2bf97fd969475cbccb707aec43..40aaf462ad8ec1a4f07a0ad36c4db51cf904cd93 100644 (file)
@@ -79,7 +79,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 90acc8c59f0e9358a1bd735107c5093afcaa1988..5312f8b91f8f0ee2468ed6e3c5f8e3569a3ffba1 100644 (file)
@@ -99,7 +99,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 66fa52c5ab93df569d7487a3879177ad9dc53769..4c3fa97864ff88744944fc669d9eeebc3be47ffd 100644 (file)
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
 
 @RunWith(PaxExam.class)
 public class NorthboundIT {
-    private Logger log = LoggerFactory.getLogger(NorthboundIT.class);
+    private final Logger log = LoggerFactory.getLogger(NorthboundIT.class);
     // get the OSGI bundle context
     @Inject
     private BundleContext bc;
@@ -66,7 +66,7 @@ public class NorthboundIT {
     private IInventoryListener invtoryListener = null;
     private IListenTopoUpdates topoUpdates = null;
 
-    private Boolean debugMsg = false;
+    private final Boolean debugMsg = false;
 
     private String stateToString(int state) {
         switch (state) {
@@ -1271,7 +1271,7 @@ public class NorthboundIT {
                 mavenBundle("org.opendaylight.controller", "security", "0.4.0-SNAPSHOT").noStart(),
                 mavenBundle("org.opendaylight.controller", "sal", "0.5.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "sal.implementation", "0.4.0-SNAPSHOT"),
-                mavenBundle("org.opendaylight.controller", "switchmanager", "0.4.0-SNAPSHOT"),
+                mavenBundle("org.opendaylight.controller", "switchmanager", "0.5.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "switchmanager.implementation", "0.4.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "forwardingrulesmanager", "0.4.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "forwardingrulesmanager.implementation", "0.4.0-SNAPSHOT"),
index 977365f021f600bd9b4cab900cfd3df010c23999..a3931beadd34540de0c3d97cdd84e83ffe6428cd 100644 (file)
@@ -36,7 +36,7 @@
           <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>switchmanager</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>0.5.0-SNAPSHOT</version>
           </dependency>
         </dependencies>
       </plugin>
@@ -90,7 +90,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller.thirdparty</groupId>
index 26e1b2469ce261b7fb4436c67d79d557a832465e..556c964055b2c335d80f57e90839b0adabf48a62 100644 (file)
@@ -75,7 +75,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
 
     <dependency>
index 22036b5d641a1d58fbbe435ce39a817a31b27f01..0e45e06cdf234301f048c99799448c4aae385a57 100644 (file)
@@ -60,7 +60,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ForwardingMode.java
new file mode 100644 (file)
index 0000000..b83e3a6
--- /dev/null
@@ -0,0 +1,74 @@
+package org.opendaylight.controller.sal.core;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The class represents the forwarding mode property of a node.
+ */
+@XmlRootElement
+@SuppressWarnings("serial")
+public class ForwardingMode extends Property {
+    @XmlElement
+    private final int modeValue;
+    public static final int REACTIVE_FORWARDING = 0;
+    public static final int PROACTIVE_FORWARDING = 1;
+    public static final String name = "mode";
+
+    /*
+     * Private constructor used for JAXB mapping
+     */
+    private ForwardingMode() {
+        super(name);
+        this.modeValue = REACTIVE_FORWARDING;
+    }
+
+    public ForwardingMode(int mode) {
+        super(name);
+        this.modeValue = mode;
+    }
+
+    public int getValue() {
+        return this.modeValue;
+    }
+
+    public boolean isProactive() {
+        return (modeValue == ForwardingMode.PROACTIVE_FORWARDING);
+    }
+
+    public boolean isValid() {
+        return ((modeValue >= 0) && (modeValue <= 1));
+    }
+
+    @Override
+    public ForwardingMode clone() {
+        return new ForwardingMode(this.modeValue);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + modeValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ForwardingMode other = (ForwardingMode) obj;
+        if (modeValue != other.modeValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "Mode[" + modeValue + "]";
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/networkconfiguration/api/pom.xml b/opendaylight/sal/networkconfiguration/api/pom.xml
new file mode 100644 (file)
index 0000000..579c963
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+  <modelVersion>4.0.0</modelVersion>\r
+  <parent>\r
+    <groupId>org.opendaylight.controller</groupId>\r
+    <artifactId>commons.opendaylight</artifactId>\r
+    <version>1.4.0-SNAPSHOT</version>\r
+    <relativePath>../../../commons/opendaylight</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>sal.networkconfiguration</artifactId>\r
+  <version>0.0.1-SNAPSHOT</version>\r
+  <packaging>bundle</packaging>\r
+\r
+  <build>\r
+    <plugins>\r
+      <plugin>\r
+        <groupId>org.apache.felix</groupId>\r
+        <artifactId>maven-bundle-plugin</artifactId>\r
+        <version>2.3.6</version>\r
+        <extensions>true</extensions>\r
+        <configuration>\r
+          <instructions>\r
+            <Import-Package>\r
+              org.slf4j,\r
+              org.osgi.framework,\r
+              org.apache.felix.dm,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils\r
+            </Import-Package>\r
+            <Export-Package>\r
+              org.opendaylight.controller.sal.networkconfig.bridgedomain\r
+             </Export-Package>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+      <version>0.5.0-SNAPSHOT</version>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/ConfigConstants.java
new file mode 100644 (file)
index 0000000..27240e8
--- /dev/null
@@ -0,0 +1,33 @@
+package org.opendaylight.controller.sal.networkconfig.bridgedomain;
+
+/**
+ * Enum constant that is used as a key for the configuration parameters for BridgeDomains and Ports.
+ * The main intention of having a constant type is to avoid fragmentation and find common grounds for
+ * applications to rely on.
+ *
+ * This is set to expand based on various capabilities south-bound protocol might expose.
+ * Not all of them be supported by all the plugins. But this gives a consolidated view of
+ * all the supported feature configs and avoid config fragmentation.
+ */
+public enum ConfigConstants {
+    TYPE("type"),
+    VLAN("Vlan"),
+    VLAN_MODE("vlan_mode"),
+    TUNNEL_TYPE("Tunnel Type"),
+    SOURCE_IP("Source IP"),
+    DEST_IP("Destination IP"),
+    MACADDRESS("MAC Address"),
+    INTERFACE_IDENTIFIER("Interface Identifier"),
+    MGMT("Management"),
+    CUSTOM("Custom Configurations");
+
+    private ConfigConstants(String name) {
+        this.name = name;
+    }
+
+    private String name;
+
+    public String toString() {
+        return name;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IBridgeDomainConfigService.java
new file mode 100644 (file)
index 0000000..04dd59e
--- /dev/null
@@ -0,0 +1,4 @@
+package org.opendaylight.controller.sal.networkconfig.bridgedomain;
+
+public interface IBridgeDomainConfigService extends IPluginInBridgeDomainConfigService {
+}
\ No newline at end of file
diff --git a/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/api/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/IPluginInBridgeDomainConfigService.java
new file mode 100644 (file)
index 0000000..20562b8
--- /dev/null
@@ -0,0 +1,157 @@
+package org.opendaylight.controller.sal.networkconfig.bridgedomain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.Status;
+
+/**
+ * @file IPluginInConfigurationService.java
+ *
+ */
+public interface IPluginInBridgeDomainConfigService {
+    /**
+     * Create a Bridge Domain
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param params Map representation of config name (ConfigConstants) and Parameter value (represented as Object).
+     * @return Status.StatusCode.SUCCESS if bridge domain is created successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status createBridgeDomain(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params) throws Throwable;
+
+    /**
+     * Delete a Bridge Domain
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @return Status.StatusCode.SUCCESS if bridge domain is deleted successfully. Failure Status otherwise.
+     */
+    public Status deleteBridgeDomain(Node node, String bridgeIdentifier);
+
+    /**
+     * Returns the configured Bridge Domains
+     *
+     * @param node Node serving this configuration service
+     * @return List of Bridge Domain Identifiers
+     */
+    public List<String> getBridgeDomains(Node node);
+
+    /**
+     * add Bridge Domain Configuration
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param params Map representation of config Name (ConfigConstants) and config value(represented as Object).
+     * @return Status.StatusCode.SUCCESS if bridge domain configuration is added successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status addBridgeDomainConfig(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params);
+
+    /**
+     * Delete Bridge Domain Configuration
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param params Map representation of config name (ConfigConstants) and Parameter value (represented as Object).
+     * @return Status.StatusCode.SUCCESS if bridge domain configuration is deleted successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status removeBridgeDomainConfig(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params);
+
+    /**
+     * Returns Bridge Domain Configurations
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @return Map representation of config Name (ConfigConstants) and config value(represented as Object).
+     */
+
+    public Map<ConfigConstants, Object> getBridgeDomainConfigs(Node node, String bridgeIdentifier);
+
+    /**
+     * Returns a Node dedicated to a Bridge Domain (if available) that is created using createBridgeDomain.
+     * @param configNode Node serving this configuration service.
+     * @param bridgeIdentifier Name of the bridge domain that would map to a dedicated Node
+     * @return Node dedicated to a bridge domain that is created using createBridgeDomain.
+     *         returns null if there is no such dedicated node is available or represented.
+     */
+    public Node getBridgeDomainNode(Node configNode, String bridgeIdentifier);
+
+    /**
+     * Add a port to a bridge domain
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param portIdentifier String representation of a Port.
+     * @param params Map representation of config name (ConfigConstants) and Parameter value (represented as Object).
+     * @return Status.StatusCode.SUCCESS if a port is added successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status addPort(Node node, String bridgeIdentifier, String portIdentifier,
+                           Map<ConfigConstants, Object> params);
+
+    /**
+     * Delete a Port from a bridge domain
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param portIdentifier String representation of a Port.
+     * @return Status.StatusCode.SUCCESS if a port is added successfully. Failure Status otherwise.
+     */
+    public Status deletePort(Node node, String bridgeIdentifier, String portIdentifier);
+
+    /**
+     * add Port Configuration
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param portIdentifier String representation of a Port.
+     * @param params Map representation of config name (ConfigConstants) and Parameter value (represented as Object).
+     * @return Status.StatusCode.SUCCESS if a port configuration is added successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status addPortConfig(Node node, String bridgeIdentifier, String portIdentifier,
+                                 Map<ConfigConstants, Object> params);
+
+    /**
+     * Delete Port Configuration
+     *
+     * @param node Node serving this configuration service
+     * @param portIdentifier String representation of a Port.
+     * @param config Map representation of ConfigName and Configuration Value in Strings.
+     * @return Status.StatusCode.SUCCESS if a port configuration is removed successfully. Failure Status otherwise.
+     * @note This method will return false if one or more of the supplied params is not supported by the
+     * protocol plugin that serves the Node.
+     */
+    public Status removePortConfig(Node node, String bridgeIdentifier, String portIdentifier, Map<ConfigConstants, Object> params);
+
+    /**
+     * Returns Port Configurations
+     *
+     * @param node Node serving this configuration service
+     * @param bridgeIdentifier String representation of a Bridge Domain
+     * @param portIdentifier String representation of a Port.
+     * @return Map representation of Configuration Name (ConfigConstants) and Configuration value (represented as Object).
+     */
+    public Map<ConfigConstants, Object> getPortConfigs(Node node, String bridgeIdentifier, String portIdentifier);
+
+
+    /**
+     * Returns a NodeConnector mapped to a Port (if available) that is created using addPort.
+     * @param configNode Node serving this configuration service.
+     * @param bridgeIdentifier Name of the bridge domain that would map to a dedicated Node
+     * @param portIdentifier String representation of a Port.
+     * @return NodeConnector that is mapped to a port created using addPort.
+     *         returns null if there is no such nodeConnector is available or mapped.
+     */
+    public NodeConnector getNodeConnector(Node configNode, String bridgeIdentifier, String portIdentifier);
+}
\ No newline at end of file
diff --git a/opendaylight/sal/networkconfiguration/implementation/pom.xml b/opendaylight/sal/networkconfiguration/implementation/pom.xml
new file mode 100644 (file)
index 0000000..7a95057
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+  <modelVersion>4.0.0</modelVersion>\r
+  <parent>\r
+    <groupId>org.opendaylight.controller</groupId>\r
+    <artifactId>commons.opendaylight</artifactId>\r
+    <version>1.4.0-SNAPSHOT</version>\r
+    <relativePath>../../../commons/opendaylight</relativePath>\r
+  </parent>\r
+\r
+  <artifactId>sal.networkconfiguration.implementation</artifactId>\r
+  <version>0.0.1-SNAPSHOT</version>\r
+  <packaging>bundle</packaging>\r
+\r
+  <build>\r
+    <plugins>\r
+      <plugin>\r
+        <groupId>org.apache.felix</groupId>\r
+        <artifactId>maven-bundle-plugin</artifactId>\r
+        <version>2.3.6</version>\r
+        <extensions>true</extensions>\r
+        <configuration>\r
+          <instructions>\r
+            <Import-Package>\r
+              org.slf4j,\r
+              org.opendaylight.controller.sal.core,\r
+              org.opendaylight.controller.sal.utils,\r
+              org.opendaylight.controller.sal.networkconfig.bridgedomain,\r
+              org.apache.felix.dm,\r
+              org.osgi.framework\r
+            </Import-Package>\r
+            <Export-Package>\r
+            </Export-Package>\r
+            <Bundle-Activator>\r
+              org.opendaylight.controller.sal.networkconfig.internal.Activator\r
+            </Bundle-Activator>\r
+          </instructions>\r
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>\r
+        </configuration>\r
+      </plugin>\r
+    </plugins>\r
+  </build>\r
+  <dependencies>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal</artifactId>\r
+      <version>0.5.0-SNAPSHOT</version>\r
+    </dependency>\r
+    <dependency>\r
+      <groupId>org.opendaylight.controller</groupId>\r
+      <artifactId>sal.networkconfiguration</artifactId>\r
+      <version>0.0.1-SNAPSHOT</version>\r
+    </dependency>\r
+  </dependencies>\r
+</project>\r
diff --git a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/bridgedomain/internal/BridgeDomainConfigService.java
new file mode 100644 (file)
index 0000000..1c9ca57
--- /dev/null
@@ -0,0 +1,219 @@
+package org.opendaylight.controller.sal.networkconfig.bridgedomain.internal;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.IPluginInBridgeDomainConfigService;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BridgeDomainConfigService implements IBridgeDomainConfigService {
+    protected static final Logger logger = LoggerFactory
+            .getLogger(BridgeDomainConfigService.class);
+    private ConcurrentMap<String, IPluginInBridgeDomainConfigService> pluginService =
+            new ConcurrentHashMap<String, IPluginInBridgeDomainConfigService>();
+
+    void setPluginInService (Map props, IPluginInBridgeDomainConfigService s) {
+        String type = null;
+        Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
+        if (value instanceof String) {
+            type = (String) value;
+        }
+        if (type == null) {
+            logger.error("Received a PluginInConnectionService without any "
+                    + "protocolPluginType provided");
+        } else {
+            this.pluginService.put(type, s);
+        }
+    }
+
+    void unsetPluginInService(Map props, IPluginInBridgeDomainConfigService s) {
+        String type = null;
+
+        Object value = props.get(GlobalConstants.PROTOCOLPLUGINTYPE.toString());
+        if (value instanceof String) {
+            type = (String) value;
+        }
+        if (type == null) {
+            logger.error("Received a PluginInConnectionService without any "
+                    + "protocolPluginType provided");
+        } else if (this.pluginService.get(type).equals(s)) {
+            this.pluginService.remove(type);
+        }
+    }
+
+    /**
+     * Function called by the dependency manager when all the required
+     * dependencies are satisfied
+     *
+     */
+    void init() {
+    }
+
+    /**
+     * Function called by the dependency manager when at least one dependency
+     * become unsatisfied or when the component is shutting down because for
+     * example bundle is being stopped.
+     *
+     */
+    void destroy() {
+        if (this.pluginService != null) {
+            this.pluginService.clear();
+        }
+    }
+
+    @Override
+    public Status createBridgeDomain(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params)
+            throws Throwable {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.createBridgeDomain(node, bridgeIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Status deleteBridgeDomain(Node node, String bridgeIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.deleteBridgeDomain(node, bridgeIdentifier);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public List<String> getBridgeDomains(Node node) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.getBridgeDomains(node);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Status addBridgeDomainConfig(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.addBridgeDomainConfig(node, bridgeIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Status removeBridgeDomainConfig(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> params) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.removeBridgeDomainConfig(node, bridgeIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Map<ConfigConstants, Object> getBridgeDomainConfigs(Node node, String bridgeIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.getBridgeDomainConfigs(node, bridgeIdentifier);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Node getBridgeDomainNode(Node configNode, String bridgeIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(configNode.getType());
+            if (plugin != null) {
+                return plugin.getBridgeDomainNode(configNode, bridgeIdentifier);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Status addPort(Node node, String bridgeIdentifier, String portIdentifier, Map<ConfigConstants, Object> params) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.addPort(node, bridgeIdentifier, portIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Status deletePort(Node node, String bridgeIdentifier, String portIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.deletePort(node, bridgeIdentifier, portIdentifier);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Status addPortConfig(Node node, String bridgeIdentifier, String portIdentifier,
+            Map<ConfigConstants, Object> params) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.addPortConfig(node, bridgeIdentifier, portIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Status removePortConfig(Node node, String bridgeIdentifier, String portIdentifier,
+            Map<ConfigConstants, Object> params) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.removePortConfig(node, bridgeIdentifier, portIdentifier, params);
+            }
+        }
+        return new Status(StatusCode.NOSERVICE, "Requested Plugin Service Not available");
+    }
+
+    @Override
+    public Map<ConfigConstants, Object> getPortConfigs(Node node, String bridgeIdentifier, String portIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(node.getType());
+            if (plugin != null) {
+                return plugin.getPortConfigs(node, bridgeIdentifier, portIdentifier);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public NodeConnector getNodeConnector(Node configNode, String bridgeIdentifier, String portIdentifier) {
+        if (pluginService != null) {
+            IPluginInBridgeDomainConfigService plugin = this.pluginService.get(configNode.getType());
+            if (plugin != null) {
+                return plugin.getNodeConnector(configNode, bridgeIdentifier, portIdentifier);
+            }
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java b/opendaylight/sal/networkconfiguration/implementation/src/main/java/org/opendaylight/controller/sal/networkconfig/internal/Activator.java
new file mode 100644 (file)
index 0000000..d647faa
--- /dev/null
@@ -0,0 +1,71 @@
+package org.opendaylight.controller.sal.networkconfig.internal;
+
+import org.apache.felix.dm.Component;
+import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.IPluginInBridgeDomainConfigService;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.internal.BridgeDomainConfigService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator extends ComponentActivatorAbstractBase {
+    protected static final Logger logger = LoggerFactory
+            .getLogger(Activator.class);
+
+    /**
+     * Function called when the activator starts just after some initializations
+     * are done by the ComponentActivatorAbstractBase.
+     *
+     */
+    @Override
+    public void init() {
+
+    }
+
+    /**
+     * Function called when the activator stops just before the cleanup done by
+     * ComponentActivatorAbstractBase
+     *
+     */
+    @Override
+    public void destroy() {
+
+    }
+
+    /**
+     * Function that is used to communicate to dependency manager the list of
+     * known Global implementations
+     *
+     *
+     * @return An array containing all the CLASS objects that will be
+     *         instantiated in order to get an fully working implementation
+     *         Object
+     */
+    public Object[] getGlobalImplementations() {
+        Object[] res = { BridgeDomainConfigService.class};
+        return res;
+    }
+
+    /**
+     * Function that is called when configuration of the dependencies is required.
+     *
+     * @param c
+     *            dependency manager Component object, used for configuring the
+     *            dependencies exported and imported
+     * @param imp
+     *            Implementation class that is being configured, needed as long
+     *            as the same routine can configure multiple implementations
+     */
+    public void configureGlobalInstance(Component c, Object imp) {
+        if (imp.equals(BridgeDomainConfigService.class)) {
+            c.setInterface(
+                    new String[] { IBridgeDomainConfigService.class.getName()},
+                                   null);
+
+            c.add(createServiceDependency()
+                    .setService(IPluginInBridgeDomainConfigService.class)
+                    .setCallbacks("setPluginInService", "unsetPluginInService")
+                    .setRequired(false));
+        }
+    }
+}
index ca7e93c5a9bb4aa132287309bdc0862dde52111b..0ab5e4bc99f2f685fc16b63d0fe39fb1aefa54d8 100644 (file)
@@ -76,7 +76,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index f12331cbb296565602f0a7902ae00e86b2bc4f50..2d7c2f22ec9baade044191b7e336b55adceb58ae 100644 (file)
@@ -71,7 +71,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
index f6e84ca78b3e0d7e79d90d5cd7a5615a25ffb0c9..228626383ea5686f8bc70ad73dd5b68088565d76 100644 (file)
@@ -70,7 +70,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
 
       <dependency>
index 106ff3dd2ab0252ca0fec7d5239591bff4d743d9..dd3ccfa5c42c69e4a841e4db1962e15bf8a735ce 100644 (file)
@@ -10,7 +10,7 @@
   </parent>
 
   <artifactId>switchmanager</artifactId>
-  <version>0.4.0-SNAPSHOT</version>
+  <version>0.5.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
   <properties>
index 48f5aa48f61c579127fc1d5229dbd116e57cd70e..ee2c2c20398cf2c5deefa4b0b03bdceecde56fbb 100644 (file)
@@ -19,12 +19,6 @@ import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.utils.Status;
 
-import org.opendaylight.controller.switchmanager.SpanConfig;
-import org.opendaylight.controller.switchmanager.Subnet;
-import org.opendaylight.controller.switchmanager.SubnetConfig;
-import org.opendaylight.controller.switchmanager.Switch;
-import org.opendaylight.controller.switchmanager.SwitchConfig;
-
 /**
  * Primary purpose of this interface is to provide methods for application to
  * access various system resources and inventory data including nodes, node
@@ -129,14 +123,40 @@ public interface ISwitchManager {
      * Update Switch specific configuration such as Switch Name and Tier
      *
      * @param cfgConfig refer to {@link Open Declaration org.opendaylight.controller.switchmanager.SwitchConfig}
+     *
+     * @deprecated replaced by updateNodeConfig(switchConfig)
      */
+    @Deprecated
     public void updateSwitchConfig(SwitchConfig cfgObject);
 
+    /**
+     * Update Node specific configuration such as Node Name and Tier
+     *
+     * @param cfgConfig
+     *            refer to {@link Open Declaration
+     *            org.opendaylight.controller.switchmanager.SwitchConfig}
+     * @return "Success" or failure reason
+     */
+    public Status updateNodeConfig(SwitchConfig switchConfig);
+
+    /**
+     * Removes node properties configured by the user
+     *
+     * @param nodeId
+     *            Node Identifier as specified by
+     *            {@link org.opendaylight.controller.sal.core.Node}
+     * @return "Success" or failure reason
+     */
+    public Status removeNodeConfig(String nodeId);
+
     /**
      * Return the previously configured Switch Configuration given the node id
      *
-     * @param nodeId Node Identifier as specified by {@link org.opendaylight.controller.sal.core.Node}
-     * @return {@link org.opendaylight.controller.switchmanager.SwitchConfig} resources
+     * @param nodeId
+     *            Node Identifier as specified by
+     *            {@link org.opendaylight.controller.sal.core.Node}
+     * @return {@link org.opendaylight.controller.switchmanager.SwitchConfig}
+     *         resources
      */
     public SwitchConfig getSwitchConfig(String nodeId);
 
@@ -357,5 +377,6 @@ public interface ISwitchManager {
      * configured and the network node does not provide its description,
      * an empty string is returned.
      */
+    @Deprecated
     public String getNodeDescription(Node node);
 }
index c595c43e5bc48cf05d5f8b26e38d6289c915a092..ba9d1a12f3e0b42e389eac6f98bb59bf6557b10d 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
  *
 package org.opendaylight.controller.switchmanager;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.ForwardingMode;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.Tier;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
 
 /**
- * The class describes a switch configuration including node identifier, node
- * name, tier number and proactive/reactive mode.
+ * The class describes a switch configuration
  */
-public class SwitchConfig implements Serializable {
+public class SwitchConfig implements Cloneable, Serializable {
     private static final long serialVersionUID = 1L;
-    String nodeId;
-    String description;
-    String tier;
-    String mode;
+    private final String nodeId;
+    private final Map<String, Property> nodeProperties;
+
+    public SwitchConfig(String nodeId, Map<String, Property> nodeProperties) {
+        this.nodeId = nodeId;
+        this.nodeProperties = (nodeProperties == null) ? new HashMap<String, Property>()
+                : new HashMap<String, Property>(nodeProperties);
+    }
 
+    @Deprecated
     public SwitchConfig(String nodeId, String description, String tier, String mode) {
-        super();
         this.nodeId = nodeId;
-        this.description = description;
-        this.tier = tier;
-        this.mode = mode;
+        this.nodeProperties = new HashMap<String, Property>();
+        Property desc = new Description(description);
+        this.nodeProperties.put(desc.getName(), desc);
+        Property nodeTier = new Tier(Integer.valueOf(tier));
+        this.nodeProperties.put(nodeTier.getName(), nodeTier);
+        Property forwardingMode = new ForwardingMode(Integer.valueOf(mode));
+        this.nodeProperties.put(forwardingMode.getName(), forwardingMode);
     }
 
     public String getNodeId() {
-        return nodeId;
+        return this.nodeId;
+    }
+
+    public Map<String, Property> getNodeProperties() {
+        return new HashMap<String, Property>(this.nodeProperties);
+    }
+
+    public Property getProperty(String PropName) {
+        return nodeProperties.get(PropName);
     }
 
+    /**
+     * This method returns the configured description of the node
+     *
+     * @return Configured description
+     *
+     * @deprecated replaced by getProperty(Description.propertyName)
+     */
+    @Deprecated
     public String getNodeDescription() {
-        return description;
+        Description description = (Description) getProperty(Description.propertyName);
+        return (description == null) ? null : description.getValue();
     }
 
+    /**
+     * This method returns the configured Tier of a node
+     *
+     * @return Configured tier
+     *
+     * @deprecated replaced by getProperty(Tier.TierPropName)
+     */
+    @Deprecated
     public String getTier() {
-        return tier;
+        Tier tier = (Tier) getProperty(Tier.TierPropName);
+        return (tier == null) ? null : String.valueOf(tier.getValue());
     }
 
+    /**
+     * This method returns the configured Forwarding Mode of a node
+     *
+     * @return Configured Forwarding Mode
+     *
+     * @deprecated replaced by getProperty(ForwardingMode.name)
+     */
+    @Deprecated
     public String getMode() {
-        return mode;
+        ForwardingMode forwardingMode = (ForwardingMode) getProperty(ForwardingMode.name);
+        return (forwardingMode == null) ? null : String.valueOf(forwardingMode.getValue());
     }
 
+    /**
+     * This method returns true, if the configured forwarding mode is proactive,
+     * else false
+     *
+     * @return true, if the configured forwarding mode is proactive, else false
+     *
+     * @deprecated replaced by isProactive() API of ForwardingMode property
+     */
+    @Deprecated
     public boolean isProactive() {
-        return Integer.parseInt(mode) != 0;
+        return Integer.parseInt(getMode()) == ForwardingMode.PROACTIVE_FORWARDING;
     }
 
     public static long getSerialversionuid() {
         return serialVersionUID;
     }
 
+    public Status validate() {
+        Status validCheck = validateNodeId();
+        if (validCheck.isSuccess()) {
+            validCheck = validateNodeProperties();
+        }
+        return validCheck;
+    }
+
+    private Status validateNodeId() {
+        if (nodeId == null || nodeId.isEmpty()) {
+            return new Status(StatusCode.BADREQUEST, "NodeId cannot be empty");
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    private Status validateNodeProperties() {
+        if (nodeProperties == null) {
+            return new Status(StatusCode.BADREQUEST, "nodeProperties cannot be null");
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result
-                + ((description == null) ? 0 : description.hashCode());
-        result = prime * result + ((mode == null) ? 0 : mode.hashCode());
         result = prime * result + ((nodeId == null) ? 0 : nodeId.hashCode());
-        result = prime * result + ((tier == null) ? 0 : tier.hashCode());
+        result = prime * result + ((nodeProperties == null) ? 0 : nodeProperties.hashCode());
         return result;
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         SwitchConfig other = (SwitchConfig) obj;
-        if (description == null) {
-            if (other.description != null)
-                return false;
-        } else if (!description.equals(other.description))
-            return false;
-        if (mode == null) {
-            if (other.mode != null)
-                return false;
-        } else if (!mode.equals(other.mode))
-            return false;
         if (nodeId == null) {
-            if (other.nodeId != null)
+            if (other.nodeId != null) {
                 return false;
-        } else if (!nodeId.equals(other.nodeId))
+            }
+        } else if (!nodeId.equals(other.nodeId)) {
             return false;
-        if (tier == null) {
-            if (other.tier != null)
+        }
+        if (nodeProperties == null) {
+            if (other.nodeProperties != null) {
                 return false;
-        } else if (!tier.equals(other.tier))
+            }
+        } else if (!nodeProperties.equals(other.nodeProperties)) {
             return false;
+        }
         return true;
     }
 
     @Override
     public String toString() {
-        return ("SwitchConfig [Node=" + nodeId + ", Description=" + description +
-                ", Tier=" + tier + ", Mode=" + mode + "]");
+        return ("SwitchConfig [Node=" + nodeId + ", Properties=" + nodeProperties + "]");
     }
+
+    /**
+     * Implement clonable interface
+     */
+    @Override
+    public SwitchConfig clone() {
+        Map<String, Property> nodeProperties = (this.nodeProperties == null) ? null : new HashMap<String, Property>(
+                this.nodeProperties);
+        return new SwitchConfig(this.nodeId, nodeProperties);
+    }
+
 }
index 18b3195372ff2f6f42a97c277b6d507be4d4dc33..2f4989577bb8154f7682c3ed8abee5c821b918dd 100644 (file)
@@ -11,15 +11,23 @@ package org.opendaylight.controller.switchmanager;
 import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.junit.Assert;
 import org.junit.Test;
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.ForwardingMode;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.Tier;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
 
 public class SwitchTest {
 
@@ -122,24 +130,21 @@ public class SwitchTest {
 
     @Test
     public void testSwitchConfig(){
-        SwitchConfig sc = new SwitchConfig(null, null, null, null);
-        SwitchConfig sc2 = new SwitchConfig(null, null, null, null);
-        Assert.assertTrue(sc.equals(sc2));
-
-        Assert.assertNull(sc.getMode());
-        Assert.assertNull(sc.getNodeId());
-        Assert.assertNull(sc.getTier());
-        Assert.assertNull(sc.getNodeDescription());
-
-        SwitchConfig sc3 = new SwitchConfig("123", "name", "tier", "mode");
-        SwitchConfig sc4 = new SwitchConfig("123", "name", "tier", "mode");
-        Assert.assertFalse(sc.equals(sc3));
-        Assert.assertTrue(sc3.equals(sc4));
-
-        Assert.assertTrue(sc3.getNodeId().equals("123"));
-        Assert.assertTrue(sc3.getNodeDescription().equals("name"));
-        Assert.assertTrue(sc3.getTier().equals("tier"));
-        Assert.assertTrue(sc3.getMode().equals("mode"));
+        Map<String, Property> prop = new HashMap<String, Property>();
+        Property desc = new Description("swicth1");
+        prop.put(desc.getName(), desc);
+        Property tier = new Tier(1);
+        prop.put(tier.getName(), tier);
+        SwitchConfig sc1 = new SwitchConfig("123", prop);
+        SwitchConfig sc2 = new SwitchConfig("123", prop);
+        Property mode = new ForwardingMode(1);
+        prop.put(mode.getName(), mode);
+        SwitchConfig sc3 = new SwitchConfig("123", prop);
+        Assert.assertTrue(sc1.equals(sc2));
+        Assert.assertEquals(tier, sc1.getProperty(Tier.TierPropName));
+        Assert.assertFalse(sc1.equals(sc3));
+        Assert.assertTrue(sc1.hashCode() == sc2.hashCode());
+        Assert.assertTrue(sc1.getNodeProperties().equals(sc2.getNodeProperties()));
     }
 
 }
index 511cab14cda0ecd54373a40442cf2a6828f10795..28bb6f274c791e94ca4c43f5202d43159f13d170 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>
index c24c93c65ddaa738136c065713461fe62e659b4c..5d10620c4403f8c00829bd02927d5da39fa07178 100644 (file)
@@ -42,6 +42,7 @@ import org.opendaylight.controller.sal.core.Bandwidth;
 import org.opendaylight.controller.sal.core.Config;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.ForwardingMode;
 import org.opendaylight.controller.sal.core.MacAddress;
 import org.opendaylight.controller.sal.core.Name;
 import org.opendaylight.controller.sal.core.Node;
@@ -670,10 +671,7 @@ CommandProvider {
         if (propMapCurr == null) {
             return;
         }
-        Map<String, Property> propMap = new HashMap<String, Property>();
-        for (String s : propMapCurr.keySet()) {
-            propMap.put(s, propMapCurr.get(s).clone());
-        }
+        Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
         Property desc = new Description(cfgObject.getNodeDescription());
         propMap.put(desc.getName(), desc);
         Property tier = new Tier(Integer.parseInt(cfgObject.getTier()));
@@ -691,6 +689,120 @@ CommandProvider {
         }
     }
 
+    @Override
+    public Status updateNodeConfig(SwitchConfig switchConfig) {
+        Status status = switchConfig.validate();
+        if (!status.isSuccess()) {
+            return status;
+        }
+
+        Map<String, Property> updateProperties = switchConfig.getNodeProperties();
+        String nodeId = switchConfig.getNodeId();
+        ForwardingMode mode = (ForwardingMode) updateProperties.get(ForwardingMode.name);
+        if (mode != null) {
+            if (isDefaultContainer) {
+                if (!mode.isValid()) {
+                    return new Status(StatusCode.NOTACCEPTABLE, "Invalid Forwarding Mode Value.");
+                }
+            } else {
+                return new Status(StatusCode.NOTACCEPTABLE,
+                        "Forwarding Mode modification is allowed only in default container");
+            }
+        }
+        boolean modeChange = false;
+        SwitchConfig sc = nodeConfigList.get(nodeId);
+        Map<String, Property> prevNodeProperties = new HashMap<String, Property>();
+        if (sc == null) {
+            if ((mode != null) && mode.isProactive()) {
+                modeChange = true;
+            }
+            if (!updateProperties.isEmpty()) {
+                if (nodeConfigList.putIfAbsent(nodeId, switchConfig) != null) {
+                    return new Status(StatusCode.CONFLICT, "Cluster conflict: Unable to update node configuration");
+                }
+            }
+        } else {
+            prevNodeProperties = new HashMap<String, Property>(sc.getNodeProperties());
+            ForwardingMode prevMode = (ForwardingMode) sc.getProperty(ForwardingMode.name);
+            if (mode == null) {
+                if ((prevMode != null) && (prevMode.isProactive())) {
+                    modeChange = true;
+                }
+            } else {
+                if (((prevMode != null) && (prevMode.getValue() != mode.getValue()))
+                        || (prevMode == null && mode.isProactive())) {
+                    modeChange = true;
+                }
+            }
+            if (updateProperties.isEmpty()) {
+                nodeConfigList.remove(nodeId);
+            } else {
+                if (!nodeConfigList.replace(nodeId, sc, switchConfig)) {
+                    return new Status(StatusCode.CONFLICT, "Cluster conflict: Unable to update node configuration");
+                }
+            }
+        }
+        Node node = Node.fromString(nodeId);
+        Map<String, Property> propMapCurr = nodeProps.get(node);
+        Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
+        if (propMapCurr == null) {
+            return new Status(StatusCode.SUCCESS);
+        }
+        if (!prevNodeProperties.isEmpty()) {
+            for (String prop : prevNodeProperties.keySet()) {
+                if (!updateProperties.containsKey(prop)) {
+                    if (prop.equals(Description.propertyName)) {
+                        Map<Node, Map<String, Property>> nodeProp = this.inventoryService.getNodeProps();
+                        if (nodeProp.get(node) != null) {
+                            propMap.put(Description.propertyName, nodeProp.get(node).get(Description.propertyName));
+                            continue;
+                        }
+                    }
+                    propMap.remove(prop);
+                }
+            }
+        }
+        propMap.putAll(updateProperties);
+        if (!nodeProps.replace(node, propMapCurr, propMap)) {
+            // TODO rollback using Transactionality
+            return new Status(StatusCode.CONFLICT, "Cluster conflict: Unable to update node configuration.");
+        }
+        if (modeChange) {
+            notifyModeChange(node, (mode == null) ? false : mode.isProactive());
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    @Override
+    public Status removeNodeConfig(String nodeId) {
+        if ((nodeId == null) || (nodeId.isEmpty())) {
+            return new Status(StatusCode.BADREQUEST, "nodeId cannot be empty.");
+        }
+        Map<String, Property> nodeProperties = getSwitchConfig(nodeId).getNodeProperties();
+        Node node = Node.fromString(nodeId);
+        Map<String, Property> propMapCurr = nodeProps.get(node);
+        if ((propMapCurr != null) && (nodeProperties != null) && (!nodeProperties.isEmpty())) {
+            Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
+            for (String prop : nodeProperties.keySet()) {
+                if (prop.equals(Description.propertyName)) {
+                    Map<Node, Map<String, Property>> nodeProp = this.inventoryService.getNodeProps();
+                    if (nodeProp.get(node) != null) {
+                        propMap.put(Description.propertyName, nodeProp.get(node).get(Description.propertyName));
+                        continue;
+                    }
+                }
+                propMap.remove(prop);
+            }
+            if (!nodeProps.replace(node, propMapCurr, propMap)) {
+                return new Status(StatusCode.CONFLICT, "Cluster conflict: Unable to update node configuration.");
+            }
+        }
+        if (nodeConfigList != null) {
+            nodeConfigList.remove(nodeId);
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
     @Override
     public Status saveSwitchConfig() {
         // Publish the save config event to the cluster nodes
@@ -791,12 +903,8 @@ CommandProvider {
         }
 
         Map<String, Property> propMapCurr = nodeProps.get(node);
-        Map<String, Property> propMap = new HashMap<String, Property>();
-        if (propMapCurr != null) {
-            for (String s : propMapCurr.keySet()) {
-                propMap.put(s, propMapCurr.get(s).clone());
-            }
-        }
+        Map<String, Property> propMap = (propMapCurr == null) ? new HashMap<String, Property>()
+                : new HashMap<String, Property>(propMapCurr);
 
         // copy node properties from plugin
         if (props != null) {
@@ -809,14 +917,13 @@ CommandProvider {
         boolean proactiveForwarding = false;
         if (nodeConfigList != null) {
             String nodeId = node.toString();
-            for (SwitchConfig conf : nodeConfigList.values()) {
-                if (conf.getNodeId().equals(nodeId)) {
-                    Property description = new Description(conf.getNodeDescription());
-                    propMap.put(description.getName(), description);
-                    Property tier = new Tier(Integer.parseInt(conf.getTier()));
-                    propMap.put(tier.getName(), tier);
-                    proactiveForwarding = conf.isProactive();
-                    break;
+            SwitchConfig conf = nodeConfigList.get(nodeId);
+            if (conf != null && (conf.getNodeProperties() != null)) {
+                Map<String, Property> nodeProperties = conf.getNodeProperties();
+                propMap.putAll(nodeProperties);
+                if (nodeProperties.get(ForwardingMode.name) != null) {
+                    ForwardingMode mode = (ForwardingMode) nodeProperties.get(ForwardingMode.name);
+                    proactiveForwarding = mode.isProactive();
                 }
             }
         }
@@ -831,8 +938,7 @@ CommandProvider {
         }
 
         if (!result) {
-            log.debug(
-                    "Cluster conflict: Conflict while adding the node properties. Node: {}  Properties: {}",
+            log.debug("Cluster conflict: Conflict while adding the node properties. Node: {}  Properties: {}",
                     node.getID(), props);
             addNodeProps(node, propMap);
         }
@@ -871,12 +977,8 @@ CommandProvider {
         }
 
         Map<String, Property> propMapCurr = nodeProps.get(node);
-        Map<String, Property> propMap = new HashMap<String, Property>();
-        if (propMapCurr != null) {
-            for (String s : propMapCurr.keySet()) {
-                propMap.put(s, propMapCurr.get(s).clone());
-            }
-        }
+        Map<String, Property> propMap = (propMapCurr == null) ? new HashMap<String, Property>()
+                : new HashMap<String, Property>(propMapCurr);
 
         // copy node properties from plugin
         for (Property prop : props) {
@@ -1003,11 +1105,7 @@ CommandProvider {
                 return;
             }
 
-            Map<String, Property> propMap = new HashMap<String, Property>();
-            for (String s : propMapCurr.keySet()) {
-                propMap.put(s, propMapCurr.get(s).clone());
-            }
-
+            Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
             propMap.put(prop.getName(), prop);
 
             if (nodeProps.replace(node, propMapCurr, propMap)) {
@@ -1029,11 +1127,7 @@ CommandProvider {
                 if (!propMapCurr.containsKey(propName)) {
                     return new Status(StatusCode.SUCCESS);
                 }
-                Map<String, Property> propMap = new HashMap<String, Property>();
-                for (String s : propMapCurr.keySet()) {
-                    propMap.put(s, propMapCurr.get(s).clone());
-                }
-
+                Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
                 propMap.remove(propName);
                 if (nodeProps.replace(node, propMapCurr, propMap)) {
                     return new Status(StatusCode.SUCCESS);
@@ -1196,13 +1290,8 @@ CommandProvider {
     public Status addNodeConnectorProp(NodeConnector nodeConnector,
             Property prop) {
         Map<String, Property> propMapCurr = getNodeConnectorProps(nodeConnector);
-        Map<String, Property> propMap = new HashMap<String, Property>();
-
-        if (propMapCurr != null) {
-            for (String s : propMapCurr.keySet()) {
-                propMap.put(s, propMapCurr.get(s).clone());
-            }
-        }
+        Map<String, Property> propMap = (propMapCurr == null) ? new HashMap<String, Property>()
+                : new HashMap<String, Property>(propMapCurr);
 
         String msg = "Cluster conflict: Unable to add NodeConnector Property.";
         // Just add the nodeConnector if prop is not available (in a non-default
@@ -1282,12 +1371,7 @@ CommandProvider {
             return new Status(StatusCode.SUCCESS);
         }
 
-        Map<String, Property> propMap = new HashMap<String, Property>();
-
-        for (String s : propMapCurr.keySet()) {
-            propMap.put(s, propMapCurr.get(s).clone());
-        }
-
+        Map<String, Property> propMap = new HashMap<String, Property>(propMapCurr);
         propMap.remove(propName);
         boolean result = nodeConnectorProps.replace(nodeConnector, propMapCurr, propMap);
         String msg = "Cluster conflict: Unable to remove NodeConnector property.";
@@ -1559,7 +1643,8 @@ CommandProvider {
         for (Node node : getNodes()) {
             SwitchConfig sc = getSwitchConfig(node.toString());
             if ((sc != null) && isDefaultContainer) {
-                service.modeChangeNotify(node, sc.isProactive());
+                ForwardingMode mode = (ForwardingMode) sc.getProperty(ForwardingMode.name);
+                service.modeChangeNotify(node, (mode == null) ? false : mode.isProactive());
             }
         }
     }
@@ -1965,6 +2050,9 @@ CommandProvider {
             } else if (propName.equalsIgnoreCase(Bandwidth.BandwidthPropName)) {
                 long bw = Long.parseLong(propValue);
                 return new Bandwidth(bw);
+            } else if (propName.equalsIgnoreCase(ForwardingMode.name)) {
+                int mode = Integer.parseInt(propValue);
+                return new ForwardingMode(mode);
             } else {
                 log.debug("Not able to create {} property", propName);
             }
index e774dae115d4617bc3c7548fe4a8b9f7388aa628..af12bbee519ad15cefc553430cb6a293e2d8a720 100644 (file)
@@ -16,7 +16,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
       <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 877461daaaeed0ae970f554cb2c36f07c877c707..311465e3aba835101944d01f87276c058c6a759b 100644 (file)
@@ -28,7 +28,6 @@
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.packet,
               org.opendaylight.controller.sal.utils,
-              org.opendaylight.controller.switchmanager,
               org.opendaylight.controller.containermanager,
               org.slf4j,
               org.eclipse.osgi.framework.console,
     </plugins>
   </build>
   <dependencies>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
index a558fa20482a96a8a1a8b6562eaee0cec929bd9e..0350dc5b63c14cf0cbdaf79d16e9ba2e822551fc 100644 (file)
@@ -28,7 +28,6 @@
               org.opendaylight.controller.sal.core,
               org.opendaylight.controller.sal.packet,
               org.opendaylight.controller.sal.utils,
-              org.opendaylight.controller.switchmanager,
               org.opendaylight.controller.containermanager,
               org.slf4j,
               org.eclipse.osgi.framework.console,
       <artifactId>usermanager</artifactId>
       <version>0.4.0-SNAPSHOT</version>
     </dependency>
-    <dependency>
-      <groupId>org.opendaylight.controller</groupId>
-      <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>containermanager</artifactId>
index eb0b5d393ebdb3367b85af0231cbc7054c1f994a..116640cd3d8f682898a64a030feea709516b5db5 100644 (file)
@@ -97,7 +97,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 34aef8af9f1c15989c0e0dedb966a9e31d7f71ee..e6a785f5868044bb4c82831225dd509e04abb92b 100644 (file)
@@ -26,9 +26,12 @@ import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig;
 import org.opendaylight.controller.sal.authorization.Privilege;
 import org.opendaylight.controller.sal.authorization.UserLevel;
 import org.opendaylight.controller.sal.core.Config;
+import org.opendaylight.controller.sal.core.Description;
+import org.opendaylight.controller.sal.core.ForwardingMode;
 import org.opendaylight.controller.sal.core.Name;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
 import org.opendaylight.controller.sal.core.State;
 import org.opendaylight.controller.sal.core.Tier;
 import org.opendaylight.controller.sal.utils.GlobalConstants;
@@ -95,45 +98,39 @@ public class Devices implements IDaylightWeb {
         String userName = request.getUserPrincipal().getName();
         Privilege privilege = DaylightWebUtil.getContainerPrivilege(userName, containerName, this);
 
-        ISwitchManager switchManager = (ISwitchManager) ServiceHelper
-                .getInstance(ISwitchManager.class, containerName, this);
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName,
+                this);
         List<Map<String, String>> nodeData = new ArrayList<Map<String, String>>();
         if (switchManager != null && privilege != Privilege.NONE) {
             for (Switch device : switchManager.getNetworkDevices()) {
                 HashMap<String, String> nodeDatum = new HashMap<String, String>();
                 Node node = device.getNode();
-                Tier tier = (Tier) switchManager.getNodeProp(node,
-                        Tier.TierPropName);
-
+                Tier tier = (Tier) switchManager.getNodeProp(node, Tier.TierPropName);
                 nodeDatum.put("containerName", containerName);
-                nodeDatum.put("nodeName",
-                        switchManager.getNodeDescription(node));
+                Description description = (Description) switchManager.getNodeProp(node, Description.propertyName);
+                String desc = (description == null) ? "" : description.getValue();
+                nodeDatum.put("nodeName", desc);
                 nodeDatum.put("nodeId", node.toString());
-                int tierNumber = (tier == null) ? TierHelper.unknownTierNumber
-                        : tier.getValue();
-                nodeDatum.put("tierName", TierHelper.getTierName(tierNumber)
-                        + " (Tier-" + tierNumber + ")");
+                int tierNumber = (tier == null) ? TierHelper.unknownTierNumber : tier.getValue();
+                nodeDatum.put("tierName", TierHelper.getTierName(tierNumber) + " (Tier-" + tierNumber + ")");
                 nodeDatum.put("tier", tierNumber + "");
-                SwitchConfig sc = switchManager.getSwitchConfig(device
-                        .getNode().toString());
-                String modeStr = (sc != null) ? sc.getMode() : "0";
+                String modeStr = "0";
+                ForwardingMode mode = (ForwardingMode) switchManager.getNodeProp(node, ForwardingMode.name);
+                if (mode != null) {
+                    modeStr = String.valueOf(mode.getValue());
+                }
                 nodeDatum.put("mode", modeStr);
 
                 nodeDatum.put("json", gson.toJson(nodeDatum));
-                nodeDatum.put("mac", HexEncode.bytesToHexString(device
-                        .getDataLayerAddress()));
+                nodeDatum.put("mac", HexEncode.bytesToHexString(device.getDataLayerAddress()));
                 StringBuffer sb1 = new StringBuffer();
-                Set<NodeConnector> nodeConnectorSet = device
-                        .getNodeConnectors();
+                Set<NodeConnector> nodeConnectorSet = device.getNodeConnectors();
                 if (nodeConnectorSet != null && nodeConnectorSet.size() > 0) {
                     Map<Short, String> portList = new HashMap<Short, String>();
                     List<String> intfList = new ArrayList<String>();
                     for (NodeConnector nodeConnector : nodeConnectorSet) {
-                        String nodeConnectorNumberToStr = nodeConnector.getID()
-                                .toString();
-                        Name ncName = ((Name) switchManager
-                                .getNodeConnectorProp(nodeConnector,
-                                        Name.NamePropName));
+                        String nodeConnectorNumberToStr = nodeConnector.getID().toString();
+                        Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName));
                         Config portStatus = ((Config) switchManager
                                 .getNodeConnectorProp(nodeConnector,
                                         Config.ConfigPropName));
@@ -234,11 +231,22 @@ public class Devices implements IDaylightWeb {
         try {
             ISwitchManager switchManager = (ISwitchManager) ServiceHelper
                     .getInstance(ISwitchManager.class, containerName, this);
-            SwitchConfig cfg = new SwitchConfig(nodeId, nodeName, tier,
-                    operationMode);
-            switchManager.updateSwitchConfig(cfg);
-            resultBean.setStatus(true);
-            resultBean.setMessage("Updated node information successfully");
+            Map<String, Property> nodeProperties = new HashMap<String, Property>();
+            Property desc = new Description(nodeName);
+            nodeProperties.put(desc.getName(), desc);
+            Property nodeTier = new Tier(Integer.parseInt(tier));
+            nodeProperties.put(nodeTier.getName(), nodeTier);
+            Property mode = new ForwardingMode(Integer.parseInt(operationMode));
+            nodeProperties.put(mode.getName(), mode);
+            SwitchConfig cfg = new SwitchConfig(nodeId, nodeProperties);
+            Status result = switchManager.updateNodeConfig(cfg);
+            if (!result.isSuccess()) {
+                resultBean.setStatus(false);
+                resultBean.setMessage(result.getDescription());
+            } else {
+                resultBean.setStatus(true);
+                resultBean.setMessage("Updated node information successfully");
+            }
         } catch (Exception e) {
             resultBean.setStatus(false);
             resultBean.setMessage("Error updating node information. "
@@ -737,8 +745,10 @@ public class Devices implements IDaylightWeb {
                 .getInstance(ISwitchManager.class, containerName, this);
         String description = "";
         if (switchManager != null) {
-            description = switchManager.getNodeDescription(Node
-                    .fromString(nodeId));
+            Description desc = (Description) switchManager.getNodeProp(Node.fromString(nodeId), Description.propertyName);
+            if(desc != null) {
+                description = desc.getValue();
+            }
         }
         return (description.isEmpty() || description.equalsIgnoreCase("none")) ? nodeId
                 : description;
index 7aa0ac94540fe380f65ada4a72c6e39754a4cdad..922d4a9a522c501a069d27c23e1f06313f8460cd 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 145ef9086e4a41ef8649470fc7ebd4f851376de6..4396c957bf86f96f37c8784967bc4b605f2196a7 100644 (file)
@@ -20,6 +20,7 @@ import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
 import org.opendaylight.controller.sal.authorization.Privilege;
 import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.core.Description;
 import org.opendaylight.controller.sal.core.Name;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
@@ -107,9 +108,7 @@ public class Flows implements IDaylightWeb {
             entry.put("flow", flowConfig);
             entry.put("name", flowConfig.getName());
             Node node = flowConfig.getNode();
-            String description = switchManager.getNodeDescription(node);
-            entry.put("node", (description.isEmpty() || description
-                    .equalsIgnoreCase("none")) ? node.toString() : description);
+            entry.put("node", getNodeDesc(node, switchManager));
             entry.put("nodeId", node.toString());
             flowSet.add(entry);
         }
@@ -160,11 +159,7 @@ public class Flows implements IDaylightWeb {
             entry.put("ports", port);
 
             // add name
-            String description = switchManager.getNodeDescription(node
-                    .getNode());
-            entry.put("name", (description.isEmpty() || description
-                    .equalsIgnoreCase("none")) ? node.getNode().toString()
-                    : description);
+            entry.put("name", getNodeDesc(node.getNode(), switchManager));
 
             // add to the node
             nodes.put(node.getNode().toString(), entry);
@@ -205,8 +200,8 @@ public class Flows implements IDaylightWeb {
             String nodeDesc = node.toString();
             SwitchConfig config = switchManager.getSwitchConfig(node
                     .toString());
-            if (config != null) {
-                nodeDesc = config.getNodeDescription();
+            if ((config != null) && (config.getProperty(Description.propertyName) != null)) {
+                nodeDesc = ((Description) config.getProperty(Description.propertyName)).getValue();
             }
 
             nodes.put(nodeDesc, flows.size());
@@ -284,4 +279,11 @@ public class Flows implements IDaylightWeb {
         return (result.isSuccess()) ? StatusCode.SUCCESS.toString() : result
                 .getDescription();
     }
+
+    private String getNodeDesc(Node node, ISwitchManager switchManager) {
+        Description desc = (Description) switchManager.getNodeProp(node, Description.propertyName);
+        String description = (desc == null) ? "" : desc.getValue();
+        return (description.isEmpty() || description.equalsIgnoreCase("none")) ? node.toString() : description;
+    }
+
 }
index 3dbb324988a47db6fe6da2e0dba1dc26f1da767e..593282068d90140d412439e5324492f0c5ae2130 100644 (file)
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index 31d743ee2308712d2b5df3d174b7e8ebdb89748c..fed81eb2ae886aa6bbbb062a8499aa3be90f8026 100644 (file)
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
 import org.opendaylight.controller.configuration.IConfigurationAware;
 import org.opendaylight.controller.sal.authorization.Privilege;
 import org.opendaylight.controller.sal.core.Bandwidth;
+import org.opendaylight.controller.sal.core.Description;
 import org.opendaylight.controller.sal.core.Edge;
 import org.opendaylight.controller.sal.core.Host;
 import org.opendaylight.controller.sal.core.Name;
@@ -176,7 +177,8 @@ public class Topology implements IObjectReader, IConfigurationAware {
 
         for (Map.Entry<Node, Set<Edge>> e : nodeEdges.entrySet()) {
             Node n = e.getKey();
-            String description = switchManager.getNodeDescription(n);
+            String description = getNodeDesc(n, switchManager);
+
             NodeBean node = createNodeBean(description, n);
 
             // skip production node
@@ -280,8 +282,7 @@ public class Topology implements IObjectReader, IConfigurationAware {
 
     private String getNodeConnectorDescription(NodeConnector nodeConnector, ISwitchManager switchManager) {
         Node node = nodeConnector.getNode();
-        String description = switchManager.getNodeDescription(node);
-        String name = this.getDescription(description, node);
+        String name = this.getDescription(getNodeDesc(node, switchManager), node);
         return name;
     }
 
@@ -307,7 +308,7 @@ public class Topology implements IObjectReader, IConfigurationAware {
                     continue;
                 }
 
-                String description = switchManager.getNodeDescription(n);
+                String description = getNodeDesc(n, switchManager);
 
                 if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) {
                         continue;
@@ -609,4 +610,10 @@ public class Topology implements IObjectReader, IConfigurationAware {
         // Perform the class deserialization locally, from inside the package where the class is defined
         return ois.readObject();
     }
+
+    private String getNodeDesc(Node node, ISwitchManager switchManager) {
+        Description desc = (Description) switchManager.getNodeProp(node, Description.propertyName);
+        return (desc == null) ? "" : desc.getValue();
+    }
+
 }
\ No newline at end of file
index 26001d60ab6220c4a9432d294722b0a68f3135f1..db02937a00a05bfa2c1d419c3d25c3b101b4008d 100644 (file)
@@ -98,7 +98,7 @@
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>switchmanager</artifactId>
-      <version>0.4.0-SNAPSHOT</version>
+      <version>0.5.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
index f5fda3d1bc8fe245323d3cb8666a185e9753472a..337d721696b8003713fe3805563c091760d1852b 100644 (file)
@@ -24,6 +24,7 @@ import org.opendaylight.controller.sal.action.Output;
 import org.opendaylight.controller.sal.action.SetVlanId;
 import org.opendaylight.controller.sal.authorization.Privilege;
 import org.opendaylight.controller.sal.authorization.UserLevel;
+import org.opendaylight.controller.sal.core.Description;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.TimeStamp;
@@ -109,7 +110,7 @@ public class Troubleshoot implements IDaylightWeb {
             if (nodeSet != null) {
                 for (Node node : nodeSet) {
                     Map<String, String> device = new HashMap<String, String>();
-                    device.put("nodeName", switchManager.getNodeDescription(node));
+                    device.put("nodeName", getNodeDesc(node, switchManager));
                     device.put("nodeId", node.toString());
                     lines.add(device);
                 }
@@ -139,7 +140,7 @@ public class Troubleshoot implements IDaylightWeb {
             if (nodeSet != null) {
                 for (Node node : nodeSet) {
                     Map<String, String> device = new HashMap<String, String>();
-                    device.put("nodeName", switchManager.getNodeDescription(node));
+                    device.put("nodeName", getNodeDesc(node, switchManager));
                     device.put("nodeId", node.toString());
                     TimeStamp timeStamp = (TimeStamp) switchManager.getNodeProp(
                             node, TimeStamp.TimeStampPropName);
@@ -251,10 +252,9 @@ public class Troubleshoot implements IDaylightWeb {
         Match match = flow.getMatch();
         ISwitchManager switchManager = (ISwitchManager) ServiceHelper
                 .getInstance(ISwitchManager.class, containerName, this);
-        String desc = (switchManager == null)?
-                        "" : switchManager.getNodeDescription(node);
-        desc = (desc.isEmpty() || desc.equalsIgnoreCase("none"))?
-                        node.toString(): desc;
+        String desc = getNodeDesc(node, switchManager);
+        desc = (desc == null || desc.isEmpty() || desc.equalsIgnoreCase("none"))?
+                        node.toString() : desc;
         row.put("nodeName", desc);
         if (match.isPresent(MatchType.IN_PORT)) {
             row.put(MatchType.IN_PORT.id(), ((NodeConnector) flow.getMatch()
@@ -368,4 +368,11 @@ public class Troubleshoot implements IDaylightWeb {
         return row;
     }
 
+    private String getNodeDesc(Node node, ISwitchManager switchManager) {
+        if (switchManager == null) {
+            return null;
+        }
+        Description desc = (Description) switchManager.getNodeProp(node, Description.propertyName);
+        return (desc == null) ? "" : desc.getValue();
+    }
 }