Search in sources :

Example 11 with MatchEthernetDestination

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

the class NatEvpnUtil method makeL3GwMacTableEntry.

static void makeL3GwMacTableEntry(final BigInteger dpnId, final long vpnId, String macAddress, List<Instruction> customInstructions, IMdsalApiManager mdsalManager, WriteTransaction writeFlowTx) {
    List<MatchInfo> matchInfo = new ArrayList<>();
    matchInfo.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    matchInfo.add(new MatchEthernetDestination(new MacAddress(macAddress)));
    LOG.debug("makeL3GwMacTableEntry : Create flow table {} -> table {} for External Vpn Id = {} " + "and MacAddress = {} on DpnId = {}", NwConstants.L3_GW_MAC_TABLE, NwConstants.INBOUND_NAPT_TABLE, vpnId, macAddress, dpnId);
    // Install the flow entry in L3_GW_MAC_TABLE
    String flowRef = NatUtil.getFlowRef(dpnId, NwConstants.L3_GW_MAC_TABLE, vpnId, macAddress);
    Flow l3GwMacTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_GW_MAC_TABLE, flowRef, 21, flowRef, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, matchInfo, customInstructions);
    mdsalManager.addFlowToTx(dpnId, l3GwMacTableFlowEntity, writeFlowTx);
    LOG.debug("makeL3GwMacTableEntry : Successfully created flow entity {} on DPN = {}", l3GwMacTableFlowEntity, dpnId);
}
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) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 12 with MatchEthernetDestination

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

the class AclServiceUtils method buildBroadcastIpV4Matches.

public static List<MatchInfoBase> buildBroadcastIpV4Matches(String ipAddr) {
    List<MatchInfoBase> matches = new ArrayList<>(2);
    matches.add(new MatchEthernetDestination(new MacAddress(AclConstants.BROADCAST_MAC)));
    matches.addAll(AclServiceUtils.buildIpMatches(new IpPrefixOrAddress(ipAddr.toCharArray()), MatchCriteria.MATCH_DESTINATION));
    return matches;
}
Also used : IpPrefixOrAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress) 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 13 with MatchEthernetDestination

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

the class IngressAclServiceImpl method programGotoClassifierTableRules.

@Override
protected void programGotoClassifierTableRules(BigInteger dpId, List<AllowedAddressPairs> aaps, int lportTag, int addOrRemove) {
    for (AllowedAddressPairs aap : aaps) {
        IpPrefixOrAddress attachIp = aap.getIpAddress();
        MacAddress mac = aap.getMacAddress();
        List<MatchInfoBase> matches = new ArrayList<>();
        matches.add(AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode));
        matches.add(new MatchEthernetDestination(mac));
        matches.addAll(AclServiceUtils.buildIpMatches(attachIp, MatchCriteria.MATCH_DESTINATION));
        List<InstructionInfo> gotoInstructions = new ArrayList<>();
        gotoInstructions.add(new InstructionGotoTable(getAclConntrackClassifierTable()));
        String flowName = "Ingress_Fixed_Goto_Classifier_" + dpId + "_" + lportTag + "_" + mac.getValue() + "_" + String.valueOf(attachIp.getValue());
        syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, gotoInstructions, addOrRemove);
    }
}
Also used : InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) IpPrefixOrAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress) ArrayList(java.util.ArrayList) AllowedAddressPairs(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs) 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)

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