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);
}
}
Aggregations