Added Syslog Scripts to run in Cassandra,HBase and HSQLDB 36/34436/36
authorpremnath <prem.annauniv@gmail.com>
Thu, 11 Feb 2016 07:23:29 +0000 (12:53 +0530)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 18 Feb 2016 22:09:18 +0000 (22:09 +0000)
Debugging Syslog Failures

Change-Id: I243d89cf3260e4b1d90cb8bce10db74dd10ada0b
Signed-off-by: premnath <prem.annauniv@gmail.com>
csit/libraries/TsdrUtils.robot
csit/suites/tsdr/Cassandra/050_SyslogTable.robot [new file with mode: 0644]
csit/suites/tsdr/HBase/050_SyslogTable.robot [new file with mode: 0644]
csit/suites/tsdr/HSQLDB/060_syslog_Collector.robot [new file with mode: 0644]

index 891c2e48fa65adf2e6f696a86b59095e39ff60d7..02acab61b20bcbd4453581175f2c2f65e8f40160 100644 (file)
@@ -9,6 +9,7 @@ Resource          Utils.robot
 Variables         ../variables/Variables.py
 Library           json
 Library           HttpLibrary.HTTP
+Library           Process
 
 *** Variables ***
 ${HBASE_CLIENT}    /tmp/Hbase/hbase-0.94.15/bin
@@ -28,6 +29,10 @@ ${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
+&{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
@@ -396,9 +401,9 @@ Compare Tsdr XML Metrics
     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
@@ -456,35 +461,6 @@ Check Metric Log
     ${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
diff --git a/csit/suites/tsdr/Cassandra/050_SyslogTable.robot b/csit/suites/tsdr/Cassandra/050_SyslogTable.robot
new file mode 100644 (file)
index 0000000..6271a67
--- /dev/null
@@ -0,0 +1,39 @@
+*** Settings ***
+Documentation     Test suite for Cassandra DataStore Syslog Verification
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Test Cases ***
+
+Verification of TSDR Cassandra Feature Installation
+    [Documentation]    Install and Verify the TSDR Cassandra Syslog Features
+    Initialize Cassandra Tables Metricval    val_table=metriclog
+    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages    tsdr.syslog
+    Verify Feature Is Installed    odl-tsdr-cassandra
+    Verify Feature Is Installed    odl-tsdr-syslog-collector
+
+Sending syslog to ODL Syslog collector using Logger command
+    [Documentation]    Sending Syslogs to collector.
+    :FOR    ${key}    IN ZIP   &{syslog_facility}
+    \    ${value}=    Get From Dictionary    ${syslog_facility}    ${key}
+    \    ${f_value}=    Evaluate    ${value} * 8
+    \    Generate Syslog    ${f_value}
+
+Verifying TSDR Data Store For Syslog Entries
+    [Documentation]    Verifying if syslogs is getting stored.
+    Copy TSDR tables     val_table=metriclog
+    ${metric_log}=    Verify the Metrics Syslog on Cassandra Client    grep DC=SYSLOG
+    @{Syslogs}=    Split to lines    ${metric_log}
+    ${iterator}=    Set Variable    0
+    :FOR    ${key}    IN ZIP   &{syslog_facility}
+    \    ${value}=    Get From Dictionary    ${syslog_facility}    ${key}
+    \    ${f_value}=    Evaluate    ${value} * 8
+    \    Should Contain    @{syslogs}[${iterator}]    ${MESSAGE}
+    \    Should Contain    @{syslogs}[${iterator}]    <${f_value}>
+    \    ${iterator}=    Evaluate    ${iterator} + 1
+
diff --git a/csit/suites/tsdr/HBase/050_SyslogTable.robot b/csit/suites/tsdr/HBase/050_SyslogTable.robot
new file mode 100644 (file)
index 0000000..dd0d8d9
--- /dev/null
@@ -0,0 +1,33 @@
+*** Settings ***
+Documentation     Test suite for HBase Syslog Verification
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Test Cases ***
+
+Verification of TSDR HBase Feature Installation
+    [Documentation]    Install and Verify the TSDR Cassandra Syslog Features
+    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages    tsdr.syslog
+    Verify Feature Is Installed    odl-tsdr-hbase
+    Verify Feature Is Installed    odl-tsdr-syslog-collector
+
+Sending syslog to ODL Syslog collector using Logger command
+    [Documentation]    Verifying if syslogs is collected and getting stored.
+    Query the Data from HBaseClient    truncate 'SYSLOG'
+    :FOR    ${key}    IN ZIP   &{syslog_facility}
+    \    ${value}=    Get From Dictionary    ${syslog_facility}    ${key}
+    \    ${f_value}=    Evaluate    ${value} * 8
+    \    Generate Syslog    ${f_value}
+
+    ${output}=    Query the Data from HBaseClient    scan 'SYSLOG'
+    Should Contain X Times    ${output}    ${MESSAGE_PATTERN}    1
+    :FOR    ${key}    IN ZIP   &{syslog_facility}
+    \    ${value}=    Get From Dictionary    ${syslog_facility}    ${key}
+    \    ${f_value}=    Evaluate    ${value} * 8
+    \    Should Match    ${output}    *${f_value}>*
+
diff --git a/csit/suites/tsdr/HSQLDB/060_syslog_Collector.robot b/csit/suites/tsdr/HSQLDB/060_syslog_Collector.robot
new file mode 100644 (file)
index 0000000..790b8c0
--- /dev/null
@@ -0,0 +1,35 @@
+*** Settings ***
+Documentation     Test suite for HSQLDB DataStore Syslog Stats Verification
+Library           SSHLibrary
+Library           Collections
+Library           String
+Library           ../../../libraries/Common.py
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/TsdrUtils.robot
+Variables         ../../../variables/Variables.py
+
+*** Test Cases ***
+
+Verification of TSDR HSQLDB Feature Installation
+    [Documentation]    Install and Verify the TSDR Cassandra Syslog Features
+    COMMENT    Install a Feature    odl-tsdr-hsqldb-all    ${CONTROLLER}    ${KARAF_SHELL_PORT}    60
+    COMMENT    Install a Feature    odl-tsdr-syslog-collector    ${CONTROLLER}    ${KARAF_SHELL_PORT}    60
+    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages    tsdr.syslog
+    Verify Feature Is Installed    odl-tsdr-hsqldb
+    Verify Feature Is Installed    odl-tsdr-syslog-collector
+
+
+Sending syslog to ODL Syslog collector using Logger command
+    [Documentation]    Verifying if syslogs is getting generated.
+    :FOR    ${key}    IN ZIP   &{syslog_facility}
+    \    ${value}=    Get From Dictionary    ${syslog_facility}    ${key}
+    \    ${f_value}=    Evaluate    ${value} * 8
+    \    Generate Syslog    ${f_value}
+    Wait Until Keyword Succeeds    24x    10 sec    Check HSQLDB    1    SYSLOG | grep SYSLOG | wc -l
+
+Verifying TSDR Data Store For Syslog Entries
+    [Documentation]    Verifying if syslogs is getting stored.
+    ${output}=    Issue Command On Karaf Console    tsdr:list SYSLOG
+    Should Contain X Times    ${output}    SYSLOG   1
+    Should Contain    ${output}    ${MESSAGE_PATTERN}
+