Resource Utils.robot
Variables ../variables/Variables.py
Library json
-Library HttpLibrary.HTTP
+Library Process
*** Variables ***
-${HBASE_CLIENT} /tmp/Hbase/hbase-0.94.15/bin
-${CASSANDRA_CLIENT} /tmp/cassandra/apache-cassandra-2.1.12/bin
+${HBASE_CLIENT} /tmp/Hbase/hbase-0.94.27/bin
+${CASSANDRA_CLIENT} /tmp/cassandra/apache-cassandra-2.1.16/bin
${final} ${EMPTY}
${prompt_timeout} ${EMPTY}
-${CASSANDRA_DB_PATH} /tmp/cassandra/apache-cassandra-2.1.12/
+${CASSANDRA_DB_PATH} /tmp/cassandra/apache-cassandra-2.1.16/
${metric_path} metricpath
${metric_val} metricval
${metric_log} metriclog
${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
+&{syslog_facility} kern=0
+${MESSAGE} Oct 29 18:10:31: ODL: %STKUNIT0-M:CP %IFMGR-5-ASTATE_UP: Changed interface Admin state to up: Te 0/0
+${MESSAGE_PATTERN} Changed interface
*** Keywords ***
Start Tsdr Suite
[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
- [Arguments] ${pattern}
- [Documentation] Iperf between h1 and h2 and check Hbase
+Ping Pair Hosts
+ [Arguments] ${host1} ${host2}
+ [Documentation] Ping between ${host1} and ${host2}
Switch Connection ${mininet_conn_id1}
- Write iperf h1 h2
+ Write pingpair ${host1} ${host2}
Read Until mininet>
+
+Ping Pair Hosts Hbase
+ [Arguments] ${pattern}
+ [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
- Switch Connection ${mininet_conn_id1}
- Write iperf h1 h2
- Read Until mininet>
+ [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}
+Ping Pair Hosts HSQLDB
+ [Arguments] ${pattern}
+ [Documentation] Iperf between h1 and h2 and check Cassandra
+ 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
[Documentation] Cleanup/Shutdown work that should be done at the completion of all
... tests
[Arguments] ${tsdr_line} ${metrics}
[Documentation] Create the Hbase table row from tsdr:list
@{words}= Split String ${tsdr_line} |
- : FOR ${li} IN @{words}
- \ ${key}= Fetch From Left ${li} =
- \ ${value}= Fetch From Right ${li} =
- \ ${each_value}= Prepare HBase Filter ${key} ${value} _
- \ ${final}= Concatenate the String ${final} ${each_value}
+ FOR ${li} IN @{words}
+ ${key}= Fetch From Left ${li} =
+ ${value}= Fetch From Right ${li} =
+ ${each_value}= Prepare HBase Filter ${key} ${value} _
+ ${final}= Concatenate the String ${final} ${each_value}
+ END
${query}= Concatenate the String ${metrics} ${final}
${query}= Remove Space on String ${query}
[Return] ${query}
[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}
+ Run Command On Remote System ${ODL_SYSTEM_IP} sudo rm -rf ${CASSANDRA_DB_PATH}${key_table}
+ Run Command On Remote System ${ODL_SYSTEM_IP} sudo 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
[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}
+ Run Command On Remote System ${ODL_SYSTEM_IP} sudo rm -rf ${CASSANDRA_DB_PATH}${key_table}
+ Run Command On Remote System ${ODL_SYSTEM_IP} sudo 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
${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}*\')) AND (RowFilter(=,
- ${hbase_query}= Concatenate the String ${hbase_query} 'regexstring:MN=${metric}*\'))\",LIMIT=>10}
+ ${hbase_query}= Concatenate the String ${hbase_query} 'regexstring:${metric}*\'))\",LIMIT=>10}
[Return] ${hbase_query}
Get Metrics Value
${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}
+ ${metricval}= Create Temporary Key Info ${keya} ${keyb}
+ @{lines}= Split to lines ${metricval}
+ ${mv_len}= Get Length ${lines}
+ ${mv_len}= Evaluate ${mv_len} - 1
+ ${found_line}= Get From List ${lines} ${mv_len}
+ @{split_line}= Split String ${found_line} ${SPACE}
+ ${metric_count}= Get From List ${split_line} 3
+ [Return] ${metric_count}
Form Portstats Query Pattern
[Arguments] ${metric} ${node} ${port} ${attribute}
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}
+ [Documentation] Return rows matching keya and keyb
+ ${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
[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}
+ [Arguments] ${metric_log} ${pattern}
+ [Documentation] Returns Value for lines in Metriclog matching the pattern
+ ${contents}= Grep From File ${CASSANDRA_DB_PATH}${temp_metric_val} ${pattern}
[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}
+ [Return] ${output}
+
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}
+ ${metric_grep}= Grep From 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
${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
+ Write sudo ${CASSANDRA_CLIENT}/cqlsh
Read Until cqlsh>
Write COPY tsdr.${key_table} TO '${CASSANDRA_DB_PATH}${key_table}' WITH DELIMITER = ' ';
Read Until cqlsh>
Read File and Return Split Lines
[Arguments] ${filename}
[Documentation] Reads the file and returns each line as list
- ${contents}= OperatingSystem.Get File ${filename}
+ ${contents}= Run Command On Remote System ${ODL_SYSTEM_IP} cat ${filename}
@{lines}= Split to lines ${contents}
[Return] @{lines}
[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}
+ ${resp_xml}= Parse XML ${resp.text}
${id1}= Get Element Text ${resp_xml} ${xpath}
Delete All Sessions
[Return] ${id1}
[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}
+ ${resp_xml}= Parse XML ${resp.text}
@{id1}= Get Elements Texts ${resp_xml} ${xpath}
Delete All Sessions
[Return] @{id1}
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}
+ [Arguments] ${facility}
+ [Documentation] Uses netcat to generate logs and send it to port ${ODL_SYSTEM_IP}:1514
+ Run echo "<${facility}>${MESSAGE}" | nc -w 4 -u ${ODL_SYSTEM_IP} 1514
Verify Metric Val File For Syslog
[Documentation] Returns Value for metric matching particular keya,keyb
${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}
+ ${metric_log}= Create Temporary Key Info ${keya} ${keyb} val_table=metriclog
+ [Return] ${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}
+ 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}
+ END
Iterating over metricval
[Arguments] ${keya} ${keyb}
${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}
+ @{convert}= Parse Json ${resp.text}
Delete All Sessions
[Return] @{convert}
[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}
+ @{convert}= Parse Json ${resp.text}
${dict_convert}= Convert To Dictionary @{convert}
@{dict}= Get Dictionary Values ${dict_convert}
- @{datapoints_list}= Convert to List @{dict}[0]
+ ${datapoints_list}= Convert to List ${dict}[0]
Delete All Sessions
[Return] @{datapoints_list}
... 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}*
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}
+ 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}
+ ${query_row}= Extract Row Values from TSDR Query ${q_item} ${t_item} ${n_item} ${TYPE}
+ END
+ 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}
+ END
[Return] @{ifdesc_list}
Write SNMP config
Append To File snmp.cfg \n
Move File snmp.cfg ${SNMP_PATH}
+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
+ 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
${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}
+ ${convert}= To Json ${resp.text}
@{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}
+ 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} 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_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=IfOutQLen | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutQLen
+ Append To List ${SNMP_VALUES} ${ifOutQLen}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutErrors | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutErrors
+ Append To List ${SNMP_VALUES} ${ifOutErrors}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInUcastPkts | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInUcastPkts
+ Append To List ${SNMP_VALUES} ${ifInUcastPkts}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutNUcastPkts | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutNUcastPkts
+ Append To List ${SNMP_VALUES} ${ifOutNUcastPkts}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInErrors | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInErrors
+ Append To List ${SNMP_VALUES} ${ifInErrors}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutOctets | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutOctets
+ Append To List ${SNMP_VALUES} ${ifOutOctets}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfAdminStatus | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfAdminStatus
+ Append To List ${SNMP_VALUES} ${ifAdminStatus}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInUnknownProtos | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInUnknownProtos
+ Append To List ${SNMP_VALUES} ${ifInUnknownProtos}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfOutUcastPkts | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfOutUcastPkts
+ Append To List ${SNMP_VALUES} ${ifOutUcastPkts}
+ Append To List ${SNMP_ENTRY} grep NID=${SNMP_IP} | grep DC=SNMPINTERFACES | grep MN=IfInNUcastPkts | grep RK=ifIndex:${ifindex},ifName:Iso88023Csmacd,SnmpMetric:IfInNUcastPkts
+ Append To List ${SNMP_VALUES} ${ifInNUcastPkts}
+ 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}
+ END
[Return] ${SNMP_ENTRY} ${SNMP_VALUES}
+
+Retrieve Value From Elasticsearch
+ [Arguments] ${data_category} ${metric_name} ${node_id} ${rk_node_id}
+ [Documentation] Retrieve the last record of Elastic Search from index TSDR. Query is done by data category, metricname and node ID
+ Create Session session http://${ODL_SYSTEM_IP}:${ELASTICPORT} auth=${AUTH} headers=${HEADERS_QUERY}
+ ${els_query}= create_query_string_search ${data_category} ${metric_name} ${node_id} ${rk_node_id}
+ ${els_JSON_request}= build_elastic_search_JSON_request ${els_query}
+ ${resp}= RequestsLibrary.Post_Request session _search?pretty data=${els_JSON_request}
+ Should Be Equal As Strings ${resp.status_code} 200
+ @{convert}= Parse Json ${resp.text}
+ ${json}= RequestsLibrary.To Json ${resp.text}
+ ${result}= extract_metric_value_search ${json}
+ [Teardown] Delete All Sessions
+ [Return] ${result}
+
+Check Available values from Elasticsearch
+ [Arguments] ${data_category} ${number_items}
+ [Documentation] Check whether data were sent to Elastic Search. We retrieve all data by data category and then compare its count
+ Create Session session http://${ODL_SYSTEM_IP}:${ELASTICPORT} auth=${AUTH} headers=${HEADERS_QUERY}
+ ${els_query}= create_query_string_count ${data_category}
+ ${els_JSON_request}= build_elastic_search_JSON_request ${els_query}
+ ${resp}= RequestsLibrary.Post_Request session _search?pretty data=${els_JSON_request}
+ Should Be Equal As Strings ${resp.status_code} 200
+ @{convert}= Parse Json ${resp.text}
+ ${json}= RequestsLibrary.To Json ${resp.text}
+ ${result}= extract_metric_value_count ${json}
+ Log To Console Elasticsearch: Check number of elements
+ Should Be True ${result} > ${number_items}
+ [Teardown] Delete All Sessions
+
+Clear Elasticsearch Datastore
+ [Documentation] Clear Elastic Search Datastore
+ Create Session session http://${ODL_SYSTEM_IP}:${ELASTICPORT} auth=${AUTH} headers=${HEADERS_QUERY}
+ ${resp}= RequestsLibrary.Delete_Request session tsdr
+ Should Be Equal As Strings ${resp.status_code} 200
+ [Teardown] Delete All Sessions
+ [Return] ${resp.status_code}