- So that IContainerLocalListener can poll the information when starting in default container
Change-Id: I3d8ceec9adef58915379eda3d3adc752175ea74c
Signed-off-by: Alessandro Boch <aboch@cisco.com>
* @return List of Container name strings.
*/
public List<String> getContainerNames();
+
+ /**
+ * Returns whether the controller is running in container mode
+ *
+ * @return true if controller is in container mode, false otherwise
+ */
+ public boolean inContainerMode();
}
roles = (ConcurrentMap<String, AppRoleLevel>) clusterServices.getCache("containermgr.roles");
- if (containerConfigs.size() > 0) {
+ if (inContainerMode()) {
for (Map.Entry<String, ContainerConfig> entry : containerConfigs.entrySet()) {
// Notify global and local listeners about the mode change
notifyContainerChangeInternal(entry.getValue(), UpdateType.ADDED, true);
return;
}
String staticVlan = ci.nextArgument();
- if (staticVlan == null) {
- ci.print("Static Vlan not specified");
- return;
- }
ContainerConfig containerConfig = new ContainerConfig(containerName, staticVlan, null, null);
ci.println(this.addRemoveContainer(containerConfig, false));
}
public boolean hasNonDefaultContainer() {
return !containerConfigs.keySet().isEmpty();
}
+
+ @Override
+ public boolean inContainerMode() {
+ return this.containerConfigs.size() > 0;
+ }
}
* This is configuration world: container names (also the map key)
* are maintained as they were configured by user, same case
*/
- private Set<IContainerAware> iContainerAware = (Set<IContainerAware>) Collections
+ private Set<IContainerAware> iContainerAware = Collections
.synchronizedSet(new HashSet<IContainerAware>());
private Set<IContainerListener> iContainerListener = Collections
.synchronizedSet(new HashSet<IContainerListener>());
return null;
}
+ @Override
+ public boolean inContainerMode() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
<Import-Package>
org.opendaylight.controller.clustering.services,
org.opendaylight.controller.configuration,
+ org.opendaylight.controller.containermanager,
org.opendaylight.controller.hosttracker,
org.opendaylight.controller.hosttracker.hostAware,
org.opendaylight.controller.switchmanager,
javax.xml.bind.annotation,
javax.xml.bind,
org.apache.felix.dm,
- org.apache.commons.lang3.builder,
org.osgi.service.component,
org.slf4j,
org.eclipse.osgi.framework.console,
<artifactId>connectionmanager</artifactId>
<version>0.1.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>containermanager</artifactId>
+ <version>0.5.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
import org.opendaylight.controller.clustering.services.IClusterContainerServices;
import org.opendaylight.controller.configuration.IConfigurationContainerAware;
import org.opendaylight.controller.connectionmanager.IConnectionManager;
+import org.opendaylight.controller.containermanager.IContainerManager;
import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManagerAware;
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
import org.opendaylight.controller.sal.core.IContainerLocalListener;
import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener;
import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
import org.opendaylight.controller.switchmanager.IInventoryListener;
import org.opendaylight.controller.switchmanager.ISwitchManager;
import org.opendaylight.controller.switchmanager.ISwitchManagerAware;
c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
.setCallbacks("setIContainer", "unsetIContainer").setRequired(true));
c.add(createServiceDependency().setService(IConnectionManager.class)
- .setCallbacks("setIConnectionManager", "unsetIConnectionManager")
- .setRequired(true));
+ .setCallbacks("setIConnectionManager", "unsetIConnectionManager").setRequired(true));
+ if (GlobalConstants.DEFAULT.toString().equals(containerName)) {
+ c.add(createServiceDependency().setService(IContainerManager.class)
+ .setCallbacks("setIContainerManager", "unsetIContainerManager").setRequired(true));
+ }
}
}
}
import org.opendaylight.controller.clustering.services.IClusterServices;
import org.opendaylight.controller.configuration.IConfigurationContainerAware;
import org.opendaylight.controller.connectionmanager.IConnectionManager;
+import org.opendaylight.controller.containermanager.IContainerManager;
import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
import org.opendaylight.controller.forwardingrulesmanager.FlowEntryInstall;
private ConcurrentMap<String, PortGroupConfig> portGroupConfigs;
private ConcurrentMap<PortGroupConfig, Map<Node, PortGroup>> portGroupData;
private ConcurrentMap<String, Object> TSPolicies;
+ private IContainerManager containerManager;
private boolean inContainerMode; // being used by global instance only
protected boolean stopping;
*
*/
void start() {
+ /*
+ * If running in default container, need to know if controller is in
+ * container mode
+ */
+ if (GlobalConstants.DEFAULT.toString().equals(this.getContainerName())) {
+ inContainerMode = containerManager.inContainerMode();
+ }
+
// Initialize graceful stop flag
stopping = false;
this.connectionManager = s;
}
+ public void unsetIContainerManager(IContainerManager s) {
+ if (s == this.containerManager) {
+ this.containerManager = null;
+ }
+ }
+
+ public void setIContainerManager(IContainerManager s) {
+ this.containerManager = s;
+ }
+
@Override
public void entryCreated(Object key, String cacheName, boolean originLocal) {
/*