X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FFlowProgrammerService.java;fp=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FFlowProgrammerService.java;h=96ea6cd14f9612aa80a328faab5b1160277ec0e7;hb=1bad1b7ca9a87f9e1d32cfcf5a181354fc378ad4;hp=0dd0ca736b8962335272bc540532be1dbc1f7f0e;hpb=9fab620d933bab1ddf7eef39087fa515e6d0c988;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java index 0dd0ca736b..96ea6cd14f 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java @@ -324,7 +324,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, @Override public Status removeAllFlows(Node node) { - return new Status(StatusCode.SUCCESS, null); + return new Status(StatusCode.SUCCESS); } private String errorString(String phase, String action, String cause) { @@ -445,7 +445,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, } @Override - public Status sendBarrierMessage(Node node) { + public Status syncSendBarrierMessage(Node node) { if (!node.getType().equals(NodeIDType.OPENFLOW)) { return new Status(StatusCode.NOTACCEPTABLE, "The node does not support Barrier message."); @@ -455,9 +455,32 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, long swid = (Long) node.getID(); ISwitch sw = controller.getSwitch(swid); if (sw != null) { - sw.sendBarrierMessage(); + sw.syncSendBarrierMessage(); clearXid2Rid(swid); - return (new Status(StatusCode.SUCCESS, null)); + return (new Status(StatusCode.SUCCESS)); + } else { + return new Status(StatusCode.GONE, + "The node does not have a valid Switch reference."); + } + } + return new Status(StatusCode.INTERNALERROR, + "Failed to send Barrier message."); + } + + @Override + public Status asyncSendBarrierMessage(Node node) { + if (!node.getType().equals(NodeIDType.OPENFLOW)) { + return new Status(StatusCode.NOTACCEPTABLE, + "The node does not support Barrier message."); + } + + if (controller != null) { + long swid = (Long) node.getID(); + ISwitch sw = controller.getSwitch(swid); + if (sw != null) { + sw.asyncSendBarrierMessage(); + clearXid2Rid(swid); + return (new Status(StatusCode.SUCCESS)); } else { return new Status(StatusCode.GONE, "The node does not have a valid Switch reference."); @@ -499,7 +522,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService, int size = swxid2rid.size(); if (size % barrierMessagePriorCount == 0) { - result = sendBarrierMessage(node); + result = asyncSendBarrierMessage(node); } return result;