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%2FDiscoveryService.java;h=c3833d224626832b821dea92503f5b41b756faed;hb=ff1b4a79cca00743a00c3b0b1100bd0ab2b2fb31;hp=0cbaf67d9ed9452afc0927de7b9b487547663713;hpb=af90c193ecd7e41a738892f8e70accd0086dbb85;p=controller.git diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java index 0cbaf67d9e..c3833d2246 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java @@ -26,6 +26,8 @@ import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; import org.opendaylight.controller.protocol_plugin.openflow.IDataPacketListen; import org.opendaylight.controller.protocol_plugin.openflow.IDataPacketMux; +import org.opendaylight.controller.protocol_plugin.openflow.IDiscoveryListener; +import org.opendaylight.controller.protocol_plugin.openflow.IInventoryProvider; import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimExternalListener; import org.opendaylight.controller.protocol_plugin.openflow.core.IController; import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch; @@ -45,8 +47,6 @@ import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.State; import org.opendaylight.controller.sal.core.UpdateType; -import org.opendaylight.controller.sal.discovery.IDiscoveryService; -import org.opendaylight.controller.sal.inventory.IPluginInInventoryService; import org.opendaylight.controller.sal.packet.Ethernet; import org.opendaylight.controller.sal.packet.LLDP; import org.opendaylight.controller.sal.packet.LLDPTLV; @@ -67,8 +67,8 @@ public class DiscoveryService implements IInventoryShimExternalListener, private static Logger logger = LoggerFactory .getLogger(DiscoveryService.class); private IController controller = null; - private IDiscoveryService discoveryService = null; - private IPluginInInventoryService pluginInInventoryService = null; + private IDiscoveryListener discoveryListener = null; + private IInventoryProvider inventoryProvider = null; private IDataPacketMux iDataPacketMux = null; private List readyListHi = null; // newly added ports go into @@ -292,6 +292,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, inPkt.getIncomingNodeConnector(), e); return PacketResult.IGNORED; } + if (ethPkt.getPayload() instanceof LLDP) { NodeConnector dst = inPkt.getIncomingNodeConnector(); if (isEnabled(dst)) { @@ -360,7 +361,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /* * Handle discovery frames generated by our controller - * + * * @return true if it's a success */ private boolean processDiscoveryPacket(NodeConnector dstNodeConnector, @@ -430,11 +431,11 @@ public class DiscoveryService implements IInventoryShimExternalListener, return null; } - if (pluginInInventoryService == null) { + if (inventoryProvider == null) { return null; } - Map> props = pluginInInventoryService + Map> props = inventoryProvider .getNodeConnectorProps(false); if (props == null) { return null; @@ -775,7 +776,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * Update Production Edge - * + * * @param edge * The Production Edge * @param props @@ -811,7 +812,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * Remove Production Edge for a given edge port - * + * * @param edgePort * The OF edge port */ @@ -826,8 +827,8 @@ public class DiscoveryService implements IInventoryShimExternalListener, } // notify Topology - if (this.discoveryService != null) { - this.discoveryService.notifyEdge(edge, UpdateType.REMOVED, null); + if (this.discoveryListener != null) { + this.discoveryListener.notifyEdge(edge, UpdateType.REMOVED, null); } logger.trace("Remove edge {}", edge); } @@ -858,8 +859,8 @@ public class DiscoveryService implements IInventoryShimExternalListener, } // notify Topology - if (this.discoveryService != null) { - this.discoveryService.notifyEdge(edge, UpdateType.REMOVED, null); + if (this.discoveryListener != null) { + this.discoveryListener.notifyEdge(edge, UpdateType.REMOVED, null); } logger.trace("Remove {}", nodeConnector); } @@ -869,11 +870,11 @@ public class DiscoveryService implements IInventoryShimExternalListener, } private void updateEdge(Edge edge, UpdateType type, Set props) { - if (discoveryService == null) { + if (discoveryListener == null) { return; } - this.discoveryService.notifyEdge(edge, type, props); + this.discoveryListener.notifyEdge(edge, type, props); NodeConnector src = edge.getTailNodeConnector(), dst = edge .getHeadNodeConnector(); @@ -932,20 +933,20 @@ public class DiscoveryService implements IInventoryShimExternalListener, help.append("\t pcc - Print CC info\n"); help.append("\t psize - Print sizes of all the lists\n"); help.append("\t ptm - Print timeout info\n"); - help.append("\t ecc - Enable CC\n"); - help.append("\t dcc - Disable CC\n"); + help.append("\t ecc - Enable CC\n"); + help.append("\t dcc - Disable CC\n"); help.append("\t scc [multiple] - Set/show CC multiple and interval\n"); - help.append("\t sports [ports] - Set/show max ports per batch\n"); + help.append("\t sports [ports] - Set/show max ports per batch\n"); help.append("\t spause [ticks] - Set/show pause period\n"); - help.append("\t sdi [ticks] - Set/show discovery interval in ticks\n"); + help.append("\t sdi [ticks] - Set/show discovery interval in ticks\n"); help.append("\t stm [ticks] - Set/show per timeout ticks\n"); - help.append("\t sretry [count] - Set/show num of retries\n"); - help.append("\t addsw - Add a switch\n"); - help.append("\t remsw - Remove a switch\n"); + help.append("\t sretry [count] - Set/show num of retries\n"); + help.append("\t addsw - Add a switch\n"); + help.append("\t remsw - Remove a switch\n"); help.append("\t page - Print aging info\n"); help.append("\t sage - Set/Show aging time limit\n"); - help.append("\t eage - Enable aging\n"); - help.append("\t dage - Disable aging\n"); + help.append("\t eage - Enable aging\n"); + help.append("\t dage - Disable aging\n"); help.append("\t pthrot - Print throttling\n"); help.append("\t ethrot - Enable throttling\n"); help.append("\t dthrot - Disable throttling\n"); @@ -1047,7 +1048,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, } } ci.println("\n"); - ci.println(" NodeConnector Edge "); + ci.println(" NodeConnector Edge "); Set keySet = prodMap.keySet(); if (keySet == null) { return; @@ -1382,9 +1383,6 @@ public class DiscoveryService implements IInventoryShimExternalListener, removeDiscovery(node); } - public void updateNode(Node node, Set props) { - } - void setController(IController s) { this.controller = s; } @@ -1395,12 +1393,12 @@ public class DiscoveryService implements IInventoryShimExternalListener, } } - public void setPluginInInventoryService(IPluginInInventoryService service) { - this.pluginInInventoryService = service; + public void setInventoryProvider(IInventoryProvider service) { + this.inventoryProvider = service; } - public void unsetPluginInInventoryService(IPluginInInventoryService service) { - this.pluginInInventoryService = null; + public void unsetInventoryProvider(IInventoryProvider service) { + this.inventoryProvider = null; } public void setIDataPacketMux(IDataPacketMux service) { @@ -1413,13 +1411,13 @@ public class DiscoveryService implements IInventoryShimExternalListener, } } - void setDiscoveryService(IDiscoveryService s) { - this.discoveryService = s; + void setDiscoveryListener(IDiscoveryListener s) { + this.discoveryListener = s; } - void unsetDiscoveryService(IDiscoveryService s) { - if (this.discoveryService == s) { - this.discoveryService = null; + void unsetDiscoveryListener(IDiscoveryListener s) { + if (this.discoveryListener == s) { + this.discoveryListener = null; } } @@ -1444,7 +1442,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * Function called by the dependency manager when all the required * dependencies are satisfied - * + * */ void init() { logger.trace("Init called"); @@ -1474,7 +1472,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, * Function called by the dependency manager when at least one dependency * become unsatisfied or when the component is shutting down because for * example bundle is being stopped. - * + * */ void destroy() { transmitQ = null; @@ -1493,7 +1491,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * Function called by dependency manager after "init ()" is called and after * the services provided by the class are registered in the service registry - * + * */ void start() { discoveryTimer.schedule(discoveryTimerTask, discoveryTimerTick, @@ -1513,7 +1511,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, * Function called by the dependency manager before the services exported by * the component are unregistered, this will be followed by a "destroy ()" * calls - * + * */ void stop() { shuttingDown = true; @@ -1563,7 +1561,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * This method returns the interval which determines how often the discovery * packets will be sent. Default is 300 seconds. - * + * * @return The discovery interval in second */ private int getDiscoveryInterval() { @@ -1583,7 +1581,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * This method returns the timeout value in waiting for response of a * discovery query. Default is 60 seconds. - * + * * @return The discovery timeout in second */ private int getDiscoveryTimeout() { @@ -1603,7 +1601,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, /** * This method returns the number of retries after the initial discovery * packet is not received within the timeout period. Default is 2 times. - * + * * @return The number of discovery retries */ private int getDiscoveryRetry() {