use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class ElanNodeListener method createL2ControlProtocolDropFlows.
private void createL2ControlProtocolDropFlows(BigInteger dpId) {
List<MatchInfo> mkMatches = new ArrayList<>();
MatchEthernetDestination matchEthDst = new MatchEthernetDestination(new MacAddress(ElanConstants.L2_CONTROL_PACKETS_DMAC), new MacAddress(ElanConstants.L2_CONTROL_PACKETS_DMAC_MASK));
mkMatches.add(matchEthDst);
List<ActionInfo> listActionInfo = new ArrayList<>();
listActionInfo.add(new ActionDrop());
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionApplyActions(listActionInfo));
String flowId = dpId.toString() + NwConstants.ELAN_DMAC_TABLE + "l2control" + ElanConstants.L2_CONTROL_PACKETS_DMAC + ElanConstants.L2_CONTROL_PACKETS_DMAC_MASK;
FlowEntity flow = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 15, "L2 control packets dMac Table Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC, mkMatches, mkInstructions);
mdsalManager.installFlow(flow);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class ElanNodeListener method addSmacLearnedTableFlow.
private void addSmacLearnedTableFlow(BigInteger dpId) {
// T50 - match on Reg4 and goto T51
List<MatchInfoBase> mkMatches = new ArrayList<>();
mkMatches.add(new NxMatchRegister(NxmNxReg4.class, LEARN_MATCH_REG4_VALUE));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.ELAN_DMAC_TABLE));
String flowRef = new StringBuffer().append(NwConstants.ELAN_SMAC_TABLE).append(NwConstants.FLOWID_SEPARATOR).append(LEARN_MATCH_REG4_VALUE).toString();
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_SMAC_TABLE, flowRef, 10, "ELAN sMac Table Reg4 Flow", 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_SMAC.add(BigInteger.valueOf(LEARN_MATCH_REG4_VALUE)), mkMatches, mkInstructions);
mdsalManager.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class IngressCountersServiceImpl method syncCounterFlows.
@Override
public void syncCounterFlows(ElementCountersRequest ecr, int operation) {
int lportTag = ecr.getLportTag();
List<MatchInfoBase> flowMatches = CountersServiceUtils.getCounterFlowMatch(ecr, lportTag, ElementCountersDirection.INGRESS);
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = CountersServiceUtils.getDispatcherTableResubmitInstructions(actionsInfos, ElementCountersDirection.INGRESS);
BigInteger dpn = ecr.getDpn();
String flowName = createFlowName(ecr, lportTag, dpn);
syncFlow(dpn, NwConstants.INGRESS_COUNTERS_TABLE, flowName, CountersServiceUtils.COUNTER_TABLE_COUNTER_FLOW_PRIORITY, CountersServiceUtils.COUNTER_FLOW_NAME, 0, 0, CountersServiceUtils.COOKIE_COUNTERS_BASE, flowMatches, instructions, operation);
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class CountersServiceUtils method getDispatcherTableResubmitInstructions.
public static List<InstructionInfo> getDispatcherTableResubmitInstructions(List<ActionInfo> actionsInfos, ElementCountersDirection direction) {
short dispatcherTableId = NwConstants.LPORT_DISPATCHER_TABLE;
if (ElementCountersDirection.EGRESS.equals(direction)) {
dispatcherTableId = NwConstants.EGRESS_LPORT_DISPATCHER_TABLE;
}
List<InstructionInfo> instructions = new ArrayList<>();
actionsInfos.add(new ActionNxResubmit(dispatcherTableId));
instructions.add(new InstructionApplyActions(actionsInfos));
return instructions;
}
use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.
the class AclServiceUtils method createCtMarkInstructionForNewState.
/**
* This method creates and returns the ct_mark instruction when a ACL rule removed from the
* instance. This instruction will reset the ct_mark value and stops the existing traffics.
*
* @param filterTable the filterTable
* @param elanId the Elan id
* @return list of instruction
*/
public static List<InstructionInfo> createCtMarkInstructionForNewState(Short filterTable, Long elanId) {
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
List<NxCtAction> ctActionsList = new ArrayList<>();
NxCtAction nxCtMarkClearAction = new ActionNxConntrack.NxCtMark(AclConstants.CT_MARK_NEW_STATE);
ctActionsList.add(nxCtMarkClearAction);
ActionNxConntrack actionNxConntrack = new ActionNxConntrack(2, 1, 0, elanId.intValue(), (short) 255, ctActionsList);
actionsInfos.add(actionNxConntrack);
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionGotoTable(filterTable));
return instructions;
}
Aggregations