Merge "TSDR HBase and H2 DataStore Integrations Test suites and following review...
authorLuis Gomez <ecelgp@gmail.com>
Tue, 5 May 2015 18:29:12 +0000 (18:29 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 5 May 2015 18:29:12 +0000 (18:29 +0000)
test/csit/libraries/KarafKeywords.txt
test/csit/libraries/TsdrUtils.txt [new file with mode: 0644]
test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot [new file with mode: 0755]
test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot [new file with mode: 0755]
test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh [new file with mode: 0755]
test/csit/suites/tsdr/HBase/create-tables [new file with mode: 0644]
test/csit/suites/tsdr/HBase/start-hbase-client.sh [new file with mode: 0755]
test/csit/suites/tsdr/HBase/stop-hbase-client.sh [new file with mode: 0755]
test/csit/testplans/tsdr.txt [new file with mode: 0644]
test/csit/variables/Variables.py

index 2a1ebea7b82dca210e4905ca14b6aa3cd3ff26fc..0be4ca024adbc8d5c701eb80c943d9a71fc09c47 100644 (file)
@@ -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 (file)
index 0000000..f2cd8e5
--- /dev/null
@@ -0,0 +1,62 @@
+*** Variables ***\r
+${start}          sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ovsk,protocols=OpenFlow13\r
+${START_HBASE_CLIENT}    /tmp/Hbase/hbase-0.94.15/bin/hbase shell\r
+\r
+*** Keywords ***\r
+Start Tsdr Suite\r
+    [Documentation]    Basic setup/cleanup work that can be done safely before any system\r
+    ...    is run.\r
+    Log    Start the test on the base edition\r
+    ${mininet_conn_id}=    Open Connection    ${MININET}    prompt=${LINUX_PROMPT}    timeout=30s\r
+    Set Suite Variable    ${mininet_conn_id}\r
+    Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/id_rsa    any\r
+    Write    sudo ovs-vsctl set-manager ptcp:6644\r
+    Read Until    ${LINUX_PROMPT}\r
+    Write    sudo mn -c\r
+    Read Until    ${LINUX_PROMPT}\r
+    Write    ${start}\r
+    Read Until    mininet>\r
+    Sleep    6\r
+\r
+Initialize the REST Client Session\r
+    [Documentation]    Initialize the REST Client Session\r
+    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}\r
+\r
+Initialize the HBase for TSDR\r
+    [Documentation]    Install and initialize the tsdr tables on HBase Server\r
+    ${conn_id}=    Open Connection    ${CONTROLLER}    timeout=120s\r
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any\r
+    Put File    integration/test/csit/suites/tsdr/HBase/create-tables\r
+    Put File    integration/test/csit/suites/tsdr/HBase/create-odl-hbasetable.sh\r
+    Put File    integration/test/csit/suites/tsdr/HBase/start-hbase-client.sh\r
+    ${hbase_server}=    Execute Command    ./start-hbase-client.sh\r
+    Log    ${hbase_server}\r
+    ${out}=    Execute Command    ./create-odl-hbasetable.sh\r
+    LOG    ${out}\r
+    Close Connection\r
+\r
+Stop the HBase Server\r
+    [Documentation]    Stop the HBase server\r
+    ${conn_id}=    Open Connection    ${CONTROLLER}    timeout=120s\r
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any\r
+    Put File    integration/test/csit/suites/tsdr/HBase/stop-hbase-client.sh\r
+    ${hbase_server}=    Execute Command    ./stop-hbase-client.sh\r
+    Log    ${hbase_server}\r
+    Close Connection\r
+\r
+Query the Data from HBaseClient\r
+    [Arguments]    ${query}    ${remote}=${CONTROLLER}    ${user}=${MININET_USER}    ${prompt}=${LINUX_PROMPT}    ${prompt_timeout}=40s\r
+    [Documentation]    Execute the HBase Query and return the result\r
+    Log    Attempting to execute ${query} on ${remote} via HbaseClient\r
+    ${conn_id}=    Open Connection    ${remote}    prompt=${prompt}    timeout=${prompt_timeout}\r
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/id_rsa    any\r
+    Write    export JAVA_HOME=/usr\r
+    Write    ${START_HBASE_CLIENT}\r
+    Read Until    hbase(main):001:0>\r
+    Write    ${query}\r
+    ${output}=    Read Until    hbase(main):\r
+    Write    exit\r
+    LOG    ${output}\r
+    Comment    ${output}=    Read Until    ${prompt}\r
+    Close Connection\r
+    [Return]    ${output}\r
diff --git a/test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot b/test/csit/suites/tsdr/H2/010_InterfaceMetrics.robot
new file mode 100755 (executable)
index 0000000..d0014de
--- /dev/null
@@ -0,0 +1,66 @@
+*** Settings ***\r
+Documentation     Test suite for H2 DataStore\r
+Suite Setup       Run Keywords    Start Tsdr Suite    Initialize the REST Client Session \r
+Suite Teardown    Run Keywords    Stop Suite    Delete All Sessions\r
+Library           SSHLibrary\r
+Library           Collections\r
+Library           String\r
+Library           ../../../libraries/RequestsLibrary.py\r
+Library           ../../../libraries/Common.py\r
+Resource          ../../../libraries/KarafKeywords.txt\r
+Resource          ../../../libraries/Utils.txt\r
+Resource          ../../../libraries/TsdrUtils.txt\r
+Variables         ../../../variables/Variables.py\r
+\r
+*** Variables ***\r
+@{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError\r
+...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount\r
+@{CATEGORY}       InterfaceMetrics    FlowTableMetrics    GroupMetrics    FlowMetrics    QueueMetrics\r
+${INTERFACE_QUERY}    scan 'InterfaceMetrics'\r
+\r
+*** Test Cases ***\r
+Verification Feature Installation\r
+    [Documentation]    Verify the H2 datastore is installed\r
+    Install a Feature    odl-tsdr-all    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30\r
+    Verify Feature Is Installed    odl-tsdr-all\r
+    Verify Feature Is Installed    odl-tsdr-H2-persistence\r
+    Verify Feature Is Installed    odl-tsdr-core\r
+\r
+Get list of nodes from RESTAPI\r
+    [Documentation]    Get the inventory, should not contain address observations\r
+    ${resp}    RequestsLibrary.Get    session    ${OPERATIONAL_NODES_API}\r
+    Should Be Equal As Strings    ${resp.status_code}    200\r
+    Should Contain    ${resp.content}    openflow:1\r
+    Should Contain    ${resp.content}    openflow:2\r
+\r
+Verification TSDR Command is exist in Help\r
+    [Documentation]    Verify the TSDR List command on Help\r
+    ${output}=    Issue Command On Karaf Console    tsdr\t\r
+    Should Contain    ${output}    tsdr:list\r
+    Should Contain    ${output}    tsdr:purgeall\r
+    ${output}=    Issue Command On Karaf Console    tsdr:list\t\t\r
+    : FOR    ${list}    IN    @{CATEGORY}\r
+    \    Should Contain    ${output}    ${list}\r
+    COMMENT    Intentional Sleep time for Data Collection purpose\r
+    Sleep    15\r
+\r
+Verification of TSDR InterfaceMetrics\r
+    [Documentation]    Verify the TSDR InterfaceMetrics\r
+    ${output}=    Issue Command On Karaf Console    tsdr:list    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30\r
+    : FOR    ${list}    IN    @{INTERFACE_METRICS}\r
+    \    Should Contain    ${output}    ${list}\r
+\r
+Uninstall all TSDR H2 Feature\r
+    [Documentation]    UnInstall all TSDR H2 Features\r
+    Uninstall a Feature    odl-tsdr-core\r
+    Verify Feature Is Not Installed    odl-tsdr-core\r
+    Uninstall a Feature    odl-tsdr-all\r
+    Verify Feature Is Not Installed    odl-tsdr-all\r
+    Uninstall a Feature    odl-tsdr-H2-persistence\r
+    Verify Feature Is Not Installed    odl-tsdr-H2-persistence\r
+\r
+Verification TSDR Command shouldnot exist in help\r
+    [Documentation]    Verify the TSDR List command on help\r
+    ${output}=    Issue Command On Karaf Console    tsdr\t    ${CONTROLLER}    ${KARAF_SHELL_PORT}\r
+    Should not Contain    ${output}    tsdr:list\r
+    Comment    Should not Contain    ${output}    tsdr:purgeall\r
diff --git a/test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot b/test/csit/suites/tsdr/HBase/010_InterfaceMetrics.robot
new file mode 100755 (executable)
index 0000000..0f1f1e7
--- /dev/null
@@ -0,0 +1,86 @@
+*** Settings ***\r
+Documentation     Test suite for Hbase DataStore Verification\r
+Suite Setup       Run Keywords    Start Tsdr Suite    Initialize the HBase for TSDR\r
+Suite Teardown    Run Keywords    Stop Suite    Stop the HBase Server\r
+Library           SSHLibrary\r
+Library           Collections\r
+Library           String\r
+Library           ../../../libraries/RequestsLibrary.py\r
+Library           ../../../libraries/Common.py\r
+Resource          ../../../libraries/KarafKeywords.txt\r
+Resource          ../../../libraries/Utils.txt\r
+Resource          ../../../libraries/TsdrUtils.txt\r
+Variables         ../../../variables/Variables.py\r
+\r
+*** Variables ***\r
+@{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError\r
+...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount\r
+@{CATEGORY}       InterfaceMetrics    FlowTableMetrics    GroupMetrics    FlowMetrics    QueueMetrics\r
+${INTERFACE_QUERY}    scan 'InterfaceMetrics'\r
+\r
+*** Test Cases ***\r
+Install the TSDR HBase Feature\r
+    [Documentation]    Install and Verify the TSDR HBase Features\r
+    Install a Feature    odl-tsdr-hbase    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30\r
+    Verify Feature Is Installed    odl-tsdr-hbase\r
+    Verify Feature Is Installed    odl-tsdr-hbase-persistence\r
+    Verify Feature Is Installed    odl-hbaseclient\r
+\r
+Verification TSDR Command is exist in Help\r
+    [Documentation]    Verify the TSDR List command on Help\r
+    ${output}=    Issue Command On Karaf Console    tsdr\t\r
+    Should Contain    ${output}    tsdr:list\r
+    COMMENT    Should Contain    ${output}    tsdr:purgeall\r
+    ${output}=    Issue Command On Karaf Console    tsdr:list\t\t\r
+    : FOR    ${list}    IN    @{CATEGORY}\r
+    \    Should Contain    ${output}    ${list}\r
+    COMMENT    Intentional Sleep time for Data Collection purpose\r
+    Sleep    15\r
+\r
+Verification of TSDR InterfaceMetrics\r
+    [Documentation]    Verify the TSDR InterfaceMetrics\r
+    ${output}=    Issue Command On Karaf Console    tsdr:list    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30\r
+    : FOR    ${list}    IN    @{INTERFACE_METRICS}\r
+    \    Should Contain    ${output}    ${list}\r
+\r
+Verification of InterfaceMetrics on HBase Client\r
+    [Documentation]    Verification of the InterfaceMetrics from HBase Client\r
+    ${out}=    Query the Data from HBaseClient    ${INTERFACE_QUERY}\r
+    LOG    ${out}\r
+\r
+Uninstall all TSDR HBase Feature\r
+    [Documentation]    UnInstall all TSDR HBase Features\r
+    Uninstall a Feature    odl-tsdr-hbase-persistence\r
+    Verify Feature Is Not Installed    odl-tsdr-hbase-persistence\r
+    Uninstall a Feature    odl-hbaseclient\r
+    Verify Feature Is Not Installed    odl-hbaseclient\r
+    Uninstall a Feature    odl-tsdr-core\r
+    Verify Feature Is Not Installed    odl-tsdr-core\r
+    Uninstall a Feature    odl-tsdr-hbase\r
+    Verify Feature Is Not Installed    odl-tsdr-hbase\r
+\r
+Verification TSDR Command shouldnot exist in help\r
+    [Documentation]    Verify the TSDR List command on help\r
+    ${output}=    Issue Command On Karaf Console    tsdr\t    ${CONTROLLER}    ${KARAF_SHELL_PORT}\r
+    Should not Contain    ${output}    tsdr:list\r
+    Comment    Should not Contain    ${output}    tsdr:purgeall\r
+\r
+Verify node1 Aggregate stats doesnot zero value\r
+    [Documentation]    Verfiy the nodes doesnot have stats value with zero\r
+    ${result}=    Run Command On Remote System    ${MININET}    sudo ovs-ofctl dump-aggregate s1 -O OpenFlow13\r
+    Comment    Write    sh ovs-ofctl dump-aggregate s1 -O OpenFlow13\r
+    Comment    ${result}    Read Until    mininet>\r
+    Should Not Contain    ${result}    packet_count=0\r
+    Should Not Contain    ${result}    byte_count=0\r
+    Should Not Contain    ${result}    flow_count=0\r
+\r
+Verify node1 Ports stats doesnot zero value\r
+    [Documentation]    Verfiy the nodes doesnot have stats value with zero\r
+    ${result}=    Run Command On Remote System    ${MININET}    sudo ovs-ofctl dump-ports s1 -O OpenFlow13\r
+    Comment    Write    sh ovs-ofctl dump-ports s1 -O OpenFlow13\r
+    Comment    ${result}    Read Until    mininet>\r
+    ${port1}=    Get Lines Containing String    ${result}    1:\r
+    Should Not Contain    ${port1}    rx pkts=0\r
+    Should Not Contain    ${port1}    bytes=0\r
+    ${port1_tx}=    Get Line    ${result}    6\r
+    Should Not Contain    ${port1_tx}    tx pkts=0\r
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 (executable)
index 0000000..6b20a41
--- /dev/null
@@ -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 (file)
index 0000000..dabaf1e
--- /dev/null
@@ -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 (executable)
index 0000000..5c6df70
--- /dev/null
@@ -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 (executable)
index 0000000..827477d
--- /dev/null
@@ -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 (file)
index 0000000..51dc148
--- /dev/null
@@ -0,0 +1,3 @@
+# Place the suites in run order:
+integration/test/csit/suites/tsdr/H2
+integration/test/csit/suites/tsdr/HBase
index f6a31e80c9919eb5a81db217c984ee8f8b21822c..d822ea539995d60ca1c1508f51adcb70ce477dd9 100644 (file)
@@ -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'