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