Tidy new and updated test suites
[integration/test.git] / csit / suites / tsdr / HBase / 010_InterfaceMetrics.robot
1 *** Settings ***
2 Documentation     Test suite for Hbase DataStore PortStats Verification
3 Suite Setup       Initialize the Tsdr Suite
4 Suite Teardown    Stop Tsdr Suite
5 Metadata          https://bugs.opendaylight.org/show_bug.cgi?id=5068    ${EMPTY}
6 Library           SSHLibrary
7 Library           Collections
8 Library           String
9 Library           RequestsLibrary
10 Library           ../../../libraries/Common.py
11 Resource          ../../../libraries/KarafKeywords.robot
12 Resource          ../../../libraries/TsdrUtils.robot
13 Variables         ../../../variables/Variables.py
14
15 *** Variables ***
16 @{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError
17 ...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
18 &{HEADERS_QUERY}    Content-Type=application/json    Content-Type=application/json
19
20 *** Test Cases ***
21 Init Variables
22     [Documentation]    Initialize ODL version specific variables
23     log    ${ODL_VERSION}
24     Run Keyword If    '${ODL_VERSION}' == 'stable-lithium'    Init Variables Lithium
25     ...    ELSE    Init Variables Master
26
27 Verification of TSDR HBase Feature Installation
28     [Documentation]    Install and Verify the TSDR HBase Features
29     COMMENT    Install a Feature    odl-tsdr-hbase    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
30     Verify Feature Is Installed    odl-tsdr-hbase
31     Verify Feature Is Installed    odl-hbaseclient
32
33 Verification TSDR Command is exist in Help
34     [Documentation]    Verify the TSDR List command on Help
35     ${output}=    Issue Command On Karaf Console    tsdr\t
36     Should Contain    ${output}    tsdr:list
37     ${output}=    Issue Command On Karaf Console    tsdr:list\t\t
38     : FOR    ${list}    IN    @{CATEGORY}
39     \    Should Contain    ${output}    ${list}
40     Wait Until Keyword Succeeds    620s    1s    Verify the Metric is Collected?    ${TSDR_PORTSTATS}    openflow
41
42 Verification of TSDR PortStats
43     [Documentation]    Verify the TSDR InterfaceMetrics
44     : FOR    ${list}    IN    @{INTERFACE_METRICS}
45     \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
46     \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
47     \    Should Contain    ${output}    ${list}
48
49 Verification of InterfaceMetrics-Attributes on HBase Client
50     [Documentation]    Verify the InterfaceMetrics has been updated on HBase Datastore
51     : FOR    ${list}    IN    @{INTERFACE_METRICS}
52     \    Verify the Metrics Attributes on Hbase Client    ${list}    ${node_connector}    ${portstats}
53
54 Verify Configuration Interval-change
55     [Documentation]    Verify the TSDR Collection configuration changes
56     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${default_poll}
57     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${default_poll}
58     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${non_default_poll}
59     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${non_default_poll}
60     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${default_poll}
61     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${default_poll}
62     [Teardown]    Report_Failure_Due_To_Bug    5068
63
64 *** Keywords ***
65 Init Variables Master
66     [Documentation]    Sets variables specific to latest(master) version
67     Set Suite Variable    @{CATEGORY}    FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS
68     ...    QUEUESTATS
69     Set Suite Variable    ${TSDR_PORTSTATS}    tsdr:list PORTSTATS
70     Set Suite Variable    ${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDROSCConfig
71     Set Suite Variable    ${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
72     Set Suite Variable    ${default_poll}    15000
73     set Suite Variable    ${non_default_poll}    20000
74     set Suite Variable    ${node_connector}    Node:openflow:1,NodeConnector:1
75     set suite Variable    ${portstats}    PORTSTATS
76
77 Init Variables Lithium
78     [Documentation]    Sets variables specific to Lithium version
79     Set Suite Variable    @{CATEGORY}    FlowStats    FlowTableStats    PortStats    QueueStats
80     Set Suite Variable    ${TSDR_PORTSTATS}    tsdr:list PortStats
81     Set Suite Variable    ${CONFIG_INTERVAL}    /restconf/config/TSDRDC:TSDRDCConfig
82     Set Suite Variable    ${OPER_INTERVAL}    /restconf/operations/TSDRDC:setPollingInterval
83     Set Suite Variable    ${default_poll}    180
84     set Suite Variable    ${non_default_poll}    200
85     set Suite Variable    ${node_connector}    openflow:1_1
86     set suite Variable    ${portstats}    InterfaceMetrics
87
88 Initialize the Tsdr Suite
89     COMMENT    Initialize the HBase for TSDR
90     Start Tsdr Suite
91     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
92
93 Verify TSDR Configuration Interval
94     [Arguments]    ${interval}
95     [Documentation]    Verify Configuration interval of TSDR Collection
96     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_INTERVAL}
97     Should Be Equal As Strings    ${resp.status_code}    200
98     Should Contain    ${resp.content}    ${interval}
99
100 Post TSDR Configuration Interval
101     [Arguments]    ${interval}
102     [Documentation]    Configuration TSDR collection interval ${interval}
103     ${p1}    Create Dictionary    interval=${interval}
104     ${p2}    Create Dictionary    input=${p1}
105     ${p2_json}=    json.dumps    ${p2}
106     ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    data=${p2_json}
107     Should Be Equal As Strings    ${resp.status_code}    200