Search in sources :

Example 1 with ActionPushMpls

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

the class NexthopManager method buildBucketForDcGwLbGroup.

private Bucket buildBucketForDcGwLbGroup(String ipAddress, BigInteger dpnId, int index) {
    List<Action> listAction = new ArrayList<>();
    // ActionKey 0 goes to mpls label.
    int actionKey = 1;
    listAction.add(new ActionPushMpls().buildAction());
    listAction.add(new ActionRegMove(actionKey++, FibConstants.NXM_REG_MAPPING.get(index), 0, 19).buildAction());
    String tunnelInterfaceName = getTunnelInterfaceName(dpnId, new IpAddress(ipAddress.toCharArray()));
    List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
    if (!egressActions.isEmpty()) {
        listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
    } else {
        // clear off actions if there is no egress actions.
        listAction = Collections.emptyList();
    }
    return MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, index, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
}
Also used : ActionPushMpls(org.opendaylight.genius.mdsalutil.actions.ActionPushMpls) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ActionRegMove(org.opendaylight.genius.mdsalutil.actions.ActionRegMove) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 2 with ActionPushMpls

use of org.opendaylight.genius.mdsalutil.actions.ActionPushMpls 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

ActionPushMpls (org.opendaylight.genius.mdsalutil.actions.ActionPushMpls)2 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ActionNxLoadInPort (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort)1 ActionRegMove (org.opendaylight.genius.mdsalutil.actions.ActionRegMove)1 ActionSetFieldMplsLabel (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMplsLabel)1 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)1