use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitch in project netvirt by opendaylight.
the class WeightedCentralizedSwitchScheduler method removeSwitch.
@Override
public boolean removeSwitch(BigInteger dpnId) {
LOG.info("removeSwitch: Removing {} dpnId to switchWeightsMap", dpnId);
if (!INITIAL_SWITCH_WEIGHT.equals(switchWeightsMap.get(dpnId))) {
NaptSwitches naptSwitches = getNaptSwitches(dataBroker);
for (RouterToNaptSwitch routerToNaptSwitch : naptSwitches.getRouterToNaptSwitch()) {
if (dpnId.equals(routerToNaptSwitch.getPrimarySwitchId())) {
Routers router = NatUtil.getRoutersFromConfigDS(dataBroker, routerToNaptSwitch.getRouterName());
releaseCentralizedSwitch(router);
switchWeightsMap.remove(dpnId);
scheduleCentralizedSwitch(router);
break;
}
}
} else {
switchWeightsMap.remove(dpnId);
}
return true;
}
Aggregations