Added Netflow Scripts for TSDR. 20/34320/9
authorpremnath <prem.annauniv@gmail.com>
Tue, 9 Feb 2016 13:25:48 +0000 (18:55 +0530)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 11 Feb 2016 04:24:49 +0000 (04:24 +0000)
Fixed TSDR Query for polling openflow interval.

Change-Id: Ia07bc62b3b593384c1f9cdafcd8b049c84f26611
Signed-off-by: premnath <prem.annauniv@gmail.com>
csit/libraries/TsdrUtils.robot
csit/suites/tsdr/Cassandra/010_InterfaceMetrics.robot
csit/suites/tsdr/Cassandra/070_Netflow.robot [new file with mode: 0644]
csit/suites/tsdr/HBase/010_InterfaceMetrics.robot
csit/suites/tsdr/HBase/070_Netflow.robot [new file with mode: 0644]
csit/suites/tsdr/HSQLDB/070_Netflow.robot [new file with mode: 0644]

index 07c2ca5ddf6c21350ca120f70118872f127216a6..312441d29d30a933b825e77058f3b04115791dd0 100644 (file)
@@ -35,7 +35,7 @@ Start Tsdr Suite
     [Documentation]    TSDR specific setup/cleanup work that can be done safely before any system.
     ...    is run.
     Clean Mininet System
     [Documentation]    TSDR specific setup/cleanup work that can be done safely before any system.
     ...    is run.
     Clean Mininet System
-    ${mininet_conn_id1}=    Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=30s
+    ${mininet_conn_id1}=    Open Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=120s
     Set Suite Variable    ${mininet_conn_id1}
     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
     Set Suite Variable    ${mininet_conn_id1}
     Login With Public Key    ${TOOLS_SYSTEM_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
     Execute Command    sudo ovs-vsctl set-manager ptcp:6644
@@ -56,32 +56,33 @@ Ping All Hosts
     Write    pingall
     Read Until    mininet>
 
     Write    pingall
     Read Until    mininet>
 
-Iperf All Hosts
+Ping Pair Hosts
     [Arguments]    ${host1}    ${host2}
     [Arguments]    ${host1}    ${host2}
-    [Documentation]    Iperf between ${host1} and ${host2}
+    [Documentation]    Ping between ${host1} and ${host2}
     Switch Connection    ${mininet_conn_id1}
     Switch Connection    ${mininet_conn_id1}
-    Write    iperf ${host1} ${host2}
+    Write    pingpair ${host1} ${host2}
     Read Until    mininet>
 
     Read Until    mininet>
 
-Iperf All Hosts Hbase
+
+Ping Pair Hosts Hbase
     [Arguments]    ${pattern}
     [Arguments]    ${pattern}
-    [Documentation]    Iperf between h1 and h2 and check Hbase
-    Iperf All Hosts    h1    h2
+    [Documentation]    Ping between h1 and h2 and check Hbase
+    Ping Pair Hosts    h1    h2
     ${query_output}=    Query the Data from HBaseClient    count 'NETFLOW'
     Should Match Regexp    ${query_output}    ${pattern}
 
     ${query_output}=    Query the Data from HBaseClient    count 'NETFLOW'
     Should Match Regexp    ${query_output}    ${pattern}
 
-Iperf All Hosts Cassandra
+Ping Pair Hosts Cassandra
     [Arguments]    ${pattern}
     [Arguments]    ${pattern}
-    [Documentation]    Iperf between h1 and h2 and check Cassandra
-    Iperf All Hosts    h1    h2
+    [Documentation]    Ping between h1 and h2 and check Cassandra
+    Ping Pair Hosts    h1    h2
     ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metriclog;
     Should Match Regexp    ${query_output}    ${pattern}
 
     ${query_output}=    Count Cassandra rows    select count(*) from tsdr.metriclog;
     Should Match Regexp    ${query_output}    ${pattern}
 
-Iperf All Hosts HSQLDB
+Ping Pair Hosts HSQLDB
     [Arguments]    ${pattern}
     [Documentation]    Iperf between h1 and h2 and check Cassandra
     [Arguments]    ${pattern}
     [Documentation]    Iperf between h1 and h2 and check Cassandra
-    Iperf All Hosts    h1    h2
-    ${query_output}=    Issue Command On Karaf Console    tsdr:list NETFLOW | wc -l
+    Ping Pair Hosts    h1    h2
+    ${query_output}=   Issue Command On Karaf Console    tsdr:list NETFLOW | wc -l
     Should Match Regexp    ${query_output}    ${pattern}
 
 Stop Tsdr Suite
     Should Match Regexp    ${query_output}    ${pattern}
 
 Stop Tsdr Suite
@@ -263,6 +264,7 @@ Verify the Metrics Attributes on Cassandra Client
     ${metric_count}=    Get From List    ${split_line}    3
     [Return]    ${metric_count}
 
     ${metric_count}=    Get From List    ${split_line}    3
     [Return]    ${metric_count}
 
+
 Form Portstats Query Pattern
     [Arguments]    ${metric}    ${node}    ${port}    ${attribute}
     [Documentation]    Used for geneating openflow metrics Queries for Cassandra.
 Form Portstats Query Pattern
     [Arguments]    ${metric}    ${node}    ${port}    ${attribute}
     [Documentation]    Used for geneating openflow metrics Queries for Cassandra.
@@ -283,6 +285,7 @@ Create Temporary Key Info
     ${output}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    cat ${CASSANDRA_DB_PATH}${val_table}|grep "${pattern}"
     [Return]    ${output}
 
     ${output}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    cat ${CASSANDRA_DB_PATH}${val_table}|grep "${pattern}"
     [Return]    ${output}
 
+
 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}
 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}
@@ -300,6 +303,7 @@ Verify Metric log File
     [Return]    ${contents}
 
 Grep From File
     [Return]    ${contents}
 
 Grep From File
+
     [Arguments]    ${file}    ${pattern}
     [Documentation]    Use cat to grep from the file and return the output
     ${output}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    cat ${file} | ${pattern}
     [Arguments]    ${file}    ${pattern}
     [Documentation]    Use cat to grep from the file and return the output
     ${output}=    Run Command On Remote System    ${ODL_SYSTEM_IP}    cat ${file} | ${pattern}
@@ -609,11 +613,12 @@ Write SNMP config
 Bringup Netflow
     [Documentation]    Brings up basic netflow setup .
     Verify Feature Is Installed    odl-tsdr-netflow-statistics-collector
 Bringup Netflow
     [Documentation]    Brings up basic netflow setup .
     Verify Feature Is Installed    odl-tsdr-netflow-statistics-collector
-    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages    NetFlow Data Colletor Initialized
+    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages     NetFlow Data Colletor Initialized
     Start Tsdr Suite
     Ping All Hosts
     Configure Netflow
 
     Start Tsdr Suite
     Ping All Hosts
     Configure Netflow
 
+
 Collect Data from SNMP Agent
     [Arguments]    ${SNMP_IP}=127.0.0.1    ${SNMP_AGENT_COMM}=${SNMP_COMMUNITY}
     [Documentation]    Poll for SNMP Agent OID
 Collect Data from SNMP Agent
     [Arguments]    ${SNMP_IP}=127.0.0.1    ${SNMP_AGENT_COMM}=${SNMP_COMMUNITY}
     [Documentation]    Poll for SNMP Agent OID
@@ -653,7 +658,7 @@ Collect Data from SNMP Agent
     \    ${ifOperStatus}=    Get From Dictionary    ${OPER_STATUS}    ${ifOperStatus1}
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutDiscards | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutDiscards
     \    Append To List    ${SNMP_VALUES}    ${ifOutDiscards}
     \    ${ifOperStatus}=    Get From Dictionary    ${OPER_STATUS}    ${ifOperStatus1}
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutDiscards | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutDiscards
     \    Append To List    ${SNMP_VALUES}    ${ifOutDiscards}
-    \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInDiscards | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInDiscards
+    \    Append To List    ${SNMP_ENTRY}     grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInDiscards | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInDiscards
     \    Append To List    ${SNMP_VALUES}    ${ifInDiscards}
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInOctets | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInOctets
     \    Append To List    ${SNMP_VALUES}    ${ifInOctets}
     \    Append To List    ${SNMP_VALUES}    ${ifInDiscards}
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInOctets | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInOctets
     \    Append To List    ${SNMP_VALUES}    ${ifInOctets}
@@ -680,3 +685,4 @@ Collect Data from SNMP Agent
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOperStatus | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOperStatus
     \    Append To List    ${SNMP_VALUES}    ${ifOperStatus}
     [Return]    ${SNMP_ENTRY}    ${SNMP_VALUES}
     \    Append To List    ${SNMP_ENTRY}    grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOperStatus | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOperStatus
     \    Append To List    ${SNMP_VALUES}    ${ifOperStatus}
     [Return]    ${SNMP_ENTRY}    ${SNMP_VALUES}
+
index e384bff58b7f0d866691d63ed9b68dc0eef544d5..cd221cfcd409d263d24f47ecf0aad4729ff77edc 100644 (file)
@@ -1,7 +1,6 @@
 *** Settings ***
 Documentation     Test suite for Cassandra DataStore PortStats Verification
 Suite Teardown    Stop Tsdr Suite
 *** Settings ***
 Documentation     Test suite for Cassandra DataStore PortStats Verification
 Suite Teardown    Stop Tsdr Suite
-Metadata          https://bugs.opendaylight.org/show_bug.cgi?id=5068    ${EMPTY}
 Library           SSHLibrary
 Library           Collections
 Library           String
 Library           SSHLibrary
 Library           Collections
 Library           String
@@ -19,8 +18,6 @@ ${root_path}      flow-capable-node-connector-statistics
 ...               ${root_path}/receive-frame-error    ${root_path}/receive-errors    ${root_path}/receive-drops    ${root_path}/receive-crc-error    ${root_path}/collision-count
 @{CATEGORY}       FlowStats    FlowTableStats    PortStats    QueueStats
 ${TSDR_PORTSTATS}    tsdr:list PortStats
 ...               ${root_path}/receive-frame-error    ${root_path}/receive-errors    ${root_path}/receive-drops    ${root_path}/receive-crc-error    ${root_path}/collision-count
 @{CATEGORY}       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
 ${metric_path}    metric_path
 ${metric_val}     metric_val
 @{xml_list}
 ${metric_path}    metric_path
 ${metric_val}     metric_val
 @{xml_list}
@@ -103,35 +100,7 @@ Comparing Mertics
     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${xml_list}    ${tsdr_list}
     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
 
     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${xml_list}    ${tsdr_list}
     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
 
-Verify Configuration Interval-change
-    [Documentation]    Verify the TSDR Collection configuration changes
-    ${session}=    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
-    Verify TSDR Configuration Interval    180
-    Post TSDR Configuration Interval    200
-    Verify TSDR Configuration Interval    200
-    Post TSDR Configuration Interval    180
-    Verify TSDR Configuration Interval    180
-    Delete All Sessions
-    [Teardown]    Report_Failure_Due_To_Bug    5068
-
 *** Keywords ***
 *** Keywords ***
-Verify TSDR Configuration Interval
-    [Arguments]    ${interval}
-    [Documentation]    Verify Configuration interval of TSDR Collection
-    ${resp}    RequestsLibrary.Get    session    ${CONFIG_INTERVAL}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    Should Contain    ${resp.content}    ${interval}
-
-Post TSDR Configuration Interval
-    [Arguments]    ${interval}
-    [Documentation]    Configuration TSDR collection interval ${interval}
-    ${p1}    Create Dictionary    interval    ${interval}
-    ${p2}    Create Dictionary    input    ${p1}
-    ${post_data}    Create Dictionary    setPollingInterval    ${p2}
-    Log    ${post_data}
-    ${resp}    RequestsLibrary.Post    session    ${OPER_INTERVAL}    ${post_data}
-    Should Be Equal As Strings    ${resp.status_code}    201
-
 Extract From DB Table
     [Arguments]    ${pattern}
     [Documentation]    Extract from metricpath table and return the value
 Extract From DB Table
     [Arguments]    ${pattern}
     [Documentation]    Extract from metricpath table and return the value
diff --git a/csit/suites/tsdr/Cassandra/070_Netflow.robot b/csit/suites/tsdr/Cassandra/070_Netflow.robot
new file mode 100644 (file)
index 0000000..2eff1d2
--- /dev/null
@@ -0,0 +1,87 @@
+*** Settings ***
+Documentation     Test suite for Cassandra DataStore Netflow Stats Verification
+Suite Setup       Initialize Netflow
+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 ***
+${IP_1}    10.0.0.1
+${IP_2}    10.0.0.2
+${NODE_ID}    127.0.0.1
+${engine_type}    11
+${engine_id}    11
+${nexthop}    0
+${port}    0
+${prot}    1
+${int1}    1
+${int2}    2
+${version}    5
+*** Test Cases ***
+
+
+
+Verifying TSDR Data Store For Netflow Entries
+    [Documentation]    Verify the Cassandra Data store to check if Netflow data is stored.
+    Copy TSDR tables     val_table=metriclog
+    ${metric_log}=    Verify the Metrics Syslog on Cassandra Client    grep DC=NETFLOW
+    Should Contain    ${metric_log}    srcAddr=${IP_2}
+    ${netflow}=    Create Temporary Key Info    srcAddr=${IP_2}    val_table=metriclog
+    Should Contain    ${netflow}    srcAddr=${IP_2}
+    Should Contain    ${netflow}    dstAddr=${IP_1}
+    Should Contain    ${netflow}    srcPort=${port}
+    Should Contain    ${netflow}    protocol=${prot}
+    Should Contain    ${netflow}    nextHop=${nexthop}
+    Should Contain    ${netflow}    engine_type
+    Should Contain    ${netflow}    engine_id
+    Should Contain    ${netflow}    input=${int2}
+    Should Contain    ${netflow}    output=${int1}
+    Should Contain    ${netflow}    sysUpTime
+    Should Contain    ${netflow}    flow_sequence
+    Should Contain    ${netflow}    unix_nsecs
+    Should Contain    ${netflow}    dPkts
+    Should Contain    ${netflow}    tcpFlags
+    Should Contain    ${netflow}    samplingInterval=0
+    Should Contain    ${netflow}    dstAS=0
+    Should Contain    ${netflow}    srcAS=0
+    Should Contain    ${netflow}    dstMask=0
+    Should Contain    ${netflow}    srcMask=0
+
+    ${netflow}=    Create Temporary Key Info    srcAddr=${IP_1}    val_table=metriclog
+    Should Contain    ${netflow}    srcAddr=${IP_1}
+    Should Contain    ${netflow}    dstAddr=${IP_2}
+    Should Contain    ${netflow}    dstPort=${port}
+    Should Contain    ${netflow}    protocol=${prot}
+    Should Contain    ${netflow}    nextHop=${nexthop}
+    Should Contain    ${netflow}    engine_type
+    Should Contain    ${netflow}    engine_id
+    Should Contain    ${netflow}    input=${int1}
+    Should Contain    ${netflow}    output=${int2}
+    Should Contain    ${netflow}    sysUpTime
+    Should Contain    ${netflow}    flow_sequence
+    Should Contain    ${netflow}    unix_nsecs
+    Should Contain    ${netflow}    dPkts
+    Should Contain    ${netflow}    tcpFlags
+    Should Contain    ${netflow}    samplingInterval=0
+    Should Contain    ${netflow}    dstAS=0
+    Should Contain    ${netflow}    srcAS=0
+    Should Contain    ${netflow}    dstMask=0
+    Should Contain    ${netflow}    srcMask=0
+
+
+*** Keywords ***
+Initialize Netflow
+    [Documentation]    Initialize Netflow setup and start collecting the netflow samples.
+    Verify Feature Is Installed    odl-tsdr-cassandra
+    Bringup Netflow
+    Initialize Cassandra Tables Metricval    val_table=metriclog
+    Wait Until Keyword Succeeds    36x    5 sec    Ping Pair Hosts Cassandra    \\d{2}
+
+
+
+
index 5c5ab07cb8e6c4ba3240e248bac59252d1e59690..d0c52741a694d8e4225394c5212da898aea0f333 100755 (executable)
@@ -17,8 +17,9 @@ Variables         ../../../variables/Variables.py
 ...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
 @{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
 ${TSDR_PORTSTATS}    tsdr:list PORTSTATS
 ...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
 @{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
 ${TSDR_PORTSTATS}    tsdr:list PORTSTATS
-${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDRDCConfig
+${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDROSCConfig
 ${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
 ${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
+&{HEADERS_QUERY}    Content-Type=application/json    Content-Type=application/json
 
 *** Test Cases ***
 Verification of TSDR HBase Feature Installation
 
 *** Test Cases ***
 Verification of TSDR HBase Feature Installation
@@ -50,18 +51,19 @@ Verification of InterfaceMetrics-Attributes on HBase Client
 
 Verify Configuration Interval-change
     [Documentation]    Verify the TSDR Collection configuration changes
 
 Verify Configuration Interval-change
     [Documentation]    Verify the TSDR Collection configuration changes
-    Verify TSDR Configuration Interval    180
-    Post TSDR Configuration Interval    200
-    Verify TSDR Configuration Interval    200
-    Post TSDR Configuration Interval    180
-    Verify TSDR Configuration Interval    180
+    Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    15000
+    Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    15000
+    Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    20000
+    Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    20000
+    Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    15000
+    Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    15000
     [Teardown]    Report_Failure_Due_To_Bug    5068
 
 *** Keywords ***
 Initialize the Tsdr Suite
     COMMENT    Initialize the HBase for TSDR
     Start Tsdr Suite
     [Teardown]    Report_Failure_Due_To_Bug    5068
 
 *** Keywords ***
 Initialize the Tsdr Suite
     COMMENT    Initialize the HBase for TSDR
     Start Tsdr Suite
-    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
 
 Verify TSDR Configuration Interval
     [Arguments]    ${interval}
 
 Verify TSDR Configuration Interval
     [Arguments]    ${interval}
@@ -75,7 +77,6 @@ Post TSDR Configuration Interval
     [Documentation]    Configuration TSDR collection interval ${interval}
     ${p1}    Create Dictionary    interval=${interval}
     ${p2}    Create Dictionary    input=${p1}
     [Documentation]    Configuration TSDR collection interval ${interval}
     ${p1}    Create Dictionary    interval=${interval}
     ${p2}    Create Dictionary    input=${p1}
-    ${post_data}    Create Dictionary    setPollingInterval=${p2}
-    Log    ${post_data}
-    ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    ${post_data}
-    Should Be Equal As Strings    ${resp.status_code}    201
+    ${p2_json}=    json.dumps    ${p2}
+    ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    data=${p2_json}
+    Should Be Equal As Strings    ${resp.status_code}    200
diff --git a/csit/suites/tsdr/HBase/070_Netflow.robot b/csit/suites/tsdr/HBase/070_Netflow.robot
new file mode 100644 (file)
index 0000000..39b57a9
--- /dev/null
@@ -0,0 +1,109 @@
+*** Settings ***
+Documentation     Test suite for Hbase DataStore Netflow Stats Verification
+Suite Setup       Initialize Netflow
+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 ***
+${IP_1}    10.0.0.1
+${IP_2}    10.0.0.2
+${NODE_ID}    127.0.0.1
+${engine_type}    11
+${engine_id}    11
+${nextHop}    0
+${port}    0
+${protocol}    1
+${int1}    1
+${int2}    2
+${version}    5
+*** Test Cases ***
+
+
+Verification of Full Record Text for Netflow Dumps
+    [Documentation]    Verify the Netflow Record Text Hbase client
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1' , LIMIT => 10, FILTER => "ValueFilter( =, 'regexstring:srcAddr=${IP_2}' )" }
+    Should Contain    ${out}    srcAddr=${IP_2}
+    Should Contain    ${out}    dstAddr=${IP_1}
+    Should Contain    ${out}    srcPort=${port}
+    Should Contain    ${out}    protocol=${protocol}
+    Should Contain    ${out}    nextHop=${nexthop}
+    Should Contain    ${out}    engine_type
+    Should Contain    ${out}    engine_id
+    Should Contain    ${out}    input=${int2}
+    Should Contain    ${out}    output=${int1}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1' , LIMIT => 10, FILTER => "ValueFilter( =, 'regexstring:srcAddr=${IP_1}' )" }
+    Should Contain    ${out}    srcAddr=${IP_1}
+    Should Contain    ${out}    dstAddr=${IP_2}
+    Should Contain    ${out}    dstPort=${port}
+    Should Contain    ${out}    protocol=${protocol}
+    Should Contain    ${out}    nextHop=${nexthop}
+    Should Contain    ${out}    engine_type
+    Should Contain    ${out}    engine_id
+    Should Contain    ${out}    input=${int1}
+    Should Contain    ${out}    output=${int2}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW'
+    Should Contain    ${out}    sysUpTime
+    Should Contain    ${out}    flow_sequence
+    Should Contain    ${out}    unix_nsecs
+    Should Contain    ${out}    dPkts
+    Should Contain    ${out}    tcpFlags
+    Should Contain    ${out}    dstAS=0
+    Should Contain    ${out}    srcAS=0
+    Should Contain    ${out}    dstMask=0
+    Should Contain    ${out}    srcMask=0
+
+
+
+Verification of Metric Record for Netflow Dumps
+    [Documentation]    Verify the Netflow Metric Record Hbase client
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:dstAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_1}' )" }
+    Should Contain    ${out}    value=${IP_1}
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:srcAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_1}' )" }
+    Should Contain    ${out}    value=${IP_1}
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:dstAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_2}' )" }
+    Should Contain    ${out}    value=${IP_2}
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:srcAddr' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${IP_2}' )" }
+    Should Contain    ${out}    value=${IP_2}
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:input' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int1}' )" }
+    Should Contain    ${out}    value=${int1}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:output' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int2}' )" }
+    Should Contain    ${out}    value=${int2}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:input' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int2}' )" }
+    Should Contain    ${out}    value=${int2}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:output' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${int1}' )" }
+    Should Contain    ${out}    value=${int1}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:flowDuration' , LIMIT => 10}
+    Should Contain    ${out}    flowDuration
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:nextHop' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${nextHop}' )" }
+    Should Contain    ${out}    value=${nextHop}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:version' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${version}' )" }
+    Should Contain    ${out}    value=${version}
+
+    ${out}=    Query the Data from HBaseClient    scan 'NETFLOW',{ COLUMNS => 'c1:protocol' , LIMIT => 10, FILTER => "ValueFilter( =, 'binaryprefix:${protocol}' )" }
+    Should Contain    ${out}    value=${protocol}
+
+
+*** Keywords ***
+Initialize Netflow
+    [Documentation]    Initialize Netflow setup and start collecting the netflow samples.
+    Query the Data from HBaseClient    truncate 'NETFLOW'
+    Bringup Netflow
+    Wait Until Keyword Succeeds    36x    5 sec    Ping Pair Hosts Hbase    \\d{2} row
+
+
+
+
diff --git a/csit/suites/tsdr/HSQLDB/070_Netflow.robot b/csit/suites/tsdr/HSQLDB/070_Netflow.robot
new file mode 100644 (file)
index 0000000..99b3dda
--- /dev/null
@@ -0,0 +1,71 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore NetFlow Stats Verification
+Suite Setup       Initialize Netflow
+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 ***
+${IP_1}    10.0.0.1
+${IP_2}    10.0.0.2
+${NODE_ID}    127.0.0.1
+${engine_type}    11
+${engine_id}    11
+${nexthop}    0
+${port}    0
+${prot}    1
+${int1}    1
+${int2}    2
+${version}    5
+*** Test Cases ***
+
+
+Verification of Full Record Text for Netflow Dumps
+    [Documentation]    Verify the Netflow Record Text Hbase client
+    ${out}=    Issue Command On Karaf Console     tsdr:list NETFLOW | grep srcAddr=${IP_2}
+    Should Contain    ${out}    srcPort=${port}
+    Should Contain    ${out}    srcAddr=${IP_2}
+    Should Contain    ${out}    dstAddr=${IP_1}
+    Should Contain    ${out}    srcPort=${port}
+    Should Contain    ${out}    protocol=${prot}
+    Should Contain    ${out}    nextHop=${nexthop}
+    Should Contain    ${out}    engine_type
+    Should Contain    ${out}    engine_id
+    Should Contain    ${out}    input=${int2}
+    Should Contain    ${out}    output=${int1}
+
+    ${out}=    Issue Command On Karaf Console     tsdr:list NETFLOW | grep srcAddr=${IP_1}
+    Should Contain    ${out}    srcAddr=${IP_1}
+    Should Contain    ${out}    dstAddr=${IP_2}
+    Should Contain    ${out}    dstPort=${port}
+    Should Contain    ${out}    protocol=${prot}
+    Should Contain    ${out}    nextHop=${nexthop}
+    Should Contain    ${out}    engine_type
+    Should Contain    ${out}    engine_id
+    Should Contain    ${out}    input=${int1}
+    Should Contain    ${out}    output=${int2}
+    Should Contain    ${out}    sysUpTime
+    Should Contain    ${out}    flow_sequence
+    Should Contain    ${out}    unix_nsecs
+    Should Contain    ${out}    dPkts
+    Should Contain    ${out}    dOctets
+    Should Contain    ${out}    tcpFlags
+    Should Contain    ${out}    dstAS=0
+    Should Contain    ${out}    srcAS=0
+    Should Contain    ${out}    dstMask=0
+    Should Contain    ${out}    srcMask=0
+
+*** Keywords ***
+Initialize Netflow
+    [Documentation]    Initialize Mininet topology and check if netflow data is getting collected
+    Bringup Netflow
+    Wait Until Keyword Succeeds    36x    5 sec    Ping Pair Hosts HSQLDB    2\\d+
+
+
+
+