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