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