2 * Copyright (c) 2014, 2017 Ericsson Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.sfc.ofrenderer.openflow;
11 import java.util.List;
13 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.sfc.genius.util.appcoexistence.SfcTableIndexMapper;
15 import org.opendaylight.sfc.ofrenderer.sfg.GroupBucketInfo;
16 import org.opendaylight.sfc.util.openflow.writer.SfcOfFlowWriterInterface;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
23 * An interface to be implemented by concrete classes that will write to
24 * OpenFlow or OVS switches.
29 public interface SfcOfFlowProgrammerInterface {
31 void shutdown() throws ExecutionException, InterruptedException;
33 // These table methods are used for app-coexistence
37 void setTableBase(short tableBase);
39 short getMaxTableOffset();
41 short getTableEgress();
43 void setTableEgress(short tableEgress);
45 // Set the RSP Id that subsequent flow creations belong to
46 void setFlowRspId(Long rspId);
49 * Deletes all flows created for a particular RSP and removes initialization
50 * flows from SFFs if the last RSP was removed.
53 * the id of the RSP to be deleted
55 * @return Node IDs from which initialization flows were removed.
57 Set<NodeId> deleteRspFlows(long rspId);
59 // Write any buffered flows to the data store
62 // Purge any unwritten flows not written yet. This should be called upon
63 // errors, when the remaining buffered flows should not be written.
66 // Set FlowWriter implementation
67 void setFlowWriter(SfcOfFlowWriterInterface sfcOfFlowWriter);
70 // Configure Table 1, Transport Ingress
72 void configureIpv4TransportIngressFlow(String sffNodeName);
74 void configureVlanTransportIngressFlow(String sffNodeName);
76 void configureMacChainingTransportIngressFlow(String sffNodeName);
78 // These 2 are work-around flows until the OVS NSH patch is completed
79 void configureNshVxgpeSfLoopbackEncapsulatedEgressFlow(String sffNodeName, String sfIp, short vxlanUdpPort,
82 void configureNshVxgpeSfReturnLoopbackIngressFlow(String sffNodeName, short vxlanUdpPort, long sffPort);
84 void configureNshVxgpeTransportIngressFlow(String sffNodeName, long nshNsp, short nshNsi);
86 void configureMplsTransportIngressFlow(String sffNodeName);
88 void configureArpTransportIngressFlow(String sffNodeName, String mac);
91 // Configure Table 2, Path Mapper
93 void configureMplsPathMapperFlow(String sffNodeName, long label, long pathId, boolean isSf);
95 void configureVlanPathMapperFlow(String sffNodeName, int vlan, long pathId, boolean isSf);
96 // PathMapper not needed for NshVxgpe NSH
97 // configureNshVxgpePathMapperFlow()
102 void configureMacNextHopFlow(String sffNodeName, long sfpId, String srcMac, String dstMac);
104 void configureGroupNextHopFlow(String sffNodeName, long sfpId, String srcMac, long groupId, String groupName);
106 void configureMacChainingNextHopFlow(String sffNodeName, String vmac, String dstSfMac,
107 String nextVMac, boolean l2Tranparent);
110 void configureNshVxgpeNextHopFlow(String sffNodeName, String dstIp, String nshProxyIp, long nsp, short nsi);
113 * Configure nsh next hop flow.
116 * The openflow node name
118 * MAC address used by the openflow port to which the SF is
121 * MAC address used by the SF
127 void configureNshEthNextHopFlow(String sffNodeName, String srcMac, String dstMac, long nsp, short nsi);
130 // Table 10, Transport Egress
132 void configureVlanSfTransportEgressFlow(String sffNodeName, String srcMac, String dstMac, int dstVlan, String port,
133 long pathId, boolean doPktin);
135 void configureVlanTransportEgressFlow(String sffNodeName, String srcMac, String dstMac, int dstVlan, String port,
138 void configureMacChainingSfTransportEgressFlow(String sffNodeName, String dstMac, String port, String vmac);
140 void configureVlanLastHopTransportEgressFlow(String sffNodeName, String srcMac, String dstMac, int dstVlan,
141 String port, long pathId);
143 void configureMplsTransportEgressFlow(String sffNodeName, String srcMac, String dstMac, long mplsLabel, String port,
146 void configureMplsLastHopTransportEgressFlow(String sffNodeName, String srcMac, String dstMac, long mplsLabel,
147 String port, long pathId);
149 void configureNshVxgpeTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String port);
151 void configureNshVxgpeAppCoexistTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String sffIp);
153 void configureNshVxgpeLastHopTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String port);
155 void configureNshNscTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String switchPort);
158 * Configure transport egress flows, using a list of externally provided
161 * @param sffOpenFlowNodeName
162 * The openflow identifier for the node on which the flows are to
165 * NSP to use in the match part
167 * NSI to use in the match part
169 * List of actions to use in the actions part
171 * A unique flow name, also used as a flow key
173 void configureNshEthTransportEgressFlow(String sffOpenFlowNodeName, long nshNsp, short nshNsi,
174 List<Action> actionList, String flowName);
176 void configureNshEthTransportEgressFlow(String sffNodeName, long nshNsp, short nshNsi, String port);
179 // Configure the MatchAny entry specifying if it should drop or goto the
181 // Classifier MatchAny will go to Ingress
182 // TransportIngress MatchAny will go to PathMapper
183 // PathMapper MatchAny will go to PathMapperAcl
184 // PathMapperAcl MatchAny will go to NextHop
185 // NextHop MatchAny will go to TransportEgress
187 void configureClassifierTableMatchAny(String sffNodeName);
189 void configureTransportIngressTableMatchAny(String sffNodeName);
191 void configureTransportIngressTableMatchAnyResubmit(String sffNodeName, short nextTableId);
193 void configurePathMapperTableMatchAny(String sffNodeName);
195 void configurePathMapperAclTableMatchAny(String sffNodeName);
197 void configureNextHopTableMatchAny(String sffNodeName);
199 void configureTransportEgressTableMatchAny(String sffNodeName);
202 * Set the match any flow in the Transport Egress table to resubmit.
205 * - the SFF to write the flow to
207 * - the table to resubmit
209 void configureTransportEgressTableMatchAnyResubmit(String sffNodeName, short nextTableId);
211 /* OVS DPDK only, these APIs will add extra flows for OVS DPDK */
212 void configureClassifierTableDpdkOutput(String sffNodeName, Long outPort);
214 void configureClassifierTableDpdkInput(String sffNodeName, Long inPort);
216 // group configuration
217 void configureGroup(String sffNodeName, String openflowNodeId, String sfgName, long sfgId, int groupType,
218 List<GroupBucketInfo> bucketInfos, boolean isAddGroup);
221 * Used by logical sff processor in order to write chain egress flows.
222 * The sff ip address is optional, if not provided it is assumed that
223 * the sff has no dataplane tunnel endpoints.
226 * last openflow node in the chain
227 * @param sffIpAddress
229 * @param sfMacAddress
230 * the last sf mac address
236 void configureNshEthLastHopTransportEgressFlow(String sffNodeName, IpAddress sffIpAddress,
237 MacAddress sfMacAddress, long nshNsp, short nshNsi);
240 * Setter for the table index mapper (class which provides the tables to use
241 * for Genius-based application coexistence).
243 * @param tableIndexMapper
244 * The table index mapper
246 void setTableIndexMapper(SfcTableIndexMapper tableIndexMapper);