Search in sources :

Example 56 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Provider method createIngressClassifierFilterChainEgressFlow.

/*
     * Classifier chain termination flow:
     *     Handle packets at the end of the chain
     *     Match C1 on local IP, NSP and ending NSI, restore metadata and
     *     resubmit to egress dispatcher
     */
public Flow createIngressClassifierFilterChainEgressFlow(NodeId nodeId, long nsp, short egressNsi) {
    MatchBuilder match = new MatchBuilder();
    OpenFlow13Utils.addMatchNsp(match, nsp);
    OpenFlow13Utils.addMatchNsi(match, egressNsi);
    List<Action> actionList = new ArrayList<>();
    actionList.add(OpenFlow13Utils.createActionNxMoveNsc4ToReg6Register(actionList.size()));
    actionList.add(OpenFlow13Utils.createActionNxPopNsh(actionList.size()));
    actionList.add(OpenFlow13Utils.createActionResubmitTable(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, actionList.size()));
    InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
    String flowIdStr = INGRESS_CLASSIFIER_FILTER_NSH_CHAIN_EGRESS_FLOW_NAME + nodeId.getValue() + "_" + nsp;
    return OpenFlow13Utils.createFlowBuilder(NwConstants.INGRESS_SFC_CLASSIFIER_FILTER_TABLE, INGRESS_CLASSIFIER_FILTER_CHAIN_EGRESS_PRIORITY, INGRESS_CLASSIFIER_FILTER_COOKIE, INGRESS_CLASSIFIER_FILTER_NSH_CHAIN_EGRESS_FLOW_NAME, flowIdStr, match, isb).build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)

Example 57 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Provider method createIngressClassifierSfcTunnelTrafficCaptureFlow.

/*
     * Ingress Classifier SFC Tunnel Traffic Capture Flow
     *     Captures SFC traffic coming from tunnel port and redirects it
     *     to the ingress classifier pipeline. From there, if no chain
     *     egress actions apply, it will be sent back to SFC pipeline.
     *     Match on SFC VNI = 0 and ethertype = nsh, and resubmit to
     *     ingress classifier.
     */
public Flow createIngressClassifierSfcTunnelTrafficCaptureFlow(NodeId nodeId) {
    MatchBuilder match = new MatchBuilder();
    OpenFlow13Utils.addMatchTunId(match, SFC_TUNNEL_ID);
    OpenFlow13Utils.addMatchEthNsh(match);
    List<Action> actionList = new ArrayList<>();
    actionList.add(OpenFlow13Utils.createActionResubmitTable(NwConstants.INGRESS_SFC_CLASSIFIER_FILTER_TABLE, actionList.size()));
    InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
    String flowIdStr = INGRESS_CLASSIFIER_CAPTURE_SFC_TUNNEL_TRAFFIC_FLOW_NAME + nodeId.getValue();
    return OpenFlow13Utils.createFlowBuilder(NwConstants.INTERNAL_TUNNEL_TABLE, INGRESS_CLASSIFIER_CAPTURE_SFC_TUNNEL_TRAFFIC_PRIORITY, INGRESS_CLASSIFIER_CAPTURE_SFC_TUNNEL_TRAFFIC_COOKIE, INGRESS_CLASSIFIER_CAPTURE_SFC_TUNNEL_TRAFFIC_FLOW_NAME, flowIdStr, match, isb).build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)

Example 58 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Provider method createEgressClassifierFilterNoNshFlow.

/*
     * Egress Classifier Filter No NSH flow:
     *     Only allows NSH packets to proceed in the egress classifier
     *     MatchAny (NSH not present), Resubmit to Egress Dispatcher
     *     since the packet is not for SFC
     */
public Flow createEgressClassifierFilterNoNshFlow(NodeId nodeId) {
    MatchBuilder match = new MatchBuilder();
    List<Action> actionList = new ArrayList<>();
    actionList.add(OpenFlow13Utils.createActionResubmitTable(NwConstants.EGRESS_LPORT_DISPATCHER_TABLE, actionList.size()));
    InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
    String flowIdStr = EGRESS_CLASSIFIER_FILTER_NONSH_FLOW_NAME + nodeId.getValue();
    return OpenFlow13Utils.createFlowBuilder(NwConstants.EGRESS_SFC_CLASSIFIER_FILTER_TABLE, EGRESS_CLASSIFIER_FILTER_NONSH_PRIORITY, EGRESS_CLASSIFIER_FILTER_COOKIE, EGRESS_CLASSIFIER_FILTER_NONSH_FLOW_NAME, flowIdStr, match, isb).build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)

Example 59 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class OpenFlow13Provider method createIngressClassifierFilterEthNshFlow.

/*
     * Ingress Classifier Filter Eth NSH flow:
     *     Only allows Non-NSH packets to proceed in the classifier
     *     Match on ethertype and null tunnel IP and resubmit to
     *     Ingress Dispatcher on match
     */
public Flow createIngressClassifierFilterEthNshFlow(NodeId nodeId) {
    MatchBuilder match = new MatchBuilder();
    OpenFlow13Utils.addMatchEthNsh(match);
    OpenFlow13Utils.addMatchTunDstIp(match, NULL_IP);
    List<Action> actionList = new ArrayList<>();
    actionList.add(OpenFlow13Utils.createActionResubmitTable(NwConstants.LPORT_DISPATCHER_TABLE, actionList.size()));
    InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
    String flowIdStr = INGRESS_CLASSIFIER_FILTER_ETHNSH_FLOW_NAME + nodeId.getValue();
    return OpenFlow13Utils.createFlowBuilder(NwConstants.INGRESS_SFC_CLASSIFIER_FILTER_TABLE, INGRESS_CLASSIFIER_FILTER_ETH_NSH_PRIORITY, INGRESS_CLASSIFIER_FILTER_COOKIE, INGRESS_CLASSIFIER_FILTER_ETHNSH_FLOW_NAME, flowIdStr, match, isb).build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ArrayList(java.util.ArrayList) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)

Example 60 with Action

use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.

the class ConfigurationClassifierImpl method getEntriesForAce.

private Set<ClassifierRenderableEntry> getEntriesForAce(Ace ace) {
    String ruleName = ace.getRuleName();
    LOG.debug("Generating classifier entries for Ace: {}", ruleName);
    LOG.trace("Ace details: {}", ace);
    Optional<NetvirtsfcAclActions> sfcActions = Optional.ofNullable(ace.getActions()).map(actions -> actions.getAugmentation(RedirectToSfc.class));
    String rspName = sfcActions.map(NetvirtsfcAclActions::getRspName).map(Strings::emptyToNull).orElse(null);
    String sfpName = sfcActions.map(NetvirtsfcAclActions::getSfpName).map(Strings::emptyToNull).orElse(null);
    if (rspName == null && sfpName == null) {
        LOG.debug("Ace {} ignored: no valid SFC redirect action", ruleName);
        return Collections.emptySet();
    }
    if (rspName != null && sfpName != null) {
        LOG.warn("Ace {} ignored: both SFP and a RSP as redirect actions not supported", ruleName);
        return Collections.emptySet();
    }
    Matches matches = ace.getMatches();
    if (matches == null) {
        LOG.warn("Ace {} ignored: no matches", ruleName);
        return Collections.emptySet();
    }
    NeutronNetwork network = matches.getAugmentation(NeutronNetwork.class);
    if (sfpName != null && network != null) {
        LOG.warn("Ace {} ignored: SFP redirect action with neutron network match not supported", ruleName);
        return Collections.emptySet();
    }
    String sourcePort = Optional.ofNullable(matches.getAugmentation(NeutronPorts.class)).map(NeutronPorts::getSourcePortUuid).map(Strings::emptyToNull).orElse(null);
    String destinationPort = Optional.ofNullable(matches.getAugmentation(NeutronPorts.class)).map(NeutronPorts::getDestinationPortUuid).map(Strings::emptyToNull).orElse(null);
    if (rspName != null) {
        return getEntriesForRspRedirect(ruleName, sourcePort, destinationPort, network, rspName, matches);
    }
    return getEntriesForSfpRedirect(ruleName, sourcePort, destinationPort, sfpName, matches);
}
Also used : NetvirtsfcAclActions(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NetvirtsfcAclActions) NeutronNetwork(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NeutronNetwork) Matches(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.Matches) AclMatches(org.opendaylight.netvirt.sfc.classifier.utils.AclMatches) RedirectToSfc(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.RedirectToSfc) NeutronPorts(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.sfc.acl.rev150105.NeutronPorts)

Aggregations

ArrayList (java.util.ArrayList)245 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)204 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)176 Test (org.junit.Test)127 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)127 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)126 PushMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder)121 PushPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder)121 PopVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder)110 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)108 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)107 PopMplsActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder)105 PopPbbActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder)105 PushVlanActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder)105 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)105 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)98 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)98 ActionKey (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey)97 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)97 ApplyActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)96