if type(host) == type(""): host = [host]
# get the node(s) info
- nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","nodenetwork_ids"])
+ nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","interface_ids"])
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
- for net in node["nodenetwork_ids"]:
+ for net in node["interface_ids"]:
nodenetworks.append(net)
- plcnodenetworks = self.api.GetNodeNetworks(self.auth,nodenetworks,["nodenetwork_id","ip"])
+ plcnodenetworks = self.api.GetInterfaces(self.auth,nodenetworks,["nodenetwork_id","ip"])
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
host = node['hostname']
key = node['ssh_rsa_key']
- nodenetworks = node['nodenetwork_ids']
+ nodenetworks = node['interface_ids']
if len(nodenetworks)==0: return (host, None, None, None)
- # the [0] subscript to node['nodenetwork_ids'] means
+ # the [0] subscript to node['interface_ids'] means
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
args = {}
try:
node = plccache.GetNodeByName(hostname)
- net = api.GetNodeNetworks(node['nodenetwork_ids'])[0]
+ net = api.GetInterfaces(node['interface_ids'])[0]
except:
email_exception()
print traceback.print_exc()
if type(host) == type(""): host = [host]
# get the node(s) info
- nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","nodenetwork_ids"])
+ nodes = self.api.GetNodes(self.auth,host,["hostname","ssh_rsa_key","interface_ids"])
# for each node's node network, update the self.nodenetworks cache
nodenetworks = []
for node in nodes:
- for net in node["nodenetwork_ids"]:
+ for net in node["interface_ids"]:
nodenetworks.append(net)
- plcnodenetworks = self.api.GetNodeNetworks(self.auth,nodenetworks,["nodenetwork_id","ip"])
+ plcnodenetworks = self.api.GetInterfaces(self.auth,nodenetworks,["nodenetwork_id","ip"])
for n in plcnodenetworks:
self.nodenetworks[n["nodenetwork_id"]]=n
return nodes
host = node['hostname']
key = node['ssh_rsa_key']
- nodenetworks = node['nodenetwork_ids']
+ nodenetworks = node['interface_ids']
if len(nodenetworks)==0: return (host, None, None, None)
- # the [0] subscript to node['nodenetwork_ids'] means
+ # the [0] subscript to node['interface_ids'] means
# that this function wont work with multihomed nodes
l_nw = self.nodenetworks.get(nodenetworks[0],None)
if l_nw is None: return (host, None, None, None)
try:
n = api.GetNodes(node)[0]
#print n
- net = api.GetNodeNetworks(n['nodenetwork_ids'])[0]
+ net = api.GetInterfaces(n['interface_ids'])[0]
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
def getNodeNetworks(filter=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
- nodenetworks = api.GetNodeNetworks(auth.auth, filter, None)
+ nodenetworks = api.GetInterfaces(auth.auth, filter, None)
return nodenetworks
def getNodes(filter=None, fields=None):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
nodes = api.GetNodes(auth.auth, filter, fields)
#['boot_state', 'hostname',
- #'site_id', 'date_created', 'node_id', 'version', 'nodenetwork_ids',
+ #'site_id', 'date_created', 'node_id', 'version', 'interface_ids',
#'last_updated', 'peer_node_id', 'ssh_rsa_key' ])
return nodes
l_nodes = plc.api.GetNodes({'peer_id':None},
['hostname', 'node_id', 'ports', 'site_id', 'boot_state',
'version', 'last_updated', 'date_created', 'key',
- 'last_contact', 'pcu_ids', 'nodenetwork_ids'])
+ 'last_contact', 'pcu_ids', 'interface_ids'])
l_pcus = plc.api.GetPCUs()
print "sync sites"
for node in nodes:
hn = node['hostname']
- if len(node['nodenetwork_ids']) == 0:
+ if len(node['interface_ids']) == 0:
continue
- ip = netid2ip[node['nodenetwork_ids'][0]]
+ ip = netid2ip[node['interface_ids'][0]]
if lon_x is not -1 and lat_y is not -1:
coords="%s,%s" % (lon_x, lat_y)
try:
n = api.GetNodes(node)[0]
#print n
- net = api.GetNodeNetworks(n['nodenetwork_ids'])[0]
+ net = api.GetInterfaces(n['interface_ids'])[0]
#print net
node_keys = ['boot_state', 'key', 'last_updated', 'last_contact']
'model': node['model'],
'hostname' : node['hostname'],
'version' : node['version']})
- nnets = api.GetNodeNetworks(node['nodenetwork_ids'])
+ nnets = api.GetInterfaces(node['interface_ids'])
for nnet in nnets:
del nnet['nodenetwork_id']
del nnet['nodenetwork_setting_ids']
site_nodes = api.GetNodes(site['node_ids'])
site_people = api.GetPersons(site['person_ids'])
for node in site_nodes:
- network = api.GetNodeNetworks(node['nodenetwork_ids'])
+ network = api.GetInterfaces(node['interface_ids'])
print "ok"
except:
sys.stderr.write(traceback.format_exc())
for h in d_nodes:
host = d_nodes[h]
- for nw_id in host['nodenetwork_ids']:
- l_nw = plc.getNodeNetworks({'nodenetwork_id': host['nodenetwork_ids']})
+ for nw_id in host['interface_ids']:
+ l_nw = plc.getNodeNetworks({'nodenetwork_id': host['interface_ids']})
bwlimit[h] = []
for nw in l_nw:
if nw['bwlimit'] != None and nw['bwlimit'] < 500000:
if len(sys.argv[1:]) > 0:
for host in sys.argv[1:]:
n = api.GetNodes(host)[0]
- nn = api.GetNodeNetworks(n['nodenetwork_ids'])
+ nn = api.GetInterfaces(n['interface_ids'])
for nodenet in nn:
- nnet2 = api.GetNodeNetworks({'ip': nodenet['ip']})
+ nnet2 = api.GetInterfaces({'ip': nodenet['ip']})
print "len of nn entries with ip: %s == %s " % ( nodenet['ip'], len(nnet2) )
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
nnids = util.file.getListFromFile('nnids.txt')
nnids = [ int(i) for i in nnids]
for id in nnids:
- nnet2 = api.GetNodeNetworks(id)
+ nnet2 = api.GetInterfaces(id)
for nn2 in nnet2:
n2 = api.GetNodes(nn2['node_id'])
if len(n2) == 0 :
print "\t%d node is attached to nodenetwork %s %s" % ( len(n2), nn2['nodenetwork_id'] , nn2['ip']),
- netlist = api.GetNodeNetworks({'ip' : nn2['ip']})
+ netlist = api.GetInterfaces({'ip' : nn2['ip']})
if len(netlist) != 1:
node_len = len([ n['node_id'] for n in netlist])
print "\t but, ip %s is used by %s nodenetwork entries" % (nn2['ip'], node_len)
# TODO: if it is, then we need to break up the discovery rule.
ip_list = ""
for node in node_list:
- if len(node['nodenetwork_ids']) > 0:
- ip = netid2ip[node['nodenetwork_ids'][0]]
+ if len(node['interface_ids']) > 0:
+ ip = netid2ip[node['interface_ids'][0]]
if len(ip_list) > 0: ip_list += ","
ip_list += ip