d0c52741a694d8e4225394c5212da898aea0f333
[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 @{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
19 ${TSDR_PORTSTATS}    tsdr:list PORTSTATS
20 ${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDROSCConfig
21 ${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
22 &{HEADERS_QUERY}    Content-Type=application/json    Content-Type=application/json
23
24 *** Test Cases ***
25 Verification of TSDR HBase Feature Installation
26     [Documentation]    Install and Verify the TSDR HBase Features
27     COMMENT    Install a Feature    odl-tsdr-hbase    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
28     Verify Feature Is Installed    odl-tsdr-hbase
29     Verify Feature Is Installed    odl-hbaseclient
30
31 Verification TSDR Command is exist in Help
32     [Documentation]    Verify the TSDR List command on Help
33     ${output}=    Issue Command On Karaf Console    tsdr\t
34     Should Contain    ${output}    tsdr:list
35     ${output}=    Issue Command On Karaf Console    tsdr:list\t\t
36     : FOR    ${list}    IN    @{CATEGORY}
37     \    Should Contain    ${output}    ${list}
38     Wait Until Keyword Succeeds    620s    1s    Verify the Metric is Collected?    ${TSDR_PORTSTATS}    openflow
39
40 Verification of TSDR PortStats
41     [Documentation]    Verify the TSDR InterfaceMetrics
42     : FOR    ${list}    IN    @{INTERFACE_METRICS}
43     \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
44     \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
45     \    Should Contain    ${output}    ${list}
46
47 Verification of InterfaceMetrics-Attributes on HBase Client
48     [Documentation]    Verify the InterfaceMetrics has been updated on HBase Datastore
49     : FOR    ${list}    IN    @{INTERFACE_METRICS}
50     \    Verify the Metrics Attributes on Hbase Client    ${list}    Node:openflow:1,NodeConnector:1    PORTSTATS
51
52 Verify Configuration Interval-change
53     [Documentation]    Verify the TSDR Collection configuration changes
54     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    15000
55     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    15000
56     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    20000
57     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    20000
58     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    15000
59     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    15000
60     [Teardown]    Report_Failure_Due_To_Bug    5068
61
62 *** Keywords ***
63 Initialize the Tsdr Suite
64     COMMENT    Initialize the HBase for TSDR
65     Start Tsdr Suite
66     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
67
68 Verify TSDR Configuration Interval
69     [Arguments]    ${interval}
70     [Documentation]    Verify Configuration interval of TSDR Collection
71     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_INTERVAL}
72     Should Be Equal As Strings    ${resp.status_code}    200
73     Should Contain    ${resp.content}    ${interval}
74
75 Post TSDR Configuration Interval
76     [Arguments]    ${interval}
77     [Documentation]    Configuration TSDR collection interval ${interval}
78     ${p1}    Create Dictionary    interval=${interval}
79     ${p2}    Create Dictionary    input=${p1}
80     ${p2_json}=    json.dumps    ${p2}
81     ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    data=${p2_json}
82     Should Be Equal As Strings    ${resp.status_code}    200