use of org.opendaylight.genius.mdsalutil.actions.ActionLearn.CopyFromValue in project netvirt by opendaylight.
the class ElanNodeListener method createArpPuntAndLearnFlow.
private void createArpPuntAndLearnFlow(Uint64 dpId, TypedReadWriteTransaction<Configuration> tx) {
LOG.debug("adding arp punt and learn entry in table {}", NwConstants.ARP_LEARN_TABLE_1);
List<MatchInfo> matches = new ArrayList<>();
List<ActionInfo> actions = new ArrayList<>();
Uint64 cookie = Uint64.valueOf("88880000", 16).intern();
matches.add(MatchEthernetType.ARP);
actions.add(new ActionPuntToController());
if (arpPuntTimeout != 0) {
actions.add(new ActionLearn(0, arpPuntTimeout, ARP_LEARN_FLOW_PRIORITY, cookie, 0, NwConstants.ARP_LEARN_TABLE_1, 0, 0, Arrays.asList(new MatchFromValue(NwConstants.ETHTYPE_ARP, NxmOfFieldType.NXM_OF_ETH_TYPE.getType(), NxmOfFieldType.NXM_OF_ETH_TYPE.getFlowModHeaderLenInt()), new MatchFromField(NxmOfFieldType.NXM_OF_ARP_OP.getType(), NxmOfFieldType.NXM_OF_ARP_OP.getType(), NxmOfFieldType.NXM_OF_ARP_OP.getFlowModHeaderLenInt()), new MatchFromField(NxmOfFieldType.NXM_OF_ARP_TPA.getType(), NxmOfFieldType.NXM_OF_ARP_TPA.getType(), NxmOfFieldType.NXM_OF_ARP_TPA.getFlowModHeaderLenInt()), new ActionLearn.MatchFromField(NxmOfFieldType.OXM_OF_METADATA.getType(), MetaDataUtil.METADATA_ELAN_TAG_OFFSET, NxmOfFieldType.OXM_OF_METADATA.getType(), MetaDataUtil.METADATA_ELAN_TAG_OFFSET, ElanConstants.ELAN_TAG_LENGTH), new CopyFromValue(1, NxmOfFieldType.NXM_NX_REG4.getType(), 8))));
actions.add(new ActionLearn(0, arpPuntTimeout, ARP_LEARN_FLOW_PRIORITY, cookie, 0, NwConstants.ARP_LEARN_TABLE_2, 0, 0, Arrays.asList(new MatchFromValue(NwConstants.ETHTYPE_ARP, NxmOfFieldType.NXM_OF_ETH_TYPE.getType(), NxmOfFieldType.NXM_OF_ETH_TYPE.getFlowModHeaderLenInt()), new MatchFromField(NxmOfFieldType.NXM_OF_ARP_OP.getType(), NxmOfFieldType.NXM_OF_ARP_OP.getType(), NxmOfFieldType.NXM_OF_ARP_OP.getFlowModHeaderLenInt()), new MatchFromField(NxmOfFieldType.NXM_OF_ARP_TPA.getType(), NxmOfFieldType.NXM_OF_ARP_SPA.getType(), NxmOfFieldType.NXM_OF_ARP_TPA.getFlowModHeaderLenInt()), new ActionLearn.MatchFromField(NxmOfFieldType.OXM_OF_METADATA.getType(), MetaDataUtil.METADATA_ELAN_TAG_OFFSET, NxmOfFieldType.OXM_OF_METADATA.getType(), MetaDataUtil.METADATA_ELAN_TAG_OFFSET, MetaDataUtil.METADATA_ELAN_TAG_BITLEN), new CopyFromValue(1, NxmOfFieldType.NXM_NX_REG4.getType(), 8, 8))));
}
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionApplyActions(actions));
String flowid = String.valueOf(NwConstants.ARP_LEARN_TABLE_1) + NwConstants.FLOWID_SEPARATOR + "arp.punt";
FlowEntity flow = MDSALUtil.buildFlowEntity(dpId, NwConstants.ARP_LEARN_TABLE_1, flowid, NwConstants.TABLE_MISS_PRIORITY, "arp punt/learn flow", 0, 0, cookie, matches, instructions);
mdsalManager.addFlow(tx, flow);
}
Aggregations