correction to NETVIRT-1599
[integration/test.git] / csit / suites / netvirt / upgrade / upgrade.robot
index aba7c9e172f441fe368b40e328283fbb03777a64..5733edd0a4f015c3a82a5213a6f4ff27996c463d 100644 (file)
@@ -1,7 +1,7 @@
 *** Settings ***
 Documentation     Test suite for ODL Upgrade. It is assumed that OLD + OpenStack
 ...               integrated environment is deployed and ready.
-Suite Setup       OpenStackOperations.OpenStack Suite Setup
+Suite Setup       Suite Setup
 Suite Teardown    Upgrade Suite Teardown
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Test Teardown     Get Test Teardown Debugs
@@ -27,13 +27,14 @@ ${ROUTER}         upgrade_router_1
 ${TYPE}           tun
 ${PASSIVE_MANAGER}    ptcp:6641:127.0.0.1
 @{DEBUG_LOG_COMPONENTS}    org.opendaylight.ovsdb    org.opendaylight.ovsdb.lib    org.opendaylight.netvirt    org.opendaylight.genius
+${UPDATE_FLAG_PATH}    /restconf/config/odl-serviceutils-upgrade:upgrade-config
+${COMMIT_ACTIVE_BUNDLE_URI}    /restconf/operations/arbitrator-reconcile:commit-active-bundle
+${COMMIT_ACTIVE_BUNDLE_DIR}    ${CURDIR}/../../../variables/netvirt/commit_active_bundle
 
 *** Test Cases ***
 Create Setup And Verify Instance Connectivity
     [Documentation]    Create 2 VXLAN networks, subnets with 2 VMs each and a router. Ping all 4 VMs.
-    Create Resources
     Check Resource Connectivity
-    DevstackUtils.Set Node Data For Control Only Node Setup
     Dump Debug With Annotations    POST_SETUP
 
 Stop ODL
@@ -63,12 +64,27 @@ Wait For Full Sync
     [Documentation]    Wait for networking_odl to sync neutron configuration
     Wait Until Keyword Succeeds    90s    5s    Canary Network Should Exist
 
+Set Upgrade Flag
+    ${resp} =    RequestsLibrary.Put Request    session    ${UPDATE_FLAG_PATH}    {"upgrade-config":{"upgradeInProgress":true}}
+    BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
+    : FOR    ${node}    IN    @{OS_ALL_IPS}
+    \    ${dpnid} =    OVSDB.Get DPID    ${node}
+    \    ${body} =    OperatingSystem.Get File    ${COMMIT_ACTIVE_BUNDLE_DIR}/data.json
+    \    ${body} =    Replace String    ${body}    DPNID    ${dpnid}
+    \    ${resp} =    RequestsLibrary.Post Request    session    ${COMMIT_ACTIVE_BUNDLE_URI}    data=${body}
+    \    BuiltIn.Log    ${resp.content}
+    \    BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
+
 Set OVS Manager And Controller
     [Documentation]    Set controller and manager on each OpenStack node and check that egress flows are present
     : FOR    ${node}    IN    @{OS_ALL_IPS}
-    \    Run Command On Remote System    ${node}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT} ${PASSIVE_MANAGER}
+    \    Utils.Run Command On Remote System And Log    ${node}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT} ${PASSIVE_MANAGER}
     Wait Until Keyword Succeeds    180s    15s    Check OVS Nodes Have Egress Flows
 
+UnSet Upgrade Flag
+    ${resp} =    RequestsLibrary.Put Request    session    ${UPDATE_FLAG_PATH}    {"upgrade-config":{"upgradeInProgress":false}}
+    BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
+
 Check Connectivity With Previously Created Resources And br-int Info
     [Documentation]    Check that pre-existing instance connectivity still works after the new controller is brought
     ...    up and config is sync'd
@@ -76,6 +92,12 @@ Check Connectivity With Previously Created Resources And br-int Info
     Wait Until Keyword Succeeds    90s    10s    Check Resource Connectivity
 
 *** Keywords ***
+Suite Setup
+    OpenStackOperations.OpenStack Suite Setup
+    Create Resources
+    OpenStackOperations.Show Debugs    @{NET_1_VMS}    @{NET_2_VMS}
+    OpenStackOperations.Get Suite Debugs
+
 Create Resources
     [Documentation]    Create 2 VXLAN networks, subnets with 2 VMs each and a router. Ping all 4 VMs.
     : FOR    ${net}    IN    @{NETWORKS}
@@ -117,7 +139,7 @@ Check OVS Nodes Have Egress Flows
 Does OVS Have Multiple Egress Flows
     [Arguments]    ${ip}
     [Documentation]    Verifies that at least 1 flow exists on the node for the ${EGRESS_L2_FWD_TABLE}
-    ${flows} =    Utils.Run Command On Remote System    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
+    ${flows} =    Utils.Run Command On Remote System And Log    ${ip}    sudo ovs-ofctl -O OpenFlow13 dump-flows ${INTEGRATION_BRIDGE}
     ${egress_flows} =    String.Get Lines Containing String    ${flows}    table=${EGRESS_LPORT_DISPATCHER_TABLE}
     ${num_egress_flows} =    String.Get Line Count    ${egress_flows}
     BuiltIn.Should Be True    ${num_egress_flows} > 1