Switch PrefixCounting to RFC8040
[integration/test.git] / csit / libraries / DIDMKeywords.robot
index 6a69d48c3749e6c1cbe3cc368a85a050631611c4..a42e047ccc8705802317c1df494d0d89ecd013f7 100644 (file)
@@ -5,20 +5,21 @@ Library           Collections
 Library           RequestsLibrary
 Variables         ../variables/Variables.py
 Resource          ./Utils.robot
+Resource          ../variables/openflowplugin/Variables.robot
 
 *** Keywords ***
 Check DIDM Registered With Device
     [Documentation]    Check for DIDM registered with the device
-    ${resp}=    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}
+    ${resp}=    RequestsLibrary.Get Request    session    ${RFC8040_OPERATIONAL_NODES_API}
     Should Be Equal As Strings    ${resp.status_code}    200
-    Log    ${resp.content}
-    Should Contain    ${resp.content}    didm
-    [Return]    ${resp.content}
+    Log    ${resp.text}
+    Should Contain    ${resp.text}    didm
+    [Return]    ${resp.text}
 
 Find Device Data
     [Documentation]    Extract device information
-    ${resp.content}=    Check DIDM Registered With Device
-    ${json_resp}=    RequestsLibrary.To_Json    ${resp.content}
+    ${resp.text}=    Check DIDM Registered With Device
+    ${json_resp}=    RequestsLibrary.To_Json    ${resp.text}
     ${nodes_resp}=    Get From Dictionary    ${json_resp}    nodes
     ${node_resp}=    Get From Dictionary    ${nodes_resp}    node
     ${node_data}=    Get From List    ${node_resp}    0
@@ -33,9 +34,10 @@ Check Device IP
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${dev_ip}' == '${line}'    Get From Dictionary    ${node_data}    ${dev_ip}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${dev_ip}' == '${line}'    Get From Dictionary    ${node_data}    ${dev_ip}
+    END
     [Return]    ${dev_ip}
 
 Find Device Type
@@ -46,9 +48,10 @@ Find Device Type
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${device_type}' == '${line}'    Get From Dictionary    ${node_data}    ${device_type}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${device_type}' == '${line}'    Get From Dictionary    ${node_data}    ${device_type}
+    END
     [Return]    ${device_type}
 
 Find Device Hardware
@@ -57,9 +60,10 @@ Find Device Hardware
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${device_hw}' == '${line}'    Get From Dictionary    ${node_data}    ${device_hw}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${device_hw}' == '${line}'    Get From Dictionary    ${node_data}    ${device_hw}
+    END
     [Return]    ${device_hw}
 
 Find Device Software
@@ -68,9 +72,10 @@ Find Device Software
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${device_sw}' == '${line}'    Get From Dictionary    ${node_data}    ${device_sw}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${device_sw}' == '${line}'    Get From Dictionary    ${node_data}    ${device_sw}
+    END
     [Return]    ${device_sw}
 
 Find Device Manufacturer
@@ -79,9 +84,10 @@ Find Device Manufacturer
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${manufacture}' == '${line}'    Get From Dictionary    ${node_data}    ${manufacture}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${manufacture}' == '${line}'    Get From Dictionary    ${node_data}    ${manufacture}
+    END
     [Return]    ${manufacture}
 
 Find Serial Number
@@ -90,9 +96,10 @@ Find Serial Number
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${serial_number}' == '${line}'    Get From Dictionary    ${node_data}    ${serial_number}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${serial_number}' == '${line}'    Get From Dictionary    ${node_data}    ${serial_number}
+    END
     [Return]    ${serial_number}
 
 Find Device Description
@@ -101,7 +108,8 @@ Find Device Description
     ${device_keys}=    Get Dictionary Keys    ${node_data}
     Log    ${device_keys}
     ${length}=    Get Length    ${device_keys}
-    : FOR    ${index}    IN RANGE    0    ${length}
-    \    ${line}=    Get From List    ${device_keys}    ${index}
-    \    Run Keyword And Return If    '${description}' == '${line}'    Get From Dictionary    ${node_data}    ${description}
+    FOR    ${index}    IN RANGE    0    ${length}
+        ${line}=    Get From List    ${device_keys}    ${index}
+        Run Keyword And Return If    '${description}' == '${line}'    Get From Dictionary    ${node_data}    ${description}
+    END
     [Return]    ${description}