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 SwitchManager(object):
11 self.builtin = BuiltIn()
13 def extract_all_nodes(self, content):
17 if isinstance(content, dict) and 'nodeProperties' in content:
18 self.builtin.log("18")
19 return [e.get('node') for e in content['nodeProperties']]
21 self.builtin.log("21")
24 def extract_all_properties(self, content, property_type):
25 if isinstance(content, dict) and property_type in content:
26 self.builtin.log("26")
27 list1 = [e.get('properties') for e in content[property_type]]
28 self.builtin.log(list1)
29 return [e.get('properties') for e in content[property_type]]
31 self.builtin.log("29")
34 def extract_property_value(self, content, property, property_type):
35 res = self.extract_all_properties(content, property_type)
36 return [e.get(property) for e in res]
38 def extract_all_node_properties(self, content):
39 return self.extract_all_properties(content, 'nodeProperties')
41 def extract_node_property_values(self, content, property):
42 return self.extract_property_value(content, property, 'nodeProperties')
44 def extract_all_nodeconnector_properties(self, content):
45 return self.extract_all_properties(content, 'nodeConnectorProperties')
47 def extract_nodeconnector_property_values(self, content, property):
48 return self.extract_property_value(content, property, 'nodeConnectorProperties')