use of org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions in project netvirt by opendaylight.
the class VpnNodeListener method createTableMissForVpnGwFlow.
private void createTableMissForVpnGwFlow(WriteTransaction writeFlowTx, BigInteger dpId) {
List<MatchInfo> matches = new ArrayList<>();
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntityMissforGw = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, getTableMissFlowRef(dpId, NwConstants.L3_GW_MAC_TABLE, NwConstants.TABLE_MISS_FLOW), NwConstants.TABLE_MISS_PRIORITY, "L3 Gw Mac Table Miss", 0, 0, new BigInteger("1080000", 16), matches, instructions);
LOG.trace("Invoking MDSAL to install L3 Gw Mac Table Miss Entry");
mdsalManager.addFlowToTx(flowEntityMissforGw, writeFlowTx);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions in project netvirt by opendaylight.
the class DhcpManager method setupDhcpAllocationPoolFlow.
private void setupDhcpAllocationPoolFlow(BigInteger dpId) {
List<MatchInfo> matches = DhcpServiceUtils.getDhcpMatch();
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
instructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE, "DhcpAllocationPoolFlow", DhcpMConstants.DEFAULT_DHCP_ALLOCATION_POOL_FLOW_PRIORITY, "Dhcp Allocation Pool Flow", 0, 0, DhcpMConstants.COOKIE_DHCP_BASE, matches, instructions);
LOG.trace("Installing DHCP Allocation Pool Flow DpId {}", dpId);
DhcpServiceCounters.install_dhcp_flow.inc();
mdsalUtil.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions in project netvirt by opendaylight.
the class VpnServiceChainUtils method buildLFibVpnPseudoPortFlow.
/**
* Builds a Flow for the LFIB table that sets the LPortTag of the
* VpnPseudoPort and sends to LPortDispatcher table.
* <ul>
* <li>Matching: eth_type = MPLS, mpls_label = VPN MPLS label
* <li>Actions: setMetadata LportTag and SI=2, pop MPLS, Go to
* LPortDispacherTable
* </ul>
*
* @param dpId DpnId
* @param label MPLS label
* @param nextHop Next Hop IP
* @param lportTag Pseudo Logical Port tag
* @return the FlowEntity
*/
public static FlowEntity buildLFibVpnPseudoPortFlow(BigInteger dpId, Long label, String nextHop, int lportTag) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.MPLS_UNICAST);
matches.add(new MatchMplsLabel(label));
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionPopMpls());
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionWriteMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, ServiceIndex.getIndex(NwConstants.SCF_SERVICE_NAME, NwConstants.SCF_SERVICE_INDEX)), MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionGotoTable(NwConstants.L3_INTERFACE_TABLE));
String flowRef = getLFibVpnPseudoPortFlowRef(lportTag, label, nextHop);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_LFIB_TABLE, flowRef, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_VM_LFIB_TABLE, matches, instructions);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions in project netvirt by opendaylight.
the class QosNodeListener method createTableMissEntry.
public void createTableMissEntry(BigInteger dpnId) {
List<MatchInfo> matches = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.QOS_DSCP_TABLE, "QoSTableMissFlow", 0, "QoS Table Miss Flow", 0, 0, NwConstants.COOKIE_QOS_TABLE, matches, instructions);
mdsalUtils.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions in project genius by opendaylight.
the class ActionInfoImmutableTest method actionInfoActionKeyDoesNotMagicallyChangeOnFlowEntityGetFlowBuilder.
@Test
public void actionInfoActionKeyDoesNotMagicallyChangeOnFlowEntityGetFlowBuilder() {
FlowEntityBuilder flowEntityBuilder = new FlowEntityBuilder().setDpnId(BigInteger.valueOf(123L)).setTableId((short) 1).setPriority(2).setFlowName("TEST-NAME").setFlowId("TEST-ID").setCookie(BigInteger.valueOf(110100480L));
ActionInfo actionInfo = new ActionNxConntrack(27, 1, 0, 0, (short) 255);
List<ActionInfo> actionInfos = new ArrayList<>();
actionInfos.add(actionInfo);
flowEntityBuilder.addInstructionInfoList(new InstructionApplyActions(actionInfos));
FlowEntity flowEntity = flowEntityBuilder.build();
assertEquals(27, ((InstructionApplyActions) flowEntity.getInstructionInfoList().get(0)).getActionInfos().get(0).getActionKey());
flowEntity.getFlowBuilder();
assertEquals(27, ((InstructionApplyActions) flowEntity.getInstructionInfoList().get(0)).getActionInfos().get(0).getActionKey());
flowEntity.getFlowBuilder();
assertEquals(27, ((InstructionApplyActions) flowEntity.getInstructionInfoList().get(0)).getActionInfos().get(0).getActionKey());
}
Aggregations