From 35a9bd0ffa1c1f0ceeb742de2e3a420e52d4f5f1 Mon Sep 17 00:00:00 2001 From: Tomas Cechvala Date: Fri, 3 Jun 2016 12:30:12 +0200 Subject: [PATCH] Enhanced debugging logs in GBP CSIT - fixed periodic curl - added logging for easier debugging Change-Id: Ib00a74cec8b4abcb2f7d872e48d2cd46707544fb Signed-off-by: Tomas Cechvala --- csit/libraries/GBP/DockerUtils.robot | 13 ++-- csit/libraries/GBP/OpenFlowUtils.robot | 8 ++ .../GBP/3-node/gbp1/040_show_data.robot | 59 +++++++++++++++ .../gbp2-multitenant/040_show_data.robot | 59 +++++++++++++++ .../demo-asymmetric-chain/040_show_data.robot | 73 +++++++++++++++++++ .../demo-symmetric-chain/040_show_data.robot | 73 +++++++++++++++++++ csit/variables/Variables.py | 3 + 7 files changed, 281 insertions(+), 7 deletions(-) create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp1/040_show_data.robot create mode 100644 csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/040_show_data.robot create mode 100644 csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-asymmetric-chain/040_show_data.robot create mode 100644 csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-symmetric-chain/040_show_data.robot diff --git a/csit/libraries/GBP/DockerUtils.robot b/csit/libraries/GBP/DockerUtils.robot index dc96e77d8e..1b9bc0ccd8 100755 --- a/csit/libraries/GBP/DockerUtils.robot +++ b/csit/libraries/GBP/DockerUtils.robot @@ -1,6 +1,5 @@ *** Settings *** Library SSHLibrary -Resource ../Utils.robot *** Variables *** @@ -34,7 +33,7 @@ Stop HTTP Service on Docker ${stdout} SSHLibrary.Execute Command docker exec ${docker_name} kill ${stdout} return_stdout=True return_stderr=False return_rc=False Curl from Docker - [Arguments] ${docker_name} ${dest_address} ${service_port}=80 ${connect_timeout}=2 ${retry}=3x ${retry_after}=1s + [Arguments] ${docker_name} ${dest_address} ${service_port}=80 ${connect_timeout}=2 ${retry}=5x ${retry_after}=1s [Documentation] Sends HTTP request to remote server. Endless curl should not be running. ${output} SSHLibrary.Execute Command docker exec ${docker_name} ls | grep curl_running return_stdout=True return_stderr=False return_rc=False Should Be Empty ${output} @@ -48,8 +47,7 @@ Start Endless Curl from Docker Should Be Empty ${output} ${output} SSHLibrary.Execute Command docker exec ${docker_name} touch curl_running && echo success return_stdout=True return_stderr=False return_rc=False Should Contain ${output} success - Wait Until Keyword Succeeds ${retry} ${retry_after} Execute Curl ${docker_name} ${dest_address} ${service_port} - ... endless="TRUE" sleep=${sleep} + Execute Curl ${docker_name} ${dest_address} ${service_port} endless="TRUE" Stop Endless Curl from Docker [Arguments] ${docker_name} @@ -77,7 +75,8 @@ Test Port On Docker Execute Curl [Arguments] ${docker_name} ${dest_address} ${service_port} ${endless}="FALSE" ${sleep}=1 [Documentation] Executes curl or curl loop for caller methods based on given parameters. - ${output} SSHLibrary.Execute Command docker exec ${docker_name} curl ${dest_address}:${service_port} >/dev/null 2>&1 && echo success + Run Keyword If ${endless} == "TRUE" Run Keywords + ... SSHLibrary.Execute Command docker exec -d ${docker_name} /bin/sh -c "while [ -f curl_running ]; do curl ${dest_address}:${service_port} -m 1 && sleep ${sleep}; done" + ... AND Return From Keyword + ${output} SSHLibrary.Execute Command docker exec ${docker_name} curl ${dest_address}:${service_port} -m 5 >/dev/null 2>&1 && echo success Should Contain ${output} success - Run Keyword If ${endless} == "TRUE" SSHLibrary.Execute Command docker exec -d ${docker_name} /bin/sh -c "while [ -f curl_running ]; do curl ${dest_address}:${service_port} ; sleep ${sleep}; done" - Log ${output} diff --git a/csit/libraries/GBP/OpenFlowUtils.robot b/csit/libraries/GBP/OpenFlowUtils.robot index 721e3b697a..73bfc8bb69 100644 --- a/csit/libraries/GBP/OpenFlowUtils.robot +++ b/csit/libraries/GBP/OpenFlowUtils.robot @@ -252,6 +252,14 @@ Wait For Flows On Switch Wait Until Keyword Succeeds 120s 20s Count Flows On Switch ${switch_name} SSHLibrary.Close Connection +Show Switch Status + [Arguments] ${switch_name} + [Documentation] Shows status of a switch for easier debugging. + ${stdout} ${stderr} SSHLibrary.Execute Command sudo ovs-ofctl dump-flows ${switch_name} -OOpenFlow13 return_stderr=True + Log ${stdout} + ${stdout} ${stderr} SSHLibrary.Execute Command sudo ovs-vsctl show return_stderr=True + Log ${stdout} + Count Flows On Switch [Arguments] ${switch_name} ${out} SSHLibrary.Execute Command printf "%d" $(($(sudo ovs-ofctl dump-flows ${switch_name} -OOpenFlow13 | wc -l)-1)) diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/040_show_data.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/040_show_data.robot new file mode 100644 index 0000000000..a6746de002 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp1/040_show_data.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Deep inspection of HTTP traffic on asymmetric chain. +... Nodes are located on different VMs. +Library SSHLibrary +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../Variables.robot +Resource ../Connections.robot + +*** Variables *** + +*** Testcases *** +Show GBPSFC1 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Start Connections + Switch Connection GPSFC1_CONNECTION + Show Switch Status sw1 + +Show GBPSFC2 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC2_CONNECTION + Show Switch Status sw2 + +Show GBPSFC3 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC3_CONNECTION + Show Switch Status sw3 + Close Connections + +Read Tenants Confing From ODL + [Documentation] Logs ODL data store. + Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_YANG_JSON} + ${resp} RequestsLibrary.Get Request session ${GBP_TENANTS_API} + Log ${resp.content} + +Read Tenants Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_GBP_TENANTS_API} + Log ${resp.content} + +Read Nodes Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_NODES_API} + Log ${resp.content} + +Read Nodes Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API} + Log ${resp.content} + +Read Topology Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API} + Log ${resp.content} + +Read Topology Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} + Log ${resp.content} + +Read Endpoints From ODL + ${resp} RequestsLibrary.Get Request session ${GBP_ENDPOINTS_API} + Log ${resp.content} + Delete All Sessions diff --git a/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/040_show_data.robot b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/040_show_data.robot new file mode 100644 index 0000000000..a6746de002 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBP/3-node/gbp2-multitenant/040_show_data.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Deep inspection of HTTP traffic on asymmetric chain. +... Nodes are located on different VMs. +Library SSHLibrary +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../Variables.robot +Resource ../Connections.robot + +*** Variables *** + +*** Testcases *** +Show GBPSFC1 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Start Connections + Switch Connection GPSFC1_CONNECTION + Show Switch Status sw1 + +Show GBPSFC2 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC2_CONNECTION + Show Switch Status sw2 + +Show GBPSFC3 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC3_CONNECTION + Show Switch Status sw3 + Close Connections + +Read Tenants Confing From ODL + [Documentation] Logs ODL data store. + Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_YANG_JSON} + ${resp} RequestsLibrary.Get Request session ${GBP_TENANTS_API} + Log ${resp.content} + +Read Tenants Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_GBP_TENANTS_API} + Log ${resp.content} + +Read Nodes Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_NODES_API} + Log ${resp.content} + +Read Nodes Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API} + Log ${resp.content} + +Read Topology Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API} + Log ${resp.content} + +Read Topology Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} + Log ${resp.content} + +Read Endpoints From ODL + ${resp} RequestsLibrary.Get Request session ${GBP_ENDPOINTS_API} + Log ${resp.content} + Delete All Sessions diff --git a/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-asymmetric-chain/040_show_data.robot b/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-asymmetric-chain/040_show_data.robot new file mode 100644 index 0000000000..feedcd7d14 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-asymmetric-chain/040_show_data.robot @@ -0,0 +1,73 @@ +*** Settings *** +Documentation Deep inspection of HTTP traffic on asymmetric chain. +... Nodes are located on different VMs. +Library SSHLibrary +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../Variables.robot +Resource ../Connections.robot + +*** Variables *** + +*** Testcases *** +Show GBPSFC1 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Start Connections + Switch Connection GPSFC1_CONNECTION + Show Switch Status sw1 + +Show GBPSFC2 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC2_CONNECTION + Show Switch Status sw2 + +Show GBPSFC3 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC3_CONNECTION + Show Switch Status sw3 + +Show GBPSFC4 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC4_CONNECTION + Show Switch Status sw4 +Show GBPSFC5 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC5_CONNECTION + Show Switch Status sw5 + +Show GBPSFC6 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC6_CONNECTION + Show Switch Status sw6 + Close Connections + +Read Tenants Confing From ODL + [Documentation] Logs ODL data store. + Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_YANG_JSON} + ${resp} RequestsLibrary.Get Request session ${GBP_TENANTS_API} + Log ${resp.content} + +Read Tenants Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_GBP_TENANTS_API} + Log ${resp.content} + +Read Nodes Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_NODES_API} + Log ${resp.content} + +Read Nodes Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API} + Log ${resp.content} + +Read Topology Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API} + Log ${resp.content} + +Read Topology Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} + Log ${resp.content} + +Read Endpoints From ODL + ${resp} RequestsLibrary.Get Request session ${GBP_ENDPOINTS_API} + Log ${resp.content} + Delete All Sessions diff --git a/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-symmetric-chain/040_show_data.robot b/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-symmetric-chain/040_show_data.robot new file mode 100644 index 0000000000..feedcd7d14 --- /dev/null +++ b/csit/suites/groupbasedpolicy/GBPSFC/6-node/demo-symmetric-chain/040_show_data.robot @@ -0,0 +1,73 @@ +*** Settings *** +Documentation Deep inspection of HTTP traffic on asymmetric chain. +... Nodes are located on different VMs. +Library SSHLibrary +Resource ../../../../../libraries/GBP/OpenFlowUtils.robot +Resource ../../../../../libraries/GBP/ConnUtils.robot +Resource ../Variables.robot +Resource ../Connections.robot + +*** Variables *** + +*** Testcases *** +Show GBPSFC1 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Start Connections + Switch Connection GPSFC1_CONNECTION + Show Switch Status sw1 + +Show GBPSFC2 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC2_CONNECTION + Show Switch Status sw2 + +Show GBPSFC3 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC3_CONNECTION + Show Switch Status sw3 + +Show GBPSFC4 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC4_CONNECTION + Show Switch Status sw4 +Show GBPSFC5 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC5_CONNECTION + Show Switch Status sw5 + +Show GBPSFC6 Status + [Documentation] Shows flows and configuration of a switch for easier debugging. + Switch Connection GPSFC6_CONNECTION + Show Switch Status sw6 + Close Connections + +Read Tenants Confing From ODL + [Documentation] Logs ODL data store. + Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_YANG_JSON} + ${resp} RequestsLibrary.Get Request session ${GBP_TENANTS_API} + Log ${resp.content} + +Read Tenants Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_GBP_TENANTS_API} + Log ${resp.content} + +Read Nodes Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_NODES_API} + Log ${resp.content} + +Read Nodes Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_NODES_API} + Log ${resp.content} + +Read Topology Config From ODL + ${resp} RequestsLibrary.Get Request session ${CONFIG_TOPO_API} + Log ${resp.content} + +Read Topology Operational From ODL + ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API} + Log ${resp.content} + +Read Endpoints From ODL + ${resp} RequestsLibrary.Get Request session ${GBP_ENDPOINTS_API} + Log ${resp.content} + Delete All Sessions diff --git a/csit/variables/Variables.py b/csit/variables/Variables.py index 1fc59edae8..65a1479cff 100644 --- a/csit/variables/Variables.py +++ b/csit/variables/Variables.py @@ -155,7 +155,10 @@ CREATE_PATHPOLICY_TOPOLOGY_FILE_PATH = "MininetTopo/" +\ GBP_REGEP_API = "/restconf/operations/endpoint:register-endpoint" GBP_UNREGEP_API = "/restconf/operations/endpoint:unregister-endpoint" +GBP_ENDPOINTS_API = "/restconf/operational/endpoint:endpoints" +GBP_BASE_ENDPOINTS_API = "/restconf/operational/base-endpoint:endpoints" GBP_TENANTS_API = "/restconf/config/policy:tenants" +OPERATIONAL_GBP_TENANTS_API = "/restconf/operational/policy:tenants" GBP_TUNNELS_API = "/restconf/config/opendaylight-inventory:nodes" # LISP Flow Mapping variables -- 2.36.6