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 7097958126aaec02cf680265bad8322b6526ae5e..bd377190f2d2f2911f3ae9b43edda2b2b0c39bc2 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 d80911a46533b39b63c075026c89f1352b0c4475..6afb27fb9ef5fbc5c345616c01af97f624084755 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 da301ba8c04a9f96669d77e271cf6663c52825c7..5058e2a0ac8870fc47f4f8b81f163f0d806dd48a 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 ba1a54b662f3f4c68d328bc5390c57239c2d451e..970929f794b93d2e329ddbfa7b5684b51fbf043a 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 511addae78135332f77cae3bdcbf570bb8029b24..e5d2b48d99b98f2b2d9b9a9d8c145c5b485309c1 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)