Search in sources :

Example 56 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project genius by opendaylight.

the class FlowBasedServicesUtils method getMatchInfoForVlanPortAtIngressTable.

public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchInPort(dpId, portNo));
    int vlanId = 0;
    IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
    if (l2vlan != null) {
        vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
    }
    if (vlanId >= 0 && l2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Transparent) {
        matches.add(new MatchVlanVid(vlanId));
    }
    return matches;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchVlanVid(org.opendaylight.genius.mdsalutil.matches.MatchVlanVid) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 57 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project genius by opendaylight.

the class ItmManagerRpcService method createTerminatingServiceActions.

@Override
public Future<RpcResult<java.lang.Void>> createTerminatingServiceActions(final CreateTerminatingServiceActionsInput input) {
    LOG.info("create terminatingServiceAction on DpnId = {} for service id {} and instructions {}", input.getDpnId(), input.getServiceId(), input.getInstruction());
    final SettableFuture<RpcResult<Void>> result = SettableFuture.create();
    int serviceId = input.getServiceId();
    final List<MatchInfo> mkMatches = getTunnelMatchesForServiceId(serviceId);
    Flow terminatingServiceTableFlow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, serviceId), 5, String.format("%s:%d", "ITM Flow Entry ", serviceId), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(serviceId)), mkMatches, input.getInstruction());
    ListenableFuture<Void> installFlowResult = mdsalManager.installFlow(input.getDpnId(), terminatingServiceTableFlow);
    Futures.addCallback(installFlowResult, new FutureCallback<Void>() {

        @Override
        public void onSuccess(Void voidInstance) {
            result.set(RpcResultBuilder.<Void>success().build());
        }

        @Override
        public void onFailure(Throwable error) {
            String msg = String.format("Unable to install terminating service flow for %s", input.getDpnId());
            LOG.error("create terminating service actions failed. {}", msg, error);
            result.set(RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, msg, error).build());
        }
    }, MoreExecutors.directExecutor());
    // result.set(RpcResultBuilder.<Void>success().build());
    return result;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 58 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project genius by opendaylight.

the class ItmManagerRpcService method getTunnelMatchesForServiceId.

public List<MatchInfo> getTunnelMatchesForServiceId(int serviceId) {
    final List<MatchInfo> mkMatches = new ArrayList<>();
    // Matching metadata
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
    return mkMatches;
}
Also used : MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ArrayList(java.util.ArrayList)

Example 59 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project genius by opendaylight.

the class InterfaceServiceUtil method getMatchInfoForVlanLPort.

public static List<MatchInfo> getMatchInfoForVlanLPort(BigInteger dpId, long portNo, long vlanId, boolean isVlanTransparent) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchInPort(dpId, portNo));
    if (vlanId != 0 && !isVlanTransparent) {
        matches.add(new MatchVlanVid((int) vlanId));
    }
    return matches;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchVlanVid(org.opendaylight.genius.mdsalutil.matches.MatchVlanVid) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort)

Example 60 with MatchInfo

use of org.opendaylight.genius.mdsalutil.MatchInfo in project netvirt by opendaylight.

the class ElanUtils method buildDmacRedirectToDispatcherFlow.

public static FlowEntity buildDmacRedirectToDispatcherFlow(BigInteger dpId, String dstMacAddress, String displayName, long elanTag) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
    matches.add(new MatchEthernetDestination(new MacAddress(dstMacAddress)));
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actions = new ArrayList<>();
    actions.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
    instructions.add(new InstructionApplyActions(actions));
    String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, dstMacAddress, elanTag);
    return MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 20, displayName, 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), matches, instructions);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) 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) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)117 ArrayList (java.util.ArrayList)107 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)63 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)52 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)51 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)50 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)49 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)35 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)24 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)23 BigInteger (java.math.BigInteger)22 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)18 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)15 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)15 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)11 MatchIpv4Destination (org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination)11 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)10 MatchEthernetDestination (org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination)10 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)10 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)9