Search in sources :

Example 11 with ActionPuntToController

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;
}
Also used : ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionWriteActions(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions) BigInteger(java.math.BigInteger)

Example 12 with ActionPuntToController

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);
    }
}
Also used : ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)12 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)12 ArrayList (java.util.ArrayList)11 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)11 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)11 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)11 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)10 BigInteger (java.math.BigInteger)4 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)2 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)2 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)1 ActionLearn (org.opendaylight.genius.mdsalutil.actions.ActionLearn)1 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)1 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)1 InstructionWriteActions (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions)1 MatchEthernetDestination (org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination)1 MatchEthernetType (org.opendaylight.genius.mdsalutil.matches.MatchEthernetType)1