enable tcpdump on port 6653 in suite setup
[integration/test.git] / csit / libraries / VpnOperations.robot
index aa98a5015d2997c6dd87be652b0fcebf934f00e6..c6e478504949daea438fc600d768ec3322d4ab56 100644 (file)
@@ -20,28 +20,18 @@ ${STATE_DOWN}     DOWN
 ${STATE_UNKNOWN}    UNKNOWN
 ${STATE_ENABLE}    ENABLED
 ${STATE_DISABLE}    DISABLE
+${SESSION_TIMEOUT}    10
 
 *** Keywords ***
-Basic Vpnservice Suite Setup
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    DevstackUtils.Devstack Suite Setup
-
-Basic Vpnservice Suite Teardown
-    # Delete three L3VPNs created using Multiple L3VPN Test
-    Run Keyword And Ignore Error    VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[0]}
-    Run Keyword And Ignore Error    VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[1]}
-    Run Keyword And Ignore Error    VPN Delete L3VPN    vpnid=${VPN_INSTANCE_ID[2]}
-    ${VM_INSTANCES} =    Create List    @{VM_INSTANCES_NET10}    @{VM_INSTANCES_NET20}
-    : FOR    ${VmInstance}    IN    @{VM_INSTANCES}
-    \    Run Keyword And Ignore Error    Delete Vm Instance    ${VmInstance}
-    : FOR    ${Port}    IN    @{PORT_LIST}
-    \    Run Keyword And Ignore Error    Delete Port    ${Port}
-    : FOR    ${Subnet}    IN    @{SUBNETS}
-    \    Run Keyword And Ignore Error    Delete SubNet    ${Subnet}
-    : FOR    ${Network}    IN    @{NETWORKS}
-    \    Run Keyword And Ignore Error    Delete Network    ${Network}
-    Run Keyword And Ignore Error    Delete SecurityGroup    ${SECURITY_GROUP}
-    Close All Connections
+Basic Suite Setup
+    OpenStackOperations.OpenStack Suite Setup
+    TemplatedRequests.Create Default Session    timeout=${SESSION_TIMEOUT}
+
+Basic Vpnservice Suite Cleanup
+    [Arguments]    ${vpn_instance_ids}=@{EMPTY}    ${vms}=@{EMPTY}    ${networks}=@{EMPTY}    ${subnets}=@{EMPTY}    ${ports}=@{EMPTY}    ${sgs}=@{EMPTY}
+    : FOR    ${vpn_instance_id}    IN    @{vpn_instance_ids}
+    \    BuiltIn.Run Keyword And Ignore Error    VPN Delete L3VPN    vpnid=${vpn_instance_id}
+    OpenStackOperations.Neutron Cleanup    ${vms}    ${networks}    ${subnets}    ${ports}    ${sgs}
 
 VPN Create L3VPN
     [Arguments]    &{Kwargs}
@@ -50,46 +40,46 @@ VPN Create L3VPN
     ...    ELSE    Collections.Set_To_Dictionary    ${Kwargs}    router=${empty}
     &{L3vpn_create_actual_val} =    Collections.Copy_Dictionary    ${L3VPN_CREATE_DEFAULT}
     Collections.Set_To_Dictionary    ${L3vpn_create_actual_val}    &{Kwargs}
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_create    mapping=${L3vpn_create_actual_val}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_create    mapping=${L3vpn_create_actual_val}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 VPN Get L3VPN
     [Arguments]    &{Kwargs}
     [Documentation]    Will return detailed list of the L3VPN_ID received
-    ${resp} =    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/get_l3vpn    mapping=${Kwargs}    session=session
+    ${resp} =    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/get_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
     Log    ${resp}
     [Return]    ${resp}
 
 Associate L3VPN To Network
     [Arguments]    &{Kwargs}
     [Documentation]    Associate the created L3VPN to a network-id received as dictionary argument
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_l3vpn    mapping=${Kwargs}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 Dissociate L3VPN From Networks
     [Arguments]    &{Kwargs}
     [Documentation]    Disssociate the already associated networks from L3VPN
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_l3vpn    mapping=${Kwargs}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 Associate VPN to Router
     [Arguments]    &{Kwargs}
     [Documentation]    Associate the created L3VPN to a router-id received as argument
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_router_l3vpn    mapping=${Kwargs}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_router_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 Dissociate VPN to Router
     [Arguments]    &{Kwargs}
     [Documentation]    Dissociate the already associated routers from L3VPN
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_router_l3vpn    mapping=${Kwargs}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_router_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 VPN Delete L3VPN
     [Arguments]    &{Kwargs}
     [Documentation]    Delete the created L3VPN
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_delete    mapping=${Kwargs}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/l3vpn_delete    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 ITM Create Tunnel
     [Arguments]    &{Kwargs}
     [Documentation]    Creates Tunnel between the two DPNs received in the dictionary argument
     &{Itm_actual_val} =    Collections.Copy_Dictionary    ${ITM_CREATE_DEFAULT}
     Collections.Set_To_Dictionary    ${Itm_actual_val}    &{Kwargs}
-    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/itm_create    mapping=${Itm_actual_val}    session=session
+    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/itm_create    mapping=${Itm_actual_val}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 ITM Get Tunnels
     [Documentation]    Get all Tunnels and return the contents
@@ -192,10 +182,8 @@ Get Gateway MAC And IP Address
     [Return]    ${MacAddr-list}    ${IpAddr-list}
 
 Test Teardown With Tcpdump Stop
-    [Arguments]    ${cn1_conn_id}    ${cn2_conn_id}    ${os_conn_id}
-    Stop Packet Capture on Node    ${cn1_conn_id}
-    Stop Packet Capture on Node    ${cn2_conn_id}
-    Stop Packet Capture on Node    ${os_conn_id}
+    [Arguments]    ${conn_ids}=@{EMPTY}
+    OpenStackOperations.Stop Packet Capture On Nodes    ${conn_ids}
     Get Test Teardown Debugs
 
 Verify IPv4 GWMAC Flow Entry On Flow Table