floodlight/floodlight — pull request #461 by rizard (2014-09-15 19:16:15+00:00)
Title: More DebugCounter-related fixes and changes

@capveg

Forgot to mention this in a commit message: I added the ability to track the Date a counter is modified. This is needed in the FlowReconcileManager.

Otherwise, the main changes are all summarized in the commit messages. One thing worth noting upfront is the change to the REST API wrt switches. Now that we're working towards all switch counters being maintained by each switch (in progress but this is a step forward), it makes the most sense IMHO to allow access to those counters hierarchically by means of the OFSwitchManager module. So, an example REST API path for a switch's counters would be /wm/core/counters/ofswitchmanager/00:11:22:33:44:55:66:77. Every time a switch is added, new set of counters will be added underneath the OFSwitchManager module on a DPID-basis, and will be able to be accessed via the switch DPID as a string, followed by the hierarchy of a more specific counter (or counters). Other modules can have their counters queried by using the module name and hierarchy as well. IMHO this makes accessing counters more consistent across modules.

I will have another commit shortly with a new SwitchCounters class that works very similar to SwitchManagerCounters. Every OFSwitch will have a SwitchCounters instance that contains all relevant and specific counters for that particular switch. In the case a switch is removed, its SwitchCounters will also be removed by removing the upper-most element of the switch counter hierarchy -- the DPID:
e.g. rm ofswitchmanager/00:11:22:33:44:55:66:77 will remove all counters for the switch at and below element 00:11:22:33:44:55:66:77 in the hierarchy (i.e. all counters contained in SwitchCounters).