From f4eee95343f615c51a064a48643425b333a952ce Mon Sep 17 00:00:00 2001 From: Konstantin Blagov Date: Fri, 30 Oct 2015 13:25:28 +0100 Subject: [PATCH] Integration tests for GBP Change-Id: Ica5e24f0854dbdcce1cb884edba09dcc3e8acdbb Signed-off-by: Konstantin Blagov Signed-off-by: Tomas Cechvala --- csit/libraries/GBP/RestconfUtils.robot | 13 +- .../GBP/3-node/GBP_3node.robot | 30 ++ .../GBP/3-node/Variables.robot | 49 ++ .../GBP/3-node/__init__.robot | 38 ++ .../GBP/3-node/gbp1/000_setup.robot | 20 + .../GBP/3-node/gbp1/001_set_odl.robot | 32 ++ .../GBP/3-node/gbp1/002_wait_flows.robot | 24 + .../GBP/3-node/gbp1/010_icmp.robot | 194 ++++++++ .../GBP/3-node/gbp1/020_http.robot | 218 +++++++++ .../GBP/3-node/gbp1/998_clean_odl.robot | 29 ++ .../GBP/3-node/gbp1/999_teardown.robot | 19 + .../init_scripts/infrastructure_config.py | 65 +++ .../3-node/gbp2-multitenant/000_setup.robot | 20 + .../3-node/gbp2-multitenant/001_set_odl.robot | 33 ++ .../gbp2-multitenant/002_wait_flows.robot | 24 + .../3-node/gbp2-multitenant/010_icmp.robot | 391 +++++++++++++++ .../3-node/gbp2-multitenant/020_http.robot | 457 ++++++++++++++++++ .../gbp2-multitenant/998_clean_odl.robot | 30 ++ .../gbp2-multitenant/999_teardown.robot | 19 + .../init_scripts/infrastructure_config.py | 101 ++++ .../{ => 3node}/demo-gbp1/vethl-h35_2.json | 0 .../{ => 3node}/demo-gbp1/vethl-h35_3.json | 0 .../{ => 3node}/demo-gbp1/vethl-h35_4.json | 0 .../{ => 3node}/demo-gbp1/vethl-h35_5.json | 0 .../{ => 3node}/demo-gbp1/vethl-h36_2.json | 0 .../{ => 3node}/demo-gbp1/vethl-h36_3.json | 0 .../{ => 3node}/demo-gbp1/vethl-h36_4.json | 0 .../{ => 3node}/demo-gbp1/vethl-h36_5.json | 0 .../demo-gbp2}/vethl-h35_2.json | 0 .../demo-gbp2}/vethl-h35_3.json | 0 .../demo-gbp2}/vethl-h35_4.json | 0 .../demo-gbp2}/vethl-h35_5.json | 0 .../demo-gbp2}/vethl-h35_6.json | 0 .../demo-gbp2}/vethl-h35_7.json | 0 .../demo-gbp2}/vethl-h35_8.json | 0 .../demo-gbp2}/vethl-h35_9.json | 0 .../demo-gbp2}/vethl-h36_2.json | 0 .../demo-gbp2}/vethl-h36_3.json | 0 .../demo-gbp2}/vethl-h36_4.json | 0 .../demo-gbp2}/vethl-h36_5.json | 0 .../demo-gbp2}/vethl-h36_6.json | 0 .../demo-gbp2}/vethl-h36_7.json | 0 .../demo-gbp2}/vethl-h36_8.json | 0 .../demo-gbp2}/vethl-h36_9.json | 0 .../tenants.json => 3node/tenant1.json} | 0 .../{gbp2-multitenant => 3node}/tenant2.json | 0 .../gbp/{demo-gbp1 => 3node}/tunnels.json | 0 .../gbp/gbp2-multitenant/tenant1.json | 179 ------- .../gbp/gbp2-multitenant/tunnels.json | 57 --- 49 files changed, 1801 insertions(+), 241 deletions(-) create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/GBP_3node.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/Variables.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/__init__.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/000_setup.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/001_set_odl.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/002_wait_flows.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/010_icmp.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/020_http.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/998_clean_odl.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/999_teardown.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/init_scripts/infrastructure_config.py create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/000_setup.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/001_set_odl.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/002_wait_flows.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/010_icmp.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/020_http.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/998_clean_odl.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/999_teardown.robot create mode 100755 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/init_scripts/infrastructure_config.py rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h35_2.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h35_3.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h35_4.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h35_5.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h36_2.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h36_3.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h36_4.json (100%) rename csit/variables/gbp/{ => 3node}/demo-gbp1/vethl-h36_5.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_2.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_3.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_4.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_5.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_6.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_7.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_8.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h35_9.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_2.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_3.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_4.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_5.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_6.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_7.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_8.json (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node/demo-gbp2}/vethl-h36_9.json (100%) rename csit/variables/gbp/{demo-gbp1/tenants.json => 3node/tenant1.json} (100%) rename csit/variables/gbp/{gbp2-multitenant => 3node}/tenant2.json (100%) rename csit/variables/gbp/{demo-gbp1 => 3node}/tunnels.json (100%) delete mode 100644 csit/variables/gbp/gbp2-multitenant/tenant1.json delete mode 100644 csit/variables/gbp/gbp2-multitenant/tunnels.json diff --git a/csit/libraries/GBP/RestconfUtils.robot b/csit/libraries/GBP/RestconfUtils.robot index 8b194ae47e..a1e41abeae 100644 --- a/csit/libraries/GBP/RestconfUtils.robot +++ b/csit/libraries/GBP/RestconfUtils.robot @@ -6,11 +6,14 @@ Library json Variables ../../variables/Variables.py Resource ../Utils.robot +*** Variables *** +${ENDPOINT_UNREG_PATH} ${GBP_UNREGEP_API} +${ENDPOINTS_OPER_PATH} /restconf/operational/endpoint:endpoints + *** Keywords *** Unregister Endpoints - [Arguments] ${OPER_ENDPOINTS_PATH} [Documentation] Unregister Endpoints Endpoints from ODL - ${result} = RequestsLibrary.Get session ${OPER_ENDPOINTS_PATH} + ${result} = RequestsLibrary.Get session ${ENDPOINTS_OPER_PATH} ${json_result} = json.loads ${result.text} Pass Execution If ${json_result['endpoints']}=={} No Endpoints available ${L2_ENDPOINTS} = Set Variable ${json_result['endpoints']['endpoint']} @@ -19,7 +22,7 @@ Unregister Endpoints Unregister L2Endpoints ${L2_ENDPOINTS} Log ${L3_ENDPOINTS} Unregister L3Endpoints ${L3_ENDPOINTS} - ${result} = RequestsLibrary.Get session ${OPER_ENDPOINTS_PATH} + ${result} = RequestsLibrary.Get session ${ENDPOINTS_OPER_PATH} ${json_result} = json.loads ${result.text} Should Be Empty ${json_result['endpoints']} @@ -28,14 +31,14 @@ Unregister L2Endpoints [Documentation] Unregister Endpoints L2Endpoints from ODL : FOR ${endpoint} IN @{l2_eps} \ ${l2_data} = Create L2 Endpoint JSON Data ${endpoint} - \ Post Elements To URI ${UNREG_ENDPOINTS_PATH} ${l2_data} + \ Post Elements To URI ${ENDPOINT_UNREG_PATH} ${l2_data} Unregister L3Endpoints [Arguments] ${l3_eps} [Documentation] Unregister Endpoints L3Endpoints from ODL : FOR ${endpoint} IN @{l3_eps} \ ${l3_data} = Create L3 Endpoint JSON Data ${endpoint} - \ Post Elements To URI ${UNREG_ENDPOINTS_PATH} ${l3_data} + \ Post Elements To URI ${ENDPOINT_UNREG_PATH} ${l3_data} Create L2 Endpoint JSON Data [Arguments] ${endpoint} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/GBP_3node.robot b/csit/suites/groupbasedpolicy/GBP/3-node/GBP_3node.robot new file mode 100755 index 0000000000..abb220ea40 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/GBP_3node.robot @@ -0,0 +1,30 @@ +*** Settings *** +Library SSHLibrary +Resource Variables.robot +Resource ../../../../libraries/Utils.robot +Resource ../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../variables/Variables.py + + +*** Keywords *** + +Setup Node + [Arguments] ${GBP} ${suite_dir} ${sw_index} ${timeout}=10s + ConnUtils.Connect and Login ${GBP} timeout=${timeout} + SSHLibrary.Put File ${suite_dir}/init_scripts/* ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/ mode=0755 + ${stdout} ${stderr} ${rc} Execute in VE python ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_launch.py ${CONTROLLER} ${sw_index} + ... timeout=${timeout} + Should Be Equal As Numbers ${rc} 0 + SSHLibrary.Close Connection + +Teardown Node + [Arguments] ${GBP} ${suite_dir} ${timeout}=3s + ConnUtils.Connect and Login ${GBP} timeout=${timeout} + ${stderr} SSHLibrary.Execute Command rm ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/infrastructure_config.py + ... return_stderr=True return_stdout=False + Should Be Empty ${stderr} + ${stderr} SSHLibrary.Execute Command ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/clean-demo.sh + ... return_stderr=True return_stdout=False + Should Be Empty ${stderr} + SSHLibrary.Close Connection + diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/Variables.robot b/csit/suites/groupbasedpolicy/GBP/3-node/Variables.robot new file mode 100755 index 0000000000..d6a18524ce --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/Variables.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Global variables for GBPSFC 6-node topology +Variables ../../../../variables/Variables.py + +*** Variables *** +${VM_HOME_FOLDER} = ${WORKSPACE} +${VM_SCRIPTS_FOLDER} = scripts +${ODL} = ${ODL_SYSTEM_IP} +${GBP1} = ${TOOLS_SYSTEM_IP} +${GBP2} = ${TOOLS_SYSTEM_2_IP} +${GBP3} = ${TOOLS_SYSTEM_3_IP} +@{GBPs} = ${GBP1} ${GBP2} ${GBP3} + +${GBP_TENANT1_ID} f5c7d344-d1c7-4208-8531-2c2693657e12 +${GBP_TENANT2_ID} 25c7d344-d1c7-4208-8531-2c2693657e12 +${TENANT1_PATH} ${GBP_TENANTS_API}/tenant/${GBP_TENANT1_ID} +${TENANT2_PATH} ${GBP_TENANTS_API}/tenant/${GBP_TENANT2_ID} +${TUNNELS_PATH} ${CONFIG_NODES_API} +${ENDPOINT_REG_PATH} ${GBP_REGEP_API} +${ENDPOINT_UNREG_PATH} ${GBP_UNREGEP_API} +${ENDPOINTS_OPER_PATH} /restconf/operational/endpoint:endpoints +${OF_OVERLAY_CONFIG_PATH} /restconf/config/ofoverlay:of-overlay-config +${TENANT1_FILE} ${CURDIR}/../../../../variables/gbp/3node/tenant1.json +${TENANT2_FILE} ${CURDIR}/../../../../variables/gbp/3node/tenant2.json +${TUNNELS_FILE} ${CURDIR}/../../../../variables/gbp/3node/tunnels.json +${ENDPOINTS_GBP1_DIR} ${CURDIR}/../../../../variables/gbp/3node/demo-gbp1 +${ENDPOINTS_GBP2_DIR} ${CURDIR}/../../../../variables/gbp/3node/demo-gbp2 + +*** Keywords *** +Set Test Variables + [Documentation] Sets variables used in 3node test cases. + [Arguments] ${client_switch_ip} ${client_docker} ${client_ip} ${client_mac} + ... ${same_webserver_docker} ${same_webserver_ip} ${same_webserver_mac} + ... ${diff_webserver_switch_ip} ${diff_webserver_docker} ${diff_webserver_ip} + ... ${diff_webserver_mac} + Set Global Variable ${CLIENT_SWITCH_IP} ${client_switch_ip} + Set Global Variable ${CLIENT_DOCKER} ${client_docker} + Set Global Variable ${CLIENT_IP} ${client_ip} + Set Global Variable ${CLIENT_MAC} ${client_mac} + + Set Global Variable ${SAME_WEBSERVER_DOCKER} ${same_webserver_docker} + Set Global Variable ${SAME_WEBSERVER_IP} ${same_webserver_ip} + Set Global Variable ${SAME_WEBSERVER_MAC} ${same_webserver_mac} + + Set Global Variable ${DIFF_WEBSERVER_SWITCH_IP} ${diff_webserver_switch_ip} + Set Global Variable ${DIFF_WEBSERVER_DOCKER} ${diff_webserver_docker} + Set Global Variable ${DIFF_WEBSERVER_IP} ${diff_webserver_ip} + Set Global Variable ${DIFF_WEBSERVER_MAC} ${diff_webserver_mac} + diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/__init__.robot b/csit/suites/groupbasedpolicy/GBP/3-node/__init__.robot new file mode 100755 index 0000000000..a8a880eb88 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/__init__.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Setup/teardown for GBP 3-node topology +Suite Setup Setup Everything +Suite Teardown Teardown Everything +Library SSHLibrary +Library RequestsLibrary +Resource ../../../../libraries/Utils.robot +Resource ../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../variables/Variables.py +Resource Variables.robot + + +*** Variables *** +${timeout} = 10s + + +*** Keywords *** +Setup Everything + Log start_suite_in_3_node + Create Session session http://${ODL}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} + Wait Until Keyword Succeeds 10x 30 s Get Data From URI + ... session ${OF_OVERLAY_CONFIG_PATH} headers=${headers} + Delete All Sessions + :FOR ${GBP} IN @{GBPs} + \ ConnUtils.Connect and Login ${GBP} timeout=${timeout} + \ ${stderr} SSHLibrary.Execute Command virtualenv --system-site-packages ${VE_DIR} return_stdout=False return_stderr=True return_rc=False + \ Should Be Empty ${stderr} + \ SSHLibrary.Put File ${CURDIR}/../../common_scripts/* ${VM_HOME_FOLDER}${/}${VM_SCRIPTS_FOLDER}/ mode=0755 + \ ${stdout} ${stderr} ${rc} ConnUtils.Execute in VE pip freeze | grep ipaddr -q || pip install ipaddr timeout=${timeout} + \ Should Be Equal As Numbers ${rc} 0 + \ SSHLibrary.Close Connection + +Teardown Everything + Log stop_suite_in_3_node + :FOR ${GBP} IN @{GBPs} + \ ConnUtils.Connect and Login ${GBP} timeout=${timeout} + \ SSHLibrary.Execute Command sudo rm -rf ${VM_SCRIPTS_FOLDER} + \ SSHLibrary.Close Connection diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/000_setup.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/000_setup.robot new file mode 100755 index 0000000000..6bbdd70589 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/000_setup.robot @@ -0,0 +1,20 @@ +*** Settings *** +Default Tags single-tenant setup single-tenant-setup +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Resource ../GBP_3node.robot + + +*** Variables *** +${timeout} = 10s + + +*** Test Cases *** +Setup Suite + Log Setup suite in gbp1 + GBP_3node.Setup Node ${GBP1} ${CURDIR} 0 timeout=${timeout} + GBP_3node.Setup Node ${GBP2} ${CURDIR} 1 timeout=${timeout} + GBP_3node.Setup Node ${GBP3} ${CURDIR} 2 timeout=${timeout} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/001_set_odl.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/001_set_odl.robot new file mode 100644 index 0000000000..20a4e57931 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/001_set_odl.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Test suite for GBP Tenants, Operates functions from Restconf APIs. +Default Tags single-tenant setup single-tenant-setup +Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} +Suite Teardown Delete All Sessions +Library RequestsLibrary +Library OperatingSystem +Variables ../../../../../variables/Variables.py +Resource ../../../../../libraries/Utils.robot +Resource ../Variables.robot + +*** Variables *** + +*** Test Cases *** +Put Tunnels + [Documentation] Send tunnel augmentation to ODL + ${json_to_edit} OperatingSystem.Get File ${TUNNELS_FILE} + ${edited_json} Replace String ${json_to_edit} _CLASSIFIER1 ${GBP1} + ${edited_json} Replace String ${edited_json} _CLASSIFIER2 ${GBP2} + ${edited_json} Replace String ${edited_json} _CLASSIFIER3 ${GBP3} + ${resp} RequestsLibrary.Put Request session ${TUNNELS_PATH} ${edited_json} ${HEADERS} + Should Be Equal As Strings ${resp.status_code} 200 + +Register Endpoints + [Documentation] Endpoints registration + @{endpoint_files} = OperatingSystem.List Files In Directory ${ENDPOINTS_GBP1_DIR} vethl*.*json absolute + :FOR ${endpoint_file} IN @{endpoint_files} + \ Post Elements To URI From File ${ENDPOINT_REG_PATH} ${endpoint_file} + +Put Tenant + [Documentation] Send GBP policy to ODL + Add Elements To URI From File ${TENANT1_PATH} ${TENANT1_FILE} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/002_wait_flows.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/002_wait_flows.robot new file mode 100755 index 0000000000..41b0e94982 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/002_wait_flows.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Waiting until flows are created +Default Tags single-tenant setup single-tenant-setup +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot + + +*** Variables *** +${timeout} = 10s + + +*** Testcases *** + +Wait For Flows + Sleep 30s + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP1} sw1 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw1! + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP2} sw2 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw2! + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP3} sw3 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw3! diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/010_icmp.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/010_icmp.robot new file mode 100644 index 0000000000..7fb7f87f49 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/010_icmp.robot @@ -0,0 +1,194 @@ +*** Settings *** +Documentation Tests for ICMP flow +Default Tags single-tenant icmp single-tenant-main +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../../../../../libraries/GBP/DockerUtils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Suite Setup Set Test Variables client_switch_ip=${GBP1} client_docker=h35_2 client_ip=10.0.35.2 + ... client_mac=00:00:00:00:35:02 same_webserver_docker=h36_4 same_webserver_ip=10.0.36.4 + ... same_webserver_mac=00:00:00:00:36:04 diff_webserver_switch_ip=${GBP3} + ... diff_webserver_docker=h36_3 diff_webserver_ip=10.0.36.3 + ... diff_webserver_mac=00:00:00:00:36:03 + + +*** Variables *** +${timeout} = 10s + + +*** Testcases *** + +Same switch, ping once from h35_2 to h36_4 + [Documentation] Ping between endpoints located on the same switch "sw1". + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Same switch, start endless ping from h35_2 to h36_4 + [Documentation] Start endless ping from h35_2 to h36_4 so that icmp traffic + ... can be inspected. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Same switch, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_4 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Same switch, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_4 to h35_2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + Set Suite Variable @{matches} @{EMPTY} + Set Suite Variable @{actions} @{EMPTY} + + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Same switch, stop endless ping from h35_2 to h36_4 + [Documentation] Stops endless pinging from h35_2 to h36_4 when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + + +Different switches, ping once from h35_2 to h36_3 + [Documentation] Different switches (sw1 -> sw3) + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Different switches, start endless ping from h35_2 to h36_3 + [Documentation] Starting icmp session for traffic inspection between endpoints located + ... on different switches. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Different switches, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, ICMP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 5 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, ICMP reply ovs-dpctl output check on sw3 + [Documentation] assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 5 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, stop endless ping from h35_2 to h36_3 + [Documentation] Stops endless pinging from h35_2 to h36_3 when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/020_http.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/020_http.robot new file mode 100644 index 0000000000..31cb559233 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/020_http.robot @@ -0,0 +1,218 @@ +*** Settings *** +Documentation Tests for HTTP flow +Default Tags single-tenant http single-tenant-main +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../../../../../libraries/GBP/DockerUtils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Suite Setup Set Test Variables client_switch_ip=${GBP1} client_docker=h35_2 client_ip=10.0.35.2 + ... client_mac=00:00:00:00:35:02 same_webserver_docker=h36_4 same_webserver_ip=10.0.36.4 + ... same_webserver_mac=00:00:00:00:36:04 diff_webserver_switch_ip=${GBP3} + ... diff_webserver_docker=h36_3 diff_webserver_ip=10.0.36.3 + ... diff_webserver_mac=00:00:00:00:36:03 + + +*** Variables *** +${timeout} = 10s + +*** Testcases *** + +# Same subnet tests are not supported by current topology configuration; +# clients and webservers are put in two different subnets + +Same switch, start SimpleHttpServer on h36_4 + [Documentation] Same Switch (sw1) + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Same switch, curl once from h35_2 to h36_4 + [Documentation] Test HTTP req/resp from h35_2 to h36_4. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Same switch, start endless curl from h35_2 to h36_4 + [Documentation] Init of endless HTTP session for purposes of traffic inspection. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Same switch, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_4 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Same switch, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP reply from h36_4 to h35_2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Same switch, stop endless curl from h35_2 to h36_4 + [Documentation] Stopping endless HTTP session when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Same switch, stop SimpleHttpServer on h36_4 + [Documentation] Shutting down HTTP service on h36_4. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} + SSHLibrary.Close Connection + +Different switches, start SimpleHttpServer on h36_3 + [Documentation] Different switches (sw1 -> sw3) + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Different switches, curl once from h35_2 to h36_3 + [Documentation] Test HTTP req/resp from h35_2 to h36_3. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Different switches, start endless curl from h35_2 to h36_3 + [Documentation] Init of endless HTTP session for purposes of traffic inspection. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Different switches, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_3 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, HTTP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_3 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 5 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, HTTP reply ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP reply from h36_3 to h35_2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 5 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_3 to h35_2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Different switches, stop endless curl from h35_2 to h36_3 + [Documentation] Stopping endless HTTP session when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Different switches, stop SimpleHttpServer on h36_3 + [Documentation] Shutting down HTTP service on h36_3. + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} + SSHLibrary.Close Connection diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/998_clean_odl.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/998_clean_odl.robot new file mode 100644 index 0000000000..e2188e1fde --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/998_clean_odl.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Test suite for cleaning up / unregister infrastructure constructs like endpoints for demo-asymmetric-chain +Default Tags single-tenant teardown single-tenant-teardown +Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} +Suite Teardown Delete All Sessions +Library RequestsLibrary +Library OperatingSystem +Library json +Variables ../../../../../variables/Variables.py +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/RestconfUtils.robot +Resource ../Variables.robot + + +*** Variables *** + +*** Test Cases *** + +Delete Tenant + [Documentation] Delete Tenants from ODL + Remove All Elements At URI ${TENANT1_PATH} + +Unregister Endpoints + [Documentation] Unregister Endpoints Endpoints from ODL + RestconfUtils.Unregister Endpoints + +Delete Nodes + [Documentation] Delete Nodes from ODL + Remove All Elements At URI ${TUNNELS_PATH} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/999_teardown.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/999_teardown.robot new file mode 100755 index 0000000000..32befd1e8c --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/999_teardown.robot @@ -0,0 +1,19 @@ +*** Settings *** +Default Tags single-tenant teardown single-tenant-teardown +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Resource ../GBP_3node.robot + + +*** Variables *** +${timeout} = 10s + + +*** Test Cases *** +Teardown Suite + Log Teardown suite in gbp1 + :FOR ${GBP} IN @{GBPs} + \ GBP_3node.Teardown Node ${GBP} ${CURDIR} timeout=${timeout} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/init_scripts/infrastructure_config.py b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/init_scripts/infrastructure_config.py new file mode 100755 index 0000000000..8503c8e5da --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/init_scripts/infrastructure_config.py @@ -0,0 +1,65 @@ +# Config for switches, tunnelIP is the local IP address. +switches = [{'name': 'sw1', + 'type': 'gbp', + 'dpid': '1'}, + {'name': 'sw2', + 'type': 'gbp', + 'dpid': '2'}, + {'name': 'sw3', + 'type': 'gbp', + 'dpid': '3'}, + {'name': 'sw4', + 'type': 'none', + 'dpid': '4'}, + {'name': 'sw5', + 'type': 'none', + 'dpid': '5'}, + {'name': 'sw6', + 'type': 'none', + 'dpid': '6'}, + {'name': 'sw7', + 'type': 'none', + 'dpid': '7'}, + {'name': 'sw8', + 'type': 'none', + 'dpid': '8'} + ] + +defaultContainerImage = 'alagalah/odlpoc_ovs230' +# defaultContainerImage='ubuntu:14.04' + +# Note that tenant name and endpointGroup name come from policy_config.py + +hosts = [{'name': 'h35_2', + 'mac': '00:00:00:00:35:02', + 'ip': '10.0.35.2/24', + 'switch': 'sw1'}, + {'name': 'h35_3', + 'ip': '10.0.35.3/24', + 'mac': '00:00:00:00:35:03', + 'switch': 'sw2'}, + {'name': 'h35_4', + 'ip': '10.0.35.4/24', + 'mac': '00:00:00:00:35:04', + 'switch': 'sw3'}, + {'name': 'h35_5', + 'ip': '10.0.35.5/24', + 'mac': '00:00:00:00:35:05', + 'switch': 'sw1'}, + {'name': 'h36_2', + 'ip': '10.0.36.2/24', + 'mac': '00:00:00:00:36:02', + 'switch': 'sw2'}, + {'name': 'h36_3', + 'ip': '10.0.36.3/24', + 'mac': '00:00:00:00:36:03', + 'switch': 'sw3'}, + {'name': 'h36_4', + 'ip': '10.0.36.4/24', + 'mac': '00:00:00:00:36:04', + 'switch': 'sw1'}, + {'name': 'h36_5', + 'ip': '10.0.36.5/24', + 'mac': '00:00:00:00:36:05', + 'switch': 'sw2'} + ] diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/000_setup.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/000_setup.robot new file mode 100755 index 0000000000..9d7b4b084b --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/000_setup.robot @@ -0,0 +1,20 @@ +*** Settings *** +Default Tags multi-tenant setup multi-tenant-setup +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Resource ../GBP_3node.robot + + +*** Variables *** +${timeout} = 10s + + +*** Test Cases *** +Setup Suite + Log Setup suite in gbp2-multitenant + GBP_3node.Setup Node ${GBP1} ${CURDIR} 0 timeout=${timeout} + GBP_3node.Setup Node ${GBP2} ${CURDIR} 1 timeout=${timeout} + GBP_3node.Setup Node ${GBP3} ${CURDIR} 2 timeout=${timeout} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/001_set_odl.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/001_set_odl.robot new file mode 100644 index 0000000000..c38add9db4 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/001_set_odl.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Test suite for GBP Tenants, Operates functions from Restconf APIs. +Default Tags multi-tenant setup multi-tenant-setup +Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} +Suite Teardown Delete All Sessions +Library RequestsLibrary +Library OperatingSystem +Variables ../../../../../variables/Variables.py +Resource ../../../../../libraries/Utils.robot +Resource ../Variables.robot + +*** Variables *** + +*** Test Cases *** +Put Tunnels + [Documentation] Send tunnel augmentation to ODL + ${json_to_edit} OperatingSystem.Get File ${TUNNELS_FILE} + ${edited_json} Replace String ${json_to_edit} _CLASSIFIER1 ${GBP1} + ${edited_json} Replace String ${edited_json} _CLASSIFIER2 ${GBP2} + ${edited_json} Replace String ${edited_json} _CLASSIFIER3 ${GBP3} + ${resp} RequestsLibrary.Put Request session ${TUNNELS_PATH} ${edited_json} ${HEADERS} + Should Be Equal As Strings ${resp.status_code} 200 + +Register Endpoints + [Documentation] Endpoints registration + @{endpoint_files} = OperatingSystem.List Files In Directory ${ENDPOINTS_GBP2_DIR} vethl*.*json absolute + :FOR ${endpoint_file} IN @{endpoint_files} + \ Post Elements To URI From File ${ENDPOINT_REG_PATH} ${endpoint_file} + +Put Tenants + [Documentation] Send GBP policy to ODL + Add Elements To URI From File ${TENANT1_PATH} ${TENANT1_FILE} + Add Elements To URI From File ${TENANT2_PATH} ${TENANT2_FILE} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/002_wait_flows.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/002_wait_flows.robot new file mode 100755 index 0000000000..c0c57e3939 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/002_wait_flows.robot @@ -0,0 +1,24 @@ +*** Settings *** +Documentation Waiting until flows are created +Default Tags multi-tenant setup multi-tenant-setup +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot + + +*** Variables *** +${timeout} = 10s + + +*** Testcases *** + +Wait For Flows + Sleep 30s + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP1} sw1 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw1! + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP2} sw2 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw2! + ${passed} = Run Keyword And Return Status OpenFlowUtils.Wait For Flows On Switch ${GBP3} sw3 + Run Keyword Unless ${passed} Fatal Error Flows not created on sw3! diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/010_icmp.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/010_icmp.robot new file mode 100644 index 0000000000..f4f51913b1 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/010_icmp.robot @@ -0,0 +1,391 @@ +*** Settings *** +Documentation Tests for ICMP flow +Force Tags multi-tenant icmp multi-tenant-main +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../../../../../libraries/GBP/DockerUtils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot + +*** Variables *** +${timeout} = 10s + + +*** Testcases *** +Setting Variables For Tenant 1 + [Documentation] Setting variables for tenant 1 related test cases. + Set Test Variables client_switch_ip=${GBP1} client_docker=h35_2 client_ip=10.0.35.2 + ... client_mac=00:00:00:00:35:02 same_webserver_docker=h36_3 same_webserver_ip=10.0.36.3 + ... same_webserver_mac=00:00:00:00:36:03 diff_webserver_switch_ip=${GBP3} + ... diff_webserver_docker=h36_2 diff_webserver_ip=10.0.36.2 + ... diff_webserver_mac=00:00:00:00:36:02 + +Tenant 1 Same switch, ping once from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Ping between endpoints located on the same switch "sw1". + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 1 Same switch, start endless ping from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Start endless ping from h35_2 to h36_4 so that icmp traffic + ... can be inspected. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 1 Same switch, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_3 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 7 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Same switch, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_3 to h35_2. + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 7 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Same switch, stop endless ping from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + + +Tenant 1 Different switches, ping once from h35_2 to h36_2 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 1 Different switches, start endless ping from h35_2 to h36_2 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, ICMP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_2 to h36_2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of ICMP request from h36_2 to h35_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_2 to h35_2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, stop endless ping from h35_2 to h36_2 + [Tags] tenant1 + [Documentation] Stops endless pinging from h35_2 to h36_2 when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Setting Variables For Tenant 2 + [Documentation] Setting variables for tenant 2 related test cases. + Set Test Variables client_switch_ip=${GBP1} client_docker=h35_8 client_ip=10.0.35.8 + ... client_mac=00:00:00:00:35:08 same_webserver_docker=h36_6 same_webserver_ip=10.0.36.6 + ... same_webserver_mac=00:00:00:00:36:06 diff_webserver_switch_ip=${GBP2} + ... diff_webserver_docker=h36_7 diff_webserver_ip=10.0.36.7 + ... diff_webserver_mac=00:00:00:00:36:07 + +Tenant 2 Same switch, ping once from h35_8 to h36_6 + [Documentation] Same switch (sw1) + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 2 Same switch, start endless ping from h35_8 to h36_6 + [Tags] tenant2 + [Documentation] Starting icmp between hosts on the same switch so that + ... traffic can be inspected. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 2 Same switch, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_6 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 8 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Same switch, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h35_8 to h36_6 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 8 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Same switch, stop endless ping from h35_8 to h36_6 + [Tags] tenant2 + [Documentation] Stops endless pinging from h35_8 to h36_6 when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} + SSHLibrary.Close Connection + + +Tenant 2 Different switches, ping once from h35_8 to h36_7 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Ping From Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 2 Different switches, start endless ping from h35_8 to h36_7 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Ping from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection + +Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, ICMP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of ICMP request from h35_8 to h36_7 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 8 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of ICMP request from h36_7 to h35_8 + [Tags] tenant2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 8 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, ICMP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of ICMP reply from h36_7 to h35_8 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 1 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 1 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, stop endless ping from h35_8 to h36_7 + [Documentation] Stops endless pinging from h35_8 to h36_7 when traffic inspection finishes. + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Ping from Docker to Address ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} + SSHLibrary.Close Connection diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/020_http.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/020_http.robot new file mode 100644 index 0000000000..35c2686261 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/020_http.robot @@ -0,0 +1,457 @@ +*** Settings *** +Documentation Tests for HTTP flow +Force Tags multi-tenant http multi-tenant-main +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../../../../../libraries/GBP/DockerUtils.robot +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot + +*** Variables *** +${timeout} = 10s + +*** Testcases *** + +# Same subnet tests are not supported by current topology configuration; +# clients and webservers are put in two different subnets + +Setting Variables for Tenant 1 + [Documentation] Setting variables for test cases related to tenant 1. + Set Test Variables client_switch_ip=${GBP1} client_docker=h35_2 client_ip=10.0.35.2 + ... client_mac=00:00:00:00:35:02 same_webserver_docker=h36_3 same_webserver_ip=10.0.36.3 + ... same_webserver_mac=00:00:00:00:36:03 diff_webserver_switch_ip=${GBP3} + ... diff_webserver_docker=h36_2 diff_webserver_ip=10.0.36.2 + ... diff_webserver_mac=00:00:00:00:36:02 + +Tenant 1 Same switch, start SimpleHttpServer on h36_3 + [Documentation] Same Switch (sw1) + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Tenant 1 Same switch, curl once from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Test HTTP req/rest session between docker located on the same switch. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 1 Same switch, start endless curl from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Init of endless HTTP session between endpoints so that + ... HTTP traffic can be inspected. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 1 Same switch, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_3 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 7 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Same switch, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_3 to h35_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 7 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Same switch, stop endless curl from h35_2 to h36_3 + [Tags] tenant1 + [Documentation] Stopping endless HTTP session after traffic inspection is done. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Tenant 1 Same switch, stop SimpleHttpServer on h36_3 + [Tags] tenant1 + [Documentation] Stoping HTTP service on docker container. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} + SSHLibrary.Close Connection + + +Tenant 1 Different switches, start SimpleHttpServer on h36_2 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant1 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Tenant 1 Different switches, curl once from h35_2 to h36_2 + [Tags] tenant1 + [Documentation] Test HTTP req/resp between endpoints located on different switches. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 1 Different switches, start endless curl from h35_2 to h36_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 1 Different switches, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 4 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, HTTP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_2 to h36_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, HTTP reply ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_2 to h35_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_2 to h35_2 + [Tags] tenant1 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 4 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 1 Different switches, stop endless curl from h35_2 to h36_2 + [Tags] tenant1 + [Documentation] Stopping endless HTTP session when traffic inspection finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Tenant 1 Different switches, stop SimpleHttpServer on h36_2 + [Tags] tenant1 + [Documentation] Terminating HTTP service on docker container. + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} + SSHLibrary.Close Connection + + +Setting Variables For Tenant 2 + [Documentation] Setting variables for test cases related to tenant 1. + Set Test Variables client_switch_ip=${GBP1} client_docker=h35_8 client_ip=10.0.35.8 + ... client_mac=00:00:00:00:35:08 same_webserver_docker=h36_6 same_webserver_ip=10.0.36.6 + ... same_webserver_mac=00:00:00:00:36:06 diff_webserver_switch_ip=${GBP2} + ... diff_webserver_docker=h36_7 diff_webserver_ip=10.0.36.7 + ... diff_webserver_mac=00:00:00:00:36:07 + +Tenant 2 Same switch, start SimpleHttpServer on h36_6 + [Documentation] Same Switch (sw1) + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Tenant 2 Same switch, curl once from h35_8 to h36_6 + [Tags] tenant1 + [Documentation] Test HTTP req/resp between endpoints on the same switch. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 2 Same switch, start endless curl from h35_8 to h36_6 + [Tags] tenant2 + [Documentation] Init if endless HTTP Session between endpoints on the same switch. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${SAME_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 2 Same switch, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_8 to h36_6 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${SAME_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${SAME_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 8 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Same switch, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_6 to h35_8 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append In Port Check ${matches} 8 + Append Inner MAC Check ${matches} src_addr=${SAME_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${SAME_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Same switch, stop endless curl from h35_8 to h36_6 + [Tags] tenant2 + [Documentation] Terminating endless HTTP session after traffic inspection is done. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Tenant 2 Same switch, stop SimpleHttpServer on h36_6 + [Tags] tenant2 + [Documentation] Stoping HTTP service on serving docker container. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${SAME_WEBSERVER_DOCKER} + SSHLibrary.Close Connection + +Tenant 2 Different switches, start SimpleHttpServer on h36_7 + [Documentation] Different switches (sw1 -> sw3) + [Tags] tenant2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Start HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} 80 + SSHLibrary.Close Connection + +Tenant 2 Different switches, curl once from h35_8 to h36_7 + [Tags] tenant2 + [Documentation] Test HTTP req/resp between endpoints located on different switches. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 2 Different switches, start endless curl from h35_8 to h36_7 + [Tags] tenant2 + [Documentation] Starting endless HTTP session so that the traffic can be inspected. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Start Endless Curl from Docker ${CLIENT_DOCKER} ${DIFF_WEBSERVER_IP} 80 + SSHLibrary.Close Connection + +Tenant 2 Different switches, HTTP request ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_8 to h36_7 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 6 + Append Inner MAC Check ${matches} src_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${DIFF_WEBSERVER_MAC} + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, HTTP request ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP request from h35_8 to h36_7 + [Tags] tenant1 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${CLIENT_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${CLIENT_IP} ${DIFF_WEBSERVER_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 8 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, HTTP reply ovs-dpctl output check on sw3 + [Documentation] Assert matches and actions on megaflow of HTTP request from h36_7 to h35_8 + [Tags] tenant2 + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + + Append In Port Check ${matches} 8 + Append Inner MAC Check ${matches} src_addr=${DIFF_WEBSERVER_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Tunnel Set Check ${actions} + Append Inner MAC Check ${actions} dst_addr=${CLIENT_MAC} + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 3 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, HTTP reply ovs-dpctl output check on sw1 + [Documentation] Assert matches and actions on megaflow of HTTP reply from h36_7 to h35_8 + [Tags] tenant2 + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + + @{matches} Create List + @{actions} Create List + Append Tunnel Set Check ${matches} + Append Outer IPs Check ${matches} src_ip=${DIFF_WEBSERVER_SWITCH_IP} + Append Outer IPs Check ${matches} dst_ip=${CLIENT_SWITCH_IP} + Append In Port Check ${matches} 3 + Append Inner MAC Check ${matches} dst_addr=${CLIENT_MAC} + Append Ether-Type Check ${matches} 0x0800 + Append Inner IPs Check ${matches} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${matches} 6 + + Append Inner IPs Check ${actions} ${DIFF_WEBSERVER_IP} ${CLIENT_IP} + Append Proto Check ${actions} 6 + Append Out Port Check ${actions} 6 + + ${output} Find Flow in DPCTL Output ${matches} ${actions} + + SSHLibrary.Close Connection + +Tenant 2 Different switches, stop endless curl from h35_8 to h36_7 + [Tags] tenant2 + [Documentation] Terminanting endless HTTP session after traffic inspection + ... finishes. + ConnUtils.Connect and Login ${CLIENT_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop Endless Curl from Docker ${CLIENT_DOCKER} + SSHLibrary.Close Connection + +Tenant 2 Different switches, stop SimpleHttpServer on h36_7 + [Tags] tenant2 + [Documentation] Stopping HTTP service on docker container. + ConnUtils.Connect and Login ${DIFF_WEBSERVER_SWITCH_IP} timeout=${timeout} + DockerUtils.Stop HTTP Service on Docker ${DIFF_WEBSERVER_DOCKER} + SSHLibrary.Close Connection diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/998_clean_odl.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/998_clean_odl.robot new file mode 100644 index 0000000000..bbd7dba370 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/998_clean_odl.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Test suite for cleaning up / unregister infrastructure constructs like endpoints for demo-asymmetric-chain +Default Tags multi-tenant teardown multi-tenant-teardown +Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} +Suite Teardown Delete All Sessions +Library RequestsLibrary +Library OperatingSystem +Library json +Variables ../../../../../variables/Variables.py +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/RestconfUtils.robot +Resource ../Variables.robot + + +*** Variables *** + +*** Test Cases *** + +Delete Tenants + [Documentation] Delete Tenants from ODL + Remove All Elements At URI ${TENANT1_PATH} + Remove All Elements At URI ${TENANT2_PATH} + +Unregister Endpoints + [Documentation] Unregister Endpoints Endpoints from ODL + RestconfUtils.Unregister Endpoints + +Delete Nodes + [Documentation] Delete Nodes from ODL + Remove All Elements At URI ${TUNNELS_PATH} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/999_teardown.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/999_teardown.robot new file mode 100755 index 0000000000..52dab7a43c --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/999_teardown.robot @@ -0,0 +1,19 @@ +*** Settings *** +Default Tags multi-tenant teardown multi-tenant-teardown +Library SSHLibrary +Resource ../../../../../libraries/Utils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Variables ../../../../../variables/Variables.py +Resource ../Variables.robot +Resource ../GBP_3node.robot + + +*** Variables *** +${timeout} = 10s + + +*** Test Cases *** +Teardown Suite + Log Teardown suite in gbp1 + :FOR ${GBP} IN @{GBPs} + \ GBP_3node.Teardown Node ${GBP} ${CURDIR} timeout=${timeout} diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/init_scripts/infrastructure_config.py b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/init_scripts/infrastructure_config.py new file mode 100755 index 0000000000..a3a60183e9 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/init_scripts/infrastructure_config.py @@ -0,0 +1,101 @@ +# Config for switches, tunnelIP is the local IP address. +switches = [ + {'name': 'sw1', + 'type': 'gbp', + 'dpid': '1'}, + {'name': 'sw2', + 'type': 'gbp', + 'dpid': '2'}, + {'name': 'sw3', + 'type': 'gbp', + 'dpid': '3'} +] + +defaultContainerImage = 'alagalah/odlpoc_ovs230' +# defaultContainerImage='ubuntu:14.04' + +# Note that tenant name and endpointGroup name come from policy_config.py + +hosts = [{'name': 'h35_2', + 'mac': '00:00:00:00:35:02', + 'ip': '10.0.35.2/24', + 'switch': 'sw1'}, + {'name': 'h35_3', + 'ip': '10.0.35.3/24', + 'mac': '00:00:00:00:35:03', + 'switch': 'sw2'}, + {'name': 'h35_4', + 'ip': '10.0.35.4/24', + 'mac': '00:00:00:00:35:04', + 'switch': 'sw3'}, + {'name': 'h35_5', + 'ip': '10.0.35.5/24', + 'mac': '00:00:00:00:35:05', + 'switch': 'sw1'}, + + {'name': 'h35_6', + 'ip': '10.0.35.6/24', + 'mac': '00:00:00:00:35:06', + 'switch': 'sw2', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h35_7', + 'ip': '10.0.35.7/24', + 'mac': '00:00:00:00:35:07', + 'switch': 'sw3', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h35_8', + 'ip': '10.0.35.8/24', + 'mac': '00:00:00:00:35:08', + 'switch': 'sw1', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h35_9', + 'ip': '10.0.35.9/24', + 'mac': '00:00:00:00:35:09', + 'switch': 'sw2', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + + {'name': 'h36_2', + 'ip': '10.0.36.2/24', + 'mac': '00:00:00:00:36:02', + 'switch': 'sw3'}, + {'name': 'h36_3', + 'ip': '10.0.36.3/24', + 'mac': '00:00:00:00:36:03', + 'switch': 'sw1'}, + {'name': 'h36_4', + 'ip': '10.0.36.4/24', + 'mac': '00:00:00:00:36:04', + 'switch': 'sw2'}, + {'name': 'h36_5', + 'ip': '10.0.36.5/24', + 'mac': '00:00:00:00:36:05', + 'switch': 'sw3'}, + + {'name': 'h36_6', + 'ip': '10.0.36.6/24', + 'mac': '00:00:00:00:36:06', + 'switch': 'sw1', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h36_7', + 'ip': '10.0.36.7/24', + 'mac': '00:00:00:00:36:07', + 'switch': 'sw2', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h36_8', + 'ip': '10.0.36.8/24', + 'mac': '00:00:00:00:36:08', + 'switch': 'sw3', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}, + {'name': 'h36_9', + 'ip': '10.0.36.9/24', + 'mac': '00:00:00:00:36:09', + 'switch': 'sw1', + 'tenant': 'GBPPOC2', + 'endpointGroup': 'test'}] diff --git a/csit/variables/gbp/demo-gbp1/vethl-h35_2.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h35_2.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h35_2.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h35_2.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h35_3.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h35_3.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h35_3.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h35_3.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h35_4.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h35_4.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h35_4.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h35_4.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h35_5.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h35_5.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h35_5.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h35_5.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h36_2.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h36_2.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h36_2.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h36_2.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h36_3.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h36_3.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h36_3.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h36_3.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h36_4.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h36_4.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h36_4.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h36_4.json diff --git a/csit/variables/gbp/demo-gbp1/vethl-h36_5.json b/csit/variables/gbp/3node/demo-gbp1/vethl-h36_5.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/vethl-h36_5.json rename to csit/variables/gbp/3node/demo-gbp1/vethl-h36_5.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_2.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_2.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_2.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_2.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_3.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_3.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_3.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_3.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_4.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_4.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_4.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_4.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_5.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_5.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_5.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_5.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_6.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_6.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_6.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_6.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_7.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_7.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_7.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_7.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_8.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_8.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_8.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_8.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h35_9.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h35_9.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h35_9.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h35_9.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_2.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_2.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_2.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_2.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_3.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_3.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_3.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_3.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_4.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_4.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_4.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_4.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_5.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_5.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_5.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_5.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_6.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_6.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_6.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_6.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_7.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_7.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_7.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_7.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_8.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_8.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_8.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_8.json diff --git a/csit/variables/gbp/gbp2-multitenant/vethl-h36_9.json b/csit/variables/gbp/3node/demo-gbp2/vethl-h36_9.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/vethl-h36_9.json rename to csit/variables/gbp/3node/demo-gbp2/vethl-h36_9.json diff --git a/csit/variables/gbp/demo-gbp1/tenants.json b/csit/variables/gbp/3node/tenant1.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/tenants.json rename to csit/variables/gbp/3node/tenant1.json diff --git a/csit/variables/gbp/gbp2-multitenant/tenant2.json b/csit/variables/gbp/3node/tenant2.json similarity index 100% rename from csit/variables/gbp/gbp2-multitenant/tenant2.json rename to csit/variables/gbp/3node/tenant2.json diff --git a/csit/variables/gbp/demo-gbp1/tunnels.json b/csit/variables/gbp/3node/tunnels.json similarity index 100% rename from csit/variables/gbp/demo-gbp1/tunnels.json rename to csit/variables/gbp/3node/tunnels.json diff --git a/csit/variables/gbp/gbp2-multitenant/tenant1.json b/csit/variables/gbp/gbp2-multitenant/tenant1.json deleted file mode 100644 index ae8402e3ed..0000000000 --- a/csit/variables/gbp/gbp2-multitenant/tenant1.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "tenant": { - "id": "f5c7d344-d1c7-4208-8531-2c2693657e12", - "contract": [ - { - "id": "22282cca-9a13-4d0c-a67e-a933ebb0b0ae", - "clause": [ - { - "name": "allow-http-clause", - "subject-refs": [ - "allow-http-subject", - "allow-icmp-subject" - ] - } - ], - "subject": [ - { - "name": "allow-http-subject", - "rule": [ - { - "name": "allow-http-rule", - "classifier-ref": [ - { - "direction": "in", - "name": "http-dest", - "instance-name": "http-dest" - }, - { - "direction": "out", - "name": "http-src", - "instance-name": "http-src" - } - ], - "action-ref": [ - { - "name": "allow1", - "order": 0 - } - ] - } - ] - }, - { - "name": "allow-icmp-subject", - "rule": [ - { - "name": "allow-icmp-rule", - "classifier-ref": [ - { - "name": "icmp", - "instance-name": "icmp" - } - ], - "action-ref": [ - { - "name": "allow1", - "order": 0 - } - ] - } - ] - } - ] - } - ], - "endpoint-group": [ - { - "id": "1eaf9a67-a171-42a8-9282-71cf702f61dd", - "network-domain": "d2779562-ebf1-45e6-93a4-78e2362bc418", - "provider-named-selector": [], - "consumer-named-selector": [ - { - "contract": [ - "22282cca-9a13-4d0c-a67e-a933ebb0b0ae" - ], - "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae" - } - ] - }, - { - "consumer-named-selector": [], - "id": "e593f05d-96be-47ad-acd5-ba81465680d5", - "network-domain": "2c71d675-693e-406f-899f-12a026eb55f1", - "provider-named-selector": [ - { - "contract": [ - "22282cca-9a13-4d0c-a67e-a933ebb0b0ae" - ], - "name": "e593f05d-96be-47ad-acd5-ba81465680d5-1eaf9a67-a171-42a8-9282-71cf702f61dd-22282cca-9a13-4d0c-a67e-a933ebb0b0ae" - } - ] - } - ], - "l2-bridge-domain": [ - { - "id": "7b796915-adf4-4356-b5ca-de005ac410c1", - "parent": "cbe0cc07-b8ff-451d-8171-9eef002a8e80" - } - ], - "l2-flood-domain": [ - { - "id": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b", - "parent": "7b796915-adf4-4356-b5ca-de005ac410c1" - }, - { - "id": "03f69af2-481c-4554-97d6-c4fedca5d126", - "parent": "7b796915-adf4-4356-b5ca-de005ac410c1" - } - ], - "l3-context": [ - { - "id": "cbe0cc07-b8ff-451d-8171-9eef002a8e80" - } - ], - "name": "GBPPOC", - "subnet": [ - { - "id": "d2779562-ebf1-45e6-93a4-78e2362bc418", - "ip-prefix": "10.0.35.1/24", - "parent": "1ddde8d8-c2bc-48d7-8ce0-d78eb6ed4b5b", - "virtual-router-ip": "10.0.35.1" - }, - { - "id": "2c71d675-693e-406f-899f-12a026eb55f1", - "ip-prefix": "10.0.36.1/24", - "parent": "03f69af2-481c-4554-97d6-c4fedca5d126", - "virtual-router-ip": "10.0.36.1" - } - ], - "subject-feature-instances": { - "classifier-instance": [ - { - "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f", - "name": "http-dest", - "parameter-value": [ - { - "int-value": "6", - "name": "proto" - }, - { - "int-value": "80", - "name": "destport" - } - ] - }, - { - "classifier-definition-id": "4250ab32-e8b8-445a-aebb-e1bd2cdd291f", - "name": "http-src", - "parameter-value": [ - { - "int-value": "6", - "name": "proto" - }, - { - "int-value": "80", - "name": "sourceport" - } - ] - }, - { - "classifier-definition-id": "79c6fdb2-1e1a-4832-af57-c65baf5c2335", - "name": "icmp", - "parameter-value": [ - { - "int-value": "1", - "name": "proto" - } - ] - } - ], - "action-instance": [ - { - "name": "allow1", - "action-definition-id": "f942e8fd-e957-42b7-bd18-f73d11266d17" - } - ] - } - } -} diff --git a/csit/variables/gbp/gbp2-multitenant/tunnels.json b/csit/variables/gbp/gbp2-multitenant/tunnels.json deleted file mode 100644 index a61e0462b6..0000000000 --- a/csit/variables/gbp/gbp2-multitenant/tunnels.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "nodes": { - "node": [ - { - "id": "openflow:1", - "ofoverlay:tunnel": [ - { - "tunnel-type": "overlay: tunnel-type-vxlan-gpe", - "node-connector-id": "openflow:1:1", - "ip": "_CLASSIFIER1", - "port": 6633 - }, - { - "tunnel-type": "overlay: tunnel-type-vxlan", - "node-connector-id": "openflow:1:2", - "ip": "_CLASSIFIER1", - "port": 4789 - } - ] - }, - { - "id": "openflow:2", - "ofoverlay:tunnel": [ - { - "tunnel-type": "overlay: tunnel-type-vxlan-gpe", - "node-connector-id": "openflow:2:1", - "ip": "_CLASSIFIER2", - "port": 6633 - }, - { - "tunnel-type": "overlay: tunnel-type-vxlan", - "node-connector-id": "openflow:2:2", - "ip": "_CLASSIFIER2", - "port": 4789 - } - ] - }, - { - "id": "openflow:3", - "ofoverlay:tunnel": [ - { - "tunnel-type": "overlay: tunnel-type-vxlan-gpe", - "node-connector-id": "openflow:3:1", - "ip": "_CLASSIFIER3", - "port": 6633 - }, - { - "tunnel-type": "overlay: tunnel-type-vxlan", - "node-connector-id": "openflow:3:2", - "ip": "_CLASSIFIER3", - "port": 4789 - } - ] - } - ] - } -} \ No newline at end of file -- 2.36.6