Showing
1 changed file
with
217 additions
and
51 deletions
... | @@ -5,6 +5,7 @@ import org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeComplet | ... | @@ -5,6 +5,7 @@ import org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeComplet |
5 | import org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; | 5 | import org.onlab.onos.openflow.controller.driver.SwitchDriverSubHandshakeNotStarted; |
6 | import org.onlab.onos.openflow.controller.Dpid; | 6 | import org.onlab.onos.openflow.controller.Dpid; |
7 | import org.onlab.onos.openflow.controller.driver.AbstractOpenFlowSwitch; | 7 | import org.onlab.onos.openflow.controller.driver.AbstractOpenFlowSwitch; |
8 | +import org.projectfloodlight.openflow.protocol.OFBarrierRequest; | ||
8 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsReply; | 9 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsReply; |
9 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsRequest; | 10 | import org.projectfloodlight.openflow.protocol.OFCircuitPortsRequest; |
10 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; | 11 | import org.projectfloodlight.openflow.protocol.OFDescStatsReply; |
... | @@ -21,7 +22,6 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxmInPort; | ... | @@ -21,7 +22,6 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxmInPort; |
21 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigid; | 22 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigid; |
22 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic; | 23 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic; |
23 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigtype; | 24 | import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigtype; |
24 | -import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigtypeBasic; | ||
25 | import org.projectfloodlight.openflow.types.CircuitSignalID; | 25 | import org.projectfloodlight.openflow.types.CircuitSignalID; |
26 | import org.projectfloodlight.openflow.types.OFPort; | 26 | import org.projectfloodlight.openflow.types.OFPort; |
27 | import org.projectfloodlight.openflow.types.U8; | 27 | import org.projectfloodlight.openflow.types.U8; |
... | @@ -119,11 +119,12 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -119,11 +119,12 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
119 | processHandshakeOFExperimenterPortDescRequest( | 119 | processHandshakeOFExperimenterPortDescRequest( |
120 | (OFCircuitPortsReply) m); | 120 | (OFCircuitPortsReply) m); |
121 | driverHandshakeComplete.set(true); | 121 | driverHandshakeComplete.set(true); |
122 | - /* try { | 122 | + try { |
123 | testMA(); | 123 | testMA(); |
124 | + testReverseMA(); | ||
124 | } catch (IOException e) { | 125 | } catch (IOException e) { |
125 | e.printStackTrace(); | 126 | e.printStackTrace(); |
126 | - }*/ | 127 | + } |
127 | break; | 128 | break; |
128 | default: | 129 | default: |
129 | log.debug("Received message {} during switch-driver " + | 130 | log.debug("Received message {} during switch-driver " + |
... | @@ -163,22 +164,71 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -163,22 +164,71 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
163 | "message " + | 164 | "message " + |
164 | "{}", | 165 | "{}", |
165 | circuitPortsRequest.toString()); | 166 | circuitPortsRequest.toString()); |
166 | - channel.write(Collections.singletonList(circuitPortsRequest)); | 167 | + sendMsg(Collections.<OFMessage>singletonList(circuitPortsRequest)); |
167 | } | 168 | } |
168 | 169 | ||
169 | 170 | ||
170 | - | 171 | + public static final U8 SIGNAL_TYPE = U8.of((short) 10); |
171 | - //todo for testing | ||
172 | - public static final U8 SIGNAL_TYPE = U8.of((short) 1); | ||
173 | private void testMA() throws IOException { | 172 | private void testMA() throws IOException { |
174 | log.debug("LINC OE *** Testing MA "); | 173 | log.debug("LINC OE *** Testing MA "); |
175 | - short lambda = 100; | 174 | + short lambda = 1; |
176 | - if (getId() == 0x0000ffffffffff02L) { | 175 | + if (getId() == 0x0000ffffffffff01L) { |
177 | final int inport = 10; | 176 | final int inport = 10; |
178 | final int outport = 20; | 177 | final int outport = 20; |
179 | //Circuit signal id | 178 | //Circuit signal id |
180 | CircuitSignalID sigID = getSignalID(lambda); | 179 | CircuitSignalID sigID = getSignalID(lambda); |
181 | 180 | ||
181 | + OFOxmOchSigidBasic ofOxmOchSigidBasic = | ||
182 | + factory().oxms().ochSigidBasic(sigID); | ||
183 | + | ||
184 | + | ||
185 | + //Match Port | ||
186 | + OFOxmInPort fieldPort = factory().oxms() | ||
187 | + .inPort(OFPort.of(inport)); | ||
188 | + OFMatchV3 matchPort = | ||
189 | + factory() | ||
190 | + .buildMatchV3(). | ||
191 | + setOxmList(OFOxmList.of(fieldPort)).build(); | ||
192 | + | ||
193 | + | ||
194 | + // Set Action outport ,sigType and sigID | ||
195 | + List<OFAction> actionList = new ArrayList<>(); | ||
196 | + OFAction actionOutPort = | ||
197 | + factory().actions().output(OFPort.of(outport), | ||
198 | + 0xffff); | ||
199 | + | ||
200 | + OFActionCircuit actionCircuit = factory() | ||
201 | + .actions() | ||
202 | + .circuit(ofOxmOchSigidBasic); | ||
203 | + | ||
204 | + actionList.add(actionCircuit); | ||
205 | + actionList.add(actionOutPort); | ||
206 | + | ||
207 | + OFInstruction instructionAction = | ||
208 | + factory().instructions().buildApplyActions() | ||
209 | + .setActions(actionList) | ||
210 | + .build(); | ||
211 | + List<OFInstruction> instructions = | ||
212 | + Collections.singletonList(instructionAction); | ||
213 | + | ||
214 | + OFMessage opticalFlowEntry = | ||
215 | + factory().buildFlowAdd() | ||
216 | + .setMatch(matchPort) | ||
217 | + .setPriority(100) | ||
218 | + .setInstructions(instructions) | ||
219 | + .setXid(getNextTransactionId()) | ||
220 | + .build(); | ||
221 | + log.debug("Adding optical flow in sw {}", getStringId()); | ||
222 | + List<OFMessage> msglist = new ArrayList<>(1); | ||
223 | + msglist.add(opticalFlowEntry); | ||
224 | + write(msglist); | ||
225 | + sendBarrier(true); | ||
226 | + } else if (getId() == 0x0000ffffffffff03L) { | ||
227 | + final int inport = 30; | ||
228 | + final int outport = 31; | ||
229 | + //Circuit signal id | ||
230 | + CircuitSignalID sigID = getSignalID(lambda); | ||
231 | + | ||
182 | OFOxmOchSigid fieldSigIDMatch = factory().oxms().ochSigid(sigID); | 232 | OFOxmOchSigid fieldSigIDMatch = factory().oxms().ochSigid(sigID); |
183 | OFOxmOchSigtype fieldSigType = factory() | 233 | OFOxmOchSigtype fieldSigType = factory() |
184 | .oxms() | 234 | .oxms() |
... | @@ -187,8 +237,119 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -187,8 +237,119 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
187 | OFOxmOchSigidBasic ofOxmOchSigidBasic = | 237 | OFOxmOchSigidBasic ofOxmOchSigidBasic = |
188 | factory().oxms().ochSigidBasic(sigID); | 238 | factory().oxms().ochSigidBasic(sigID); |
189 | 239 | ||
190 | - OFOxmOchSigtypeBasic ofOxmOchSigtypeBasic = | 240 | + //Match Port,SigType,SigID |
191 | - factory().oxms().ochSigtypeBasic(SIGNAL_TYPE); | 241 | + OFOxmInPort fieldPort = factory() |
242 | + .oxms() | ||
243 | + .inPort(OFPort.of(inport)); | ||
244 | + OFMatchV3 matchPort = factory() | ||
245 | + .buildMatchV3() | ||
246 | + .setOxmList(OFOxmList.of(fieldPort, | ||
247 | + fieldSigIDMatch, | ||
248 | + fieldSigType | ||
249 | + )) | ||
250 | + .build(); | ||
251 | + | ||
252 | + // Set Action outport ,SigType, sigID | ||
253 | + List<OFAction> actionList = new ArrayList<>(); | ||
254 | + OFAction actionOutPort = | ||
255 | + factory().actions().output(OFPort.of(outport), | ||
256 | + 0xffff); | ||
257 | + | ||
258 | + OFActionCircuit actionCircuit = factory() | ||
259 | + .actions() | ||
260 | + .circuit(ofOxmOchSigidBasic); | ||
261 | + | ||
262 | + | ||
263 | + | ||
264 | + //actionList.add(setActionSigType); | ||
265 | + actionList.add(actionCircuit); | ||
266 | + actionList.add(actionOutPort); | ||
267 | + | ||
268 | + OFInstruction instructionAction = | ||
269 | + factory().instructions().buildApplyActions() | ||
270 | + .setActions(actionList) | ||
271 | + .build(); | ||
272 | + List<OFInstruction> instructions = | ||
273 | + Collections.singletonList(instructionAction); | ||
274 | + | ||
275 | + OFMessage opticalFlowEntry = | ||
276 | + factory().buildFlowAdd() | ||
277 | + .setMatch(matchPort) | ||
278 | + .setPriority(100) | ||
279 | + .setInstructions(instructions) | ||
280 | + .setXid(getNextTransactionId()) | ||
281 | + .build(); | ||
282 | + log.debug("Adding optical flow in sw {}", getStringId()); | ||
283 | + List<OFMessage> msglist = new ArrayList<>(1); | ||
284 | + msglist.add(opticalFlowEntry); | ||
285 | + write(msglist); | ||
286 | + sendBarrier(true); | ||
287 | + | ||
288 | + } else if (getId() == 0x0000ffffffffff02L) { | ||
289 | + final int inport = 21; | ||
290 | + final int outport = 11; | ||
291 | + //Circuit signal id | ||
292 | + CircuitSignalID sigID = getSignalID(lambda); | ||
293 | + | ||
294 | + OFOxmOchSigid fieldSigIDMatch = factory().oxms().ochSigid(sigID); | ||
295 | + OFOxmOchSigtype fieldSigType = factory() | ||
296 | + .oxms() | ||
297 | + .ochSigtype(SIGNAL_TYPE); | ||
298 | + | ||
299 | + | ||
300 | + //Match Port, sig type and sig id | ||
301 | + OFOxmInPort fieldPort = factory() | ||
302 | + .oxms() | ||
303 | + .inPort(OFPort.of(inport)); | ||
304 | + OFMatchV3 matchPort = | ||
305 | + factory().buildMatchV3() | ||
306 | + .setOxmList(OFOxmList.of(fieldPort, | ||
307 | + fieldSigIDMatch, | ||
308 | + fieldSigType | ||
309 | + )) | ||
310 | + .build(); | ||
311 | + | ||
312 | + // Set Action outport | ||
313 | + List<OFAction> actionList = new ArrayList<>(); | ||
314 | + OFAction actionOutPort = | ||
315 | + factory().actions().output(OFPort.of(outport), | ||
316 | + 0xffff); | ||
317 | + | ||
318 | + actionList.add(actionOutPort); | ||
319 | + | ||
320 | + OFInstruction instructionAction = | ||
321 | + factory().instructions().buildApplyActions() | ||
322 | + .setActions(actionList) | ||
323 | + .build(); | ||
324 | + List<OFInstruction> instructions = | ||
325 | + Collections.singletonList(instructionAction); | ||
326 | + | ||
327 | + OFMessage opticalFlowEntry = | ||
328 | + factory().buildFlowAdd() | ||
329 | + .setMatch(matchPort) | ||
330 | + .setPriority(100) | ||
331 | + .setInstructions(instructions) | ||
332 | + .setXid(getNextTransactionId()) | ||
333 | + .build(); | ||
334 | + log.debug("Adding optical flow in sw {}", getStringId()); | ||
335 | + List<OFMessage> msglist = new ArrayList<>(1); | ||
336 | + msglist.add(opticalFlowEntry); | ||
337 | + write(msglist); | ||
338 | + sendBarrier(true); | ||
339 | + } | ||
340 | + | ||
341 | + } | ||
342 | + private void testReverseMA() throws IOException { | ||
343 | + log.debug("LINC OE *** Testing MA "); | ||
344 | + short lambda = 1; | ||
345 | + if (getId() == 0x0000ffffffffff02L) { | ||
346 | + final int inport = 11; | ||
347 | + final int outport = 21; | ||
348 | + //Circuit signal id | ||
349 | + CircuitSignalID sigID = getSignalID(lambda); | ||
350 | + | ||
351 | + OFOxmOchSigidBasic ofOxmOchSigidBasic = | ||
352 | + factory().oxms().ochSigidBasic(sigID); | ||
192 | 353 | ||
193 | //Match Port | 354 | //Match Port |
194 | OFOxmInPort fieldPort = factory().oxms() | 355 | OFOxmInPort fieldPort = factory().oxms() |
... | @@ -196,27 +357,20 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -196,27 +357,20 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
196 | OFMatchV3 matchPort = | 357 | OFMatchV3 matchPort = |
197 | factory() | 358 | factory() |
198 | .buildMatchV3(). | 359 | .buildMatchV3(). |
199 | - setOxmList(OFOxmList.of(fieldPort, | 360 | + setOxmList(OFOxmList.of(fieldPort)).build(); |
200 | - fieldSigType, | ||
201 | - fieldSigIDMatch)).build(); | ||
202 | 361 | ||
203 | 362 | ||
204 | // Set Action outport ,sigType and sigID | 363 | // Set Action outport ,sigType and sigID |
205 | List<OFAction> actionList = new ArrayList<>(); | 364 | List<OFAction> actionList = new ArrayList<>(); |
206 | OFAction actionOutPort = | 365 | OFAction actionOutPort = |
207 | factory().actions().output(OFPort.of(outport), | 366 | factory().actions().output(OFPort.of(outport), |
208 | - Short.MAX_VALUE); | 367 | + 0xffff); |
209 | 368 | ||
210 | OFActionCircuit actionCircuit = factory() | 369 | OFActionCircuit actionCircuit = factory() |
211 | .actions() | 370 | .actions() |
212 | .circuit(ofOxmOchSigidBasic); | 371 | .circuit(ofOxmOchSigidBasic); |
213 | - OFActionCircuit setActionSigType = factory() | ||
214 | - .actions() | ||
215 | - .circuit(ofOxmOchSigtypeBasic); | ||
216 | - | ||
217 | - actionList.add(actionOutPort); | ||
218 | - actionList.add(setActionSigType); | ||
219 | actionList.add(actionCircuit); | 372 | actionList.add(actionCircuit); |
373 | + actionList.add(actionOutPort); | ||
220 | 374 | ||
221 | OFInstruction instructionAction = | 375 | OFInstruction instructionAction = |
222 | factory().instructions().buildApplyActions() | 376 | factory().instructions().buildApplyActions() |
... | @@ -228,6 +382,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -228,6 +382,7 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
228 | OFMessage opticalFlowEntry = | 382 | OFMessage opticalFlowEntry = |
229 | factory().buildFlowAdd() | 383 | factory().buildFlowAdd() |
230 | .setMatch(matchPort) | 384 | .setMatch(matchPort) |
385 | + .setPriority(100) | ||
231 | .setInstructions(instructions) | 386 | .setInstructions(instructions) |
232 | .setXid(getNextTransactionId()) | 387 | .setXid(getNextTransactionId()) |
233 | .build(); | 388 | .build(); |
... | @@ -235,9 +390,10 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -235,9 +390,10 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
235 | List<OFMessage> msglist = new ArrayList<>(1); | 390 | List<OFMessage> msglist = new ArrayList<>(1); |
236 | msglist.add(opticalFlowEntry); | 391 | msglist.add(opticalFlowEntry); |
237 | write(msglist); | 392 | write(msglist); |
393 | + sendBarrier(true); | ||
238 | } else if (getId() == 0x0000ffffffffff03L) { | 394 | } else if (getId() == 0x0000ffffffffff03L) { |
239 | - final int inport = 21; | 395 | + final int inport = 31; |
240 | - final int outport = 22; | 396 | + final int outport = 30; |
241 | //Circuit signal id | 397 | //Circuit signal id |
242 | CircuitSignalID sigID = getSignalID(lambda); | 398 | CircuitSignalID sigID = getSignalID(lambda); |
243 | 399 | ||
... | @@ -249,9 +405,6 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -249,9 +405,6 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
249 | OFOxmOchSigidBasic ofOxmOchSigidBasic = | 405 | OFOxmOchSigidBasic ofOxmOchSigidBasic = |
250 | factory().oxms().ochSigidBasic(sigID); | 406 | factory().oxms().ochSigidBasic(sigID); |
251 | 407 | ||
252 | - OFOxmOchSigtypeBasic ofOxmOchSigtypeBasic = | ||
253 | - factory().oxms().ochSigtypeBasic(SIGNAL_TYPE); | ||
254 | - | ||
255 | //Match Port,SigType,SigID | 408 | //Match Port,SigType,SigID |
256 | OFOxmInPort fieldPort = factory() | 409 | OFOxmInPort fieldPort = factory() |
257 | .oxms() | 410 | .oxms() |
... | @@ -259,27 +412,22 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -259,27 +412,22 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
259 | OFMatchV3 matchPort = factory() | 412 | OFMatchV3 matchPort = factory() |
260 | .buildMatchV3() | 413 | .buildMatchV3() |
261 | .setOxmList(OFOxmList.of(fieldPort, | 414 | .setOxmList(OFOxmList.of(fieldPort, |
262 | - fieldSigType, | 415 | + fieldSigIDMatch, |
263 | - fieldSigIDMatch)) | 416 | + fieldSigType |
417 | + )) | ||
264 | .build(); | 418 | .build(); |
265 | 419 | ||
266 | // Set Action outport ,SigType, sigID | 420 | // Set Action outport ,SigType, sigID |
267 | List<OFAction> actionList = new ArrayList<>(); | 421 | List<OFAction> actionList = new ArrayList<>(); |
268 | OFAction actionOutPort = | 422 | OFAction actionOutPort = |
269 | factory().actions().output(OFPort.of(outport), | 423 | factory().actions().output(OFPort.of(outport), |
270 | - Short.MAX_VALUE); | 424 | + 0xffff); |
271 | - | ||
272 | - OFActionCircuit setActionSigType = factory() | ||
273 | - .actions() | ||
274 | - .circuit(ofOxmOchSigtypeBasic); | ||
275 | OFActionCircuit actionCircuit = factory() | 425 | OFActionCircuit actionCircuit = factory() |
276 | .actions() | 426 | .actions() |
277 | .circuit(ofOxmOchSigidBasic); | 427 | .circuit(ofOxmOchSigidBasic); |
278 | 428 | ||
279 | - | ||
280 | - actionList.add(actionOutPort); | ||
281 | - actionList.add(setActionSigType); | ||
282 | actionList.add(actionCircuit); | 429 | actionList.add(actionCircuit); |
430 | + actionList.add(actionOutPort); | ||
283 | 431 | ||
284 | OFInstruction instructionAction = | 432 | OFInstruction instructionAction = |
285 | factory().instructions().buildApplyActions() | 433 | factory().instructions().buildApplyActions() |
... | @@ -290,18 +438,20 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -290,18 +438,20 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
290 | 438 | ||
291 | OFMessage opticalFlowEntry = | 439 | OFMessage opticalFlowEntry = |
292 | factory().buildFlowAdd() | 440 | factory().buildFlowAdd() |
293 | - .setMatch(matchPort) | 441 | + .setMatch(matchPort) |
294 | - .setInstructions(instructions) | 442 | + .setPriority(100) |
295 | - .setXid(getNextTransactionId()) | 443 | + .setInstructions(instructions) |
296 | - .build(); | 444 | + .setXid(getNextTransactionId()) |
445 | + .build(); | ||
297 | log.debug("Adding optical flow in sw {}", getStringId()); | 446 | log.debug("Adding optical flow in sw {}", getStringId()); |
298 | List<OFMessage> msglist = new ArrayList<>(1); | 447 | List<OFMessage> msglist = new ArrayList<>(1); |
299 | msglist.add(opticalFlowEntry); | 448 | msglist.add(opticalFlowEntry); |
300 | write(msglist); | 449 | write(msglist); |
450 | + sendBarrier(true); | ||
301 | 451 | ||
302 | - } else if (getId() == 0x0000ffffffffff04L) { | 452 | + } else if (getId() == 0x0000ffffffffff01L) { |
303 | - final int inport = 23; | 453 | + final int inport = 20; |
304 | - final int outport = 11; | 454 | + final int outport = 10; |
305 | //Circuit signal id | 455 | //Circuit signal id |
306 | CircuitSignalID sigID = getSignalID(lambda); | 456 | CircuitSignalID sigID = getSignalID(lambda); |
307 | 457 | ||
... | @@ -318,15 +468,16 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -318,15 +468,16 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
318 | OFMatchV3 matchPort = | 468 | OFMatchV3 matchPort = |
319 | factory().buildMatchV3() | 469 | factory().buildMatchV3() |
320 | .setOxmList(OFOxmList.of(fieldPort, | 470 | .setOxmList(OFOxmList.of(fieldPort, |
321 | - fieldSigType, | 471 | + fieldSigIDMatch, |
322 | - fieldSigIDMatch)) | 472 | + fieldSigType |
473 | + )) | ||
323 | .build(); | 474 | .build(); |
324 | 475 | ||
325 | // Set Action outport | 476 | // Set Action outport |
326 | List<OFAction> actionList = new ArrayList<>(); | 477 | List<OFAction> actionList = new ArrayList<>(); |
327 | OFAction actionOutPort = | 478 | OFAction actionOutPort = |
328 | factory().actions().output(OFPort.of(outport), | 479 | factory().actions().output(OFPort.of(outport), |
329 | - Short.MAX_VALUE); | 480 | + 0xffff); |
330 | 481 | ||
331 | actionList.add(actionOutPort); | 482 | actionList.add(actionOutPort); |
332 | 483 | ||
... | @@ -339,18 +490,21 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -339,18 +490,21 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
339 | 490 | ||
340 | OFMessage opticalFlowEntry = | 491 | OFMessage opticalFlowEntry = |
341 | factory().buildFlowAdd() | 492 | factory().buildFlowAdd() |
342 | - .setMatch(matchPort) | 493 | + .setMatch(matchPort) |
343 | - .setInstructions(instructions) | 494 | + .setPriority(100) |
344 | - .setXid(getNextTransactionId()) | 495 | + .setInstructions(instructions) |
345 | - .build(); | 496 | + .setXid(getNextTransactionId()) |
497 | + .build(); | ||
346 | log.debug("Adding optical flow in sw {}", getStringId()); | 498 | log.debug("Adding optical flow in sw {}", getStringId()); |
347 | List<OFMessage> msglist = new ArrayList<>(1); | 499 | List<OFMessage> msglist = new ArrayList<>(1); |
348 | msglist.add(opticalFlowEntry); | 500 | msglist.add(opticalFlowEntry); |
349 | write(msglist); | 501 | write(msglist); |
502 | + sendBarrier(true); | ||
350 | } | 503 | } |
351 | 504 | ||
352 | } | 505 | } |
353 | 506 | ||
507 | + | ||
354 | // Todo remove - for testing purpose only | 508 | // Todo remove - for testing purpose only |
355 | private static CircuitSignalID getSignalID(short lambda) { | 509 | private static CircuitSignalID getSignalID(short lambda) { |
356 | byte myGrid = 1; | 510 | byte myGrid = 1; |
... | @@ -365,9 +519,21 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { | ... | @@ -365,9 +519,21 @@ public class OFOpticalSwitchImplLINC13 extends AbstractOpenFlowSwitch { |
365 | return signalID; | 519 | return signalID; |
366 | } | 520 | } |
367 | 521 | ||
522 | + private void sendBarrier(boolean finalBarrier) throws IOException { | ||
523 | + int xid = getNextTransactionId(); | ||
524 | + if (finalBarrier) { | ||
525 | + barrierXidToWaitFor = xid; | ||
526 | + } | ||
527 | + OFBarrierRequest br = factory() | ||
528 | + .buildBarrierRequest() | ||
529 | + .setXid(xid) | ||
530 | + .build(); | ||
531 | + sendMsg(br); | ||
532 | + } | ||
533 | + | ||
368 | @Override | 534 | @Override |
369 | public void write(OFMessage msg) { | 535 | public void write(OFMessage msg) { |
370 | - this.channel.write(msg); | 536 | + this.sendMsg(msg); |
371 | } | 537 | } |
372 | 538 | ||
373 | @Override | 539 | @Override | ... | ... |
-
Please register or login to post a comment