Tidy updated test suites
[integration/test.git] / csit / suites / tsdr / Cassandra / 030_FlowTableMetrics.robot
1 *** Settings ***
2 Documentation     Test suite for Cassandra DataStore Flow Table Stats Verification
3 Suite Setup       Initialize the Tsdr Suite
4 Suite Teardown    Stop Tsdr Suite
5 Library           SSHLibrary
6 Library           Collections
7 Library           String
8 Library           ../../../libraries/Common.py
9 Resource          ../../../libraries/KarafKeywords.robot
10 Resource          ../../../libraries/TsdrUtils.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${TSDR_FLOWTABLE_STATS}    tsdr:list FlowTableStats
15 @{tsdr_pl}
16 @{tsdr_af}
17 @{tsdr_pm}
18 ${packetlookup}    flow-table-statistics/packets-looked-up
19 ${activeflows}    flow-table-statistics/active-flows
20 ${packetmatched}    flow-table-statistics/packets-matched
21 @{openflow_packetlookup}
22 @{openflow_activeflows}
23 @{openflow_packetmatched}
24
25 *** Test Cases ***
26 Verification of TSDR Cassandra Feature Installation
27     [Documentation]    Install and Verify the TSDR Cassandra Features
28     COMMENT    Install a Feature    odl-tsdr-cassandra-all    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
29     Verify Feature Is Installed    odl-tsdr-cassandra
30     COMMENT    Verify Feature Is Installed    odl-tsdr-cassandra-persistence
31     Verify Feature Is Installed    odl-tsdr-openflow-statistics-collector
32     Start Tsdr Suite
33     Ping All Hosts
34     Wait Until Keyword Succeeds    5x    30 sec    Check Metric path    24\\d+|25\\d+
35     Wait Until Keyword Succeeds    5x    30 sec    Check Metric val    \\d{5}
36
37 Getting all Tables from Openflow Plugin
38     [Documentation]    Getting Flow Table Stats Values from Openflow plugin
39     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packetlookup}
40     Append To List    ${openflow_packetlookup}    ${ret}
41     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packetlookup}
42     Append To List    ${openflow_packetlookup}    ${ret}
43     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packetlookup}
44     Append To List    ${openflow_packetlookup}    ${ret}
45     Set Suite Variable    @{openflow_packetlookup}
46     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${activeflows}
47     Append To List    ${openflow_activeflows}    ${ret}
48     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${activeflows}
49     Append To List    ${openflow_activeflows}    ${ret}
50     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${activeflows}
51     Append To List    ${openflow_activeflows}    ${ret}
52     Set Suite Variable    @{openflow_activeflows}
53     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packetmatched}
54     Append To List    ${openflow_packetmatched}    ${ret}
55     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packetmatched}
56     Append To List    ${openflow_packetmatched}    ${ret}
57     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packetmatched}
58     Append To List    ${openflow_packetmatched}    ${ret}
59     Set Suite Variable    @{openflow_packetmatched}
60
61 Verification of FlowStats-Attributes on Cassandra Data Store
62     [Documentation]    Verify the InterfaceMetrics has been updated on Cassandra Data Store
63     Copy TSDR tables
64     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:1 | grep DC=FLOWTABLESTATS | grep MN=PacketLookup | grep RK=Node:openflow:1,Table:0
65     Append To List    ${tsdr_pl}    ${ret_val1}
66     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:2 | grep DC=FLOWTABLESTATS | grep MN=PacketLookup | grep RK=Node:openflow:2,Table:0
67     Append To List    ${tsdr_pl}    ${ret_val1}
68     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:3 | grep DC=FLOWTABLESTATS | grep MN=PacketLookup | grep RK=Node:openflow:3,Table:0
69     Append To List    ${tsdr_pl}    ${ret_val1}
70     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:1 | grep DC=FLOWTABLESTATS | grep MN=ActiveFlows | grep RK=Node:openflow:1,Table:0
71     Append To List    ${tsdr_af}    ${ret_val1}
72     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:2 | grep DC=FLOWTABLESTATS | grep MN=ActiveFlows | grep RK=Node:openflow:2,Table:0
73     Append To List    ${tsdr_af}    ${ret_val1}
74     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:3 | grep DC=FLOWTABLESTATS | grep MN=ActiveFlows | grep RK=Node:openflow:3,Table:0
75     Append To List    ${tsdr_af}    ${ret_val1}
76     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:1 | grep DC=FLOWTABLESTATS | grep MN=PacketMatch | grep RK=Node:openflow:1,Table:0
77     Append To List    ${tsdr_pm}    ${ret_val1}
78     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:2 | grep DC=FLOWTABLESTATS | grep MN=PacketMatch | grep RK=Node:openflow:2,Table:0
79     Append To List    ${tsdr_pm}    ${ret_val1}
80     ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:3 | grep DC=FLOWTABLESTATS | grep MN=PacketMatch | grep RK=Node:openflow:3,Table:0
81     Append To List    ${tsdr_pm}    ${ret_val1}
82
83 Comparing Flow Table Metrics
84     [Documentation]    Comparing Flow table values between Cassandra and openflow plugin.
85     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_packetlookup}    ${tsdr_pl}
86     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    5
87     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_activeflows}    ${tsdr_af}
88     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    5
89     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_packetmatched}    ${tsdr_pm}
90     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    5
91
92 *** Keywords ***
93 Initialize the Tsdr Suite
94     COMMENT    Initialize the Cassandra for TSDR
95     Initialize Cassandra Tables Metricval