From: Luis Gomez Date: Tue, 5 May 2015 18:29:12 +0000 (+0000) Subject: Merge "TSDR HBase and H2 DataStore Integrations Test suites and following review... X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=ecfe166ad20dd85ad72d6689cb30648bf5047b33;hp=f1afbe6b89ac334693586de492e804bfed6f3fe9;p=integration%2Ftest.git Merge "TSDR HBase and H2 DataStore Integrations Test suites and following review comments are addressed 1.Space on leading and trailing on script 2.Reusage KarafKeyword has been written 3.Utils.txt suiteSetup has been utilized 4.Seperated the Hbase Client installation to Controller.sh 5.Updated the Variable.py with common Karaf variables" --- diff --git a/test/csit/libraries/KarafKeywords.txt b/test/csit/libraries/KarafKeywords.txt index 2a1ebea7b8..0be4ca024a 100644 --- a/test/csit/libraries/KarafKeywords.txt +++ b/test/csit/libraries/KarafKeywords.txt @@ -1,14 +1,11 @@ *** Settings *** Library SSHLibrary Library OperatingSystem +Variables ../variables/Variables.py *** Variables *** ${WORKSPACE} /tmp ${BUNDLEFOLDER} distribution-karaf-0.3.0-SNAPSHOT -${karaf_shell_port} 8101 -${karaf_prompt} opendaylight-user -${karaf_user} karaf -${karaf_password} karaf *** Keywords *** Check Karaf Log File Does Not Have Messages @@ -17,39 +14,39 @@ Check Karaf Log File Does Not Have Messages Should Not Contain ${output} ${message} Verify Feature Is Installed - [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${karaf_shell_port} + [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} [Documentation] Will Succeed if the given ${feature_name} is found in the output of "feature:list -i" ${output}= Issue Command On Karaf Console feature:list -i | grep ${feature_name} ${controller} ${karaf_port} Should Contain ${output} ${feature_name} [Return] ${output} Verify Feature Is Not Installed - [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${karaf_shell_port} + [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} [Documentation] Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i" ${output}= Issue Command On Karaf Console feature:list -i | grep ${feature_name} ${controller} ${karaf_port} Should Not Contain ${output} ${feature_name} [Return] ${output} Issue Command On Karaf Console - [Arguments] ${cmd} ${controller}=${CONTROLLER} ${karaf_port}=${karaf_shell_port} ${timeout}=5 + [Arguments] ${cmd} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=5 [Documentation] Will execute the given ${cmd} by ssh'ing to the karaf console running on ${CONTROLLER} - Open Connection ${controller} port=${karaf_port} prompt=${karaf_prompt} timeout=${timeout} - Login ${karaf_user} ${karaf_password} + Open Connection ${controller} port=${karaf_port} prompt=${KARAF_PROMPT} timeout=${timeout} + Login ${KARAF_USER} ${KARAF_PASSWORD} Write ${cmd} - ${output} Read Until ${karaf_prompt} + ${output} Read Until ${KARAF_PROMPT} Close Connection Log ${output} [Return] ${output} Verify Bundle Is Installed - [Arguments] ${bundle_name} ${controller}=${CONTROLLER} ${karaf_port}=${karaf_shell_port} + [Arguments] ${bundle_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} [Documentation] Will succeed if the given ${bundle name} is present in the output of "bundle:list -s " ${output}= Issue Command On Karaf Console bundle:list -s | grep ${bundle_name} ${controller} ${karaf_port} Should Contain ${output} ${bundle_name} [Return] ${output} Verify Bundle Is Not Installed - [Arguments] ${bundle_name} ${controller}=${CONTROLLER} ${karaf_port}=${karaf_shell_port} + [Arguments] ${bundle_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} [Documentation] Will succeed if the given ${bundle_name} is NOT found in the output of "bundle:list -s" ${output}= Issue Command On Karaf Console bundle:list -i | grep ${bundle_name} ${controller} ${karaf_port} Should Not Contain ${output} ${bundle_name} @@ -62,3 +59,18 @@ Check Karaf Log Has Messages : FOR ${message} IN @{message_list} \ Should Contain ${output} ${message} [Return] ${output} + +Install a Feature + [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=15 + [Documentation] Will Install the given ${feature_name} + Log ${timeout} + ${output}= Issue Command On Karaf Console feature:install ${feature_name} ${controller} ${karaf_port} ${timeout} + Log ${output} + [Return] ${output} + +Uninstall a Feature + [Arguments] ${feature_name} ${controller}=${CONTROLLER} ${karaf_port}=${KARAF_SHELL_PORT} ${timeout}=15 + [Documentation] Will UnInstall the given ${feature_name} + ${output}= Issue Command On Karaf Console feature:uninstall ${feature_name} ${controller} ${karaf_port} ${timeout} + Log ${output} + [Return] ${output} diff --git a/test/csit/libraries/TsdrUtils.txt b/test/csit/libraries/TsdrUtils.txt new file mode 100644 index 0000000000..f2cd8e559f --- /dev/null +++ b/test/csit/libraries/TsdrUtils.txt @@ -0,0 +1,62 @@ +*** Variables *** +${start} sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ovsk,protocols=OpenFlow13 +${START_HBASE_CLIENT} /tmp/Hbase/hbase-0.94.15/bin/hbase shell + +*** Keywords *** +Start Tsdr Suite + [Documentation] Basic setup/cleanup work that can be done safely before any system + ... is run. + Log Start the test on the base edition + ${mininet_conn_id}= Open Connection ${MININET} prompt=${LINUX_PROMPT} timeout=30s + Set Suite Variable ${mininet_conn_id} + Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/id_rsa any + Write sudo ovs-vsctl set-manager ptcp:6644 + Read Until ${LINUX_PROMPT} + Write sudo mn -c + Read Until ${LINUX_PROMPT} + Write ${start} + Read Until mininet> + Sleep 6 + +Initialize the REST Client Session + [Documentation] Initialize the REST Client Session + Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS_XML} + +Initialize the HBase for TSDR + [Documentation] Install and initialize the tsdr tables on HBase Server + ${conn_id}= Open Connection ${CONTROLLER} timeout=120s + Login With Public Key ${user} ${USER_HOME}/.ssh/id_rsa any + Put File integration/test/csit/suites/tsdr/HBase/create-tables + Put File integration/test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh + Put File integration/test/csit/suites/tsdr/HBase/start-hbase-client.sh + ${hbase_server}= Execute Command ./start-hbase-client.sh + Log ${hbase_server} + ${out}= Execute Command ./create-odl-hbasetable.sh + LOG ${out} + Close Connection + +Stop the HBase Server + [Documentation] Stop the HBase server + ${conn_id}= Open Connection ${CONTROLLER} timeout=120s + Login With Public Key ${user} ${USER_HOME}/.ssh/id_rsa any + Put File integration/test/csit/suites/tsdr/HBase/stop-hbase-client.sh + ${hbase_server}= Execute Command ./stop-hbase-client.sh + Log ${hbase_server} + Close Connection + +Query the Data from HBaseClient + [Arguments] ${query} ${remote}=${CONTROLLER} ${user}=${MININET_USER} ${prompt}=${LINUX_PROMPT} ${prompt_timeout}=40s + [Documentation] Execute the HBase Query and return the result + Log Attempting to execute ${query} on ${remote} via HbaseClient + ${conn_id}= Open Connection ${remote} prompt=${prompt} timeout=${prompt_timeout} + Login With Public Key ${user} ${USER_HOME}/.ssh/id_rsa any + Write export JAVA_HOME=/usr + Write ${START_HBASE_CLIENT} + Read Until hbase(main):001:0> + Write ${query} + ${output}= Read Until hbase(main): + Write exit + LOG ${output} + Comment ${output}= Read Until ${prompt} + Close Connection + [Return] ${output} diff --git a/test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot b/test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot new file mode 100755 index 0000000000..d0014debec --- /dev/null +++ b/test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Test suite for H2 DataStore +Suite Setup Run Keywords Start Tsdr Suite Initialize the REST Client Session +Suite Teardown Run Keywords Stop Suite Delete All Sessions +Library SSHLibrary +Library Collections +Library String +Library ../../../libraries/RequestsLibrary.py +Library ../../../libraries/Common.py +Resource ../../../libraries/KarafKeywords.txt +Resource ../../../libraries/Utils.txt +Resource ../../../libraries/TsdrUtils.txt +Variables ../../../variables/Variables.py + +*** Variables *** +@{INTERFACE_METRICS} TransmittedPackets TransmittedBytes TransmitErrors TransmitDrops ReceivedPackets ReceivedBytes ReceiveOverRunError +... ReceiveFrameError ReceiveErrors ReceiveDrops ReceiveCrcError CollisionCount +@{CATEGORY} InterfaceMetrics FlowTableMetrics GroupMetrics FlowMetrics QueueMetrics +${INTERFACE_QUERY} scan 'InterfaceMetrics' + +*** Test Cases *** +Verification Feature Installation + [Documentation] Verify the H2 datastore is installed + Install a Feature odl-tsdr-all ${CONTROLLER} ${KARAF_SHELL_PORT} 30 + Verify Feature Is Installed odl-tsdr-all + Verify Feature Is Installed odl-tsdr-H2-persistence + Verify Feature Is Installed odl-tsdr-core + +Get list of nodes from RESTAPI + [Documentation] Get the inventory, should not contain address observations + ${resp} RequestsLibrary.Get session ${OPERATIONAL_NODES_API} + Should Be Equal As Strings ${resp.status_code} 200 + Should Contain ${resp.content} openflow:1 + Should Contain ${resp.content} openflow:2 + +Verification TSDR Command is exist in Help + [Documentation] Verify the TSDR List command on Help + ${output}= Issue Command On Karaf Console tsdr\t + Should Contain ${output} tsdr:list + Should Contain ${output} tsdr:purgeall + ${output}= Issue Command On Karaf Console tsdr:list\t\t + : FOR ${list} IN @{CATEGORY} + \ Should Contain ${output} ${list} + COMMENT Intentional Sleep time for Data Collection purpose + Sleep 15 + +Verification of TSDR InterfaceMetrics + [Documentation] Verify the TSDR InterfaceMetrics + ${output}= Issue Command On Karaf Console tsdr:list ${CONTROLLER} ${KARAF_SHELL_PORT} 30 + : FOR ${list} IN @{INTERFACE_METRICS} + \ Should Contain ${output} ${list} + +Uninstall all TSDR H2 Feature + [Documentation] UnInstall all TSDR H2 Features + Uninstall a Feature odl-tsdr-core + Verify Feature Is Not Installed odl-tsdr-core + Uninstall a Feature odl-tsdr-all + Verify Feature Is Not Installed odl-tsdr-all + Uninstall a Feature odl-tsdr-H2-persistence + Verify Feature Is Not Installed odl-tsdr-H2-persistence + +Verification TSDR Command shouldnot exist in help + [Documentation] Verify the TSDR List command on help + ${output}= Issue Command On Karaf Console tsdr\t ${CONTROLLER} ${KARAF_SHELL_PORT} + Should not Contain ${output} tsdr:list + Comment Should not Contain ${output} tsdr:purgeall diff --git a/test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot b/test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot new file mode 100755 index 0000000000..0f1f1e74c1 --- /dev/null +++ b/test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot @@ -0,0 +1,86 @@ +*** Settings *** +Documentation Test suite for Hbase DataStore Verification +Suite Setup Run Keywords Start Tsdr Suite Initialize the HBase for TSDR +Suite Teardown Run Keywords Stop Suite Stop the HBase Server +Library SSHLibrary +Library Collections +Library String +Library ../../../libraries/RequestsLibrary.py +Library ../../../libraries/Common.py +Resource ../../../libraries/KarafKeywords.txt +Resource ../../../libraries/Utils.txt +Resource ../../../libraries/TsdrUtils.txt +Variables ../../../variables/Variables.py + +*** Variables *** +@{INTERFACE_METRICS} TransmittedPackets TransmittedBytes TransmitErrors TransmitDrops ReceivedPackets ReceivedBytes ReceiveOverRunError +... ReceiveFrameError ReceiveErrors ReceiveDrops ReceiveCrcError CollisionCount +@{CATEGORY} InterfaceMetrics FlowTableMetrics GroupMetrics FlowMetrics QueueMetrics +${INTERFACE_QUERY} scan 'InterfaceMetrics' + +*** Test Cases *** +Install the TSDR HBase Feature + [Documentation] Install and Verify the TSDR HBase Features + Install a Feature odl-tsdr-hbase ${CONTROLLER} ${KARAF_SHELL_PORT} 30 + Verify Feature Is Installed odl-tsdr-hbase + Verify Feature Is Installed odl-tsdr-hbase-persistence + Verify Feature Is Installed odl-hbaseclient + +Verification TSDR Command is exist in Help + [Documentation] Verify the TSDR List command on Help + ${output}= Issue Command On Karaf Console tsdr\t + Should Contain ${output} tsdr:list + COMMENT Should Contain ${output} tsdr:purgeall + ${output}= Issue Command On Karaf Console tsdr:list\t\t + : FOR ${list} IN @{CATEGORY} + \ Should Contain ${output} ${list} + COMMENT Intentional Sleep time for Data Collection purpose + Sleep 15 + +Verification of TSDR InterfaceMetrics + [Documentation] Verify the TSDR InterfaceMetrics + ${output}= Issue Command On Karaf Console tsdr:list ${CONTROLLER} ${KARAF_SHELL_PORT} 30 + : FOR ${list} IN @{INTERFACE_METRICS} + \ Should Contain ${output} ${list} + +Verification of InterfaceMetrics on HBase Client + [Documentation] Verification of the InterfaceMetrics from HBase Client + ${out}= Query the Data from HBaseClient ${INTERFACE_QUERY} + LOG ${out} + +Uninstall all TSDR HBase Feature + [Documentation] UnInstall all TSDR HBase Features + Uninstall a Feature odl-tsdr-hbase-persistence + Verify Feature Is Not Installed odl-tsdr-hbase-persistence + Uninstall a Feature odl-hbaseclient + Verify Feature Is Not Installed odl-hbaseclient + Uninstall a Feature odl-tsdr-core + Verify Feature Is Not Installed odl-tsdr-core + Uninstall a Feature odl-tsdr-hbase + Verify Feature Is Not Installed odl-tsdr-hbase + +Verification TSDR Command shouldnot exist in help + [Documentation] Verify the TSDR List command on help + ${output}= Issue Command On Karaf Console tsdr\t ${CONTROLLER} ${KARAF_SHELL_PORT} + Should not Contain ${output} tsdr:list + Comment Should not Contain ${output} tsdr:purgeall + +Verify node1 Aggregate stats doesnot zero value + [Documentation] Verfiy the nodes doesnot have stats value with zero + ${result}= Run Command On Remote System ${MININET} sudo ovs-ofctl dump-aggregate s1 -O OpenFlow13 + Comment Write sh ovs-ofctl dump-aggregate s1 -O OpenFlow13 + Comment ${result} Read Until mininet> + Should Not Contain ${result} packet_count=0 + Should Not Contain ${result} byte_count=0 + Should Not Contain ${result} flow_count=0 + +Verify node1 Ports stats doesnot zero value + [Documentation] Verfiy the nodes doesnot have stats value with zero + ${result}= Run Command On Remote System ${MININET} sudo ovs-ofctl dump-ports s1 -O OpenFlow13 + Comment Write sh ovs-ofctl dump-ports s1 -O OpenFlow13 + Comment ${result} Read Until mininet> + ${port1}= Get Lines Containing String ${result} 1: + Should Not Contain ${port1} rx pkts=0 + Should Not Contain ${port1} bytes=0 + ${port1_tx}= Get Line ${result} 6 + Should Not Contain ${port1_tx} tx pkts=0 diff --git a/test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh b/test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh new file mode 100755 index 0000000000..6b20a41749 --- /dev/null +++ b/test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh @@ -0,0 +1,2 @@ +export JAVA_HOME=/usr +/home/demo/hbase-0.94.15/bin/hbase shell create-tables diff --git a/test/csit/suites/tsdr/HBase/create-tables b/test/csit/suites/tsdr/HBase/create-tables new file mode 100644 index 0000000000..dabaf1eefc --- /dev/null +++ b/test/csit/suites/tsdr/HBase/create-tables @@ -0,0 +1,16 @@ +disable 'FlowTableMetrics' +disable 'FlowMetrics' +disable 'GroupMetrics' +disable 'InterfaceMetrics' +disable 'QueueMetrics' +drop 'FlowTableMetrics' +drop 'FlowMetrics' +drop 'GroupMetrics' +drop 'InterfaceMetrics' +drop 'QueueMetrics' +create 'FlowTableMetrics', 'c1' +create 'FlowMetrics', 'c1' +create 'GroupMetrics', 'c1' +create 'InterfaceMetrics', 'c1' +create 'QueueMetrics', 'c1' +exit diff --git a/test/csit/suites/tsdr/HBase/start-hbase-client.sh b/test/csit/suites/tsdr/HBase/start-hbase-client.sh new file mode 100755 index 0000000000..5c6df70805 --- /dev/null +++ b/test/csit/suites/tsdr/HBase/start-hbase-client.sh @@ -0,0 +1,13 @@ +#echo "Downloading the distribution..." +#rm -rf /tmp/Hbase +#mkdir /tmp/Hbase +#cd /tmp/Hbase + +#wget --no-verbose https://archive.apache.org/dist/hbase/hbase-0.94.15/hbase-0.94.15.tar.gz + +#echo "Installing the Hbase Server..." +#tar -xvf hbase*.tar.gz +#Above installation has been moved to controller.sh on Controller VM deployment +echo "Starting Hbase Server daemon..." +export JAVA_HOME=/usr +/tmp/Hbase/hbase-0.94.15/bin/start-hbase.sh diff --git a/test/csit/suites/tsdr/HBase/stop-hbase-client.sh b/test/csit/suites/tsdr/HBase/stop-hbase-client.sh new file mode 100755 index 0000000000..827477daf1 --- /dev/null +++ b/test/csit/suites/tsdr/HBase/stop-hbase-client.sh @@ -0,0 +1,3 @@ +echo "Stoping Hbase Server daemon..." +export JAVA_HOME=/usr +/tmp/Hbase/hbase-0.94.15/bin/stop-hbase.sh diff --git a/test/csit/testplans/tsdr.txt b/test/csit/testplans/tsdr.txt new file mode 100644 index 0000000000..51dc1488e2 --- /dev/null +++ b/test/csit/testplans/tsdr.txt @@ -0,0 +1,3 @@ +# Place the suites in run order: +integration/test/csit/suites/tsdr/H2 +integration/test/csit/suites/tsdr/HBase diff --git a/test/csit/variables/Variables.py b/test/csit/variables/Variables.py index f6a31e80c9..d822ea5399 100644 --- a/test/csit/variables/Variables.py +++ b/test/csit/variables/Variables.py @@ -23,6 +23,16 @@ ODL_CONTROLLER_SESSION = None TOPO_TREE_LEVEL = 2 TOPO_TREE_DEPTH = 3 TOPO_TREE_FANOUT = 2 + +# KARAF Varaiable +KARAF_SHELL_PORT = '8101' +KARAF_PROMPT = 'opendaylight-user' +KARAF_USER = 'karaf' +KARAF_PASSWORD = 'karaf' + +# VM Environment Variables +LINUX_PROMPT = '>' + # VTN Coordinator Variables VTNC = '127.0.0.1' VTNCPORT = '8083'