Added Configurable parameter for the Connection Manager scheme and Container profile. 67/1167/1
authorMadhu Venugopal <vmadhu@cisco.com>
Thu, 12 Sep 2013 15:38:01 +0000 (08:38 -0700)
committerMadhu Venugopal <vmadhu@cisco.com>
Thu, 12 Sep 2013 15:38:01 +0000 (08:38 -0700)
Change-Id: I2b65f80b9d2d0d914ff34cdf18af2e652d04a8b1
Signed-off-by: Madhu Venugopal <vmadhu@cisco.com>
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/SingleControllerScheme.java
opendaylight/containermanager/implementation/src/main/java/org/opendaylight/controller/containermanager/internal/ContainerManager.java
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/northbound/containermanager/src/main/java/org/opendaylight/controller/containermanager/northbound/ContainerManagerNorthbound.java

index 7097958..bd37719 100644 (file)
@@ -133,11 +133,17 @@ public class ConnectionManager implements IConnectionManager, IConnectionListene
     }
 
     public void init() {
+        String schemeStr = System.getProperty("connection.scheme");
         this.connectionEvents = new LinkedBlockingQueue<ConnectionMgmtEvent>();
         schemes = new ConcurrentHashMap<ConnectionMgmtScheme, AbstractScheme>();
         for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) {
             AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme, clusterServices);
-            if (schemeImpl != null) schemes.put(scheme, schemeImpl);
+            if (schemeImpl != null) {
+                schemes.put(scheme, schemeImpl);
+                if (scheme.name().equalsIgnoreCase(schemeStr)) {
+                    activeScheme = scheme;
+                }
+            }
         }
     }
 
index d80911a..6afb27f 100644 (file)
@@ -1,7 +1,5 @@
 package org.opendaylight.controller.connectionmanager.scheme;
 
-import java.net.InetAddress;
-import java.util.Set;
 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
 import org.opendaylight.controller.connectionmanager.ConnectionMgmtScheme;
 import org.opendaylight.controller.sal.core.Node;
@@ -25,11 +23,8 @@ class SingleControllerScheme extends AbstractScheme {
     @Override
     public boolean isConnectionAllowedInternal(Node node) {
         if (nodeConnections == null) return true;
-        for (Node existingNode : nodeConnections.keySet()) {
-            Set<InetAddress> controllers = nodeConnections.get(existingNode);
-            if (controllers == null || controllers.size() == 0) continue;
-            if (!controllers.contains(clusterServices.getMyAddress())) return false;
-        }
-        return true;
+        // Lets make it simple. The Cluster Coordinator is the master
+        if (clusterServices.amICoordinator()) return true;
+        return false;
     }
-}
+}
\ No newline at end of file
index da301ba..5058e2a 100644 (file)
@@ -801,10 +801,12 @@ public class ContainerManager extends Authorization<String> implements IContaine
      * @param delete
      */
     private void updateResourceGroups(String containerName, boolean delete) {
+        String containerProfile = System.getProperty("container.profile");
+        if (containerProfile == null) containerProfile = "Container";
         // Container Roles and Container Resource Group
-        String groupName = "Container-" + containerName;
-        String containerAdminRole = "Container-" + containerName + "-Admin";
-        String containerOperatorRole = "Container-" + containerName + "-Operator";
+        String groupName = containerProfile+"-" + containerName;
+        String containerAdminRole = containerProfile+"-" + containerName + "-Admin";
+        String containerOperatorRole = containerProfile+"-" + containerName + "-Operator";
         Set<String> allContainerSet = resourceGroups.get(allResourcesGroupName);
         if (delete) {
             resourceGroups.remove(groupName);
index ba1a54b..970929f 100644 (file)
@@ -40,6 +40,12 @@ felix.fileinstall.filter=^(?!org.apache.felix.fileinstall).*
 # logback configuration
 logback.configurationFile=configuration/logback.xml
 
+# Container configuration
+container.profile = Container
+
+# Connection manager configuration
+connection.scheme = ANY_CONTROLLER_ONE_MASTER
+
 # Embedded Tomcat configuration File
 org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
 
index 511adda..e5d2b48 100644 (file)
@@ -115,7 +115,7 @@ public class ContainerManagerNorthbound {
      * Example:
      *
      * Request URL:
-     * http://localhost:8080/controller/nb/v2/containermanager/all
+     * http://localhost:8080/controller/nb/v2/containermanager/containers
      *
      * Response Payload in XML:
      * &lt;container-config-list&gt;
@@ -142,12 +142,12 @@ public class ContainerManagerNorthbound {
      * &lt;/container-config-list&gt;
      *
      * Response Payload in JSON:
-     * { "container-config" : [ { "name" : "black", "nodeConnectors" : ["OF|1@OF|00:00:00:00:00:00:00:01", "OF|23@OF|00:00:00:00:00:00:20:21"], "staticVlan" : "10", "flowSpecs : [{ "name": "udp", "protocol": "UDP" }] } ] }
-     * { "container-config" : [ { "name" : "red", "nodeConnectors" : ["OF|1@OF|00:00:00:00:00:00:00:01", "OF|23@OF|00:00:00:00:00:00:20:21"], "staticVlan" : "20", "flowSpecs": [{ "name": "tcp", "protocol": "TCP" }] } ] }
+     * { "container-config" : [ { "container" : "black", "nodeConnectors" : ["OF|1@OF|00:00:00:00:00:00:00:01", "OF|23@OF|00:00:00:00:00:00:20:21"], "staticVlan" : "10", "flowSpecs : [{ "name": "udp", "protocol": "UDP" }] } ] }
+     * { "container-config" : [ { "container" : "red", "nodeConnectors" : ["OF|1@OF|00:00:00:00:00:00:00:01", "OF|23@OF|00:00:00:00:00:00:20:21"], "staticVlan" : "20", "flowSpecs": [{ "name": "tcp", "protocol": "TCP" }] } ] }
      *
      * </pre>
      */
-    @Path("/all")
+    @Path("/containers")
     @GET
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @TypeHint(ContainerConfigs.class)
@@ -242,7 +242,7 @@ public class ContainerManagerNorthbound {
      * </pre>
      */
     @Path("/container/{container}")
-    @POST
+    @PUT
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @StatusCodes({ @ResponseCode(code = 201, condition = "Container created successfully"),
             @ResponseCode(code = 400, condition = "Invalid Container configuration."),
@@ -407,7 +407,7 @@ public class ContainerManagerNorthbound {
      *
      * </pre>
      */
-    @Path("/container/{container}/flowspec")
+    @Path("/container/{container}/flowspecs")
     @GET
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @TypeHint(FlowSpecConfigs.class)