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%2FReadService.java;fp=opendaylight%2Fprotocol_plugins%2Fopenflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fprotocol_plugin%2Fopenflow%2Finternal%2FReadService.java;h=84f7dd9282ca89cc67eb160a6465712c2b489d8b;hb=850d5b748e96c2667bb95ce423bdb00083838619;hp=585e4f32c46d83b1edbe758ad2b635655639dcc8;hpb=2d36fc2f0b7691efe2f641beacd146c260676fea;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java index 585e4f32c4..84f7dd9282 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadService.java @@ -17,6 +17,7 @@ import java.util.concurrent.CopyOnWriteArraySet; import org.apache.felix.dm.Component; import org.opendaylight.controller.protocol_plugin.openflow.IReadFilterInternalListener; import org.opendaylight.controller.protocol_plugin.openflow.IReadServiceFilter; +import org.opendaylight.controller.sal.connection.IPluginOutConnectionService; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.Node.NodeIDType; import org.opendaylight.controller.sal.core.NodeConnector; @@ -40,6 +41,7 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis private IReadServiceFilter filter; private Set pluginOutReadServices; private String containerName; + private IPluginOutConnectionService connectionOutService; /** * Function called by the dependency manager when all the required @@ -110,6 +112,10 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis return null; } + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for the node : " + node); + return null; + } return filter.readFlow(containerName, node, flow, cached); } @@ -120,6 +126,11 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis return null; } + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for the node : " + node); + return null; + } + return filter.readAllFlow(containerName, node, cached); } @@ -130,6 +141,11 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis return null; } + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for the node : " + node); + return null; + } + return filter.readDescription(node, cached); } @@ -141,6 +157,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis logger.error("Invalid node type"); return null; } + + if (!connectionOutService.isLocal(connector.getNode())) { + logger.debug("This Controller is not the master for connector : "+connector); + return null; + } + return filter.readNodeConnector(containerName, connector, cached); } @@ -152,6 +174,11 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis return null; } + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return null; + } + return filter.readAllNodeConnector(containerName, node, cached); } @@ -162,6 +189,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis logger.error("Invalid node type"); return 0; } + + if (!connectionOutService.isLocal(connector.getNode())) { + logger.debug("This Controller is not the master for connector : "+connector); + return 0; + } + return filter.getTransmitRate(containerName, connector); } @@ -172,6 +205,12 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis logger.error("Invalid node type"); return null; } + + if (!connectionOutService.isLocal(table.getNode())) { + logger.debug("This Controller is not the master for connector : "+table); + return null; + } + return filter.readNodeTable(containerName, table, cached); } @@ -182,11 +221,20 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis return null; } + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return null; + } + return filter.readAllNodeTable(containerName, node, cached); } @Override public void nodeFlowStatisticsUpdated(Node node, List flowStatsList) { + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return; + } for (IPluginOutReadService service : pluginOutReadServices) { service.nodeFlowStatisticsUpdated(node, flowStatsList); } @@ -194,6 +242,10 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis @Override public void nodeConnectorStatisticsUpdated(Node node, List ncStatsList) { + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return; + } for (IPluginOutReadService service : pluginOutReadServices) { service.nodeConnectorStatisticsUpdated(node, ncStatsList); } @@ -201,6 +253,10 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis @Override public void nodeTableStatisticsUpdated(Node node, List tableStatsList) { + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return; + } for (IPluginOutReadService service : pluginOutReadServices) { service.nodeTableStatisticsUpdated(node, tableStatsList); } @@ -208,8 +264,22 @@ public class ReadService implements IPluginInReadService, IReadFilterInternalLis @Override public void nodeDescriptionStatisticsUpdated(Node node, NodeDescription nodeDescription) { + if (!connectionOutService.isLocal(node)) { + logger.debug("This Controller is not the master for node : " + node); + return; + } for (IPluginOutReadService service : pluginOutReadServices) { service.descriptionStatisticsUpdated(node, nodeDescription); } } + + void setIPluginOutConnectionService(IPluginOutConnectionService s) { + connectionOutService = s; + } + + void unsetIPluginOutConnectionService(IPluginOutConnectionService s) { + if (connectionOutService == s) { + connectionOutService = null; + } + } }