Search in sources :

Example 16 with RouterToNaptSwitch

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;
}
Also used : RouterToNaptSwitch(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitch) Routers(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers) NaptSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.NaptSwitches)

Aggregations

RouterToNaptSwitch (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitch)11 BigInteger (java.math.BigInteger)10 Routers (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers)5 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)4 RouterToNaptSwitchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitchBuilder)4 ExecutionException (java.util.concurrent.ExecutionException)3 NaptSwitches (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.NaptSwitches)3 RouterToNaptSwitchKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.napt.switches.RouterToNaptSwitchKey)3 UnknownHostException (java.net.UnknownHostException)2 PrintStream (java.io.PrintStream)1 HashMap (java.util.HashMap)1 TreeSet (java.util.TreeSet)1 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 IntextIpMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.IntextIpMap)1 ProviderTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)1 ExternalIps (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps)1 RouterPorts (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.RouterPorts)1 Ports (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.Ports)1 InternalToExternalPortMap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.floating.ip.info.router.ports.ports.InternalToExternalPortMap)1