Add flow table metrics test for Elastic Search TSDR
[integration/test.git] / csit / suites / tsdr / Elasticsearch / 030_FlowTableMetrics.robot
1 *** Settings ***
2 Documentation     Test suite for ElasticSearch DataStore PortStats Verification
3 Suite Teardown    Stop Tsdr Suite
4 Library           SSHLibrary
5 Library           Collections
6 Library           String
7 Library           RequestsLibrary
8 Library           ../../../libraries/Common.py
9 Resource          ../../../libraries/KarafKeywords.robot
10 Resource          ../../../libraries/TsdrUtils.robot
11 Resource          ../../../variables/Variables.robot
12
13 *** Variables ***
14 @{tsdr_pl}
15 @{tsdr_af}
16 @{tsdr_pm}
17 ${packetlookup}    flow-table-statistics/packets-looked-up
18 ${activeflows}    flow-table-statistics/active-flows
19 ${packetmatched}    flow-table-statistics/packets-matched
20 @{openflow_packetlookup}
21 @{openflow_activeflows}
22 @{openflow_packetmatched}
23
24 *** Test Cases ***
25 Verification of TSDR ElasticSearch Feature Installation
26     [Documentation]    Install and Verify the Elastic Search Features
27     COMMENT    Install a Feature    odl-tsdr-elasticsearch    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
28     Install a Feature    odl-tsdr-elasticsearch    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
29     Install a Feature    odl-tsdr-openflow-statistics-collector    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    260
30     COMMENT    Wait Until Keyword Succeeds    24x    10 sec    Check Karaf Log Has Messages    tsdr.openflow
31     Verify Feature Is Installed    odl-tsdr-elasticsearch
32     Verify Feature Is Installed    odl-tsdr-openflow-statistics-collector
33     Start Tsdr Suite
34     Ping All Hosts
35     Clear Elasticsearch Datastore
36     Wait Until Keyword Succeeds    30x    1 sec    Check Available values from Elasticsearch    FLOWTABLESTATS    4571
37
38 Comparing Flow Table Metrics
39     [Documentation]    Comparing Flow table values between Elasticsearch and openflow plugin.
40     Getting all Tables from Openflow Plugin
41     Getting all Tables from ElasticSearch datastore
42     Should Be Equal As Strings    ${tsdr_pl}    ${openflow_packetlookup}
43     Should Be Equal As Strings    ${tsdr_af}    ${openflow_activeflows}
44     Should Be Equal As Strings    ${tsdr_pm}    ${openflow_packetmatched}
45
46 *** Keywords ***
47 Getting all Tables from Openflow Plugin
48     [Documentation]    Getting Flow Table Stats Values from Openflow plugin
49     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packetlookup}
50     Append To List    ${openflow_packetlookup}    ${ret}
51     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packetlookup}
52     Append To List    ${openflow_packetlookup}    ${ret}
53     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packetlookup}
54     Append To List    ${openflow_packetlookup}    ${ret}
55     Set Suite Variable    @{openflow_packetlookup}
56     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${activeflows}
57     Append To List    ${openflow_activeflows}    ${ret}
58     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${activeflows}
59     Append To List    ${openflow_activeflows}    ${ret}
60     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${activeflows}
61     Append To List    ${openflow_activeflows}    ${ret}
62     Set Suite Variable    @{openflow_activeflows}
63     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:1/table/0/    ${packetmatched}
64     Append To List    ${openflow_packetmatched}    ${ret}
65     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:2/table/0/    ${packetmatched}
66     Append To List    ${openflow_packetmatched}    ${ret}
67     ${ret}=    Get Stats XML    ${OPERATIONAL_NODES_API}/node/openflow:3/table/0/    ${packetmatched}
68     Append To List    ${openflow_packetmatched}    ${ret}
69     Set Suite Variable    @{openflow_packetmatched}
70
71 Getting all Tables from ElasticSearch datastore
72     [Documentation]    Getting Flow Table Stats Values from ELK plugin
73     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketLookup    openflow:1    openflow:1
74     Append To List    ${tsdr_pl}    ${ret}
75     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketLookup    openflow:2    openflow:2
76     Append To List    ${tsdr_pl}    ${ret}
77     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketLookup    openflow:3    openflow:3
78     Append To List    ${tsdr_pl}    ${ret}
79     Set Suite Variable    @{tsdr_pl}
80     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    ActiveFlows    openflow:1    openflow:1
81     Append To List    ${tsdr_af}    ${ret}
82     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    ActiveFlows    openflow:2    openflow:2
83     Append To List    ${tsdr_af}    ${ret}
84     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    ActiveFlows    openflow:3    openflow:3
85     Append To List    ${tsdr_af}    ${ret}
86     Set Suite Variable    @{tsdr_af}
87     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketMatch    openflow:1    openflow:1
88     Append To List    ${tsdr_pm}    ${ret}
89     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketMatch    openflow:2    openflow:2
90     Append To List    ${tsdr_pm}    ${ret}
91     ${ret}=    Retrieve Value From Elasticsearch    FLOWTABLESTATS    PacketMatch    openflow:3    openflow:3
92     Append To List    ${tsdr_pm}    ${ret}
93     Set Suite Variable    @{tsdr_pm}