Done the following changes : 03/32603/17
authorpremnath <prem.annauniv@gmail.com>
Thu, 14 Jan 2016 11:01:57 +0000 (16:31 +0530)
committerJamo Luhrsen <jluhrsen@redhat.com>
Sat, 23 Jan 2016 01:20:06 +0000 (01:20 +0000)
TsdrUtils.robot - Addressed the review comments
All HSQLDB Suites - Addressed the review comments
All HBase Suites - Modified Query format based on new Design
Added HSQLDB Testplan
Changed HBase scriptplan as per new environmental variables
Removed the Flowmeter and Groupmeter status (refer bugzilla#3466)
Modified keywords which were used with deprecated format in Dictionary and Request Library

Change-Id: I3ea717671d84a66df3903d66ba24de4212a600b7
Signed-off-by: premnath <prem.annauniv@gmail.com>
13 files changed:
csit/libraries/TsdrUtils.robot
csit/suites/tsdr/HBase/010_InterfaceMetrics.robot
csit/suites/tsdr/HBase/020_FlowMetrics.robot
csit/suites/tsdr/HBase/030_FlowTableMetrics.robot
csit/suites/tsdr/HBase/040_QueueMetrics.robot
csit/suites/tsdr/HBase/050_GroupMetrics.robot [deleted file]
csit/suites/tsdr/HBase/060_FlowMeterMetrics.robot [deleted file]
csit/suites/tsdr/HBase/scripts/hbase-startup.sh
csit/suites/tsdr/HSQLDB/010_InterfaceMetrics.robot [new file with mode: 0644]
csit/suites/tsdr/HSQLDB/020_FlowMetrics.robot [new file with mode: 0644]
csit/suites/tsdr/HSQLDB/030_FlowTableMetrics.robot [new file with mode: 0644]
csit/suites/tsdr/HSQLDB/040_QueueMetrics.robot [new file with mode: 0644]
csit/testplans/tsdr-hsqldb-datastore.txt [new file with mode: 0644]

index f876c4326857cb04595939eff7b60b1f7de2a79c..34c6d00fc4cce9e9c51aa3f32cce83f88a783b5c 100644 (file)
@@ -1,27 +1,79 @@
 *** Settings ***
+Library           RequestsLibrary
+Library           XML
 Library           OperatingSystem
+Library           String
+Library           Collections
+Library           DateTime
 Resource          Utils.robot
 Variables         ../variables/Variables.py
+Library           json
+Library           HttpLibrary.HTTP
 
 *** Variables ***
 ${HBASE_CLIENT}    /tmp/Hbase/hbase-0.94.15/bin
+${CASSANDRA_CLIENT}    /tmp/cassandra/apache-cassandra-2.1.12/bin
 ${final}          ${EMPTY}
+${prompt_timeout}    ${EMPTY}
+${CASSANDRA_DB_PATH}    /tmp/cassandra/apache-cassandra-2.1.12/
+${metric_path}    metricpath
+${metric_val}     metricval
+${metric_log}     metriclog
+${temp_metric_val}    temp_metric_val
+${NETFLOW_PORT}    2055
+${KARAF_PATH}     ${WORKSPACE}/${BUNDLEFOLDER}
+${TSDR_PATH}      ${KARAF_PATH}/tsdr
+${PURGE_PATH}     ${KARAF_PATH}/etc/tsdr.data.purge.cfg
+${SNMP_PATH}      ${KARAF_PATH}/etc/tsdr.snmp.cfg
+${SNMP_COMMUNITY}    mib2dev\/if-mib
+&{HEADERS_QUERY}    Content-Type=application/json    Content-Type=application/json
+&{OPER_STATUS}    up=1    down=2    testing=3    unknown=4    dormant=5    notPresent=6    lowerLayerDown=7
 
 *** Keywords ***
 Start Tsdr Suite
-    [Arguments]    ${switch}=ovsk
-    [Documentation]    TSDR specific setup/cleanup work that can be done safely before any system
+    [Arguments]    ${switch}=ovsk    ${switch_count}=3
+    [Documentation]    TSDR specific setup/cleanup work that can be done safely before any system.
     ...    is run.
     Clean Mininet System
-    ${mininet_conn_id1}=    Open Connection    ${MININET}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
+    ${mininet_conn_id1}=    Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
     Set Suite Variable    ${mininet_conn_id1}
-    Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
-    ${start}=    Set Variable    sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ${switch},protocols=OpenFlow13
+    ${start}=    Set Variable    sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo=linear,${switch_count} --switch ${switch},protocols=OpenFlow13
     Log    ${start}
     Write    ${start}
     Read Until    mininet>
 
+Configure Netflow
+    [Arguments]    ${user}=${TOOLS_SYSTEM_USER}
+    [Documentation]    Configure Netflow
+    ${output}=    Run Command On Controller    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl -- set Bridge s1 netflow=@nf -- --id=@nf create NetFlow target=\\"${ODL_SYSTEM_IP}:${NETFLOW_PORT}\\" active-timeout=10    ${user}
+
+Ping All Hosts
+    [Arguments]    ${switch}=ovsk
+    [Documentation]    Ping between all hosts in mininet topology.
+    Switch Connection    ${mininet_conn_id1}
+    Write    pingall
+    Read Until    mininet>
+
+Iperf All Hosts
+    [Arguments]    ${pattern}
+    [Documentation]    Iperf between h1 and h2 and check Hbase
+    Switch Connection    ${mininet_conn_id1}
+    Write    iperf h1 h2
+    Read Until    mininet>
+    ${query_output}=    Query the Data from HBaseClient    count 'NETFLOW'
+    Should Match Regexp    ${query_output}    ${pattern}
+
+Iperf All Hosts Cassandra
+    [Arguments]    ${pattern}
+    [Documentation]    Iperf between h1 and h2 and check Cassandra
+    Switch Connection    ${mininet_conn_id1}
+    Write    iperf h1 h2
+    Read Until    mininet>
+    ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metriclog;
+    Should Match Regexp    ${query_output}    ${pattern}
+
 Stop Tsdr Suite
     [Documentation]    Cleanup/Shutdown work that should be done at the completion of all
     ...    tests
@@ -31,27 +83,44 @@ Stop Tsdr Suite
     Read Until    ${DEFAULT_LINUX_PROMPT}
     Close Connection
 
+Purge Data
+    [Arguments]    ${HOST}=127.0.0.1    ${purge_enabled}=true    ${purge_time}=00:00:00    ${purge_interval}=1400    ${retention}=0
+    [Documentation]    Write Purge file and copy it to directory.127.0.0.1 refers local controller
+    Create File    purge.cfg    \#TSDR Project Configuration file
+    Append To File    purge.cfg    \n
+    Append To File    purge.cfg    host=${HOST}
+    Append To File    purge.cfg    \n
+    Append To File    purge.cfg    data_purge_enabled=${purge_enabled}
+    Append To File    purge.cfg    \n
+    Append To File    purge.cfg    data_purge_time=${purge_time}
+    Append To File    purge.cfg    \n
+    Append To File    purge.cfg    data_purge_interval_in_minutes=${purge_interval}
+    Append To File    purge.cfg    \n
+    Append To File    purge.cfg    retention_time_in_hours=${retention}
+    Append To File    purge.cfg    \n
+    Move File    purge.cfg    ${PURGE_PATH}
+
 Initialize the HBase for TSDR
     [Documentation]    Install and initialize the tsdr tables on HBase Server
-    ${hbase_server}=    Run Command On Remote System    ${CONTROLLER}    export JAVA_HOME=/usr && ${HBASE_CLIENT}/start-hbase.sh    ${MININET_USER}    ${prompt_timeout}=120
+    ${hbase_server}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    export JAVA_HOME=/usr && ${HBASE_CLIENT}/start-hbase.sh    ${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120
     Log    ${hbase_server}
-    ${hbase_process}=    Run Command On Remote System    ${CONTROLLER}    ps -ef | grep HMaster
+    ${hbase_process}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    ps -ef | grep HMaster
     Log    ${hbase_process}
 
 Stop the HBase Server
     [Documentation]    Stop the HBase server
-    ${hbase_server}=    Run Command On Remote System    ${CONTROLLER}    export JAVA_HOME=/usr && ${HBASE_CLIENT}/stop-hbase.sh    ${MININET_USER}    ${prompt_timeout}=90
+    ${hbase_server}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    export JAVA_HOME=/usr && ${HBASE_CLIENT}/stop-hbase.sh    ${TOOLS_SYSTEM_USER}    ${prompt_timeout}=90
     Log    ${hbase_server}
 
 Configure the Queue on Switch
-    [Arguments]    ${queue_interface}    ${user}=${MININET_USER}    ${prompt_timeout}=120s
+    [Arguments]    ${queue_interface}    ${user}=${TOOLS_SYSTEM_USER}
     [Documentation]    Configure the 2 queues on specified openvswitch interface
     Log    Configure the queue on ${queue_interface}
-    ${output}=    Run Command On Remote System    ${MININET}    sudo ovs-vsctl set port ${queue_interface} qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=200000000 queues=0=@q0,1=@q1,2=@q2 -- --id=@q0 create queue other-config:min-rate=100000 other-config:max-rate=200000 -- --id=@q1 create queue other-config:min-rate=10001 other-config:max-rate=300000 -- --id=@q2 create queue other-config:min-rate=300001 other-config:max-rate=200000000    ${MININET_USER}    ${prompt_timeout}=90
+    ${output}=    Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo ovs-vsctl set port ${queue_interface} qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=200000000 queues=0=@q0,1=@q1,2=@q2 -- --id=@q0 create queue other-config:min-rate=100000 other-config:max-rate=200000 -- --id=@q1 create queue other-config:min-rate=10001 other-config:max-rate=300000 -- --id=@q2 create queue other-config:min-rate=300001 other-config:max-rate=200000000
     Log    ${output}
 
 Query the Data from HBaseClient
-    [Arguments]    ${query}    ${remote}=${CONTROLLER}    ${user}=${MININET_USER}    ${prompt_timeout}=120s
+    [Arguments]    ${query}    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s
     [Documentation]    Execute the HBase Query and return the result
     Log    Attempting to execute ${query} on ${remote} via HbaseClient
     ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
@@ -68,7 +137,7 @@ Query the Data from HBaseClient
     [Return]    ${output}
 
 Verify the Metric is Collected?
-    [Arguments]    ${tsdr_cmd}    ${metric}    ${remote}=${CONTROLLER}    ${user}=${MININET_USER}    ${prompt_timeout}=120s
+    [Arguments]    ${tsdr_cmd}    ${metric}    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s
     [Documentation]    Verify the ${tsdr_cmd} output contains ${metric}
     ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${remote}    ${KARAF_SHELL_PORT}    ${prompt_timeout}
     Should Contain    ${output}    ${metric}
@@ -97,20 +166,55 @@ Create the Hbase table row
     ${query}=    Remove Space on String    ${query}
     [Return]    ${query}
 
+Initialize Cassandra Tables
+    [Arguments]    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s    ${key_table}=metricpath    ${val_table}=metricval
+    [Documentation]    Truncate Existing tables in Cassandra to Start it fresh.
+    Log    Attempting to truncate tables in Cassandra
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    rm -rf ${CASSANDRA_DB_PATH}${key_table}
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    rm -rf ${CASSANDRA_DB_PATH}${val_table}
+    ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Write    export JAVA_HOME=/usr
+    Write    ${CASSANDRA_CLIENT}/cqlsh
+    Read Until    cqlsh>
+    Write    TRUNCATE tsdr.${key_table} ;
+    Read Until    cqlsh>
+    Write    TRUNCATE tsdr.${val_table} ;
+    Read Until    cqlsh>
+    Write    exit
+    Close Connection
+
+Initialize Cassandra Tables Metricval
+    [Arguments]    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s    ${key_table}=metricpath    ${val_table}=metricval
+    [Documentation]    Truncate Existing tables in Cassandra to Start it fresh
+    Log    Attempting to truncate tables in Cassandra
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    rm -rf ${CASSANDRA_DB_PATH}${key_table}
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    rm -rf ${CASSANDRA_DB_PATH}${val_table}
+    ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Write    export JAVA_HOME=/usr
+    Write    ${CASSANDRA_CLIENT}/cqlsh
+    Read Until    cqlsh>
+    Write    TRUNCATE tsdr.${val_table} ;
+    Read Until    cqlsh>
+    Write    exit
+    Close Connection
+
 Query Metrics on H2 Datastore
     [Arguments]    ${category}    ${attribute}    ${nodeid}=openflow:1
     [Documentation]    Generate the JDBC query for H2 Datastore
     ${h2_query}=    Concatenate the String    jdbc:query metric "select * from Metric where MetricCategory=    '${category}' and
     ${h2_query}=    Concatenate the String    ${h2_query}    MetricName = '${attribute}' and NODEID = '${nodeid}' order by ID desc limit 5"
-    ${output}=    Issue Command On Karaf Console    ${h2_query}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
+    ${output}=    Issue Command On Karaf Console    ${h2_query}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
     [Return]    ${output}
 
 Generate HBase Query
-    [Arguments]    ${table}    ${filter}
+    [Arguments]    ${table}    ${filter}    ${metric}
     [Documentation]    Scan the Hbase Table with Filter
     ${hbase_query}=    Concatenate the String    scan    '${table}'
     ${hbase_query}=    Concatenate the String    ${hbase_query}    ,{ FILTER =>\"(RowFilter(=,
-    ${hbase_query}=    Concatenate the String    ${hbase_query}    'regexstring:${filter}*\'))\",LIMIT=>10}
+    ${hbase_query}=    Concatenate the String    ${hbase_query}    'regexstring:${filter}*\')) AND (RowFilter(=,
+    ${hbase_query}=    Concatenate the String    ${hbase_query}    'regexstring:MN=${metric}*\'))\",LIMIT=>10}
     [Return]    ${hbase_query}
 
 Get Metrics Value
@@ -127,9 +231,426 @@ Get Metrics Value
 Verify the Metrics Attributes on Hbase Client
     [Arguments]    ${attribute}    ${rowfilter}    ${table}=PortStats
     [Documentation]    Verification on Metrics attributes on Hbase Client
-    ${pattern}=    Concatenate the String    ${attribute}    _
-    ${pattern}=    Concatenate the String    ${pattern}    ${rowfilter}
-    ${pattern}=    Remove Space on String    ${pattern}
-    ${query}=    Generate HBase Query    ${table}    ${pattern}
+    ${query}=    Generate HBase Query    ${table}    ${rowfilter}    ${attribute}
     ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)${attribute}
+    Should Match Regexp    ${out}    (?mui)value
+
+Verify the Metrics Attributes on Cassandra Client
+    [Arguments]    ${pattern}
+    [Documentation]    Verification on Metrics attributes on Cassandra Client
+    @{metric_row}=    Find Metricval Keys    ${pattern}    metricpath
+    ${keya}=    Get From List    ${metric_row}    1
+    ${keyb}=    Get From List    ${metric_row}    2
+    ${keya_bool}=    Evaluate    ${keya} < 0
+    ${keya}=    Run Keyword If    '${keya_bool}' == 'True'    Catenate    SEPARATOR=    \\    ${keya}
+    ...    ELSE    Catenate    ${keya}
+    Create Temporary Key Info    ${keya} ${keyb}
+    ${metric_value}=    Verify Metric Val File
+    [Return]    ${metric_value}
+
+Form Portstats Query Pattern
+    [Arguments]    ${metric}    ${node}    ${port}    ${attribute}
+    [Documentation]    Used for geneating openflow metrics Queries for Cassandra.
+    ${pattern}=    Concatenate the String    ${attribute}    .
+    ${pattern}=    Concatenate the String    ${pattern}    ${metric}
+    ${pattern}=    Concatenate the String    ${pattern}    .
+    ${pattern}=    Concatenate the String    ${pattern}    ${node}
+    ${pattern}=    Concatenate the String    ${pattern}    .
+    ${pattern}=    Concatenate the String    ${pattern}    Node_${node}
+    ${pattern}=    Concatenate the String    ${pattern}    .
+    ${pattern}=    Concatenate the String    ${pattern}    NodeConnector_${node}:${port}
+    ${pattern}=    Remove Space on String    ${pattern}
+    [Return]    ${pattern}
+
+Create Temporary Key Info
+    [Arguments]    ${pattern}    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s    ${val_table}=metricval
+    [Documentation]    Creates a temporary File with matching keya,keyb values.
+    Log    Removing existing file
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    rm -rf ${CASSANDRA_DB_PATH}${temp_metric_val}
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    cat ${CASSANDRA_DB_PATH}${val_table}|grep "${pattern}" > ${CASSANDRA_DB_PATH}${temp_metric_val}
+
+Verify Metric Val File
+    [Documentation]    Returns Value for metric matching particular keya,keyb
+    @{metricval}=    Read File and Return Split Lines    ${CASSANDRA_DB_PATH}${temp_metric_val}
+    ${mv_len}=    Get Length    ${metricval}
+    ${mv_len}=    Evaluate    ${mv_len} - 1
+    ${found_line}=    Get From List    ${metricval}    ${mv_len}
+    @{split_line}=    Split String    ${found_line}    ${SPACE}
+    ${metric_count}=    Get From List    ${split_line}    3
+    [Return]    ${metric_count}
+
+Verify Metric log File
+    [Arguments]    ${pattern}
+    [Documentation]    Returns Value for lines in Metriclog file matching the pattern
+    ${contents}=    Grep File    ${CASSANDRA_DB_PATH}${temp_metric_val}    ${pattern}
+    [Return]    ${contents}
+
+Find Metricval Keys
+    [Arguments]    ${pattern}    ${file}
+    [Documentation]    Return list element which has the particular pattern.
+    ${db_grep}=    Grep File    ${CASSANDRA_DB_PATH}${file}    ${pattern}
+    ${metric_grep}=    Grep File    ${TSDR_PATH}/tsdrKeyCache.txt    ${pattern}
+    @{split_line}=    Split String    ${metric_grep}    |
+    ${keypath}=    Get From List    ${split_line}    0
+    Should Contain    ${db_grep}    ${keypath}
+    [Return]    @{split_line}
+
+Copy TSDR tables
+    [Arguments]    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s    ${key_table}=metricpath    ${val_table}=metricval
+    [Documentation]    Copy TSDR files to external File system for text processing.
+    Log    Attempting to truncate tables in Cassandra
+    ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Write    export JAVA_HOME=/usr
+    Write    ${CASSANDRA_CLIENT}/cqlsh
+    Read Until    cqlsh>
+    Write    COPY tsdr.${key_table} TO '${CASSANDRA_DB_PATH}${key_table}' WITH DELIMITER = ' ';
+    Read Until    cqlsh>
+    Write    COPY tsdr.${val_table} TO '${CASSANDRA_DB_PATH}${val_table}' WITH DELIMITER = ' ';
+    Read Until    cqlsh>
+    Write    exit
+    Close Connection
+
+Issue Cassandra Query
+    [Arguments]    ${query}    ${output}    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s
+    [Documentation]    Issue query in cqlsh and match it with output which is passed as a argument
+    ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Write    export JAVA_HOME=/usr
+    Write    ${CASSANDRA_CLIENT}/cqlsh
+    Read Until    cqlsh>
+    ${query_output}=    Write    ${query}
+    ${query_output}=    Read Until    cqlsh>
+    ${str_output}=    Convert To String    ${output}
+    Should Contain    ${query_output}    ${str_output}
+    Write    exit
+    Close Connection
+
+Count Cassandra rows
+    [Arguments]    ${query}    ${remote}=${ODL_SYSTEM_IP}    ${user}=${TOOLS_SYSTEM_USER}    ${prompt_timeout}=120s
+    [Documentation]    Issue query in cqlsh and match it with output which is passed as a argument
+    ${conn_id}=    Open Connection    ${remote}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=${prompt_timeout}
+    Login With Public Key    ${user}    ${USER_HOME}/.ssh/${SSH_KEY}    any
+    Write    export JAVA_HOME=/usr
+    Write    ${CASSANDRA_CLIENT}/cqlsh
+    Read Until    cqlsh>
+    ${query_output}=    Write    ${query}
+    ${query_output}=    Read Until    cqlsh>
+    Write    exit
+    Close Connection
+    [Return]    ${query_output}
+
+Read File and Return Split Lines
+    [Arguments]    ${filename}
+    [Documentation]    Reads the file and returns each line as list
+    ${contents}=    OperatingSystem.Get File    ${filename}
+    @{lines}=    Split to lines    ${contents}
+    [Return]    @{lines}
+
+Get Stats XML
+    [Arguments]    ${query}    ${xpath}
+    [Documentation]    Parse the xml output and returns it.
+    ${sid}=    RequestsLibrary.Create_Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    headers=${SEND_ACCEPT_XML_HEADERS}    auth=${AUTH}
+    ${resp}=    RequestsLibrary.Get Request    session    ${query}    headers=${SEND_ACCEPT_XML_HEADERS}
+    ${resp_xml}=    Parse XML    ${resp.content}
+    ${id1}=    Get Element Text    ${resp_xml}    ${xpath}
+    Delete All Sessions
+    [Return]    ${id1}
+
+Return all XML matches
+    [Arguments]    ${query}    ${xpath}
+    [Documentation]    Returns all the values from xpath
+    ${sid}=    RequestsLibrary.Create_Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    headers=${SEND_ACCEPT_XML_HEADERS}    auth=${AUTH}
+    ${resp}=    RequestsLibrary.Get Request    session    ${query}    headers=${SEND_ACCEPT_XML_HEADERS}
+    ${resp_xml}=    Parse XML    ${resp.content}
+    @{id1}=    Get Elements Texts    ${resp_xml}    ${xpath}
+    Delete All Sessions
+    [Return]    @{id1}
+
+Compare Tsdr XML Metrics
+    [Arguments]    ${xml}    ${tsdr}    ${deviation}=10
+    [Documentation]    Compares xml metrics from openflow plugin with TSDR metric values
+    ${val_max}=    Evaluate    ${xml}*${deviation}/100
+    ${val_diff}=    Evaluate    ${tsdr} - ${xml}
+    ${find_negative}=    Evaluate    ${val_diff} < 0
+    ${val_diff}=    Run Keyword If    '${find_negative}' == 'True'    Evaluate    ${val_diff}*-1
+    ...    ELSE    Evaluate    ${val_diff}*1
+    Should Be True    ${val_diff} <= ${val_max}
+
+Generate Syslog
+    [Arguments]    ${facility}    ${level}    ${MESSAGE}
+    [Documentation]    Uses syslogd to generate syslogs
+    Run Command On Remote System    ${ODL_SYSTEM_IP}    logger -p ${facility}.${level} -n 127.0.0.1 -u 514 ${MESSAGE}
+
+Verify Metric Val File For Syslog
+    [Documentation]    Returns Value for metric matching particular keya,keyb
+    @{metricval}=    Read File and Return Split Lines    ${CASSANDRA_DB_PATH}${temp_metric_val}
+    [Return]    ${metricval}
+
+Verify the Metrics Syslog on Cassandra Client
+    [Arguments]    ${pattern}
+    [Documentation]    Getting the keya and keyb for a particular syslog agent and create a temporary file from metriclog
+    @{metric_row}=    Find Metricval Keys    ${pattern}    metricpath
+    ${keya}=    Get From List    ${metric_row}    1
+    ${keyb}=    Get From List    ${metric_row}    2
+    ${keya_bool}=    Evaluate    ${keya} < 0
+    ${keya}=    Run Keyword If    '${keya_bool}' == 'True'    Catenate    SEPARATOR=    \\    ${keya}
+    ...    ELSE    Catenate    ${keya}
+    Create Temporary Key Info    ${keya} ${keyb}    val_table=${metric_log}
+
+Iterating over metricpath
+    [Documentation]    Used to traverse over metricpath file and traverse over metricpath file and get the keys
+    @{mp_lines}=    Read File and Return Split Lines    ${CASSANDRA_DB_PATH}${metric_path}
+    : FOR    ${line}    IN    @{mp_lines}
+    \    @{split_line}=    Split String    ${line}    ${SPACE}
+    \    ${keya}=    Get From List    ${split_line}    1
+    \    ${keyb}=    Get From List    ${split_line}    2
+    \    Iterating over metricval    ${keya}    ${keyb}
+
+Iterating over metricval
+    [Arguments]    ${keya}    ${keyb}
+    [Documentation]    Used to traverse over metricval file and check if keya and keyb are present.
+    ${mv_contents}=    OperatingSystem.Get File    ${CASSANDRA_DB_PATH}${metric_val}
+    Should Contain    ${mv_contents}    ${keya}    ${keyb}
+
+Check Metric path
+    [Arguments]    ${pattern}
+    [Documentation]    Count the number of rows in metricpath and compare with the pattern.
+    ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metricpath;
+    Should Match Regexp    ${query_output}    ${pattern}
+
+Check HSQLDB
+    [Arguments]    ${pattern}    ${TYPE}
+    [Documentation]    Count the number of rows in HSQLDB with Metric ${TYPE}
+    ${output}=    Issue Command On Karaf Console    tsdr:list ${TYPE}
+    Should Match Regexp    ${output}    ${pattern}
+
+Check Metric Val
+    [Arguments]    ${pattern}
+    [Documentation]    Count the number of rows in metricval table and compare with the pattern.
+    ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metricval;
+    Should Match Regexp    ${query_output}    ${pattern}
+
+Check Metric Log
+    [Arguments]    ${pattern}
+    [Documentation]    Count the number of rows in metriclog and compare with the pattern.
+    ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metriclog;
+    Should Match Regexp    ${query_output}    ${pattern}
+
+Severity Iterator
+    [Arguments]    ${key}    ${MESSAGE}    ${syslog_severity}
+    [Documentation]    Simulating FOR loop for generating syslogs for each syslog_severity
+    : FOR    ${level}    IN ZIP    &{syslog_severity}
+    \    ${level_value}=    Get From Dictionary    ${syslog_severity}    ${level}
+    \    Generate Syslog    ${key}    ${level}    ${MESSAGE}
+
+Severity Iterator For TSDR
+    [Arguments]    ${key}    ${facility_value}    ${iterator_value}    ${syslogs}    ${MESSAGE}    ${syslog_severity}
+    [Documentation]    Simulating FOR loop for checking TSDR for each syslog_severity
+    ${iterator}=    Evaluate    ${iterator_value} * 8
+    : FOR    ${level}    IN ZIP    &{syslog_severity}
+    \    ${severity_value}=    Get From Dictionary    ${syslog_severity}    ${level}
+    \    ${fac_sev}=    Evaluate    ${facility_value} * 8 + ${severity_value}
+    \    Should Contain    @{syslogs}[${iterator}]    ${MESSAGE}
+    \    Should Contain    @{syslogs}[${iterator}]    <${fac_sev}>
+    \    ${iterator}=    Evaluate    ${iterator} + 1
+
+Severity Iterator For Syslog HBase
+    [Arguments]    ${message}    ${value}    &{syslog_severity}
+    [Documentation]    Simulating FOR loop for checking HBASE for each syslog_severity
+    ${output}=    Query the Data from HBaseClient    scan 'SysLog'
+    Should Contain X Times    ${output}    ${message}    8
+    ${iterator}=    Evaluate    ${value} * 8
+    : FOR    ${level}    IN ZIP    &{syslog_severity}
+    \    ${severity_value}=    Get From Dictionary    ${syslog_severity}    ${level}
+    \    ${fac_sev}=    Evaluate    ${iterator} + ${severity_value}
+    \    Should Match    ${output}    *${fac_sev}>*
+
+Generate TSDR Query
+    [Arguments]    ${DC}=    ${MN}=    ${NID}=    ${RK}=    ${from}=0    ${until}=now
+    [Documentation]    Issues TSDR Query and returns the list
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
+    ${resp}=    RequestsLibrary.Get Request    session    /tsdr/metrics/query?tsdrkey="[NID=${NID}][DC=${DC}][MN=${MN}][RK=${RK}]"&from=${from}&until=${until}    headers=${HEADERS_QUERY}
+    @{convert}=    Parse Json    ${resp.content}
+    Delete All Sessions
+    [Return]    @{convert}
+
+Generate TSDR NBI
+    [Arguments]    ${DC}=    ${MN}=    ${NID}=    ${RK}=    ${from}=0    ${until}=now
+    ...    ${datapts}=1000000
+    [Documentation]    Issues TSDR Query and returns the list
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
+    ${resp}=    RequestsLibrary.Get Request    session    /tsdr/nbi/render?target="[NID=${NID}][DC=${DC}][MN=${MN}][RK=${RK}]"&from=${from}&until=${until}&maxDataPoints=${datapts}    headers=${HEADERS_QUERY}
+    @{convert}=    Parse Json    ${resp.content}
+    ${dict_convert}=    Convert To Dictionary    @{convert}
+    @{dict}=    Get Dictionary Values    ${dict_convert}
+    @{datapoints_list}=    Convert to List    @{dict}[0]
+    Delete All Sessions
+    [Return]    @{datapoints_list}
+
+Extract PORTSTATS RecordKeys
+    [Arguments]    ${Record_keys}
+    [Documentation]    Dissect Record keys for Portstats
+    ${node_dict}=    Get From List    ${Record_keys}    0
+    ${nc_dict}=    Get From List    ${Record_keys}    1
+    ${NODE}=    Get From Dictionary    ${node_dict}    keyValue
+    ${NC}=    Get From Dictionary    ${nc_dict}    keyValue
+    ${rk_val}=    Set Variable    Node:${NODE},NodeConnector:${NC}
+    [Return]    ${rk_val}
+
+Extract QUEUESTATS RecordKeys
+    [Arguments]    ${Record_keys}
+    [Documentation]    Dissect Record keys for Queuestats
+    ${node_dict}=    Get From List    ${Record_keys}    0
+    ${connect_dict}=    Get From List    ${Record_keys}    1
+    ${queue_dict}=    Get From List    ${Record_keys}    2
+    ${NODE}=    Get From Dictionary    ${node_dict}    keyValue
+    ${CONNECT}=    Get From Dictionary    ${connect_dict}    keyValue
+    ${QUEUE}=    Get From Dictionary    ${queue_dict}    keyValue
+    ${rk_val}=    Set Variable    Node:${NODE},NodeConnector:${CONNECT},Queue:${QUEUE}
+    [Return]    ${rk_val}
+
+Extract FLOWSTATS RecordKeys
+    [Arguments]    ${Record_keys}
+    [Documentation]    Dissect Record keys for Flowstats
+    ${node_dict}=    Get From List    ${Record_keys}    0
+    ${table_dict}=    Get From List    ${Record_keys}    1
+    ${flow_dict}=    Get From List    ${Record_keys}    2
+    ${NODE}=    Get From Dictionary    ${node_dict}    keyValue
+    ${TABLE}=    Get From Dictionary    ${table_dict}    keyValue
+    ${FLOW}=    Get From Dictionary    ${flow_dict}    keyValue
+    ${rk_val}=    Set Variable    Node:${NODE},Table:${TABLE},Flow:${FLOW}
+    [Return]    ${rk_val}
+
+Extract FLOWTABLESTATS RecordKeys
+    [Arguments]    ${Record_keys}
+    [Documentation]    Dissect Record keys for Flowtablestats
+    ${node_dict}=    Get From List    ${Record_keys}    0
+    ${table_dict}=    Get From List    ${Record_keys}    1
+    ${NODE}=    Get From Dictionary    ${node_dict}    keyValue
+    ${TABLE}=    Get From Dictionary    ${table_dict}    keyValue
+    ${rk_val}=    Set Variable    Node:${NODE},Table:${TABLE}
+    [Return]    ${rk_val}
+
+Extract Row Values from TSDR Query
+    [Arguments]    ${row_dict}    ${tsdr_row}    ${nbi_row}    ${DATA_CATEGORY}
+    [Documentation]    Extract the row values from query and generate it in DB format
+    ${nbi_value}=    Get From List    ${nbi_row}    0
+    ${nbi_time}=    Get From List    ${nbi_row}    1
+    ${MN}=    Get From Dictionary    ${row_dict}    metricName
+    ${MV}=    Get From Dictionary    ${row_dict}    metricValue
+    ${NID}=    Get From Dictionary    ${row_dict}    nodeID
+    ${RK}=    Get From Dictionary    ${row_dict}    recordKeys
+    ${time}=    Get From Dictionary    ${row_dict}    timeStamp
+    ${DC}=    Get From Dictionary    ${row_dict}    tsdrDataCategory
+    ${RK_VAL}=    Run Keyword If    '${DATA_CATEGORY}'=='PORTSTATS'    Extract PORTSTATS RecordKeys    ${RK}
+    ...    ELSE IF    '${DATA_CATEGORY}'=='FLOWSTATS'    Extract FLOWSTATS RecordKeys    ${RK}
+    ...    ELSE IF    '${DATA_CATEGORY}'=='FLOWTABLESTATS'    Extract FLOWTABLESTATS RecordKeys    ${RK}
+    ...    ELSE IF    '${DATA_CATEGORY}'=='QUEUESTATS'    Extract QUEUESTATS RecordKeys    ${RK}
+    ${epoch_time}=    Convert Date    ${time}    epoch    date_format=%a %b %d %H:%M:%S %Z %Y
+    ${epoch_time_int}=    Convert To Integer    ${epoch_time}
+    LOG    [NID=${NID}][DC=${DC}][MN=${MN}][${RK_VAL}][TS=${epoch_time_int}][${MV}]
+    Should Match    ${tsdr_row}    *${NID}*
+    Should Match    ${tsdr_row}    *${DC}*
+    Should Match    ${tsdr_row}    *${MN}*
+    Should Match    ${tsdr_row}    *${RK_VAL}*
+    Should Match    ${tsdr_row}    *[${MV}]*
+    Should Match    ${tsdr_row}    *${epoch_time_int}*
+    Should Be Equal As Numbers    ${nbi_time}    ${epoch_time_int}
+    Should Be Equal As Numbers    ${nbi_value}    ${MV}
+
+Evaluate Datasets Length
+    [Arguments]    ${tsdr_lines}    ${query_output}    ${nbi_output}
+    [Documentation]    Compare the outputs returned from all Data Stores
+    ${query_count}=    Get Length    ${query_output}
+    ${tsdr_count}=    Get Length    ${tsdr_lines}
+    ${nbi_count}=    Get Length    ${nbi_output}
+    Should Be Equal As Numbers    ${query_count}    ${tsdr_count}
+    Should Be Equal As Numbers    ${nbi_count}    ${tsdr_count}
+
+Evaluate Datasets Value
+    [Arguments]    ${tsdr_lines}    ${query_output}    ${nbi_output}    ${TYPE}
+    [Documentation]    Compare the outputs returned from all Data Stores
+    : FOR    ${q_item}    ${t_item}    ${n_item}    IN ZIP    ${query_output}    ${tsdr_lines}
+    ...    ${nbi_output}
+    \    ${query_row}=    Extract Row Values from TSDR Query    ${q_item}    ${t_item}    ${n_item}    ${TYPE}
+    : FOR    ${found_line}    IN    @{matching_list}
+    \    @{split_line}=    Split String    ${found_line}    |
+    \    ${hex_name}=    Get From List    ${split_line}    2
+    \    ${if_desc}=    Decode Bytes To String    ${hex_name}    HEX
+    \    Append To List    ${ifdesc_list}    ${if_desc}
+    [Return]    @{ifdesc_list}
+
+Write SNMP config
+    [Arguments]    ${HOST}=127.0.0.1    ${community}=${SNMP_COMMUNITY}
+    [Documentation]    Write SNMP Config File
+    Create File    snmp.cfg    credentials=[${HOST},${community}]
+    Append To File    snmp.cfg    \n
+    Move File    snmp.cfg    ${SNMP_PATH}
+
+Collect Data from SNMP Agent
+    [Arguments]    ${SNMP_IP}=127.0.0.1    ${SNMP_AGENT_COMM}=${SNMP_COMMUNITY}
+    [Documentation]    Poll for SNMP Agent OID
+    ${snmpagentinfo}    Create Dictionary    ip-address=${SNMP_IP}    community=${SNMP_AGENT_COMM}
+    ${snmpagentcreate}    Create Dictionary    input=${snmpagentinfo}
+    ${snmpagentcreate_json}=    json.dumps    ${snmpagentcreate}
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
+    ${resp}=    RequestsLibrary.Post Request    session    /restconf/operations/snmp:get-interfaces    data=${snmpagentcreate_json}
+    ${convert}=    To Json    ${resp.content}
+    @{dict1}=    Get Dictionary Keys    ${convert}
+    ${dict1_0}=    Get From List    ${dict1}    0
+    ${dict1_val}=    Get From Dictionary    ${convert}    ${dict1_0}
+    @{ifEntry}=    Get From Dictionary    ${dict1_val}    ifEntry
+    @{SNMP_ENTRY}=    Create List
+    @{SNMP_VALUES}=    Create List
+    : FOR    ${int}    IN    @{ifEntry}
+    \    ${ifindex}=    Get From Dictionary    ${int}    ifIndex
+    \    ${ifOutDiscards}=    Get From Dictionary    ${int}    ifOutDiscards
+    \    ${ifInDiscards}=    Get From Dictionary    ${int}    ifInDiscards
+    \    ${ifType}=    Get From Dictionary    ${int}    ifType
+    \    ${ifInOctets}=    Get From Dictionary    ${int}    ifInOctets
+    \    ${ifSpeed}=    Get From Dictionary    ${int}    ifSpeed
+    \    ${ifOutQLen}=    Get From Dictionary    ${int}    ifOutQLen
+    \    ${ifOutErrors}=    Get From Dictionary    ${int}    ifOutErrors
+    \    ${ifPhysAddress}=    Get From Dictionary    ${int}    ifPhysAddress
+    \    ${ifInUcastPkts}=    Get From Dictionary    ${int}    ifInUcastPkts
+    \    ${ifOutNUcastPkts}=    Get From Dictionary    ${int}    ifOutNUcastPkts
+    \    ${ifInErrors}=    Get From Dictionary    ${int}    ifInErrors
+    \    ${ifOutOctets}=    Get From Dictionary    ${int}    ifOutOctets
+    \    ${ifAdminStatus1}=    Get From Dictionary    ${int}    ifAdminStatus
+    \    ${ifAdminStatus}=    Get From Dictionary    ${OPER_STATUS}    ${ifAdminStatus1}
+    \    ${ifInUnknownProtos}=    Get From Dictionary    ${int}    ifInUnknownProtos
+    \    ${ifOutUcastPkts}=    Get From Dictionary    ${int}    ifOutUcastPkts
+    \    ${ifInNUcastPkts}=    Get From Dictionary    ${int}    ifInNUcastPkts
+    \    ${ifMtu}=    Get From Dictionary    ${int}    ifMtu
+    \    ${ifOperStatus1}=    Get From Dictionary    ${int}    ifOperStatus
+    \    ${ifOperStatus}=    Get From Dictionary    ${OPER_STATUS}    ${ifOperStatus1}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutDiscards*RK=ifIndex:${ifindex},SnmpMetric:IfOutDiscards*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutDiscards}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInDiscards*RK=ifIndex:${ifindex},SnmpMetric:IfInDiscards*
+    \    Append To List    ${SNMP_VALUES}    ${ifInDiscards}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInOctets*RK=ifIndex:${ifindex},SnmpMetric:IfInOctets*
+    \    Append To List    ${SNMP_VALUES}    ${ifInOctets}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutQLen*RK=ifIndex:${ifindex},SnmpMetric:IfOutQLen*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutQLen}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutErrors*RK=ifIndex:${ifindex},SnmpMetric:IfOutErrors*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutErrors}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInUcastPkts*RK=ifIndex:${ifindex},SnmpMetric:IfInUcastPkts*
+    \    Append To List    ${SNMP_VALUES}    ${ifInUcastPkts}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutNUcastPkts*RK=ifIndex:${ifindex},SnmpMetric:IfOutNUcastPkts*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutNUcastPkts}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInErrors*RK=ifIndex:${ifindex},SnmpMetric:IfInErrors*
+    \    Append To List    ${SNMP_VALUES}    ${ifInErrors}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutOctets*RK=ifIndex:${ifindex},SnmpMetric:IfOutOctets*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutOctets}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfAdminStatus*RK=ifIndex:${ifindex},SnmpMetric:IfAdminStatus*
+    \    Append To List    ${SNMP_VALUES}    ${ifAdminStatus}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInUnknownProtos*RK=ifIndex:${ifindex},SnmpMetric:IfInUnknownProtos*
+    \    Append To List    ${SNMP_VALUES}    ${ifInUnknownProtos}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOutUcastPkts*RK=ifIndex:${ifindex},SnmpMetric:IfOutUcastPkts*
+    \    Append To List    ${SNMP_VALUES}    ${ifOutUcastPkts}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfInNUcastPkts*RK=ifIndex:${ifindex},SnmpMetric:IfInNUcastPkts*
+    \    Append To List    ${SNMP_VALUES}    ${ifInNUcastPkts}
+    \    Append To List    ${SNMP_ENTRY}    *NID=${SNMP_IP}*DC=SNMPINTERFACES*MN=IfOperStatus*RK=ifIndex:${ifindex},SnmpMetric:IfOperStatus*
+    \    Append To List    ${SNMP_VALUES}    ${ifOperStatus}
+    [Return]    ${SNMP_ENTRY}    ${SNMP_VALUES}
index b7cd419f647c62fc6d8df28f0c51cf828fb9e69f..7a376d4d30d6bf5b8f1b3967078bb9668273c23b 100755 (executable)
@@ -14,17 +14,16 @@ Variables         ../../../variables/Variables.py
 *** Variables ***
 @{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError
 ...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
-@{CATEGORY}       FlowGroupStats    FlowMeterStats    FlowStats    FlowTableStats    PortStats    QueueStats
-${TSDR_PORTSTATS}    tsdr:list PortStats
-${CONFIG_INTERVAL}    /restconf/config/TSDRDC:TSDRDCConfig
-${OPER_INTERVAL}    /restconf/operations/TSDRDC:setPollingInterval
+@{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
+${TSDR_PORTSTATS}    tsdr:list PORTSTATS
+${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDRDCConfig
+${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
 
 *** Test Cases ***
 Verification of TSDR HBase Feature Installation
     [Documentation]    Install and Verify the TSDR HBase Features
-    COMMENT    Install a Feature    odl-tsdr-hbase    ${CONTROLLER}    ${KARAF_SHELL_PORT}    60
+    COMMENT    Install a Feature    odl-tsdr-hbase    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
     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
@@ -40,13 +39,13 @@ Verification of TSDR PortStats
     [Documentation]    Verify the TSDR InterfaceMetrics
     : FOR    ${list}    IN    @{INTERFACE_METRICS}
     \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
-    \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
+    \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
     \    Should Contain    ${output}    ${list}
 
 Verification of InterfaceMetrics-Attributes on HBase Client
     [Documentation]    Verify the InterfaceMetrics has been updated on HBase Datastore
     : FOR    ${list}    IN    @{INTERFACE_METRICS}
-    \    Verify the Metrics Attributes on Hbase Client    ${list}    openflow:1_1    InterfaceMetrics
+    \    Verify the Metrics Attributes on Hbase Client    ${list}    Node:openflow:1,NodeConnector:1    PORTSTATS
 
 Verify Configuration Interval-change
     [Documentation]    Verify the TSDR Collection configuration changes
@@ -60,12 +59,13 @@ Verify Configuration Interval-change
 Initialize the Tsdr Suite
     COMMENT    Initialize the HBase for TSDR
     Start Tsdr Suite
-    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
 
 Verify TSDR Configuration Interval
     [Arguments]    ${interval}
     [Documentation]    Verify Configuration interval of TSDR Collection
-    ${resp}    RequestsLibrary.Get    session    ${CONFIG_INTERVAL}
+    ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_INTERVAL}
+    LOG    ${resp.content}    WARN
     Should Be Equal As Strings    ${resp.status_code}    200
     Should Contain    ${resp.content}    ${interval}
 
@@ -76,5 +76,5 @@ Post TSDR Configuration Interval
     ${p2}    Create Dictionary    input=${p1}
     ${post_data}    Create Dictionary    setPollingInterval=${p2}
     Log    ${post_data}
-    ${resp}    RequestsLibrary.Post    session    ${OPER_INTERVAL}    ${post_data}
+    ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    ${post_data}
     Should Be Equal As Strings    ${resp.status_code}    201
index 03f351912b9d8137d70558708a6f36cfffc3c750..0bbb77dd768656f4311c69aa5ef471ae7e36a670 100644 (file)
@@ -12,33 +12,30 @@ Variables         ../../../variables/Variables.py
 
 *** Variables ***
 @{FLOW_METRICS}    PacketCount    ByteCount
-${TSDR_FLOWSTATS}    tsdr:list FlowStats
+${TSDR_FLOWSTATS}    tsdr:list FLOWSTATS
 
 *** Test Cases ***
 Verification of TSDR FlowMetrics
     [Documentation]    Verify the TSDR FlowStats
     Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    ${TSDR_FLOWSTATS}    PacketCount
-    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWSTATS}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
+    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWSTATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
     : FOR    ${list}    IN    @{FLOW_METRICS}
     \    Should Contain    ${output}    ${list}
 
 Verification of FlowMetrics-PacketCount on HBase Client
     [Documentation]    Verify the FlowStats-Packetcount on both Karaf console and Hbase client
     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWSTATS}    | grep PacketCount | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
+    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
     ${Line1}=    Get Line    ${output}    0
     Should Contain    ${Line1}    PacketCount
-    ${q1}=    Generate HBase Query    FlowMetrics    PacketCount_openflow:1_0
-    ${out}=    Query the Data from HBaseClient    ${q1}
-    Comment    ${output}=    Get Metrics Value    ${Line1}
-    Should Match Regexp    ${out}    (?mui)PacketCount_openflow
+    Verify the Metrics Attributes on Hbase Client    PacketCount    Node:openflow:1,Table:0    FLOWSTATS
+
 
 Verification of FlowMetrics-BytesCount on HBase Client
     [Documentation]    Verify the FlowStats-ByteCount on both Karaf Console and Hbase Client
     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWSTATS}    | grep ByteCount | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
+    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
     ${Line1}=    Get Line    ${output}    0
     Should Contain    ${Line1}    ByteCount
-    ${q1}=    Generate HBase Query    FlowMetrics    ByteCount_openflow:1_0
-    ${out}=    Query the Data from HBaseClient    ${q1}
-    Should Match Regexp    ${out}    (?mui)ByteCount_openflow
+    Verify the Metrics Attributes on Hbase Client    ByteCount    Node:openflow:1,Table:0    FLOWSTATS
+
index b6e930756a11dca49631770f4c76e997cbb928c0..6d17b712905a1f197b8a408c15ddabd53be492b9 100644 (file)
@@ -11,35 +11,31 @@ Resource          ../../../libraries/TsdrUtils.robot
 Variables         ../../../variables/Variables.py
 
 *** Variables ***
-${TSDR_FLOWTABLE_STATS}    tsdr:list FlowTableStats
+${TSDR_FLOWTABLE_STATS}    tsdr:list FLOWTABLESTATS
 
 *** Test Cases ***
 Verification of TSDR FlowTableMetrics
     [Documentation]    Verify the TSDR FlowTableMetrics
-    Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    ${TSDR_FLOWTABLE_STATS}    MetricName
-    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWTABLE_STATS}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
-    Should Contain    ${output}    MetricName
+    Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    ${TSDR_FLOWTABLE_STATS}    MN
+    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWTABLE_STATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
+    Should Contain    ${output}    MN
 
 Verification of FlowTableMetrics on Karaf Console
     [Documentation]    Verify the FlowTableMetrics has been updated thru tsdr:list command on karaf console
     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWTABLE_STATS}    | grep ActiveFlows | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
+    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
     Should Contain    ${output}    ActiveFlows
 
 Verification of FlowTableMetrics-ActiveFlows on HBase Client
     [Documentation]    Verify the FlowTableMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    FlowTableMetrics    ActiveFlows_openflow:1_0
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)ActiveFlows_openflow
+    Verify the Metrics Attributes on Hbase Client    ActiveFlows    Node:openflow:1,Table:0    FLOWTABLESTATS
 
 Verification of FlowTableMetrics-PacketMatch on HBase Client
     [Documentation]    Verify the FlowTableMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    FlowTableMetrics    PacketMatch_openflow:1_0_
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)PacketMatch_openflow
+    Verify the Metrics Attributes on Hbase Client    PacketMatch    Node:openflow:1,Table:0    FLOWTABLESTATS
+
 
 Verification of FlowTableMetrics-PacketLookup on HBase Client
     [Documentation]    Verify the FlowTableMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    FlowTableMetrics    PacketLookup_openflow:1_0_
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)PacketLookup_openfl
+    Verify the Metrics Attributes on Hbase Client    PacketLookup    Node:openflow:1,Table:0    FLOWTABLESTATS
+
index 5a14855ef4b338fc4218fa6e2cdc2cbeeb1c484c..fe229776856bd6944f5d7eb940442b6e374dbd15 100644 (file)
@@ -12,39 +12,34 @@ Variables         ../../../variables/Variables.py
 
 *** Variables ***
 @{QUEUE_METRICS}    TransmittedPackets    TransmittedBytes    TransmissionErrors
-${TSDR_QUEUESTATS}    tsdr:list QueueStats
+${TSDR_QUEUESTATS}    tsdr:list QUEUESTATS
 
 *** Test Cases ***
 Verify the Queue Metrics attributes exist thru Karaf console
     [Documentation]    Verify the QueueMetrics attributes exist on Karaf Console
     Wait Until Keyword Succeeds    180s    1s    Verify the Metric is Collected?    ${TSDR_QUEUESTATS}    Transmitted
-    ${output}=    Issue Command On Karaf Console    ${TSDR_QUEUESTATS}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
+    ${output}=    Issue Command On Karaf Console    ${TSDR_QUEUESTATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
     : FOR    ${list}    IN    @{QUEUE_METRICS}
     \    Should Contain    ${output}    ${list}
 
 Verification of QueueMetrics-TransmittedPackets on Karaf Console
     [Documentation]    Verify the QueueMetrics has been updated thru tsdr:list command on karaf console
     ${tsdr_cmd}=    Concatenate the String    ${TSDR_QUEUESTATS}    | grep TransmittedPackets | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
+    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
     Should Contain    ${output}    TransmittedPackets
 
 Verification of QueueMetrics-TransmittedPackets on HBase Client
     [Documentation]    Verify the QueueMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    QueueMetrics    TransmittedPackets_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)TransmittedPackets
+    Verify the Metrics Attributes on Hbase Client    TransmittedPackets    Node:openflow:2    QUEUESTATS
 
 Verification of QueueMetrics-TransmittedBytes on HBase Client
     [Documentation]    Verify the QueueMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    QueueMetrics    TransmittedBytes_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)TransmittedBytes
+    Verify the Metrics Attributes on Hbase Client    TransmittedBytes    Node:openflow:2    QUEUESTATS
 
 Verification of QueueMetrics-TransmissionErrors on HBase Client
     [Documentation]    Verify the QueueMetrics has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    QueueMetrics    TransmissionErrors_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)TransmissionErrors
+    Verify the Metrics Attributes on Hbase Client    TransmissionErrors    Node:openflow:2    QUEUESTATS
+
 
 *** Keyword ***
 Configuration of Queue on Switch
diff --git a/csit/suites/tsdr/HBase/050_GroupMetrics.robot b/csit/suites/tsdr/HBase/050_GroupMetrics.robot
deleted file mode 100644 (file)
index 4042129..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-*** Settings ***
-Documentation     Test suite for Hbase DataStore FlowGroup Stats Verification
-Suite Setup       Run Keywords    Start TSDR suite with CPqD Switch    Configuration of FlowGroup on Switch
-Suite Teardown    Stop Tsdr Suite
-Library           SSHLibrary
-Library           Collections
-Library           String
-Library           ../../../libraries/Common.py
-Resource          ../../../libraries/KarafKeywords.robot
-Resource          ../../../libraries/TsdrUtils.robot
-Variables         ../../../variables/Variables.py
-
-*** Variables ***
-@{FLOWGROUP_METRICS}    ByteCount    PacketCount    RefCount
-${TSDR_FLOWGROUPSTATS}    tsdr:list FlowGroupStats
-@{FLOWGROUP_HEADER}    MetricName    MetricValue    MetricCategory    MetricDetails
-
-*** Test Cases ***
-Verify the FlowGroup Stats attributes exist thru Karaf console
-    [Documentation]    Verify the FlowGroupStats attributes exist on Karaf Console
-    Wait Until Keyword Succeeds    180s    1s    Verify the Metric is Collected?    ${TSDR_FLOWGROUPSTATS}    ByteCount
-    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWGROUPSTATS}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
-    : FOR    ${list}    IN    @{FLOWGROUP_METRICS}
-    \    Should Contain    ${output}    ${list}
-
-Verification of FlowGroupStats-ByteCount on Karaf Console
-    [Documentation]    Verify the FlowGroupStats has been updated thru tsdr:list command on karaf console
-    ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWGROUPSTATS}    | grep ByteCount | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
-    Should Contain    ${output}    ByteCount
-    Should Contain    ${output}    FlowGroupStats
-    Should not Contain    ${output}    null
-    : FOR    ${list}    IN    @{FLOWGROUP_HEADER}
-    \    Should Contain    ${output}    ${list}
-
-Verification of FlowGroupStats-ByteCount on HBase Client
-    [Documentation]    Verify the FlowGroupStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    GroupMetrics    ByteCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)ByteCount
-
-Verification of FlowGroupStats-PacketCount on HBase Client
-    [Documentation]    Verify the FlowGroupStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    GroupMetrics    PacketCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)PacketCount
-
-Verification of FlowGroupStats-RefCount on HBase Client
-    [Documentation]    Verify the FlowGroupStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    GroupMetrics    RefCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)RefCount
-
-*** Keyword ***
-Start TSDR suite with CPqD Switch
-    Start Tsdr Suite    user
-
-Configuration of FlowGroup on Switch
-    [Documentation]    FlowGroup configuration on CPqD
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 group-mod cmd=add,group=1,type=all
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 flow-mod table=0,cmd=add eth_type=0x800,eth_src=00:01:02:03:04:05 apply:group=1
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 ping 10
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s2 ping 10
diff --git a/csit/suites/tsdr/HBase/060_FlowMeterMetrics.robot b/csit/suites/tsdr/HBase/060_FlowMeterMetrics.robot
deleted file mode 100644 (file)
index 4410b88..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-*** Settings ***
-Documentation     Test suite for Hbase DataStore FlowMeter Stats Verification
-Suite Setup       Run Keywords    Start TSDR suite with CPqD Switch    Configuration of FlowMeter on Switch
-Suite Teardown    Stop Tsdr Suite
-Library           SSHLibrary
-Library           Collections
-Library           String
-Library           ../../../libraries/Common.py
-Resource          ../../../libraries/KarafKeywords.robot
-Resource          ../../../libraries/TsdrUtils.robot
-Variables         ../../../variables/Variables.py
-
-*** Variables ***
-@{FLOWMETER_METRICS}    ByteInCount    PacketInCount    FlowCount
-${TSDR_FLOWMETERSTATS}    tsdr:list FlowMeterStats
-@{FLOWMETER_HEADER}    MetricName    MetricValue    MetricCategory    MetricDetails
-
-*** Test Cases ***
-Verify the FlowMeter Stats attributes exist thru Karaf console
-    [Documentation]    Verify the FlowMeterStats attributes exist on Karaf Console
-    Wait Until Keyword Succeeds    180s    1s    Verify the Metric is Collected?    ${TSDR_FLOWMETERSTATS}    ByteInCount
-    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWMETERSTATS}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
-    : FOR    ${list}    IN    @{FLOWMETER_METRICS}
-    \    Should Contain    ${output}    ${list}
-
-Verification of FlowMeterStats-ByteInCount on Karaf Console
-    [Documentation]    Verify the FlowMeterStats has been updated thru tsdr:list command on karaf console
-    ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWMETERSTATS}    | grep ByteInCount | head
-    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
-    Should Contain    ${output}    ByteInCount
-    Should Contain    ${output}    FlowMeterStats
-    Should not Contain    ${output}    null
-    : FOR    ${list}    IN    @{FLOWMETER_HEADER}
-    \    Should Contain    ${output}    ${list}
-
-Verification of FlowMeterStats-ByteInCount on HBase Client
-    [Documentation]    Verify the FlowMeterStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    MeterMetrics    ByteInCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)ByteInCount
-
-Verification of FlowMeterStats-PacketInCount on HBase Client
-    [Documentation]    Verify the FlowMeterStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    MeterMetrics    PacketInCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)PacketInCount
-
-Verification of FlowMeterStats-FlowCount on HBase Client
-    [Documentation]    Verify the FlowMeterStats has been updated on HBase Datastore
-    ${query}=    Generate HBase Query    MeterMetrics    FlowCount_openflow:1
-    ${out}=    Query the Data from HBaseClient    ${query}
-    Should Match Regexp    ${out}    (?mui)FlowCount
-
-Uninstall all TSDR HBase Feature
-    [Documentation]    UnInstall all TSDR HBase Features
-    Uninstall a Feature    odl-tsdr-hbase-persistence odl-hbaseclient odl-tsdr-core odl-tsdr-hbase
-    Verify Feature Is Not Installed    odl-tsdr-hbase-persistence
-    Verify Feature Is Not Installed    odl-hbaseclient
-    Verify Feature Is Not Installed    odl-tsdr-core
-    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
-
-*** Keyword ***
-Start TSDR suite with CPqD Switch
-    Start Tsdr Suite    user
-
-Configuration of FlowMeter on Switch
-    [Documentation]    FlowMeter configuration on CPqD
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 meter-mod cmd=add,flags=1,meter=1 drop:rate=100
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 flow-mod table=0,cmd=add in_port=1 meter:1 apply:output=2
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 ping 10
-    Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s2 ping 10
index 72a95349ed59ae833f726066f47d42660f90b72f..f7ef75dea4a70582891163179f305492cd07efce 100755 (executable)
@@ -8,7 +8,7 @@ export JAVA_HOME=/usr
 /tmp/Hbase/hbase-0.94.15/bin/start-hbase.sh
 
 EOF
-echo "Copy the Hbase startup script to ${CONTROLLER0}"
-scp ${WORKSPACE}/hbasestartup.sh ${CONTROLLER0}:/tmp
-ssh ${CONTROLLER0} 'bash /tmp/hbasestartup.sh'
+echo "Copy the Hbase startup script to ${ODL_SYSTEM_IP}"
+scp ${WORKSPACE}/hbasestartup.sh ${ODL_SYSTEM_IP}:/tmp
+ssh ${ODL_SYSTEM_IP} 'bash /tmp/hbasestartup.sh'
 # vim: ts=4 sw=4 sts=4 et ft=sh :
diff --git a/csit/suites/tsdr/HSQLDB/010_InterfaceMetrics.robot b/csit/suites/tsdr/HSQLDB/010_InterfaceMetrics.robot
new file mode 100644 (file)
index 0000000..63e5d8a
--- /dev/null
@@ -0,0 +1,43 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore InterfaceMetrics Verification
+Suite Setup       Start Tsdr Suite
+Suite Teardown    Stop Tsdr Suite
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+@{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError
+...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
+@{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
+${TSDR_PORTSTATS}    tsdr:list PORTSTATS
+
+*** Test Cases ***
+Verification of TSDR HSQLDB Feature Installation
+    [Documentation]    Install and Verify the TSDR HSQLDB Datastore and JDBC
+    COMMENT    Install a Feature    odl-tsdr-hsqldb    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
+    COMMENT    Install a Feature    odl-tsdr-openflow-statistics-collector    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
+    Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    log:display | grep "Connecting to HSQLDB"    HSQLDB
+    Verify Feature Is Installed    odl-tsdr-hsqldb
+    Verify Feature Is Installed    odl-tsdr-core
+    Verify Feature Is Installed    odl-tsdr-openflow-statistics-collector
+
+Verification TSDR Command exists in Help
+    [Documentation]    Verify the TSDR List command on Help
+    ${output}=    Issue Command On Karaf Console    tsdr\t
+    Should Contain    ${output}    tsdr:list
+    ${output}=    Issue Command On Karaf Console    tsdr:list\t\t
+    : FOR    ${list}    IN    @{CATEGORY}
+    \    Should Contain    ${output}    ${list}
+    Wait Until Keyword Succeeds    60s    1s    Verify the Metric is Collected?    ${TSDR_PORTSTATS}    openflow
+
+Verify PortStats On Karaf console
+    [Documentation]    Verify the InterfaceMetrics(PortStats),attributes using ${TSDR_PORTSTATS}
+    : FOR    ${list}    IN    @{INTERFACE_METRICS}
+    \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
+    \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
+    \    Should Contain    ${output}    ${list}
diff --git a/csit/suites/tsdr/HSQLDB/020_FlowMetrics.robot b/csit/suites/tsdr/HSQLDB/020_FlowMetrics.robot
new file mode 100644 (file)
index 0000000..643a630
--- /dev/null
@@ -0,0 +1,23 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore Flow Metrics Verification
+Suite Setup       Start Tsdr Suite
+Suite Teardown    Stop Tsdr Suite
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+@{FLOW_METRICS}    PacketCount    ByteCount
+${TSDR_FLOWSTATS}    tsdr:list FLOWSTATS
+
+*** Test Cases ***
+Verification of TSDR FlowMetrics
+    [Documentation]    Verify the TSDR FLOWSTATS
+    Wait Until Keyword Succeeds    60s    1s    Verify the Metric is Collected?    ${TSDR_FLOWSTATS}    PacketCount
+    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWSTATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
+    : FOR    ${list}    IN    @{FLOW_METRICS}
+    \    Should Contain    ${output}    ${list}
diff --git a/csit/suites/tsdr/HSQLDB/030_FlowTableMetrics.robot b/csit/suites/tsdr/HSQLDB/030_FlowTableMetrics.robot
new file mode 100644 (file)
index 0000000..bcd9b24
--- /dev/null
@@ -0,0 +1,23 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore Flow Table Metrics Verification
+Suite Setup       Start Tsdr Suite
+Suite Teardown    Stop Tsdr Suite
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+@{FLOWTABLE_METRICS}    ActiveFlows    PacketLookup    PacketMatch
+${TSDR_FLOWTABLE_STATS}    tsdr:list FLOWTABLESTATS
+
+*** Test Cases ***
+Verification of TSDR FLOWTABLESTATS
+    [Documentation]    Verify the TSDR FlowiTableStats
+    Wait Until Keyword Succeeds    60s    1s    Verify the Metric is Collected?    ${TSDR_FLOWTABLE_STATS}| grep ActiveFlow | grep openflow:1    FLOWTABLESTATS
+    ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWTABLE_STATS}| grep openflow:1 | head    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    180
+    : FOR    ${list}    IN    @{FLOWTABLE_METRICS}
+    \    Should Contain    ${output}    ${list}
diff --git a/csit/suites/tsdr/HSQLDB/040_QueueMetrics.robot b/csit/suites/tsdr/HSQLDB/040_QueueMetrics.robot
new file mode 100644 (file)
index 0000000..2a6ea70
--- /dev/null
@@ -0,0 +1,28 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore Queue Metrics Verification
+Suite Setup       Run Keywords    Start Tsdr Suite    Configuration of Queue on Switch
+Suite Teardown    Stop Tsdr Suite
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+@{QUEUE_METRICS}    TransmittedPackets    TransmittedBytes    TransmissionErrors
+${TSDR_QUEUE_STATS}    tsdr:list QUEUESTATS
+
+*** Test Cases ***
+Verify the QueueStats attributes exist thru Karaf console
+    [Documentation]    Verify the QueueMetrics attributes exist on Karaf Console
+    Wait Until Keyword Succeeds    60s    1s    Verify the Metric is Collected?    ${TSDR_QUEUE_STATS}    Transmitted
+    ${output}=    Issue Command On Karaf Console    ${TSDR_QUEUE_STATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
+    : FOR    ${list}    IN    @{QUEUE_METRICS}
+    \    Should Contain    ${output}    ${list}
+
+*** Keyword ***
+Configuration of Queue on Switch
+    [Documentation]    Queue configuration on openvswitch
+    Configure the Queue on Switch    s2-eth2
diff --git a/csit/testplans/tsdr-hsqldb-datastore.txt b/csit/testplans/tsdr-hsqldb-datastore.txt
new file mode 100644 (file)
index 0000000..272c636
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order:
+integration/test/csit/suites/tsdr/HSQLDB