import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
// Convert the AddFlowInput to FlowModInput
FlowModInput ofFlowModInput = FlowConvertor.toFlowModInput(input, version);
+ BarrierInputBuilder barrierInput = new BarrierInputBuilder();
+ barrierInput.setVersion(version);
// For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
// the request can be routed through any connection to the switch
SwitchConnectionDistinguisher cookie = null ;
+ if (input.isBarrier()) {
+ Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
+ }
LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput, cookie) ;
public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
// Convert the RemoveFlowInput to FlowModInput
FlowModInput ofFlowModInput = FlowConvertor.toFlowModInput(input, version);
-
+ BarrierInputBuilder barrierInput = new BarrierInputBuilder();
+ barrierInput.setVersion(version);
// For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
// the request can be routed through any connection to the switch
SwitchConnectionDistinguisher cookie = null ;
-
+ if (input.isBarrier()) {
+ Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
+ }
+
LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput, cookie) ;
public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
// Convert the UpdateFlowInput to FlowModInput
FlowModInput ofFlowModInput = FlowConvertor.toFlowModInput(input.getUpdatedFlow(), version);
-
+ BarrierInputBuilder barrierInput = new BarrierInputBuilder();
+ barrierInput.setVersion(version);
// Call the RPC method on MessageDispatchService
// For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
// the request can be routed through any connection to the switch
SwitchConnectionDistinguisher cookie = null ;
-
+ if (input.getUpdatedFlow().isBarrier()) {
+ Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
+ }
+
LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput, cookie) ;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
@Override
public Future<RpcResult<BarrierOutput>> barrier(BarrierInput input, SwitchConnectionDistinguisher cookie) {
- return getConnectionAdapter(cookie).barrier(input);
+ Long Xid = session.getNextXid();
+ BarrierInputBuilder inputBuilder = new BarrierInputBuilder(input);
+ inputBuilder.setXid(Xid);
+ return getConnectionAdapter(cookie).barrier(inputBuilder.build());
}
@Override
import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
*/
@Test
public void testBarrierMessageForPrimary() throws Exception {
- session.getMessageDispatchService().barrier(null, null);
+ MockConnectionConductor conductor = new MockConnectionConductor(1);
+ SwitchConnectionDistinguisher cookie = conductor.getAuxiliaryKey();
+ BarrierInputBuilder barrierMsg = new BarrierInputBuilder();
+ session.getMessageDispatchService().barrier(barrierMsg.build(), cookie);
Assert.assertEquals(MessageType.BARRIER, session.getPrimaryConductor().getMessageType());
}