add sorting tables to the pcu view.
[monitor.git] / monitor / wrapper / plccache.py
index f872d7a..45f879c 100755 (executable)
@@ -21,6 +21,10 @@ def dsn_from_dsln(d_sites, id2lb, l_nodes):
        lb2hn = {}
        dsn = {}
        hn2lb = {}
+       for id in id2lb:
+               if id2lb[id] not in lb2hn:
+                       lb2hn[id2lb[id]] = []
+
        for node in l_nodes:
                # this won't reach sites without nodes, which I guess isn't a problem.
                if node['site_id'] in id2lb.keys():
@@ -70,6 +74,7 @@ l_nodenetworks = None
 plcdb_hn2lb = None
 plcdb_lb2hn = None
 plcdb_netid2ip = None
+plcdb_id2lb = None
 
 def init():
        global l_sites
@@ -79,11 +84,12 @@ def init():
        global plcdb_hn2lb
        global plcdb_lb2hn
        global plcdb_netid2ip
+       global plcdb_id2lb
 
        api = plc.getCachedAuthAPI()
        l_sites = api.GetSites({'peer_id':None}, 
                                                        ['login_base', 'site_id', 'abbreviated_name', 'latitude', 
-                                                       'longitude', 'max_slices', 'slice_ids', 'node_ids' ])
+                                                       'longitude', 'max_slices', 'slice_ids', 'node_ids', 'enabled' ])
        l_nodes = api.GetNodes({'peer_id':None}, 
                                                        ['hostname', 'node_id', 'ports', 'site_id', 'version', 'last_updated', 
                                                         'date_created', 'last_contact', 'pcu_ids', 'nodenetwork_ids'])
@@ -97,6 +103,7 @@ def init():
        plcdb_hn2lb = hn2lb
        plcdb_lb2hn = lb2hn
        plcdb_netid2ip = netid2ip
+       plcdb_id2lb = id2lb
        
        return l_nodes