Search in sources :

Example 86 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.

the class DhcpUCastMacListener method remove.

@Override
protected void remove(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs del) {
    // Flow removal for table 18 is handled in Neutron Port delete.
    // remove the new CR-DHCP
    NodeId torNodeId = identifier.firstKeyOf(Node.class).getNodeId();
    LogicalSwitches logicalSwitch = getLogicalSwitches(del);
    if (null == logicalSwitch) {
        LOG.error("DhcpUCastMacListener remove :Logical Switch ref doesn't have data");
        return;
    }
    String elanInstanceName = logicalSwitch.getHwvtepNodeName().getValue();
    L2GatewayDevice device = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanInstanceName, torNodeId.getValue());
    if (device == null) {
        LOG.error("Logical Switch Device with name {} is not present in L2GWCONN cache", elanInstanceName);
        return;
    }
    IpAddress tunnelIp = device.getTunnelIp();
    Pair<IpAddress, String> tunnelIpElanName = new ImmutablePair<>(tunnelIp, elanInstanceName);
    dhcpExternalTunnelManager.removeFromAvailableCache(tunnelIpElanName);
}
Also used : LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 87 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.

the class DhcpUCastMacListener method add.

@Override
protected void add(InstanceIdentifier<LocalUcastMacs> identifier, LocalUcastMacs add) {
    NodeId torNodeId = identifier.firstKeyOf(Node.class).getNodeId();
    InstanceIdentifier<LogicalSwitches> logicalSwitchRef = (InstanceIdentifier<LogicalSwitches>) add.getLogicalSwitchRef().getValue();
    Optional<LogicalSwitches> logicalSwitchOptional = MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, logicalSwitchRef);
    if (!logicalSwitchOptional.isPresent()) {
        LOG.error("Logical Switch ref doesn't have data {}", logicalSwitchRef);
        return;
    }
    LogicalSwitches logicalSwitch = logicalSwitchOptional.get();
    String elanInstanceName = logicalSwitch.getHwvtepNodeName().getValue();
    String macAddress = add.getMacEntryKey().getValue();
    BigInteger vni = new BigInteger(logicalSwitch.getTunnelKey());
    Port port = dhcpExternalTunnelManager.readVniMacToPortCache(vni, macAddress);
    if (port == null) {
        LOG.trace("No neutron port created for macAddress {}, tunnelKey {}", macAddress, vni);
        return;
    }
    L2GatewayDevice device = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanInstanceName, torNodeId.getValue());
    if (device == null) {
        LOG.error("Logical Switch Device with name {} is not present in L2GWCONN cache", elanInstanceName);
        return;
    }
    IpAddress tunnelIp = device.getTunnelIp();
    Subnet subnet = dhcpManager.getNeutronSubnet(port);
    if (null != subnet && !subnet.isEnableDhcp()) {
        dhcpExternalTunnelManager.updateExistingVMTunnelIPCache(tunnelIp, elanInstanceName, macAddress);
        LOG.warn("DhcpUCastMacListener add: flag for the subnetId {} is False so Table 18 entries are not added", subnet.getUuid());
        return;
    }
    BigInteger designatedDpnId = dhcpExternalTunnelManager.readDesignatedSwitchesForExternalTunnel(tunnelIp, elanInstanceName);
    if (designatedDpnId == null || designatedDpnId.equals(DhcpMConstants.INVALID_DPID)) {
        LOG.trace("Unable to install flows for macAddress {}. TunnelIp {}, elanInstanceName {}, designatedDpn {} ", macAddress, tunnelIp, elanInstanceName, designatedDpnId);
        dhcpExternalTunnelManager.updateLocalCache(tunnelIp, elanInstanceName, macAddress);
        return;
    }
    dhcpExternalTunnelManager.installDhcpFlowsForVms(tunnelIp, elanInstanceName, DhcpServiceUtils.getListOfDpns(broker), designatedDpnId, macAddress);
}
Also used : LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Subnet(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 88 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.

the class ElanDpnInterfacesListener method add.

@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
    final String elanName = getElanName(identifier);
    BigInteger addDpnId = dpnInterfaces.getDpId();
    LOG.debug("ELAN interfaces {} added on DPN {} for Elan {}", dpnInterfaces.getInterfaces(), addDpnId, elanName);
    Optional<ElanServiceChainState> elanServiceChainState = ElanServiceChainUtils.getElanServiceChainState(broker, elanName);
    if (elanServiceChainState.isPresent()) {
        List<ElanToPseudoPortData> elanToPseudoPortDataList = elanServiceChainState.get().getElanToPseudoPortData();
        for (ElanToPseudoPortData elanToPseudoPortData : elanToPseudoPortDataList) {
            Long scfTag = elanToPseudoPortData.getScfTag();
            Long elanLportTag = elanToPseudoPortData.getElanLportTag();
            if (elanLportTag != null && scfTag != null) {
                short tableId = NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
                handleUpdate(addDpnId, elanName, tableId, elanLportTag.intValue(), /*21 bit*/
                scfTag, NwConstants.ADD_FLOW);
            } else {
                LOG.debug("Could not find lportTag for ELAN={}", elanName);
            }
        }
    }
}
Also used : BigInteger(java.math.BigInteger) ElanToPseudoPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData) ElanServiceChainState(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.ElanServiceChainState)

Example 89 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.

the class NeutronSubnetChangeListener method remove.

@Override
protected 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);
    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);
        return;
    }
    handleNeutronSubnetDeleted(subnetId, networkId);
    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 90 with Identifier

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier in project netvirt by opendaylight.

the class NeutronSubnetChangeListener method add.

@Override
protected 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)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 ArrayList (java.util.ArrayList)57 BigInteger (java.math.BigInteger)55 Test (org.junit.Test)52 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)35 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)30 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)29 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)25 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)19 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)19 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)16 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)14 List (java.util.List)13 VpnInterface (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface)13 VpnInterfaceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry)13 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)12 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)11 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)10 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)10