dana-i2cat/opennaas — pull request #965 by adrian-rosello (2014-10-27 11:03:37+00:00)
Title: Fix/ofertie monitor

The generateSwitchPortStatistics method was taking the wrong element as key for the map of statistics of a specific network element. Even though this hack we implemented for DOLFIN demo worked, it worked only in specific use cases.

The "switchesStatistics" object has as key the network element id from the topology file. For example, network n1 defines as elements the several switches it has. Let's take s1 as example: The networkElementId would be "openflowswitch:s1".

Then, switchesStatistics.get(networkElementId) would contain all port statistics for switch s1. The returned object is a another map. filled by the GetNetworkStatisticsAction:

https://github.com/dana-i2cat/opennaas/blob/d724836f67fc7e7c6210475f4182843017400906/extensions/bundles/genericnetwork/src/main/java/org/opennaas/extensions/genericnetwork/actionsets/internal/statistics/actions/GetNetworkStatisticsAction.java#L130

As seen in line 130, the key is the "netPortId", so the map would not contain the networkElementId (openflowswitch:s1.x) but the network port (s1.x). With old approach we were forcing the user (without telling him) to use a specific format for the ports ids and mappings, but with this fix he can define it in any format.