16 package org.openkilda.floodlight.test.standard;
18 import static java.util.Collections.singletonList;
23 import net.floodlightcontroller.util.FlowModUtils;
24 import org.projectfloodlight.openflow.protocol.OFFlowAdd;
25 import org.projectfloodlight.openflow.protocol.match.MatchField;
26 import org.projectfloodlight.openflow.types.EthType;
27 import org.projectfloodlight.openflow.types.OFBufferId;
28 import org.projectfloodlight.openflow.types.OFPort;
29 import org.projectfloodlight.openflow.types.OFVlanVidMatch;
30 import org.projectfloodlight.openflow.types.U64;
32 import java.util.Arrays;
41 long meterId,
long cookie) {
43 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
44 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
45 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
46 .setBufferId(OFBufferId.NO_BUFFER)
47 .setPriority(DEFAULT_RULE_PRIORITY)
49 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
50 .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
52 .setInstructions(Arrays.asList(
53 ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
54 ofFactory.instructions().applyActions(Arrays.asList(
56 .setEthertype(EthType.of(ETH_TYPE))
60 .setValue(OFVlanVidMatch.ofVlan(transitVlan))
64 .setMaxLen(0xFFFFFFFF)
65 .setPort(OFPort.of(outputPort))
76 long meterId,
long cookie) {
78 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
79 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
80 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
81 .setBufferId(OFBufferId.NO_BUFFER)
82 .setPriority(DEFAULT_RULE_PRIORITY)
84 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
86 .setInstructions(Arrays.asList(
87 ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
88 ofFactory.instructions().applyActions(Arrays.asList(
90 .setEthertype(EthType.of(ETH_TYPE))
94 .setValue(OFVlanVidMatch.ofVlan(transitVlan))
98 .setMaxLen(0xFFFFFFFF)
99 .setPort(OFPort.of(outputPort))
109 public OFFlowAdd
egressPushFlowMod(
int inputPort,
int outputPort,
int transitVlan,
int outputVlan,
long cookie) {
111 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
112 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
113 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
114 .setBufferId(OFBufferId.NO_BUFFER)
115 .setPriority(DEFAULT_RULE_PRIORITY)
117 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
118 .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
120 .setInstructions(singletonList(
121 ofFactory.instructions().applyActions(Arrays.asList(
124 .setEthertype(EthType.of(ETH_TYPE))
127 .setField(
ofFactory.oxms().buildVlanVid()
128 .setValue(OFVlanVidMatch.ofVlan(outputVlan))
132 .setMaxLen(0xFFFFFFFF)
133 .setPort(OFPort.of(outputPort))
142 public OFFlowAdd
egressPopFlowMod(
int inputPort,
int outputPort,
int transitVlan,
long cookie) {
144 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
145 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
146 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
147 .setBufferId(OFBufferId.NO_BUFFER)
148 .setPriority(DEFAULT_RULE_PRIORITY)
150 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
151 .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
153 .setInstructions(singletonList(
154 ofFactory.instructions().applyActions(Arrays.asList(
158 .setMaxLen(0xFFFFFFFF)
159 .setPort(OFPort.of(outputPort))
168 public OFFlowAdd
egressNoneFlowMod(
int inputPort,
int outputPort,
int transitVlan,
long cookie) {
170 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
171 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
172 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
173 .setBufferId(OFBufferId.NO_BUFFER)
174 .setPriority(DEFAULT_RULE_PRIORITY)
176 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
177 .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
179 .setInstructions(singletonList(
180 ofFactory.instructions().applyActions(Arrays.asList(
183 .setMaxLen(0xFFFFFFFF)
184 .setPort(OFPort.of(outputPort))
193 public OFFlowAdd
egressReplaceFlowMod(
int inputPort,
int outputPort,
int inputVlan,
int outputVlan,
long cookie) {
195 .setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
196 .setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
197 .setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
198 .setBufferId(OFBufferId.NO_BUFFER)
199 .setPriority(DEFAULT_RULE_PRIORITY)
201 .setExact(MatchField.IN_PORT, OFPort.of(inputPort))
202 .setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
204 .setInstructions(singletonList(
205 ofFactory.instructions().applyActions(Arrays.asList(
208 .setField(
ofFactory.oxms().buildVlanVid()
209 .setValue(OFVlanVidMatch.ofVlan(outputVlan))
213 .setMaxLen(0xFFFFFFFF)
214 .setPort(OFPort.of(outputPort))
OFFlowAdd egressPopFlowMod(int inputPort, int outputPort, int transitVlan, long cookie)
OFFlowAdd ingressMatchVlanIdFlowMod(int inputPort, int outputPort, int inputVlan, int transitVlan, long meterId, long cookie)
static final int ETH_TYPE
static final int DEFAULT_RULE_PRIORITY
OFFlowAdd egressReplaceFlowMod(int inputPort, int outputPort, int inputVlan, int outputVlan, long cookie)
OFFlowAdd egressNoneFlowMod(int inputPort, int outputPort, int transitVlan, long cookie)
OFFlowAdd egressPushFlowMod(int inputPort, int outputPort, int transitVlan, int outputVlan, long cookie)
OFFlowAdd ingressNoMatchVlanIdFlowMod(int inputPort, int outputPort, int transitVlan, long meterId, long cookie)
static final long FLOW_COOKIE_MASK