Search in sources :

Example 1 with CopyFromValue

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);
}
Also used : ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) MatchFromField(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromField) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchFromField(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromField) MatchFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromValue) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) CopyFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.CopyFromValue) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Aggregations

ArrayList (java.util.ArrayList)1 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)1 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)1 ActionLearn (org.opendaylight.genius.mdsalutil.actions.ActionLearn)1 CopyFromValue (org.opendaylight.genius.mdsalutil.actions.ActionLearn.CopyFromValue)1 MatchFromField (org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromField)1 MatchFromValue (org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromValue)1 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)1 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)1 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)1