spot-aliens.py
[myplc.git] / bin / spot-aliens.py
1 #!/usr/bin/plcsh
2
3 # nodes in a site are expected to be in the same peer as their owning site
4
5 all_sites=GetSites({},['login_base','name','site_id','peer_id'])
6 all_nodes=GetNodes({},['node_id','hostname','peer_id','site_id'])
7
8 node_hash=dict ( [ (node['node_id'],node) for node in all_nodes ] )
9 site_hash=dict ( [ (site['site_id'],site) for site in all_sites ] )
10
11 for node in all_nodes:
12     site=site_hash[node['site_id']]
13     if node['peer_id'] != site['peer_id']: 
14         print "mismatch with %r and site %r"%(node,site)
15