2 Documentation Keywords for DIDM suites
5 Library RequestsLibrary
6 Variables ../variables/Variables.py
10 Check DIDM Registered With Device
11 [Documentation] Check for DIDM registered with the device
12 ${resp}= RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API}
13 Should Be Equal As Strings ${resp.status_code} 200
15 Should Contain ${resp.content} didm
16 [Return] ${resp.content}
19 [Documentation] Extract device information
20 ${resp.content}= Check DIDM Registered With Device
21 ${json_resp}= RequestsLibrary.To_Json ${resp.content}
22 ${nodes_resp}= Get From Dictionary ${json_resp} nodes
23 ${node_resp}= Get From Dictionary ${nodes_resp} node
24 ${node_data}= Get From List ${node_resp} 0
26 Set Suite Variable ${node_data}
30 [Documentation] Check for the device IP address
31 ${dev_ip}= Set Variable flow-node-inventory:ip-address
32 ${node_data}= Find Device Data
33 ${device_keys}= Get Dictionary Keys ${node_data}
35 ${length}= Get Length ${device_keys}
36 : FOR ${index} IN RANGE 0 ${length}
37 \ ${line}= Get From List ${device_keys} ${index}
38 \ Run Keyword And Return If '${dev_ip}' == '${line}' Get From Dictionary ${node_data} ${dev_ip}
42 [Documentation] Look for the device type
43 ${device_type}= Set Variable didm-identification:device-type
44 ${device_ip}= Check Device IP
45 Should Match ${DEVICE_IP} ${device_ip}
46 ${device_keys}= Get Dictionary Keys ${node_data}
48 ${length}= Get Length ${device_keys}
49 : FOR ${index} IN RANGE 0 ${length}
50 \ ${line}= Get From List ${device_keys} ${index}
51 \ Run Keyword And Return If '${device_type}' == '${line}' Get From Dictionary ${node_data} ${device_type}
52 [Return] ${device_type}
55 [Documentation] Look for the device hardware information
56 ${device_hw}= Set Variable flow-node-inventory:hardware
57 ${device_keys}= Get Dictionary Keys ${node_data}
59 ${length}= Get Length ${device_keys}
60 : FOR ${index} IN RANGE 0 ${length}
61 \ ${line}= Get From List ${device_keys} ${index}
62 \ Run Keyword And Return If '${device_hw}' == '${line}' Get From Dictionary ${node_data} ${device_hw}
66 [Documentation] Look for the device software information
67 ${device_sw}= Set Variable flow-node-inventory:software
68 ${device_keys}= Get Dictionary Keys ${node_data}
70 ${length}= Get Length ${device_keys}
71 : FOR ${index} IN RANGE 0 ${length}
72 \ ${line}= Get From List ${device_keys} ${index}
73 \ Run Keyword And Return If '${device_sw}' == '${line}' Get From Dictionary ${node_data} ${device_sw}
76 Find Device Manufacturer
77 [Documentation] Look for the device manufacture
78 ${manufacture}= Set Variable flow-node-inventory:manufacturer
79 ${device_keys}= Get Dictionary Keys ${node_data}
81 ${length}= Get Length ${device_keys}
82 : FOR ${index} IN RANGE 0 ${length}
83 \ ${line}= Get From List ${device_keys} ${index}
84 \ Run Keyword And Return If '${manufacture}' == '${line}' Get From Dictionary ${node_data} ${manufacture}
85 [Return] ${manufacture}
88 [Documentation] Look for the device serial number
89 ${serial_number}= Set Variable flow-node-inventory:serial-number
90 ${device_keys}= Get Dictionary Keys ${node_data}
92 ${length}= Get Length ${device_keys}
93 : FOR ${index} IN RANGE 0 ${length}
94 \ ${line}= Get From List ${device_keys} ${index}
95 \ Run Keyword And Return If '${serial_number}' == '${line}' Get From Dictionary ${node_data} ${serial_number}
96 [Return] ${serial_number}
98 Find Device Description
99 [Documentation] Look for the device description
100 ${description}= Set Variable flow-node-inventory:description
101 ${device_keys}= Get Dictionary Keys ${node_data}
103 ${length}= Get Length ${device_keys}
104 : FOR ${index} IN RANGE 0 ${length}
105 \ ${line}= Get From List ${device_keys} ${index}
106 \ Run Keyword And Return If '${description}' == '${line}' Get From Dictionary ${node_data} ${description}
107 [Return] ${description}