Bump pre-commit black to 22.1.0
[integration/test.git] / csit / libraries / TopoprocessingKeywords.robot
index 698aa9a28ff2a81de113b435885f4001f060faf9..d4a47cf320dd91114cf1a8521835617da2bb224b 100644 (file)
@@ -5,7 +5,9 @@ Variables         ../variables/topoprocessing/TopologyRequests.py
 Library           RequestsLibrary
 Library           SSHLibrary
 Library           XML
+Resource          CompareStream.robot
 Resource          KarafKeywords.robot
+Resource          SetupUtils.robot
 Resource          Utils.robot
 
 *** Variables ***
@@ -63,23 +65,20 @@ Delete Underlay Link
 Setup Environment
     [Documentation]    Setup karaf enviroment for following tests
     Log    ---- Setup Environment ----
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
     Open Connection    ${ODL_SYSTEM_IP}
     Flexible Controller Login
-    Run Keyword If    '${ODL_STREAM}' == 'carbon'    Put File    ${CONFIGURATION_CFG}    ${REMOTE_CFG_FILE}
-    Run Keyword Unless    '${ODL_STREAM}' == 'carbon'    Put File    ${CONFIGURATION_XML}    ${REMOTE_XML_FILE}
+    Put File    ${CONFIGURATION_CFG}    ${REMOTE_CFG_FILE}
     Close Connection
     Wait Until Keyword Succeeds    2x    2s    Issue Command On Karaf Console    log:set DEBUG org.opendaylight.topoprocessing
-    Install a Feature    odl-restconf-noauth    timeout=30
     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${SEND_ACCEPT_XML_HEADERS}
-    Install Features    odl-openflowplugin-nsf-model odl-topoprocessing-framework odl-topoprocessing-network-topology odl-topoprocessing-inventory odl-mdsal-models odl-ovsdb-southbound-impl
     Prepare New Feature Installation
     Insert Underlay topologies
 
 Install Features
     [Arguments]    ${features}    ${timeout}=180
     [Documentation]    Install features according to tested distribution
-    Run Keyword If    '${ODL_STREAM}' == 'beryllium'    Install Features for Beryllium Distribution    ${features}    ${timeout}
-    ...    ELSE    Install Features for Other Distributions    ${features}    ${timeout}
+    Install Features for Other Distributions    ${features}    ${timeout}
 
 Install Features for Beryllium Distribution
     [Arguments]    ${features}    ${timeout}
@@ -103,8 +102,7 @@ Clean Environment
     Log    ---- Clean Environment ----
     Open Connection    ${ODL_SYSTEM_IP}
     Flexible Controller Login
-    Run Keyword If    '${ODL_STREAM}' == 'carbon'    Put File    ${OPERATIONAL_CFG}    ${REMOTE_CFG_FILE}
-    Run Keyword Unless    '${ODL_STREAM}' == 'carbon'    Put File    ${OPERATIONAL_XML}    ${REMOTE_XML_FILE}
+    Put File    ${OPERATIONAL_CFG}    ${REMOTE_CFG_FILE}
     Close Connection
     Delete All Sessions
 
@@ -121,7 +119,7 @@ Print Output Topo
     Log    ---- Output Topo Dump After Cooldown----
     Sleep    2s
     ${resp}    Wait Until Keyword Succeeds    5x    250ms    Basic Request Get    ${OVERLAY_TOPO_URL}
-    Log    ${resp.content}
+    Log    ${resp.text}
 
 Refresh Underlay Topologies And Delete Overlay Topology
     [Documentation]    Deletes given overlay topology from datastore and overwrites the underlaying ones with initial topologies
@@ -138,21 +136,23 @@ Insert Underlay Topologies
     [Documentation]    Insert underlay topologies used by following tests
     Log    Inserting underlay topologies
     # Network underlay topologies
-    : FOR    ${index}    IN RANGE    1    7
-    \    ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:${index}    data=${NETWORK_UNDERLAY_TOPOLOGY_${index}}
-    \    Log    ${resp.content}
-    \    Should Match    "${resp.status_code}"    "20?"
-    # Openflow underlay nodes
+    FOR    ${index}    IN RANGE    1    7
+        ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/network-topo:${index}    data=${NETWORK_UNDERLAY_TOPOLOGY_${index}}
+        Log    ${resp.text}
+        Should Match    "${resp.status_code}"    "20?"
+        # Openflow underlay nodes
+    END
     ${resp}    Put Request    session    ${CONFIG_API}/opendaylight-inventory:nodes    data=${OPENFLOW_UNDERLAY_NODES}
-    Log    ${resp.content}
+    Log    ${resp.text}
     Should Match    "${resp.status_code}"    "20?"
     # Openflow underlay topologies
-    : FOR    ${index}    IN RANGE    1    7
-    \    ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:${index}    data=${OPENFLOW_UNDERLAY_TOPOLOGY_${index}}
-    \    Log    ${resp.content}
-    \    Should Match    "${resp.status_code}"    "20?"
+    FOR    ${index}    IN RANGE    1    7
+        ${resp}    Put Request    session    ${CONFIG_API}/${TOPOLOGY_URL}/openflow-topo:${index}    data=${OPENFLOW_UNDERLAY_TOPOLOGY_${index}}
+        Log    ${resp.text}
+        Should Match    "${resp.status_code}"    "20?"
+    END
     Issue Command On Karaf Console    log:clear
-    Log    ${resp.content}
+    Log    ${resp.text}
 
 Prepare Unification Inside Topology Request
     [Arguments]    ${request_template}    ${model}    ${correlation_item}    ${underlay_topo1}
@@ -411,8 +411,9 @@ Check Aggregated Node in Topology
     Should Contain X Times    ${aggregated_node}    <supporting-node>    ${supp_node_count}
     Should Contain X Times    ${aggregated_node}    <termination-point>    ${tp_count}
     Should Contain X Times    ${aggregated_node}    <tp-ref>    ${tp_count}
-    : FOR    ${supp_node_id}    IN    @{supp_node_ids}
-    \    Element Text Should Be    ${aggregated_node}    ${supp_node_id}    xpath=.//supporting-node[node-ref='${supp_node_id}']/node-ref
+    FOR    ${supp_node_id}    IN    @{supp_node_ids}
+        Element Text Should Be    ${aggregated_node}    ${supp_node_id}    xpath=.//supporting-node[node-ref='${supp_node_id}']/node-ref
+    END
     ${overlay_node_id}    Get Element Text    ${aggregated_node}    xpath=./node-id
     [Return]    ${overlay_node_id}
 
@@ -423,14 +424,16 @@ Check Aggregated Termination Point in Node
     ${tp}    Extract Termination Point from Topology    ${model}    ${topology}    ${topology_id}    ${node_id}    ${tp_id}
     ${supp_tp_count}    Get Length    ${supp_tp_ids}
     Should Contain X Times    ${tp}    <tp-ref>    ${supp_tp_count}
-    : FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
-    \    Should Contain X Times    ${tp}    ${supp_tp_id}</tp-ref>    1
+    FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
+        Should Contain X Times    ${tp}    ${supp_tp_id}</tp-ref>    1
+    END
 
 Check Filtered Nodes in Topology
     [Arguments]    ${topology}    ${tp_count}    @{node_ids}
     [Documentation]    Checks nodes in filtered topology
-    : FOR    ${node_id}    IN    @{node_ids}
-    \    Element Text Should Be    ${topology}    ${node_id}    xpath=.//node/supporting-node[node-ref='${node_id}']/node-ref
+    FOR    ${node_id}    IN    @{node_ids}
+        Element Text Should Be    ${topology}    ${node_id}    xpath=.//node/supporting-node[node-ref='${node_id}']/node-ref
+    END
 
 Check Filtered Termination Points in Node
     [Arguments]    ${topology}    ${supp_node_id}    @{supp_tp_ids}
@@ -440,14 +443,16 @@ Check Filtered Termination Points in Node
     Should Contain X Times    ${node}    <supporting-node>    1
     Should Contain X Times    ${node}    <termination-point>    ${supp_tp_count}
     Should Contain X Times    ${node}    <tp-ref>    ${supp_tp_count}
-    : FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
-    \    Should Contain X Times    ${node}    ${supp_tp_id}    1
+    FOR    ${supp_tp_id}    IN    @{supp_tp_ids}
+        Should Contain X Times    ${node}    ${supp_tp_id}    1
+    END
 
 Check Filtered Links In Topology
     [Arguments]    ${topology}    @{supp_link_ids}
     [Documentation]    Checks links in filtered topology
-    : FOR    ${supp_link_id}    IN    @{supp_link_ids}
-    \    Should Contain X Times    ${topology}    ${supp_link_id}</link-ref>    1
+    FOR    ${supp_link_id}    IN    @{supp_link_ids}
+        Should Contain X Times    ${topology}    ${supp_link_id}</link-ref>    1
+    END
 
 Check Overlay Link Source And Destination
     [Arguments]    ${model}    ${topology}    ${topo_id}    ${link_id}    ${expected_source}    ${expected_destination}
@@ -463,16 +468,16 @@ Output Topo Should Be Complete
     ...    ${link-ref_count}=-1
     [Documentation]    Verifies that the output topology contains the expected amount of essential elements
     ${resp}    Wait Until Keyword Succeeds    5x    250ms    Basic Request Get    ${OVERLAY_TOPO_URL}
-    Should Contain    ${resp.content}    <topology-id>${OUTPUT_TOPO_NAME}</topology-id>
-    Run Keyword If    ${node_count}>-1    Should Contain X Times    ${resp.content}    <node>    ${node_count}
-    Run Keyword If    ${supporting-node_count}>-1    Should Contain X Times    ${resp.content}    <supporting-node>    ${supporting-node_count}
-    Run Keyword If    ${node-ref_count}>-1    Should Contain X Times    ${resp.content}    <node-ref>    ${node-ref_count}
-    Run Keyword If    ${link_count}>-1    Should Contain X Times    ${resp.content}    <link>    ${link_count}
-    Run Keyword If    ${link-ref_count}>-1    Should Contain X Times    ${resp.content}    <link-ref>    ${link-ref_count}
-    Run Keyword If    ${tp_count}>-1    Should Contain X Times    ${resp.content}    <termination-point>    ${tp_count}
-    Run Keyword If    ${tp-ref_count}>-1    Should Contain X Times    ${resp.content}    <tp-ref>    ${tp-ref_count}
+    Should Contain    ${resp.text}    <topology-id>${OUTPUT_TOPO_NAME}</topology-id>
+    Run Keyword If    ${node_count}>-1    Should Contain X Times    ${resp.text}    <node>    ${node_count}
+    Run Keyword If    ${supporting-node_count}>-1    Should Contain X Times    ${resp.text}    <supporting-node>    ${supporting-node_count}
+    Run Keyword If    ${node-ref_count}>-1    Should Contain X Times    ${resp.text}    <node-ref>    ${node-ref_count}
+    Run Keyword If    ${link_count}>-1    Should Contain X Times    ${resp.text}    <link>    ${link_count}
+    Run Keyword If    ${link-ref_count}>-1    Should Contain X Times    ${resp.text}    <link-ref>    ${link-ref_count}
+    Run Keyword If    ${tp_count}>-1    Should Contain X Times    ${resp.text}    <termination-point>    ${tp_count}
+    Run Keyword If    ${tp-ref_count}>-1    Should Contain X Times    ${resp.text}    <tp-ref>    ${tp-ref_count}
     Log    ---- Output Topo ----
-    Log    ${resp.content}
+    Log    ${resp.text}
     [Return]    ${resp}
 
 Set Global Variable If It Does Not Exist