Search in sources :

Example 1 with ActionSetFieldMplsLabel

use of org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMplsLabel in project netvirt by opendaylight.

the class BgpRouteVrfEntryHandler method addTunnelInterfaceActions.

@Override
protected void addTunnelInterfaceActions(NexthopManager.AdjacencyResult adjacencyResult, long vpnId, VrfEntry vrfEntry, List<ActionInfo> actionInfos, String rd) {
    Class<? extends TunnelTypeBase> tunnelType = VpnExtraRouteHelper.getTunnelType(getNextHopManager().getInterfaceManager(), adjacencyResult.getInterfaceName());
    if (tunnelType == null) {
        LOG.debug("Tunnel type not found for vrfEntry {}", vrfEntry);
        return;
    }
    String nextHopIp = adjacencyResult.getNextHopIp();
    if (tunnelType.equals(TunnelTypeMplsOverGre.class)) {
        java.util.Optional<Long> optionalLabel = FibUtil.getLabelForNextHop(vrfEntry, nextHopIp);
        if (!optionalLabel.isPresent()) {
            LOG.warn("NextHopIp {} not found in vrfEntry {}", nextHopIp, vrfEntry);
            return;
        }
        long label = optionalLabel.get();
        LOG.debug("addTunnelInterfaceActions: Push label action for prefix {} rd {} l3vni {} nextHop {}", vrfEntry.getDestPrefix(), rd, vrfEntry.getL3vni(), nextHopIp);
        actionInfos.add(new ActionPushMpls());
        actionInfos.add(new ActionSetFieldMplsLabel(label));
        actionInfos.add(new ActionNxLoadInPort(BigInteger.ZERO));
    } else if (tunnelType.equals(TunnelTypeVxlan.class)) {
        actionInfos.add(new ActionSetFieldTunnelId(BigInteger.valueOf(vrfEntry.getL3vni())));
        LOG.debug("addTunnelInterfaceActions: adding set tunnel id action for prefix {} rd {} l3vni {}" + " nextHop {} ", vrfEntry.getDestPrefix(), rd, vrfEntry.getL3vni(), nextHopIp);
        addRewriteDstMacAction(vpnId, vrfEntry, null, /*prefixInfo*/
        actionInfos);
    }
}
Also used : ActionPushMpls(org.opendaylight.genius.mdsalutil.actions.ActionPushMpls) ActionNxLoadInPort(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) ActionSetFieldMplsLabel(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMplsLabel)

Aggregations

ActionNxLoadInPort (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort)1 ActionPushMpls (org.opendaylight.genius.mdsalutil.actions.ActionPushMpls)1 ActionSetFieldMplsLabel (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMplsLabel)1 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)1 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)1