48887be1eec72a567d40a29907f8789af1891c3e
[integration/test.git] / csit / suites / tsdr / Cassandra / 020_FlowMetrics.robot
1 *** Settings ***
2 Documentation     Test suite for Cassandra DataStore Flow 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
15 @{FLOW_METRICS}    PacketCount    ByteCount
16 ${TSDR_FLOWSTATS}    tsdr:list FlowStats
17 ${packet_count}    flow/flow-statistics/packet-count
18 ${byte_count}    flow/flow-statistics/byte-count
19 @{tsdr_op1}
20 @{tsdr_op2}
21 @{tsdr_op3}
22 @{tsdr_op1_pc}
23 @{tsdr_op2_pc}
24 @{tsdr_op3_pc}
25 @{tsdr_op1_bc}
26 @{tsdr_op2_bc}
27 @{tsdr_op3_bc}
28
29
30 *** Test Cases ***
31
32 Verification of TSDR Cassandra Feature Installation
33     [Documentation]    Install and Verify the TSDR Cassandra Features
34     Verify Feature Is Installed    odl-tsdr-cassandra
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
41 Getting all Tables from Openflow Plugin
42     [Documentation]    Getting Flowstats from openflow plugin
43
44     @{openflow_1}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    flow/id
45     @{openflow_2}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    flow/id
46     @{openflow_3}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    flow/id
47
48     Set Suite Variable    @{openflow_1}
49     Set Suite Variable    @{openflow_2}
50     Set Suite Variable    @{openflow_3}
51
52     @{openflow_1_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packet_count}
53     @{openflow_2_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packet_count}
54     @{openflow_3_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packet_count}
55
56     Set Suite Variable    @{openflow_1_packetcount}
57     Set Suite Variable    @{openflow_2_packetcount}
58     Set Suite Variable    @{openflow_3_packetcount}
59
60
61     @{openflow_1_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${byte_count}
62     @{openflow_2_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${byte_count}
63     @{openflow_3_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${byte_count}
64
65     Set Suite Variable    @{openflow_1_bytecount}
66     Set Suite Variable    @{openflow_2_bytecount}
67     Set Suite Variable    @{openflow_3_bytecount}
68
69 Verification of FlowStats-Attributes on Cassandra Data Store
70     [Documentation]    Verify the InterfaceMetrics has been updated on Cassandra Data Store
71     Copy TSDR tables
72     : FOR    ${flow}    IN    @{openflow_1}
73     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:1 | grep DC=FLOWSTATS | grep MN=PacketCount | grep -F 'RK=Node:openflow:1,Table:0,Flow:${flow}'
74     \   Append To List    ${tsdr_op1_pc}    ${ret_val1}
75
76     : FOR    ${flow}    IN    @{openflow_2}
77     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:2 | grep DC=FLOWSTATS | grep MN=PacketCount | grep -F 'RK=Node:openflow:2,Table:0,Flow:${flow}'
78     \   Append To List    ${tsdr_op2_pc}    ${ret_val1}
79
80     : FOR    ${flow}    IN    @{openflow_3}
81     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:3 | grep DC=FLOWSTATS | grep MN=PacketCount | grep -F 'RK=Node:openflow:3,Table:0,Flow:${flow}'
82     \   Append To List    ${tsdr_op3_pc}    ${ret_val1}
83
84     : FOR    ${flow}    IN    @{openflow_1}
85     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:1 | grep DC=FLOWSTATS | grep MN=ByteCount | grep -F 'RK=Node:openflow:1,Table:0,Flow:${flow}'
86     \   Append To List    ${tsdr_op1_bc}    ${ret_val1}
87
88     : FOR    ${flow}    IN    @{openflow_2}
89     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:2 | grep DC=FLOWSTATS | grep MN=ByteCount | grep -F 'RK=Node:openflow:2,Table:0,Flow:${flow}'
90     \   Append To List    ${tsdr_op2_bc}    ${ret_val1}
91
92     : FOR    ${flow}    IN    @{openflow_3}
93     \   ${ret_val1}=    Verify the Metrics Attributes on Cassandra Client    grep NID=openflow:3 | grep DC=FLOWSTATS | grep MN=ByteCount | grep -F 'RK=Node:openflow:3,Table:0,Flow:${flow}'
94     \   Append To List    ${tsdr_op3_bc}    ${ret_val1}
95
96     Set Suite Variable    @{tsdr_op1_pc}
97     Set Suite Variable    @{tsdr_op2_pc}
98     Set Suite Variable    @{tsdr_op3_pc}
99     Set Suite Variable    @{tsdr_op1_bc}
100     Set Suite Variable    @{tsdr_op2_bc}
101     Set Suite Variable    @{tsdr_op3_bc}
102
103
104 Comparing Packet Count Metrics
105     [Documentation]    Comparing Packet count values between Cassandra and openflow plugin
106
107     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_1_packetcount}    ${tsdr_op1_pc}
108     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
109
110     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_2_packetcount}    ${tsdr_op2_pc}
111     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
112
113     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_3_packetcount}    ${tsdr_op3_pc}
114     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
115
116
117
118 Comparing Byte Count Metrics
119     [Documentation]    Comparing byte count values between Cassandra and openflow plugin
120
121     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_1_bytecount}    ${tsdr_op1_bc}
122     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
123
124     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_2_bytecount}    ${tsdr_op2_bc}
125     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
126
127     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_3_bytecount}    ${tsdr_op3_bc}
128     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
129
130
131
132
133 *** Keywords ***
134 Initialize the Tsdr Suite
135     Initialize Cassandra Tables Metricval
136