b4ce17f5ad2213fc306a97a3baae0dcd72ddff6f
[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 @{FLOW_METRICS}    PacketCount    ByteCount
15 ${TSDR_FLOWSTATS}    tsdr:list FlowStats
16 ${packet_count}    flow/flow-statistics/packet-count
17 ${byte_count}     flow/flow-statistics/byte-count
18 @{tsdr_op1}
19 @{tsdr_op2}
20 @{tsdr_op3}
21 @{tsdr_op1_pc}
22 @{tsdr_op2_pc}
23 @{tsdr_op3_pc}
24 @{tsdr_op1_bc}
25 @{tsdr_op2_bc}
26 @{tsdr_op3_bc}
27
28 *** Test Cases ***
29 Verification of TSDR Cassandra Feature Installation
30     [Documentation]    Install and Verify the TSDR Cassandra Features
31     Verify Feature Is Installed    odl-tsdr-cassandra
32     Verify Feature Is Installed    odl-tsdr-openflow-statistics-collector
33     Start Tsdr Suite
34     Ping All Hosts
35     Wait Until Keyword Succeeds    5x    30 sec    Check Metric val    \\d{5}
36
37 Getting all Tables from Openflow Plugin
38     [Documentation]    Getting Flowstats from openflow plugin
39     @{openflow_1}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    flow/id
40     @{openflow_2}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    flow/id
41     @{openflow_3}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    flow/id
42     Set Suite Variable    @{openflow_1}
43     Set Suite Variable    @{openflow_2}
44     Set Suite Variable    @{openflow_3}
45     @{openflow_1_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packet_count}
46     @{openflow_2_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packet_count}
47     @{openflow_3_packetcount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packet_count}
48     Set Suite Variable    @{openflow_1_packetcount}
49     Set Suite Variable    @{openflow_2_packetcount}
50     Set Suite Variable    @{openflow_3_packetcount}
51     @{openflow_1_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${byte_count}
52     @{openflow_2_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${byte_count}
53     @{openflow_3_bytecount}=    Return all XML matches    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${byte_count}
54     Set Suite Variable    @{openflow_1_bytecount}
55     Set Suite Variable    @{openflow_2_bytecount}
56     Set Suite Variable    @{openflow_3_bytecount}
57
58 Verification of FlowStats-Attributes on Cassandra Data Store
59     [Documentation]    Verify the InterfaceMetrics has been updated on Cassandra Data Store
60     Copy TSDR tables
61     : FOR    ${flow}    IN    @{openflow_1}
62     \    ${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}'
63     \    Append To List    ${tsdr_op1_pc}    ${ret_val1}
64     : FOR    ${flow}    IN    @{openflow_2}
65     \    ${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}'
66     \    Append To List    ${tsdr_op2_pc}    ${ret_val1}
67     : FOR    ${flow}    IN    @{openflow_3}
68     \    ${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}'
69     \    Append To List    ${tsdr_op3_pc}    ${ret_val1}
70     : FOR    ${flow}    IN    @{openflow_1}
71     \    ${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}'
72     \    Append To List    ${tsdr_op1_bc}    ${ret_val1}
73     : FOR    ${flow}    IN    @{openflow_2}
74     \    ${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}'
75     \    Append To List    ${tsdr_op2_bc}    ${ret_val1}
76     : FOR    ${flow}    IN    @{openflow_3}
77     \    ${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}'
78     \    Append To List    ${tsdr_op3_bc}    ${ret_val1}
79     Set Suite Variable    @{tsdr_op1_pc}
80     Set Suite Variable    @{tsdr_op2_pc}
81     Set Suite Variable    @{tsdr_op3_pc}
82     Set Suite Variable    @{tsdr_op1_bc}
83     Set Suite Variable    @{tsdr_op2_bc}
84     Set Suite Variable    @{tsdr_op3_bc}
85
86 Comparing Packet Count Metrics
87     [Documentation]    Comparing Packet count values between Cassandra and openflow plugin
88     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_1_packetcount}    ${tsdr_op1_pc}
89     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
90     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_2_packetcount}    ${tsdr_op2_pc}
91     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
92     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_3_packetcount}    ${tsdr_op3_pc}
93     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
94
95 Comparing Byte Count Metrics
96     [Documentation]    Comparing byte count values between Cassandra and openflow plugin
97     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_1_bytecount}    ${tsdr_op1_bc}
98     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
99     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_2_bytecount}    ${tsdr_op2_bc}
100     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
101     : FOR    ${xml_val}    ${tsdr_val}    IN ZIP    ${openflow_3_bytecount}    ${tsdr_op3_bc}
102     \    Compare Tsdr XML Metrics    ${xml_val}    ${tsdr_val}    20
103
104 *** Keywords ***
105 Initialize the Tsdr Suite
106     Initialize Cassandra Tables Metricval