NETVIRT-1599 Add support for group-add-mod-enabled param
[integration/test.git] / csit / suites / netvirt / upgrade / upgrade.robot
index 70634f1e4ec4d0e1f3a567ec43645edb4bd383a0..df375089fef298b438ba0c4f0f854a1f0a844573 100644 (file)
@@ -27,25 +27,29 @@ ${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/genius-mdsalutil:config
+${UPDATE_FLAG_PATH}    /restconf/config/odl-serviceutils-upgrade:upgrade-config
+${GET_ACTIVE_BUNDLE_URI}    /restconf/operations/arbitrator-reconcile:get-active-bundle
+${COMMIT_ACTIVE_BUNDLE_URI}    /restconf/operations/arbitrator-reconcile:commit-active-bundle
+${COMMIT_ACTIVE_BUNDLE_DIR}    ${CURDIR}/../../../variables/netvirt/commit_active_bundle
+${SET_BUNDLE_TIMEOUT}    sudo ovs-vsctl set O . other_config:bundle-idle-timeout=3600
 
 *** 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.
     Check Resource Connectivity
-    DevstackUtils.Set Node Data For Control Only Node Setup
-    Dump Debug With Annotations    POST_SETUP
 
 Stop ODL
     ClusterManagement.Stop_Members_From_List_Or_All
 
 Disconnect OVS
     [Documentation]    Delete OVS manager, controller and groups and tun ports
-    : FOR    ${node}    IN    @{OS_ALL_IPS}
-    \    OVSDB.Delete OVS Manager    ${node}
-    \    OVSDB.Delete OVS Controller    ${node}
-    \    OVSDB.Delete Groups On Bridge    ${node}    ${INTEGRATION_BRIDGE}
-    \    OVSDB.Delete Ports On Bridge By Type    ${node}    ${INTEGRATION_BRIDGE}    ${TYPE}
+    FOR    ${node}    IN    @{OS_ALL_IPS}
+        OVSDB.Delete OVS Manager    ${node}
+        OVSDB.Delete OVS Controller    ${node}
+        OVSDB.Delete Groups On Bridge    ${node}    ${INTEGRATION_BRIDGE}
+        OVSDB.Delete Ports On Bridge By Type    ${node}    ${INTEGRATION_BRIDGE}    ${TYPE}
+        Utils.Run Command On Remote System    ${node}    ${SET_BUNDLE_TIMEOUT}
+    END
 
 Wipe Local Data
     [Documentation]    Delete data/, journal/, snapshots/
@@ -64,23 +68,32 @@ Wait For Full Sync
     Wait Until Keyword Succeeds    90s    5s    Canary Network Should Exist
 
 Set Upgrade Flag
-    ${resp} =    RequestsLibrary.Put Request    session    ${UPDATE_FLAG_PATH}    {"config":{"upgradeInProgress":true}}
+    ${resp} =    RequestsLibrary.Put Request    session    ${UPDATE_FLAG_PATH}    {"upgrade-config":{"upgradeInProgress":true}}
     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    200
 
 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}
-    \    Utils.Run Command On Remote System And Log    ${node}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT} ${PASSIVE_MANAGER}
+    FOR    ${node}    IN    @{OS_ALL_IPS}
+        Utils.Run Command On Remote System And Log    ${node}    sudo ovs-vsctl set-manager tcp:${ODL_SYSTEM_IP}:${OVSDBPORT} ${PASSIVE_MANAGER}
+    END
+    Wait Until Keyword Succeeds    60s    10s    Verify Bundle Active State
+    FOR    ${node}    IN    @{OS_ALL_IPS}
+        ${dpnid} =    OVSDB.Get DPID    ${node}
+        ${dpnid} =    BuiltIn.Convert To String    ${dpnid}
+        ${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.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
+    END
     Wait Until Keyword Succeeds    180s    15s    Check OVS Nodes Have Egress Flows
 
 UnSet Upgrade Flag
-    ${resp} =    RequestsLibrary.Put Request    session    ${UPDATE_FLAG_PATH}    {"config":{"upgradeInProgress":false}}
+    ${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
-    Dump Debug With Annotations    POST_UPGRADE
     Wait Until Keyword Succeeds    90s    10s    Check Resource Connectivity
 
 *** Keywords ***
@@ -92,19 +105,23 @@ Suite Setup
 
 Create Resources
     [Documentation]    Create 2 VXLAN networks, subnets with 2 VMs each and a router. Ping all 4 VMs.
-    : FOR    ${net}    IN    @{NETWORKS}
-    \    OpenStackOperations.Create Network    ${net}
+    FOR    ${net}    IN    @{NETWORKS}
+        OpenStackOperations.Create Network    ${net}
+    END
     OpenStackOperations.Create SubNet    @{NETWORKS}[0]    @{SUBNETS}[0]    @{SUBNETS_RANGE}[0]
     OpenStackOperations.Create SubNet    @{NETWORKS}[1]    @{SUBNETS}[1]    @{SUBNETS_RANGE}[1]
     OpenStackOperations.Create Allow All SecurityGroup    ${SECURITY_GROUP}
     OpenStackOperations.Create Nano Flavor
-    : FOR    ${vm}    IN    @{NET_1_VMS}
-    \    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    ${vm}    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
-    : FOR    ${vm}    IN    @{NET_2_VMS}
-    \    OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    ${vm}    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    FOR    ${vm}    IN    @{NET_1_VMS}
+        OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[0]    ${vm}    ${OS_CMP1_HOSTNAME}    sg=${SECURITY_GROUP}
+    END
+    FOR    ${vm}    IN    @{NET_2_VMS}
+        OpenStackOperations.Create Vm Instance On Compute Node    @{NETWORKS}[1]    ${vm}    ${OS_CMP2_HOSTNAME}    sg=${SECURITY_GROUP}
+    END
     OpenStackOperations.Create Router    ${ROUTER}
-    : FOR    ${interface}    IN    @{SUBNETS}
-    \    OpenStackOperations.Add Router Interface    ${ROUTER}    ${interface}
+    FOR    ${interface}    IN    @{SUBNETS}
+        OpenStackOperations.Add Router Interface    ${ROUTER}    ${interface}
+    END
     @{NET1_VM_IPS}    ${NET1_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_1_VMS}
     @{NET2_VM_IPS}    ${NET2_DHCP_IP} =    OpenStackOperations.Get VM IPs    @{NET_2_VMS}
     BuiltIn.Set Suite Variable    @{NET1_VM_IPS}
@@ -125,8 +142,9 @@ Check Resource Connectivity
 
 Check OVS Nodes Have Egress Flows
     [Documentation]    Loop over all openstack nodes to ensure they have the proper flows installed.
-    : FOR    ${node}    IN    @{OS_ALL_IPS}
-    \    Does OVS Have Multiple Egress Flows    ${node}
+    FOR    ${node}    IN    @{OS_ALL_IPS}
+        Does OVS Have Multiple Egress Flows    ${node}
+    END
 
 Does OVS Have Multiple Egress Flows
     [Arguments]    ${ip}
@@ -141,21 +159,22 @@ Set Custom Component Logging To
     SetupUtils.Setup_Logging_For_Debug_Purposes_On_List_Or_All    ${level}    ${DEBUG_LOG_COMPONENTS}
     KarafKeywords.Issue_Command_On_Karaf_Console    log:list
 
-Dump Debug With Annotations
-    [Arguments]    ${tag}
-    [Documentation]    Dump tons of debug logs for each OS node but also emit tags to make parsing easier
-    Builtin.Log    Start dumping at phase ${tag}
-    : FOR    ${node}    IN    @{OS_ALL_IPS}
-    \    ${conn_id} =    DevstackUtils.Open Connection    ${node}_CONNECTION_NAME    ${node}
-    \    Builtin.Log    Start dumping for ${node} at phase ${tag}
-    \    OpenStackOperations.Get DumpFlows And Ovsconfig    ${conn_id}
-    \    Builtin.Log    End dumping for ${node} at phase ${tag}
-    \    SSHLibrary.Close Connection
-    Builtin.Log    End dumping at phase ${tag}
-
 Canary Network Should Exist
     OpenStackOperations.Get Neutron Network Rest    bd8db3a8-2b30-4083-a8b3-b3fd46401142
 
 Upgrade Suite Teardown
     Set Custom Component Logging To    INFO
     OpenStackOperations.OpenStack Suite Teardown
+
+Verify Bundle Active State
+    [Documentation]    Verify if the bundle is active for the node.
+    FOR    ${node}    IN    @{OS_ALL_IPS}
+        ${dpnid} =    OVSDB.Get DPID    ${node}
+        ${dpnid} =    BuiltIn.Convert To String    ${dpnid}
+        ${body} =    OperatingSystem.Get File    ${COMMIT_ACTIVE_BUNDLE_DIR}/data.json
+        ${body} =    Replace String    ${body}    DPNID    ${dpnid}
+        ${resp} =    RequestsLibrary.Post Request    session    ${GET_ACTIVE_BUNDLE_URI}    data=${body}
+        BuiltIn.Log    ${resp.content}
+        BuiltIn.Should Contain    ${resp.content}    "result":
+        BuiltIn.Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
+    END