+
+ public static void setUpOrRemoveTerminatingServiceTable(BigInteger dpnId, IMdsalApiManager mdsalManager, boolean addFlag) {
+ String logmsg = ( addFlag == true) ? "Installing" : "Removing";
+ LOG.trace( logmsg + " PUNT to Controller flow in DPN {} ", dpnId );
+ long dpId;
+ List<ActionInfo> listActionInfo = new ArrayList<ActionInfo>();
+ listActionInfo.add(new ActionInfo(ActionType.punt_to_controller,
+ new String[] {}));
+
+ try {
+ List<MatchInfo> mkMatches = new ArrayList<MatchInfo>();
+
+ mkMatches.add(new MatchInfo(MatchFieldType.tunnel_id, new BigInteger[] {
+ BigInteger.valueOf(ITMConstants.LLDP_SERVICE_ID) }));
+
+ List<InstructionInfo> mkInstructions = new ArrayList<InstructionInfo>();
+ mkInstructions.add(new InstructionInfo(InstructionType.apply_actions,
+ 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);
+ }
+ }
+
+ private static String getFlowRef(long termSvcTable, int svcId) {
+ return new StringBuffer().append(termSvcTable).append(svcId).toString();
+ }