2 Library for the robot based system test tool of the OpenDaylight project.
3 Authors: Baohua Yang@IBM, Denghui Huang@IBM
6 from robot.libraries.BuiltIn import BuiltIn
9 class Topology(object):
11 Topology class provide topology database and provide many method to get property of topology.
15 [{u'type': u'OF', u'id': u'00:00:00:00:00:00:00:01'}],
16 [{u'type': u'OF', u'id': u'00:00:00:00:00:00:00:01'},
17 {u'type': u'OF', u'id': u'00:00:00:00:00:00:00:02'},
18 {u'type': u'OF', u'id': u'00:00:00:00:00:00:00:03'}]
22 self.builtin = BuiltIn()
24 def get_nodes_from_topology(self, topo_level):
26 get nodes from topology database by topology tree level
28 if isinstance(topo_level, str) or isinstance(topo_level, unicode):
29 if topo_level.isdigit():
30 topo_level = int(topo_level)
33 return self.topo_nodes_db[topo_level]
36 elif isinstance(topo_level, int):
39 return self.topo_nodes_db[topo_level]
44 if __name__ == '__main__':
46 print(topology.get_nodes_from_topology(2))
47 print(topology.get_nodes_from_topology('2'))