Fix python3 issues in Netvirt
[integration/test.git] / csit / libraries / TsdrUtils.robot
index 19ad16a76e3324a353d8377aecf77033d97579fb..9c3604e85372ff6bd3c92d95028db61a74740c84 100644 (file)
@@ -8,7 +8,6 @@ Library           DateTime
 Resource          Utils.robot
 Variables         ../variables/Variables.py
 Library           json
-Library           HttpLibrary.HTTP
 Library           Process
 
 *** Variables ***
@@ -375,7 +374,7 @@ Get Stats XML
     [Documentation]    Parse the xml output and returns it.
     ${sid}=    RequestsLibrary.Create_Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    headers=${SEND_ACCEPT_XML_HEADERS}    auth=${AUTH}
     ${resp}=    RequestsLibrary.Get Request    session    ${query}    headers=${SEND_ACCEPT_XML_HEADERS}
-    ${resp_xml}=    Parse XML    ${resp.content}
+    ${resp_xml}=    Parse XML    ${resp.text}
     ${id1}=    Get Element Text    ${resp_xml}    ${xpath}
     Delete All Sessions
     [Return]    ${id1}
@@ -385,7 +384,7 @@ Return all XML matches
     [Documentation]    Returns all the values from xpath
     ${sid}=    RequestsLibrary.Create_Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    headers=${SEND_ACCEPT_XML_HEADERS}    auth=${AUTH}
     ${resp}=    RequestsLibrary.Get Request    session    ${query}    headers=${SEND_ACCEPT_XML_HEADERS}
-    ${resp_xml}=    Parse XML    ${resp.content}
+    ${resp_xml}=    Parse XML    ${resp.text}
     @{id1}=    Get Elements Texts    ${resp_xml}    ${xpath}
     Delete All Sessions
     [Return]    @{id1}
@@ -467,7 +466,7 @@ Generate TSDR Query
     [Documentation]    Issues TSDR Query and returns the list
     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
     ${resp}=    RequestsLibrary.Get Request    session    /tsdr/metrics/query?tsdrkey="[NID=${NID}][DC=${DC}][MN=${MN}][RK=${RK}]"&from=${from}&until=${until}    headers=${HEADERS_QUERY}
-    @{convert}=    Parse Json    ${resp.content}
+    @{convert}=    Parse Json    ${resp.text}
     Delete All Sessions
     [Return]    @{convert}
 
@@ -477,10 +476,10 @@ Generate TSDR NBI
     [Documentation]    Issues TSDR Query and returns the list
     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
     ${resp}=    RequestsLibrary.Get Request    session    /tsdr/nbi/render?target="[NID=${NID}][DC=${DC}][MN=${MN}][RK=${RK}]"&from=${from}&until=${until}&maxDataPoints=${datapts}    headers=${HEADERS_QUERY}
-    @{convert}=    Parse Json    ${resp.content}
+    @{convert}=    Parse Json    ${resp.text}
     ${dict_convert}=    Convert To Dictionary    @{convert}
     @{dict}=    Get Dictionary Values    ${dict_convert}
-    @{datapoints_list}=    Convert to List    @{dict}[0]
+    ${datapoints_list}=    Convert to List    ${dict}[0]
     Delete All Sessions
     [Return]    @{datapoints_list}
 
@@ -601,7 +600,7 @@ Collect Data from SNMP Agent
     ${snmpagentcreate_json}=    json.dumps    ${snmpagentcreate}
     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
     ${resp}=    RequestsLibrary.Post Request    session    /restconf/operations/snmp:get-interfaces    data=${snmpagentcreate_json}
-    ${convert}=    To Json    ${resp.content}
+    ${convert}=    To Json    ${resp.text}
     @{dict1}=    Get Dictionary Keys    ${convert}
     ${dict1_0}=    Get From List    ${dict1}    0
     ${dict1_val}=    Get From Dictionary    ${convert}    ${dict1_0}
@@ -669,8 +668,8 @@ Retrieve Value From Elasticsearch
     ${els_JSON_request}=    build_elastic_search_JSON_request    ${els_query}
     ${resp}=    RequestsLibrary.Post_Request    session    _search?pretty    data=${els_JSON_request}
     Should Be Equal As Strings    ${resp.status_code}    200
-    @{convert}=    Parse Json    ${resp.content}
-    ${json}=    RequestsLibrary.To Json    ${resp.content}
+    @{convert}=    Parse Json    ${resp.text}
+    ${json}=    RequestsLibrary.To Json    ${resp.text}
     ${result}=    extract_metric_value_search    ${json}
     [Teardown]    Delete All Sessions
     [Return]    ${result}
@@ -683,8 +682,8 @@ Check Available values from Elasticsearch
     ${els_JSON_request}=    build_elastic_search_JSON_request    ${els_query}
     ${resp}=    RequestsLibrary.Post_Request    session    _search?pretty    data=${els_JSON_request}
     Should Be Equal As Strings    ${resp.status_code}    200
-    @{convert}=    Parse Json    ${resp.content}
-    ${json}=    RequestsLibrary.To Json    ${resp.content}
+    @{convert}=    Parse Json    ${resp.text}
+    ${json}=    RequestsLibrary.To Json    ${resp.text}
     ${result}=    extract_metric_value_count    ${json}
     Log To Console    Elasticsearch: Check number of elements
     Should Be True    ${result} > ${number_items}