Change OS_DEPLOY to OPENSTACK_TOPO
[integration/test.git] / csit / libraries / VpnOperations.robot
index 0f112f55c156262e01a3f5a0449a2dbc585cae6b..b73266cfcb86dd817e1be900170c161fe01759ad 100644 (file)
@@ -61,11 +61,27 @@ VPN Get L3VPN ID
     ${vpn_id_hex} =    BuiltIn.Convert To Hex    ${result}
     [Return]    ${vpn_id_hex.lower()}
 
+Verify L3VPN On ODL
+    [Arguments]    @{vpns}
+    [Documentation]    To verify L3VPN on ODL for given vpn ids
+    : FOR    ${vpn}    IN    @{vpns}
+    \    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=${vpn}
+    \    BuiltIn.Should Contain    ${resp}    ${vpn}
+
 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=default    http_timeout=${SESSION_TIMEOUT}
 
+Associate L3VPNs To Networks
+    [Arguments]    ${vpnid_list}    ${network_list}
+    [Documentation]    Associates multiple networks to L3VPN and verify the same
+    : FOR    ${network}    ${vpnid}    IN ZIP    ${network_list}    ${vpnid_list}
+    \    ${network_id} =    OpenStackOperations.Get Net Id    ${network}
+    \    VpnOperations.Associate L3VPN To Network    networkid=${network_id}    vpnid=${vpnid}
+    \    ${resp} =    VpnOperations.VPN Get L3VPN    vpnid=${vpnid}
+    \    BuiltIn.Should Contain    ${resp}    ${network_id}
+
 Dissociate L3VPN From Networks
     [Arguments]    &{Kwargs}
     [Documentation]    Disssociate the already associated networks from L3VPN
@@ -74,12 +90,14 @@ Dissociate L3VPN From Networks
 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=default    http_timeout=${SESSION_TIMEOUT}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/assoc_two_router_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
+    CompareStream.Run_Keyword_If_At_Most_Oxygen    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=default    http_timeout=${SESSION_TIMEOUT}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_two_router_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
+    CompareStream.Run_Keyword_If_At_Most_Oxygen    TemplatedRequests.Post_As_Json_Templated    folder=${VAR_BASE}/dissoc_router_l3vpn    mapping=${Kwargs}    session=default    http_timeout=${SESSION_TIMEOUT}
 
 VPN Delete L3VPN
     [Arguments]    &{Kwargs}
@@ -118,6 +136,12 @@ Verify Flows Are Present For L3VPN
     : FOR    ${i}    IN    @{vm_ips}
     \    ${resp}=    Should Contain    ${l3vpn_table}    ${i}
 
+Verify Flows Are Present For L3VPN On All Compute Nodes
+    [Arguments]    ${vm_ips}
+    [Documentation]    Verify Flows Are Present For L3VPN On All Compute Nodes
+    : FOR    ${ip}    IN    @{OS_CMP_IPS}
+    \    BuiltIn.Wait Until Keyword Succeeds    30s    10s    VpnOperations.Verify Flows Are Present For L3VPN    ${ip}    ${vm_ips}
+
 Verify GWMAC Entry On ODL
     [Arguments]    ${GWMAC_ADDRS}
     [Documentation]    get ODL GWMAC table entry
@@ -138,6 +162,11 @@ Verify GWMAC Flow Entry Removed From Flow Table
     : FOR    ${macAdd}    IN    @{GWMAC_ADDRS}
     \    Should Not Contain    ${gwmac_table}    dl_dst=${macAdd} actions=goto_table:${L3_TABLE}
 
+Verify GWMAC Flow Entry Removed From Flow Table On All Compute Nodes
+    [Documentation]    Verify the GWMAC Table, ARP Response table and Dispatcher table.
+    : FOR    ${ip}    IN    @{OS_CMP_IPS}
+    \    BuiltIn.Wait Until Keyword Succeeds    30s    10s    Verify GWMAC Flow Entry Removed From Flow Table    ${ip}
+
 Verify ARP REQUEST in groupTable
     [Arguments]    ${group_output}    ${Group-ID}
     [Documentation]    get flow dump for group ID
@@ -189,7 +218,7 @@ Get Fib Entries
 Get Gateway MAC And IP Address
     [Arguments]    ${router_Name}    ${ip_regex}=${IP_REGEX}
     [Documentation]    Get Gateway mac and IP Address
-    ${output} =    Write Commands Until Prompt    neutron router-port-list ${router_Name}    30s
+    ${output} =    OpenStack CLI    openstack port list --router ${router_Name}
     @{MacAddr-list} =    Get Regexp Matches    ${output}    ${MAC_REGEX}
     @{IpAddr-list} =    Get Regexp Matches    ${output}    ${ip_regex}
     [Return]    ${MacAddr-list}    ${IpAddr-list}
@@ -246,8 +275,22 @@ Verify GWMAC Flow Entry On Flow Table
     BuiltIn.Run Keyword If    '${ipv}' == 'ipv4'    Verify IPv4 GWMAC Flow Entry On Flow Table    ${group_output}    ${group_id}    ${flow_output}
     ...    ELSE    Verify IPv6 GWMAC Flow Entry On Flow Table    ${flow_output}
 
+Verify GWMAC Flow Entry On Flow Table On All Compute Nodes
+    [Arguments]    ${ipv}=ipv4
+    [Documentation]    Verify the GWMAC Table, ARP Response table and Dispatcher table.
+    : FOR    ${ip}    IN    @{OS_CMP_IPS}
+    \    BuiltIn.Wait Until Keyword Succeeds    30s    10s    VpnOperations.Verify GWMAC Flow Entry On Flow Table    ${ip}    ${ipv}
+
 Delete Multiple L3VPNs
     [Arguments]    @{vpns}
     [Documentation]    Delete three L3VPNs created using Multiple L3VPN Test
     : FOR    ${vpn}    IN    ${vpns}
     \    VPN Delete L3VPN    vpnid=${vpn}
+
+VNI Test Setup
+    BuiltIn.Return From Keyword If    "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"
+    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+
+VNI Test Teardown
+    BuiltIn.Return From Keyword If    "${OPENSTACK_TOPO}" == "1cmb-0ctl-0cmp"
+    OpenStackOperations.Get Test Teardown Debugs