From: Jason Ye Date: Wed, 1 May 2013 22:43:12 +0000 (-0700) Subject: - Add flow and port stats polling intervals in config.ini X-Git-Tag: releasepom-0.1.0~505 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=c85c9112b0db092bd565bcf9e5174ecfa67ae1d2 - Add flow and port stats polling intervals in config.ini - Add DESC stats polling interval in CONFIG.ini and thru OSGI cmd - When the switch port is changed to admin down or the link is changed to down state, the switch sends port_status msg with OFPPR_MODIFY type. The existing logic is to map OFPPR_MODIFY to UpdateType.CHANGED. But we should exam the Config state and Link state fields within the port_status packet. If they are "down", we should fire an UpdateType.REMOVED event instead and remove both edges associated with the port. Signed-off-by: Jason Ye --- diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini index 6a7d68c8d0..33789ee2d2 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini @@ -50,6 +50,12 @@ org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml # of.messageResponseTimer=2000 # The switch liveness timeout value (default 60500 msec) # of.switchLivenessTimeout=60500 +# The flow statistics polling interval in second (default 10 sec) +# of.flowStatsPollInterval=10 +# The port statistics polling interval in second (default 5 sec) +# of.portStatsPollInterval=5 +# The description statistics polling interval in second (default 60 sec) +# of.descStatsPollInterval=60 # The maximum number of asynchronous messages can be sent before sending a Barrier Request (default 100) # of.barrierMessagePriorCount=100 # The interval which determines how often the discovery packets should be sent (default 300 sec) diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimExternalListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimExternalListener.java index 24e63df30a..df03a04384 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimExternalListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimExternalListener.java @@ -10,10 +10,8 @@ package org.opendaylight.controller.protocol_plugin.openflow; /** - * Wrapper of Interface class that provides inventory updates locally in the - * protocol plugin - * - * + * Wrapper of Interface that provides inventory updates locally in the protocol + * plugin. */ public interface IInventoryShimExternalListener extends IInventoryShimInternalListener { diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java index e7c11a6eea..6b328961fc 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/IInventoryShimInternalListener.java @@ -17,10 +17,8 @@ import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** - * Interface class that provides inventory updates to inventory listeners - * within the protocol plugin - * - * + * The Interface provides inventory updates to inventory listeners within the + * protocol plugin */ public interface IInventoryShimInternalListener { /** diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java index 23b40a3e30..0c30c80f0d 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/ITopologyServiceShimListener.java @@ -16,9 +16,7 @@ import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** - * Interface class that provides Edge updates to the topology listeners - * - * + * The Interface provides Edge updates to the topology listeners */ public interface ITopologyServiceShimListener { /** diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java index 9bccbd1d68..9b7d1e3bc2 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java @@ -358,8 +358,9 @@ public class Activator extends ComponentActivatorAbstractBase { if (imp.equals(TopologyServiceShim.class)) { c.setInterface(new String[] { IDiscoveryService.class.getName(), IContainerListener.class.getName(), - IRefreshInternalProvider.class.getName() }, null); - c.add(createServiceDependency() + IRefreshInternalProvider.class.getName(), + IInventoryShimExternalListener.class.getName() }, null); + c.add(createServiceDependency() .setService(ITopologyServiceShimListener.class) .setCallbacks("setTopologyServiceShimListener", "unsetTopologyServiceShimListener") diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java index 98a2962606..9dc8b3b6aa 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/OFStatisticsManager.java @@ -175,6 +175,8 @@ public class OFStatisticsManager implements IOFStatisticsManager, txRates = new HashMap>(initialSize); descriptionListeners = new HashSet(); + configStatsPollIntervals(); + // Initialize managed timers statisticsTimer = new Timer(); statisticsTimerTask = new TimerTask() { @@ -876,6 +878,8 @@ public class OFStatisticsManager implements IOFStatisticsManager, help.append("---OF Statistics Manager utilities---\n"); help.append("\t ofdumpstatsmgr - " + "Print Internal Stats Mgr db\n"); + help.append("\t ofstatsmgrintervals (in seconds) - " + + "Set/Show flow/port/dedscription stats poll intervals\n"); return help.toString(); } @@ -1001,33 +1005,76 @@ public class OFStatisticsManager implements IOFStatisticsManager, public void _ofstatsmgrintervals(CommandInterpreter ci) { String flowStatsInterv = ci.nextArgument(); String portStatsInterv = ci.nextArgument(); + String descStatsInterv = ci.nextArgument(); - if (flowStatsInterv == null || portStatsInterv == null) { - - ci.println("Usage: ostatsmgrintervals (in seconds)"); + if (flowStatsInterv == null || portStatsInterv == null + || descStatsInterv == null) { + ci.println("Usage: ostatsmgrintervals (in seconds)"); ci.println("Current Values: fP=" + statisticsTickNumber + "s pP=" - + portTickNumber + "s"); + + portTickNumber + "s dP=" + descriptionTickNumber + "s"); return; } - Short fP, pP; + Short fP, pP, dP; try { fP = Short.parseShort(flowStatsInterv); pP = Short.parseShort(portStatsInterv); + dP = Short.parseShort(descStatsInterv); } catch (Exception e) { ci.println("Invalid format values: " + e.getMessage()); return; } - if (pP <= 1 || fP <= 1) { - ci.println("Invalid values. fP and pP have to be greater than 1."); + if (pP <= 1 || fP <= 1 || dP <= 1) { + ci.println("Invalid values. fP, pP, dP have to be greater than 1."); return; } statisticsTickNumber = fP; portTickNumber = pP; + descriptionTickNumber = dP; ci.println("New Values: fP=" + statisticsTickNumber + "s pP=" - + portTickNumber + "s"); + + portTickNumber + "s dP=" + descriptionTickNumber + "s"); } + /** + * This method retrieves user configurations from config.ini and updates + * statisticsTickNumber/portTickNumber/descriptionTickNumber accordingly. + */ + private void configStatsPollIntervals() { + String fsStr = System.getProperty("of.flowStatsPollInterval"); + String psStr = System.getProperty("of.portStatsPollInterval"); + String dsStr = System.getProperty("of.descStatsPollInterval"); + Short fs, ps, ds; + + if (fsStr != null) { + try { + fs = Short.parseShort(fsStr); + if (fs > 0) { + statisticsTickNumber = fs; + } + } catch (Exception e) { + } + } + + if (psStr != null) { + try { + ps = Short.parseShort(psStr); + if (ps > 0) { + portTickNumber = ps; + } + } catch (Exception e) { + } + } + + if (dsStr != null) { + try { + ds = Short.parseShort(dsStr); + if (ds > 0) { + descriptionTickNumber = ds; + } + } catch (Exception e) { + } + } + } } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java index 424af8d4f4..af502a2177 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/TopologyServiceShim.java @@ -24,6 +24,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; +import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimExternalListener; import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsManager; import org.opendaylight.controller.protocol_plugin.openflow.IRefreshInternalProvider; import org.opendaylight.controller.protocol_plugin.openflow.ITopologyServiceShimListener; @@ -33,12 +34,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.opendaylight.controller.sal.core.Bandwidth; +import org.opendaylight.controller.sal.core.Config; import org.opendaylight.controller.sal.core.ContainerFlow; import org.opendaylight.controller.sal.core.Edge; import org.opendaylight.controller.sal.core.IContainerListener; import org.opendaylight.controller.sal.core.Node; 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.utils.GlobalConstants; @@ -49,7 +52,8 @@ import org.opendaylight.controller.sal.utils.GlobalConstants; * container configurations. */ public class TopologyServiceShim implements IDiscoveryService, - IContainerListener, CommandProvider, IRefreshInternalProvider { + IContainerListener, CommandProvider, IRefreshInternalProvider, + IInventoryShimExternalListener { protected static final Logger logger = LoggerFactory .getLogger(TopologyServiceShim.class); private ConcurrentMap topologyServiceShimListeners = new ConcurrentHashMap(); @@ -645,4 +649,56 @@ public class TopologyServiceShim implements IDiscoveryService, logger.debug("Sent {} updates", i); } + @Override + public void updateNode(Node node, UpdateType type, Set props) { + } + + @Override + public void updateNodeConnector(NodeConnector nodeConnector, + UpdateType type, Set props) { + List containers = new ArrayList(); + List conList = this.containerMap.get(nodeConnector); + + containers.add(GlobalConstants.DEFAULT.toString()); + if (conList != null) { + containers.addAll(conList); + } + + switch (type) { + case ADDED: + break; + case CHANGED: + if (props == null) { + break; + } + + boolean rmEdge = false; + for (Property prop : props) { + if (((prop instanceof Config) && (((Config) prop).getValue() != Config.ADMIN_UP)) + || ((prop instanceof State) && (((State) prop) + .getValue() != State.EDGE_UP))) { + /* + * If port admin down or link down, remove the edges + * associated with the port + */ + rmEdge = true; + break; + } + } + + if (rmEdge) { + for (String cName : containers) { + removeNodeConnector(cName, nodeConnector); + } + } + break; + case REMOVED: + for (String cName : containers) { + removeNodeConnector(cName, nodeConnector); + } + break; + default: + break; + } + } } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java index 3dda38ef56..29094d34f9 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/discovery/IDiscoveryService.java @@ -16,8 +16,8 @@ import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** - * The interface class provides the methods to notify the listener when an edge - * is added/deleted/changed + * The interface provides the methods to notify the listener when an edge is + * added/deleted/changed. */ public interface IDiscoveryService { /** diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IInventoryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IInventoryService.java index 2df6053098..3c58ecbfcd 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IInventoryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IInventoryService.java @@ -17,8 +17,8 @@ import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.Property; /** - * Interface class that describes methods invoked from application toward SAL to - * solicit existing inventory data + * The Interface describes methods invoked from application toward SAL to + * solicit existing inventory data. */ public interface IInventoryService { /** diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java index 41b91e1919..ccfb338849 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IListenInventoryUpdates.java @@ -17,8 +17,8 @@ import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** - * The interface class provides the methods to notify the upper applications - * in regards to any inventory changes. + * The interface provides the methods to notify the upper applications in + * regards to any inventory changes. */ public interface IListenInventoryUpdates { /** diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginInInventoryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginInInventoryService.java index 420f9bb00c..5822731f26 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginInInventoryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginInInventoryService.java @@ -17,8 +17,8 @@ import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.Property; /** - * The interface class that describes methods invoked from SAL toward the protocol - * plugin to solicit existing inventory data. + * The Interface describes methods invoked from SAL toward the protocol plugin + * to solicit existing inventory data. */ public interface IPluginInInventoryService { /** diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java index 124c34ab3e..42c9ab7475 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/inventory/IPluginOutInventoryService.java @@ -17,8 +17,8 @@ import org.opendaylight.controller.sal.core.Property; import org.opendaylight.controller.sal.core.UpdateType; /** - * The interface class describes Inventory update methods to be implemented by - * protocol plugin + * The Interface describes Inventory update methods to be implemented by + * protocol plugin. */ public interface IPluginOutInventoryService { /** diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManagerAware.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManagerAware.java index 1b67e529df..0d6410662a 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManagerAware.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/ISwitchManagerAware.java @@ -14,8 +14,8 @@ import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.switchmanager.Subnet; /** - * The interface class provides methods to notify listeners about subnet and - * mode changes. + * The interface provides methods to notify listeners about subnet and mode + * changes. */ public interface ISwitchManagerAware { /** diff --git a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/ITopologyManager.java b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/ITopologyManager.java index 73bbc4a29b..de4f0d5347 100644 --- a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/ITopologyManager.java +++ b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/ITopologyManager.java @@ -22,8 +22,7 @@ import org.opendaylight.controller.sal.core.UpdateType; import org.opendaylight.controller.sal.utils.Status; /** - * Interface class that provides methods to interact with - * network topology database + * The Interface provides methods to interact with network topology database. */ public interface ITopologyManager { /** diff --git a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java index fafbd4b3dc..d5b499c42b 100644 --- a/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java +++ b/opendaylight/topologymanager/src/main/java/org/opendaylight/controller/topologymanager/TopologyUserLinkConfig.java @@ -27,7 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Interface class that provides methods to manipulate user configured link + * The Interface provides methods to manipulate user configured link. */ @XmlRootElement @XmlAccessorType(XmlAccessType.NONE)