Fixed TSDR Query for polling openflow interval.
Change-Id: Ia07bc62b3b593384c1f9cdafcd8b049c84f26611
Signed-off-by: premnath <prem.annauniv@gmail.com>
[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
Write pingall
Read Until mininet>
-Iperf All Hosts
+Ping Pair Hosts
[Arguments] ${host1} ${host2}
- [Documentation] Iperf between ${host1} and ${host2}
+ [Documentation] Ping between ${host1} and ${host2}
Switch Connection ${mininet_conn_id1}
- Write iperf ${host1} ${host2}
+ Write pingpair ${host1} ${host2}
Read Until mininet>
-Iperf All Hosts Hbase
+
+Ping Pair Hosts Hbase
[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}
-Iperf All Hosts Cassandra
+Ping Pair Hosts Cassandra
[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}
-Iperf All Hosts HSQLDB
+Ping Pair Hosts HSQLDB
[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
${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.
${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}
[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}
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
+
Collect Data from SNMP Agent
[Arguments] ${SNMP_IP}=127.0.0.1 ${SNMP_AGENT_COMM}=${SNMP_COMMUNITY}
[Documentation] Poll for SNMP Agent OID
\ ${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_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}
+
*** 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
... ${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}
: 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 ***
-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
--- /dev/null
+*** 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}
+
+
+
+
... 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
+&{HEADERS_QUERY} Content-Type=application/json Content-Type=application/json
*** Test Cases ***
Verification of TSDR HBase Feature Installation
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
- 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}
[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
--- /dev/null
+*** 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
+
+
+
+
--- /dev/null
+*** 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+
+
+
+
+