Update Robot Framework format - step 15
[integration/test.git] / csit / suites / tsdr / H2 / 050_GroupMetrics.robot
1 *** Settings ***
2 Documentation       Test suite for H2 DataStore FlowGroup 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 FlowGroup on Switch
13 Suite Teardown      Stop Tsdr Suite
14
15
16 *** Variables ***
17 @{FLOWGROUP_METRICS}        ByteCount    PacketCount    RefCount
18 ${TSDR_FLOWGROUPSTATS}      tsdr:list FlowGroupStats
19 @{FLOWGROUP_HEADER}         MetricName    MetricValue    MetricCategory    MetricDetails
20
21
22 *** Test Cases ***
23 Verify the FlowGroup Stats attributes exist thru Karaf console
24     [Documentation]    Verify the FlowGroupStats attributes exist on Karaf Console
25     Wait Until Keyword Succeeds    120s    1s    Verify the Metric is Collected?    ${TSDR_FLOWGROUPSTATS}    ByteCount
26     ${output}=    Issue Command On Karaf Console
27     ...    ${TSDR_FLOWGROUPSTATS}
28     ...    ${ODL_SYSTEM_IP}
29     ...    ${KARAF_SHELL_PORT}
30     ...    30
31     FOR    ${list}    IN    @{FLOWGROUP_METRICS}
32         Should Contain    ${output}    ${list}
33     END
34
35 Verification of FlowGroupStats-ByteCount on Karaf Console
36     [Documentation]    Verify the FlowGroupStats has been updated thru tsdr:list command on karaf console
37     ${tsdr_cmd}=    Concatenate the String    ${TSDR_FLOWGROUPSTATS}    | grep ByteCount | head
38     ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    90
39     Should Contain    ${output}    ByteCount
40     Should Contain    ${output}    FLOWGROUPSTATS
41     Should not Contain    ${output}    null
42     FOR    ${list}    IN    @{FLOWGROUP_HEADER}
43         Should Contain    ${output}    ${list}
44     END
45
46 Verify FlowGroupStats-Attributes on H2 Datastore using JDBC Client
47     [Documentation]    Verify the GroupStats,attributes on H2 Datastore using JDBC Client
48     FOR    ${list}    IN    @{FLOWGROUP_METRICS}
49         ${output}=    Query Metrics on H2 Datastore    FLOWGROUPSTATS    ${list}
50         Should Contain    ${output}    ${list}
51     END
52
53
54 *** Keywords ***
55 Start TSDR suite with CPqD Switch
56     Start Tsdr Suite    user
57
58 Configuration of FlowGroup on Switch
59     [Documentation]    FlowGroup configuration on CPqD
60     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s1 group-mod cmd=add,group=1,type=all
61     Run Command On Remote System
62     ...    ${TOOLS_SYSTEM_IP}
63     ...    sudo dpctl unix:/tmp/s1 flow-mod table=0,cmd=add eth_type=0x800,eth_src=00:01:02:03:04:05 apply:group=1
64     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s1 ping 10
65     Run Command On Remote System    ${TOOLS_SYSTEM_IP}    sudo dpctl unix:/tmp/s2 ping 10