}
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;
+ }
+ }
}
}
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;
@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
* @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);
# 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
* Example:
*
* Request URL:
- * http://localhost:8080/controller/nb/v2/containermanager/all
+ * http://localhost:8080/controller/nb/v2/containermanager/containers
*
* Response Payload in XML:
* <container-config-list>
* </container-config-list>
*
* 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)
* </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."),
*
* </pre>
*/
- @Path("/container/{container}/flowspec")
+ @Path("/container/{container}/flowspecs")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@TypeHint(FlowSpecConfigs.class)