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