Search in sources :

Example 6 with PrefixToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.PrefixToInterface in project netvirt by opendaylight.

the class BaseVrfEntryHandler method addRewriteDstMacAction.

protected void addRewriteDstMacAction(long vpnId, VrfEntry vrfEntry, Prefixes prefixInfo, List<ActionInfo> actionInfos) {
    if (vrfEntry.getMac() != null) {
        actionInfos.add(new ActionSetFieldEthernetDestination(actionInfos.size(), new MacAddress(vrfEntry.getMac())));
        return;
    }
    if (prefixInfo == null) {
        prefixInfo = fibUtil.getPrefixToInterface(vpnId, vrfEntry.getDestPrefix());
        // Checking PrefixtoInterface again as it is populated later in some cases
        if (prefixInfo == null) {
            LOG.debug("No prefix info found for prefix {}", vrfEntry.getDestPrefix());
            return;
        }
    }
    String ipPrefix = prefixInfo.getIpAddress();
    String ifName = prefixInfo.getVpnInterfaceName();
    if (ifName == null) {
        LOG.debug("Failed to get VPN interface for prefix {}", ipPrefix);
        return;
    }
    String vpnName = fibUtil.getVpnNameFromId(vpnId);
    if (vpnName == null) {
        LOG.debug("Failed to get VPN name for vpnId {}", vpnId);
        return;
    }
    String macAddress = fibUtil.getMacAddressFromPrefix(ifName, vpnName, ipPrefix);
    if (macAddress == null) {
        LOG.warn("No MAC address found for VPN interface {} prefix {}", ifName, ipPrefix);
        return;
    }
    actionInfos.add(new ActionSetFieldEthernetDestination(actionInfos.size(), new MacAddress(macAddress)));
}
Also used : ActionSetFieldEthernetDestination(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Aggregations

ArrayList (java.util.ArrayList)4 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes)3 BigInteger (java.math.BigInteger)2 List (java.util.List)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 InterVpnLinkDataComposite (org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite)2 SubnetRoute (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.SubnetRoute)2 VrfTablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey)2 LabelRouteInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.label.route.map.LabelRouteInfo)2 Adjacency (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency)2 Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes)2 VpnToDpnList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList)2 Optional (com.google.common.base.Optional)1 Preconditions (com.google.common.base.Preconditions)1 CheckedFuture (com.google.common.util.concurrent.CheckedFuture)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1