Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / tsdr / H2 / 060_FlowMeterMetrics.robot
1 *** Settings ***
2 Documentation     Test suite for H2 DataStore FlowMeter Stats Verification
3 Suite Setup       Run Keywords    Start TSDR suite with CPqD Switch    Configuration of FlowMeter on Switch
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 @{FLOWMETER_METRICS}    ByteInCount    PacketInCount    FlowCount
15 ${TSDR_FLOWMETERSTATS}    tsdr:list FlowMeterStats
16 @{FLOWMETER_HEADER}    MetricName    MetricValue    MetricCategory    MetricDetails
17
18 *** Test Cases ***
19 Verify the FlowMeter Stats attributes exist thru Karaf console
20     [Documentation]    Verify the FlowMeterStats attributes exist on Karaf Console
21     Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    ${TSDR_FLOWMETERSTATS}    ByteInCount
22     ${output}=    Issue Command On Karaf Console    ${TSDR_FLOWMETERSTATS}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
23     FOR    ${list}    IN    @{FLOWMETER_METRICS}
24         Should Contain    ${output}    ${list}
25     END
26
27 Verification of FlowMeterStats-ByteInCount on Karaf Console
28     [Documentation]    Verify the FlowMeterStats has been updated thru tsdr:list command on karaf console
29     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWMETERSTATS}    | grep ByteInCount | head
30     ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
31     Should Contain    ${output}    ByteInCount
32     Should Contain    ${output}    FLOWMETERSTATS
33     Should not Contain    ${output}    null
34     FOR    ${list}    IN    @{FLOWMETER_HEADER}
35         Should Contain    ${output}    ${list}
36     END
37
38 Verify FlowMeterStats-Attributes on H2 Datastore using JDBC Client
39     [Documentation]    Verify the FlowMeterStats,attributes on H2 Datastore using JDBC Client
40     FOR    ${list}    IN    @{FLOWMETER_METRICS}
41         ${output}=    Query Metrics on H2 Datastore    FLOWMETERSTATS    ${list}
42         Should Contain    ${output}    ${list}
43     END
44
45 Uninstall all TSDR H2 Feature
46     [Documentation]    UnInstall all TSDR H2 Features
47     Uninstall a Feature    odl-tsdr-H2-persistence odl-tsdr-all odl-tsdr-core
48     Verify Feature Is Not Installed    odl-tsdr-H2-persistence
49     Verify Feature Is Not Installed    odl-tsdr-all
50     Verify Feature Is Not Installed    odl-tsdr-core
51
52 Verification TSDR Command shouldnot exist in help
53     [Documentation]    Verify the TSDR List command on help
54     ${output}=    Issue Command On Karaf Console    tsdr\t    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}
55     Should not Contain    ${output}    tsdr:list
56
57 *** Keyword ***
58 Start TSDR suite with CPqD Switch
59     Start Tsdr Suite    user
60
61 Configuration of FlowMeter on Switch
62     [Documentation]    FlowMeter configuration on CPqD
63     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s1 meter-mod cmd=add,flags=1,meter=1 drop:rate=100
64     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s1 flow-mod table=0,cmd=add in_port=1 meter:1 apply:output=2
65     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s1 ping 10
66     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s2 ping 10