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.
16 [{u"type": u"OF", u"id": u"00:00:00:00:00:00:00:01"}],
18 {u"type": u"OF", u"id": u"00:00:00:00:00:00:00:01"},
19 {u"type": u"OF", u"id": u"00:00:00:00:00:00:00:02"},
20 {u"type": u"OF", u"id": u"00:00:00:00:00:00:00:03"},
25 self.builtin = BuiltIn()
27 def get_nodes_from_topology(self, topo_level):
29 get nodes from topology database by topology tree level
31 if isinstance(topo_level, str) or isinstance(topo_level, unicode):
32 if topo_level.isdigit():
33 topo_level = int(topo_level)
36 return self.topo_nodes_db[topo_level]
39 elif isinstance(topo_level, int):
42 return self.topo_nodes_db[topo_level]
47 if __name__ == "__main__":
49 print(topology.get_nodes_from_topology(2))
50 print(topology.get_nodes_from_topology("2"))