Search in sources :

Example 41 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class NeutronSubnetChangeListener method remove.

@Override
public void remove(InstanceIdentifier<Subnet> identifier, Subnet input) {
    LOG.trace("Removing subnet : key: {}, value={}", identifier, input);
    Uuid networkId = input.getNetworkId();
    Uuid subnetId = input.getUuid();
    Network network = neutronvpnUtils.getNeutronNetwork(networkId);
    handleNeutronSubnetDeleted(subnetId, networkId, input.getCidr().stringValue());
    if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
        LOG.warn("neutron vpn received a subnet remove() for a network without a provider extension augmentation " + "or with an unsupported network type for the subnet {} which is part of network {}", subnetId.getValue(), network);
    } else {
        externalSubnetHandler.handleExternalSubnetRemoved(network, subnetId);
    }
    neutronvpnUtils.removeFromSubnetCache(input);
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 42 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class NeutronSubnetChangeListener method add.

@Override
public void add(InstanceIdentifier<Subnet> identifier, Subnet input) {
    LOG.trace("Adding Subnet : key: {}, value={}", identifier, input);
    Uuid networkId = input.getNetworkId();
    Uuid subnetId = input.getUuid();
    Network network = neutronvpnUtils.getNeutronNetwork(networkId);
    if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
        LOG.warn("neutron vpn received a subnet add() for a network without a provider extension augmentation " + "or with an unsupported network type for the subnet {} which is part of network {}", subnetId.getValue(), network);
        return;
    }
    neutronvpnUtils.addToSubnetCache(input);
    handleNeutronSubnetCreated(input, network);
    externalSubnetHandler.handleExternalSubnetAdded(network, subnetId, null);
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 43 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class NeutronPortChangeListener method remove.

@Override
public void remove(InstanceIdentifier<Port> identifier, Port input) {
    LOG.trace("Removing Port : key: {}, value={}", identifier, input);
    Network network = neutronvpnUtils.getNeutronNetwork(input.getNetworkId());
    // network from NN returns null, but the deletion process for port needs to continue
    if (network != null && !NeutronvpnUtils.isNetworkTypeSupported(network)) {
        String portName = input.getUuid().getValue();
        LOG.warn("neutron vpn received a port remove() for a network without a provider extension augmentation " + "or with an unsupported network type for the port {} which is part of network {}", portName, network);
        return;
    }
    neutronvpnUtils.removeFromPortCache(input);
    NeutronUtils.deletePortStatus(input.getUuid().getValue(), dataBroker);
    if (!Strings.isNullOrEmpty(input.getDeviceOwner()) && !Strings.isNullOrEmpty(input.getDeviceId())) {
        if (NeutronConstants.DEVICE_OWNER_ROUTER_INF.equals(input.getDeviceOwner())) {
            handleRouterInterfaceRemoved(input);
            /* nothing else to do here */
            return;
        } else if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner()) || NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(input.getDeviceOwner())) {
            handleRouterGatewayUpdated(input, true);
            elanService.removeKnownL3DmacAddress(input.getMacAddress().getValue(), input.getNetworkId().getValue());
        }
    }
    if (input.getFixedIps() != null) {
        handleNeutronPortDeleted(input);
    }
}
Also used : Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 44 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class NeutronPortChangeListener method add.

@Override
public void add(InstanceIdentifier<Port> identifier, Port input) {
    LOG.trace("Received port add event: port={}", input);
    String portName = input.getUuid().getValue();
    LOG.trace("Adding Port : key: {}, value={}", identifier, input);
    Network network = neutronvpnUtils.getNeutronNetwork(input.getNetworkId());
    if (network == null || !NeutronvpnUtils.isNetworkTypeSupported(network)) {
        LOG.warn("neutron vpn received a port add() for a network without a provider extension augmentation " + "or with an unsupported network type for the port {} which is part of network {}", portName, network);
        return;
    }
    neutronvpnUtils.addToPortCache(input);
    String portStatus = NeutronUtils.PORT_STATUS_DOWN;
    if (!Strings.isNullOrEmpty(input.getDeviceOwner()) && !Strings.isNullOrEmpty(input.getDeviceId())) {
        if (NeutronConstants.DEVICE_OWNER_ROUTER_INF.equals(input.getDeviceOwner())) {
            handleRouterInterfaceAdded(input);
            NeutronUtils.createPortStatus(input.getUuid().getValue(), NeutronUtils.PORT_STATUS_ACTIVE, dataBroker);
            return;
        }
        if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(input.getDeviceOwner())) {
            handleRouterGatewayUpdated(input, false);
            portStatus = NeutronUtils.PORT_STATUS_ACTIVE;
        } else if (NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(input.getDeviceOwner())) {
            handleFloatingIpPortUpdated(null, input);
            portStatus = NeutronUtils.PORT_STATUS_ACTIVE;
        }
    }
    // in order to validate the supported vnic types from the hostconfig
    if (input.getFixedIps() != null && !input.getFixedIps().isEmpty() && (!isPortTypeSwitchdev(input) || isPortBound(input))) {
        handleNeutronPortCreated(input);
    }
    NeutronUtils.createPortStatus(input.getUuid().getValue(), portStatus, dataBroker);
}
Also used : Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 45 with Received

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received in project netvirt by opendaylight.

the class NeutronvpnManager method createL3InternalVpn.

public void createL3InternalVpn(Uuid vpnId, String name, Uuid tenantId, List<String> rdList, List<String> irtList, List<String> ertList, Uuid routerId, List<Uuid> networksList) {
    IpVersionChoice ipVersChoices = neutronvpnUtils.getIpVersionChoicesFromRouterUuid(routerId);
    // Update VPN Instance node
    updateVpnInstanceNode(vpnId, rdList, irtList, ertList, false, /*isL2Vpn*/
    0, /*l3vni*/
    ipVersChoices);
    // Update local vpn-subnet DS
    updateVpnMaps(vpnId, name, routerId, tenantId, networksList);
    if (routerId != null) {
        Uuid existingVpn = neutronvpnUtils.getVpnForRouter(routerId, true);
        if (existingVpn != null) {
            // use case when a cluster is rebooted and router add DCN is received, triggering #createL3InternalVpn
            // if before reboot, router was already associated to VPN, should not proceed associating router to
            // internal VPN. Adding to RouterInterfacesMap is also not needed since it's a config DS and will be
            // preserved upon reboot.
            // For a non-reboot case #associateRouterToInternalVPN already takes care of adding to
            // RouterInterfacesMap via #createVPNInterface call.
            LOG.info("Associating router to Internal VPN skipped for VPN {} due to router {} already associated " + "to external VPN {}", vpnId.getValue(), routerId.getValue(), existingVpn.getValue());
            return;
        }
        associateRouterToInternalVpn(vpnId, routerId);
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) IpVersionChoice(org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)29 ArrayList (java.util.ArrayList)24 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)23 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)18 BigInteger (java.math.BigInteger)16 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)16 List (java.util.List)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 Test (org.junit.Test)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)12 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 UnknownHostException (java.net.UnknownHostException)10 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)9 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)9 Collections (java.util.Collections)8 Map (java.util.Map)8 VpnInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.interfaces.VpnInterface)8