Search in sources :

Example 1 with MatchEthernetDestination

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination in project netvirt by opendaylight.

the class ElanNodeListener method createLldpFlow.

private void createLldpFlow(BigInteger dpId, String dstMac, String flowName) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchEthernetType(ElanConstants.LLDP_ETH_TYPE));
    mkMatches.add(new MatchEthernetDestination(new MacAddress(dstMac)));
    List<ActionInfo> listActionInfo = new ArrayList<>();
    listActionInfo.add(new ActionPuntToController());
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionApplyActions(listActionInfo));
    String flowId = dpId.toString() + NwConstants.ELAN_DMAC_TABLE + "lldp" + ElanConstants.LLDP_ETH_TYPE + dstMac;
    FlowEntity lldpFlow = MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 16, flowName, 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC, mkMatches, mkInstructions);
    mdsalManager.installFlow(lldpFlow);
}
Also used : ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 2 with MatchEthernetDestination

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination 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);
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 3 with MatchEthernetDestination

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination in project netvirt by opendaylight.

the class AclServiceUtils method buildL2BroadcastMatches.

public static List<MatchInfoBase> buildL2BroadcastMatches() {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(new MatchEthernetDestination(new MacAddress(AclConstants.BROADCAST_MAC)));
    return matches;
}
Also used : ArrayList(java.util.ArrayList) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 4 with MatchEthernetDestination

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination in project netvirt by opendaylight.

the class ElanUtils method buildLocalDmacFlowEntry.

/**
 * Builds the flow to be programmed in the DMAC table of the local DPN (that
 * is, where the MAC is attached to). This flow consists in:
 *
 * <p>Match: + elanTag in metadata + packet goes to a MAC locally attached
 * Actions: + optionally, pop-vlan + set-vlan-id + output to ifName's
 * portNumber
 *
 * @param elanTag
 *            the elan tag
 * @param dpId
 *            the dp id
 * @param ifName
 *            the if name
 * @param macAddress
 *            the mac address
 * @param elanInfo
 *            the elan info
 * @param ifTag
 *            the if tag
 * @return the flow
 */
public Flow buildLocalDmacFlowEntry(long elanTag, BigInteger dpId, String ifName, String macAddress, ElanInstance elanInfo, long ifTag) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
    mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddress)));
    List<Instruction> mkInstructions = new ArrayList<>();
    List<Action> actions = getEgressActionsForInterface(ifName, /* tunnelKey */
    null);
    mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions));
    Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, ifTag, macAddress, elanTag), 20, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
    return flow;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 5 with MatchEthernetDestination

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination in project netvirt by opendaylight.

the class ElanUtils method buildMatchesForElanTagShFlagAndDstMac.

public static List<MatchInfo> buildMatchesForElanTagShFlagAndDstMac(long elanTag, boolean shFlag, String macAddr) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchMetadata(getElanMetadataLabel(elanTag, shFlag), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG));
    mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddr)));
    return mkMatches;
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Aggregations

ArrayList (java.util.ArrayList)13 MatchEthernetDestination (org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination)13 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)13 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)10 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)7 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)7 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)4 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)4 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)3 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)3 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)3 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)2 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)2 IpPrefixOrAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress)2 BigInteger (java.math.BigInteger)1 ExecutionException (java.util.concurrent.ExecutionException)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)1