use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.
the class VpnFloatingIpHandler method removeTunnelTableEntry.
private void removeTunnelTableEntry(BigInteger dpnId, long serviceId, WriteTransaction removeFlowInvTx) {
LOG.debug("removeTunnelTableEntry : called with DpnId = {} and label = {}", dpnId, serviceId);
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, null);
mdsalManager.removeFlowToTx(dpnId, flowEntity, removeFlowInvTx);
LOG.debug("removeTunnelTableEntry : Terminating service Entry for dpID {} : label : {} removed successfully", dpnId, serviceId);
}
use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project netvirt by opendaylight.
the class VxlanGreConntrackBasedSnatService method installTerminatingServiceTblEntryForVxlanGre.
protected void installTerminatingServiceTblEntryForVxlanGre(BigInteger dpnId, String routerName, Long routerId, int elanId, int addOrRemove) {
LOG.info("installTerminatingServiceTblEntryForVxlanGre : creating entry for" + "Terminating Service Table for switch {}, routerId {}", dpnId, routerId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
BigInteger tunnelId = BigInteger.valueOf(routerId);
if (elanManager.isOpenStackVniSemanticsEnforced()) {
tunnelId = NatOverVxlanUtil.getRouterVni(idManager, routerName, routerId);
}
matches.add(new MatchTunnelId(tunnelId));
List<ActionInfo> actionsInfos = new ArrayList<>();
List<NxCtAction> ctActionsList = new ArrayList<>();
NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0, null, null, 0, 0);
ctActionsList.add(nxCtAction);
ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId, NwConstants.OUTBOUND_NAPT_TABLE, ctActionsList);
ActionSetFieldMeta actionSetFieldMeta = new ActionSetFieldMeta(MetaDataUtil.getVpnIdMetadata(routerId.longValue()));
actionsInfos.add(actionSetFieldMeta);
actionsInfos.add(actionNxConntrack);
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actionsInfos));
String flowRef = getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId.longValue());
syncFlow(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef, NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions, addOrRemove);
}
use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project genius by opendaylight.
the class MdSalUtilTest method createFlowEntity.
// Methods to test the install Flow and Group
public FlowEntity createFlowEntity(String dpnId, String tableId) {
BigInteger dpId;
final int serviceId = 0;
List<ActionInfo> listActionInfo = new ArrayList<>();
listActionInfo.add(new ActionPuntToController());
dpId = new BigInteger(dpnId.split(":")[1]);
List<MatchInfo> mkMatches = new ArrayList<>();
final BigInteger cookie = new BigInteger("9000000", 16);
short shortTableId = Short.parseShort(tableId);
mkMatches.add(new MatchTunnelId(new BigInteger("0000000000000000", 16)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionWriteActions(listActionInfo));
FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(dpId, shortTableId, getFlowRef(shortTableId, serviceId), 5, "Terminating Service Flow Entry: " + serviceId, 0, 0, cookie.add(BigInteger.valueOf(serviceId)), null, null);
return terminatingServiceTableFlowEntity;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchTunnelId in project genius by opendaylight.
the class ItmUtils method setUpOrRemoveTerminatingServiceTable.
@SuppressWarnings("checkstyle:IllegalCatch")
public static void setUpOrRemoveTerminatingServiceTable(BigInteger dpnId, IMdsalApiManager mdsalManager, boolean addFlag) {
String logmsg = addFlag ? "Installing" : "Removing";
LOG.trace("{}PUNT to Controller flow in DPN {} ", logmsg, dpnId);
List<ActionInfo> listActionInfo = new ArrayList<>();
listActionInfo.add(new ActionPuntToController());
try {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(ITMConstants.LLDP_SERVICE_ID)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionApplyActions(listActionInfo));
FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, ITMConstants.LLDP_SERVICE_ID), 5, String.format("%s:%d", "ITM Flow Entry ", ITMConstants.LLDP_SERVICE_ID), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(ITMConstants.LLDP_SERVICE_ID)), mkMatches, mkInstructions);
if (addFlag) {
mdsalManager.installFlow(terminatingServiceTableFlowEntity);
} else {
mdsalManager.removeFlow(terminatingServiceTableFlowEntity);
}
} catch (Exception e) {
LOG.error("Error while setting up Table 36 for {}", dpnId, e);
}
}
Aggregations