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