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;
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;
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<NodeConnector> readyListHi = null; // newly added ports go into
inPkt.getIncomingNodeConnector(), e);
return PacketResult.IGNORED;
}
+
if (ethPkt.getPayload() instanceof LLDP) {
NodeConnector dst = inPkt.getIncomingNodeConnector();
- if (!processDiscoveryPacket(dst, ethPkt)) {
- /* Snoop the discovery pkt if not generated from us */
- snoopDiscoveryPacket(dst, ethPkt);
+ if (isEnabled(dst)) {
+ if (!processDiscoveryPacket(dst, ethPkt)) {
+ /* Snoop the discovery pkt if not generated from us */
+ snoopDiscoveryPacket(dst, ethPkt);
+ }
+ return PacketResult.CONSUME;
}
- return PacketResult.CONSUME;
}
return PacketResult.IGNORED;
}
/*
* Handle discovery frames generated by our controller
- *
+ *
* @return true if it's a success
*/
private boolean processDiscoveryPacket(NodeConnector dstNodeConnector,
return null;
}
- if (pluginInInventoryService == null) {
+ if (inventoryProvider == null) {
return null;
}
- Map<NodeConnector, Map<String, Property>> props = pluginInInventoryService
+ Map<NodeConnector, Map<String, Property>> props = inventoryProvider
.getNodeConnectorProps(false);
if (props == null) {
return null;
/**
* Update Production Edge
- *
+ *
* @param edge
* The Production Edge
* @param props
/**
* Remove Production Edge for a given edge port
- *
+ *
* @param edgePort
* The OF edge port
*/
}
// 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);
}
}
// 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);
}
}
private void updateEdge(Edge edge, UpdateType type, Set<Property> 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();
removeDiscovery(node);
}
- public void updateNode(Node node, Set<Property> props) {
- }
-
void setController(IController s) {
this.controller = s;
}
}
}
- 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) {
}
}
- 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;
}
}
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
- *
+ *
*/
void init() {
logger.trace("Init called");
* 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;
/**
* 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,
* 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;
/**
* 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() {
/**
* 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() {
/**
* 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() {