6 from topology import links
8 from topology import links
10 from PLC.Faults import *
11 from PLC.Method import Method
12 from PLC.Methods.GetNodeNetworks import GetNodeNetworks
13 from PLC.Methods.GetNodes import GetNodes
14 from PLC.Auth import Auth
17 class GetLinkSpecs(GetNodeNetworks, GetNodes):
19 Return LinkSpecs for topology.
22 roles = ['admin', 'pi', 'user']
28 def ifSpecDict(self, auth, nodedict):
30 Generate ifspec dict for given node dict.
32 # ifspecattrs = ['name',
40 # Assume only 1 node network per node.
41 nodenetwork = GetNodeNetworks.call(self, auth, nodedict['nodenetwork_ids'])[0]
42 ifspec = {'name': nodenetwork['hostname'],
43 'addr': nodenetwork['ip'],
44 'type': nodenetwork['type'],
50 return {'IfSpec': ifspec}
55 Create dict for physical topology.
57 # list of attributes in the LinkSpec
58 # (https://svn.planet-lab.org/svn/geniwrapper/trunk/rspec/model/planetlab.{ecore,xsd})
59 # linkspecattrs = ['type',
64 # 'endpoint', # <-- ifspec(S)?
67 # list of linkspecs. 1 per adjacency
69 # links maps sites. Get nodes in site, make linkspecs for each.
71 nodeset = GetNodes.call(self, auth, {'site_id':[i,j]})
74 ifspecs.append(self.ifSpecDict(auth, node))
83 'start_time': int(time()),