# 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)
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 {
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 {
/**
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 {
/**
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")
txRates = new HashMap<Long, Map<Short, TxRates>>(initialSize);
descriptionListeners = new HashSet<IStatisticsListener>();
+ configStatsPollIntervals();
+
// Initialize managed timers
statisticsTimer = new Timer();
statisticsTimerTask = new TimerTask() {
help.append("---OF Statistics Manager utilities---\n");
help.append("\t ofdumpstatsmgr - "
+ "Print Internal Stats Mgr db\n");
+ help.append("\t ofstatsmgrintervals <fP> <pP> <dP>(in seconds) - "
+ + "Set/Show flow/port/dedscription stats poll intervals\n");
return help.toString();
}
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 <fP> <pP> (in seconds)");
+ if (flowStatsInterv == null || portStatsInterv == null
+ || descStatsInterv == null) {
+ ci.println("Usage: ostatsmgrintervals <fP> <pP> <dP>(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) {
+ }
+ }
+ }
}
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;
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;
* 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<String, ITopologyServiceShimListener> topologyServiceShimListeners = new ConcurrentHashMap<String, ITopologyServiceShimListener>();
logger.debug("Sent {} updates", i);
}
+ @Override
+ public void updateNode(Node node, UpdateType type, Set<Property> props) {
+ }
+
+ @Override
+ public void updateNodeConnector(NodeConnector nodeConnector,
+ UpdateType type, Set<Property> props) {
+ List<String> containers = new ArrayList<String>();
+ List<String> 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;
+ }
+ }
}
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 {
/**
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 {
/**
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 {
/**
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 {
/**
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 {
/**
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 {
/**
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 {
/**
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)