2 Documentation Keywords for DIDM suites
6 Library RequestsLibrary
7 Variables ../variables/Variables.py
9 Resource ../variables/openflowplugin/Variables.robot
13 Check DIDM Registered With Device
14 [Documentation] Check for DIDM registered with the device
15 ${resp}= RequestsLibrary.GET On Session session ${RFC8040_OPERATIONAL_NODES_API} expected_status=200
17 Should Contain ${resp.text} didm
21 [Documentation] Extract device information
22 ${resp.text}= Check DIDM Registered With Device
23 ${json_resp}= RequestsLibrary.To_Json ${resp.text}
24 ${nodes_resp}= Get From Dictionary ${json_resp} nodes
25 ${node_resp}= Get From Dictionary ${nodes_resp} node
26 ${node_data}= Get From List ${node_resp} 0
28 Set Suite Variable ${node_data}
32 [Documentation] Check for the device IP address
33 ${dev_ip}= Set Variable flow-node-inventory:ip-address
34 ${node_data}= Find Device Data
35 ${device_keys}= Get Dictionary Keys ${node_data}
37 ${length}= Get Length ${device_keys}
38 FOR ${index} IN RANGE 0 ${length}
39 ${line}= Get From List ${device_keys} ${index}
40 Run Keyword And Return If '${dev_ip}' == '${line}' Get From Dictionary ${node_data} ${dev_ip}
45 [Documentation] Look for the device type
46 ${device_type}= Set Variable didm-identification:device-type
47 ${device_ip}= Check Device IP
48 Should Match ${DEVICE_IP} ${device_ip}
49 ${device_keys}= Get Dictionary Keys ${node_data}
51 ${length}= Get Length ${device_keys}
52 FOR ${index} IN RANGE 0 ${length}
53 ${line}= Get From List ${device_keys} ${index}
54 Run Keyword And Return If
55 ... '${device_type}' == '${line}'
56 ... Get From Dictionary
63 [Documentation] Look for the device hardware information
64 ${device_hw}= Set Variable flow-node-inventory:hardware
65 ${device_keys}= Get Dictionary Keys ${node_data}
67 ${length}= Get Length ${device_keys}
68 FOR ${index} IN RANGE 0 ${length}
69 ${line}= Get From List ${device_keys} ${index}
70 Run Keyword And Return If '${device_hw}' == '${line}' Get From Dictionary ${node_data} ${device_hw}
75 [Documentation] Look for the device software information
76 ${device_sw}= Set Variable flow-node-inventory:software
77 ${device_keys}= Get Dictionary Keys ${node_data}
79 ${length}= Get Length ${device_keys}
80 FOR ${index} IN RANGE 0 ${length}
81 ${line}= Get From List ${device_keys} ${index}
82 Run Keyword And Return If '${device_sw}' == '${line}' Get From Dictionary ${node_data} ${device_sw}
86 Find Device Manufacturer
87 [Documentation] Look for the device manufacture
88 ${manufacture}= Set Variable flow-node-inventory:manufacturer
89 ${device_keys}= Get Dictionary Keys ${node_data}
91 ${length}= Get Length ${device_keys}
92 FOR ${index} IN RANGE 0 ${length}
93 ${line}= Get From List ${device_keys} ${index}
94 Run Keyword And Return If
95 ... '${manufacture}' == '${line}'
96 ... Get From Dictionary
100 RETURN ${manufacture}
103 [Documentation] Look for the device serial number
104 ${serial_number}= Set Variable flow-node-inventory:serial-number
105 ${device_keys}= Get Dictionary Keys ${node_data}
107 ${length}= Get Length ${device_keys}
108 FOR ${index} IN RANGE 0 ${length}
109 ${line}= Get From List ${device_keys} ${index}
110 Run Keyword And Return If
111 ... '${serial_number}' == '${line}'
112 ... Get From Dictionary
116 RETURN ${serial_number}
118 Find Device Description
119 [Documentation] Look for the device description
120 ${description}= Set Variable flow-node-inventory:description
121 ${device_keys}= Get Dictionary Keys ${node_data}
123 ${length}= Get Length ${device_keys}
124 FOR ${index} IN RANGE 0 ${length}
125 ${line}= Get From List ${device_keys} ${index}
126 Run Keyword And Return If
127 ... '${description}' == '${line}'
128 ... Get From Dictionary
132 RETURN ${description}