Improve performance of get_active_networks_info

RPC 'get_active_networks_info' currently uses nested loop to fill
the network structure with subnet and port info. Speed up this
operation by using itertools.groupby.

Change-Id: If765dd8f2f8010b79eb168179a64dccf940e9cbb
Closes-Bug: #1390356
Merge "Improve performance of get_active_networks_info"