import org.opendaylight.controller.sal.reader.NodeDescription;
import org.opendaylight.controller.sal.utils.GlobalConstants;
import org.opendaylight.controller.sal.utils.IObjectReader;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;
import org.opendaylight.controller.statisticsmanager.IStatisticsManager;
* only subnet returned. As soon as a user-configured subnet is created this one will
* vanish.
*/
+ private static final String DISABLE_DEFAULT_SUBNET_PROP = "switchmanager.disableDefaultSubnetGateway";
+ private static final String DISABLE_DEFAULT_SUBNET_PROP_VAL = System.getProperty(DISABLE_DEFAULT_SUBNET_PROP);
+ private static final boolean USE_DEFAULT_SUBNET_GW = !Boolean.valueOf(DISABLE_DEFAULT_SUBNET_PROP_VAL);
protected static final SubnetConfig DEFAULT_SUBNETCONFIG;
protected static final Subnet DEFAULT_SUBNET;
protected static final String DEFAULT_SUBNET_NAME = "default (cannot be modifed)";
@Override
public List<SubnetConfig> getSubnetsConfigList() {
// if there are no subnets, return the default subnet
- if(subnetsConfigList.size() == 0){
+ if (USE_DEFAULT_SUBNET_GW && subnetsConfigList.isEmpty()) {
return Collections.singletonList(DEFAULT_SUBNETCONFIG);
- }else{
+ } else {
return new ArrayList<SubnetConfig>(subnetsConfigList.values());
}
}
@Override
public SubnetConfig getSubnetConfig(String subnet) {
// if there are no subnets, return the default subnet
- if(subnetsConfigList.isEmpty() && subnet.equalsIgnoreCase(DEFAULT_SUBNET_NAME)){
+ if (USE_DEFAULT_SUBNET_GW && subnetsConfigList.isEmpty() && subnet.equalsIgnoreCase(DEFAULT_SUBNET_NAME)) {
return DEFAULT_SUBNETCONFIG;
- }else{
+ } else {
return subnetsConfigList.get(subnet);
}
}
ForwardingMode mode = (ForwardingMode) nodeProperties.get(ForwardingMode.name);
forwardingModeChanged = mode.isProactive();
}
+ } else if ((conf == null) && !(GlobalConstants.DEFAULT.toString().equals(containerName))) {
+ ISwitchManager defaultSwitchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, GlobalConstants.DEFAULT.toString(), this);
+ if (defaultSwitchManager != null) {
+ Property defaultContainerSwitchDesc = (Description) defaultSwitchManager.getNodeProp(node, Description.propertyName);
+ if (defaultContainerSwitchDesc != null) {
+ Map<String, Property> descPropMap = new HashMap<String, Property>();
+ descPropMap.put(Description.propertyName, defaultContainerSwitchDesc);
+ conf = new SwitchConfig(nodeId, descPropMap);
+ updateNodeConfig(conf);
+ propMap.put(Description.propertyName, defaultContainerSwitchDesc);
+ }
+ }
}
}