Step 1: Move vm scripts to the right place
[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}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
23     : FOR    ${list}    IN    @{FLOWMETER_METRICS}
24     \    Should Contain    ${output}    ${list}
25
26 Verification of FlowMeterStats-ByteInCount on Karaf Console
27     [Documentation]    Verify the FlowMeterStats has been updated thru tsdr:list command on karaf console
28     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWMETERSTATS}    | grep ByteInCount | head
29     ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    90
30     Should Contain    ${output}    ByteInCount
31     Should Contain    ${output}    FLOWMETERSTATS
32     Should not Contain    ${output}    null
33     : FOR    ${list}    IN    @{FLOWMETER_HEADER}
34     \    Should Contain    ${output}    ${list}
35
36 Verify FlowMeterStats-Attributes on H2 Datastore using JDBC Client
37     [Documentation]    Verify the FlowMeterStats,attributes on H2 Datastore using JDBC Client
38     : FOR    ${list}    IN    @{FLOWMETER_METRICS}
39     \    ${output}=    Query Metrics on H2 Datastore    FLOWMETERSTATS    ${list}
40     \    Should Contain    ${output}    ${list}
41
42 Uninstall all TSDR H2 Feature
43     [Documentation]    UnInstall all TSDR H2 Features
44     Uninstall a Feature    odl-tsdr-H2-persistence odl-tsdr-all odl-tsdr-core
45     Verify Feature Is Not Installed    odl-tsdr-H2-persistence
46     Verify Feature Is Not Installed    odl-tsdr-all
47     Verify Feature Is Not Installed    odl-tsdr-core
48
49 Verification TSDR Command shouldnot exist in help
50     [Documentation]    Verify the TSDR List command on help
51     ${output}=    Issue Command On Karaf Console    tsdr\t    ${CONTROLLER}    ${KARAF_SHELL_PORT}
52     Should not Contain    ${output}    tsdr:list
53
54 *** Keyword ***
55 Start TSDR suite with CPqD Switch
56     Start Tsdr Suite    user
57
58 Configuration of FlowMeter on Switch
59     [Documentation]    FlowMeter configuration on CPqD
60     Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 meter-mod cmd=add,flags=1,meter=1 drop:rate=100
61     Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 flow-mod table=0,cmd=add in_port=1 meter:1 apply:output=2
62     Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s1 ping 10
63     Run Command On Remote System    ${MININET}    sudo dpctl unix:/tmp/s2 ping 10