Modified HBase scripts to run in Lithium Branch.
[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
22 Init Variables
23     [Documentation]    Initialize ODL version specific variables
24     log    ${ODL_VERSION}
25     Run Keyword If    '${ODL_VERSION}' == 'stable-lithium'    Init Variables Lithium
26     ...    ELSE    Init Variables Master
27
28 Verification of TSDR HBase Feature Installation
29     [Documentation]    Install and Verify the TSDR HBase Features
30     COMMENT    Install a Feature    odl-tsdr-hbase    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    60
31     Verify Feature Is Installed    odl-tsdr-hbase
32     Verify Feature Is Installed    odl-hbaseclient
33
34 Verification TSDR Command is exist in Help
35     [Documentation]    Verify the TSDR List command on Help
36     ${output}=    Issue Command On Karaf Console    tsdr\t
37     Should Contain    ${output}    tsdr:list
38     ${output}=    Issue Command On Karaf Console    tsdr:list\t\t
39     : FOR    ${list}    IN    @{CATEGORY}
40     \    Should Contain    ${output}    ${list}
41     Wait Until Keyword Succeeds    620s    1s    Verify the Metric is Collected?    ${TSDR_PORTSTATS}    openflow
42
43 Verification of TSDR PortStats
44     [Documentation]    Verify the TSDR InterfaceMetrics
45     : FOR    ${list}    IN    @{INTERFACE_METRICS}
46     \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
47     \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${ODL_SYSTEM_IP}    ${KARAF_SHELL_PORT}    30
48     \    Should Contain    ${output}    ${list}
49
50 Verification of InterfaceMetrics-Attributes on HBase Client
51     [Documentation]    Verify the InterfaceMetrics has been updated on HBase Datastore
52     : FOR    ${list}    IN    @{INTERFACE_METRICS}
53     \    Verify the Metrics Attributes on Hbase Client    ${list}    ${node_connector}    ${portstats}
54
55 Verify Configuration Interval-change
56     [Documentation]    Verify the TSDR Collection configuration changes
57     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${default_poll}
58     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${default_poll}
59     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${non_default_poll}
60     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${non_default_poll}
61     Wait Until Keyword Succeeds    5x    3 sec    Post TSDR Configuration Interval    ${default_poll}
62     Wait Until Keyword Succeeds    5x    3 sec    Verify TSDR Configuration Interval    ${default_poll}
63     [Teardown]    Report_Failure_Due_To_Bug    5068
64
65 *** Keywords ***
66
67 Init Variables Master
68     [Documentation]    Sets variables specific to latest(master) version
69     Set Suite Variable    @{CATEGORY}       FLOWGROUPSTATS    FLOWMETERSTATS    FLOWSTATS    FLOWTABLESTATS    PORTSTATS    QUEUESTATS
70     Set Suite Variable    ${TSDR_PORTSTATS}    tsdr:list PORTSTATS
71     Set Suite Variable    ${CONFIG_INTERVAL}    /restconf/config/tsdr-openflow-statistics-collector:TSDROSCConfig
72     Set Suite Variable    ${OPER_INTERVAL}    /restconf/operations/tsdr-openflow-statistics-collector:setPollingInterval
73     Set Suite Variable    ${default_poll}    15000
74     set Suite Variable    ${non_default_poll}    20000
75     set Suite Variable    ${node_connector}    Node:openflow:1,NodeConnector:1
76     set suite Variable    ${portstats}    PORTSTATS
77
78 Init Variables Lithium
79     [Documentation]    Sets variables specific to Lithium version
80     Set Suite Variable    @{CATEGORY}       FlowStats    FlowTableStats    PortStats    QueueStats
81     Set Suite Variable    ${TSDR_PORTSTATS}    tsdr:list PortStats
82     Set Suite Variable    ${CONFIG_INTERVAL}    /restconf/config/TSDRDC:TSDRDCConfig
83     Set Suite Variable    ${OPER_INTERVAL}    /restconf/operations/TSDRDC:setPollingInterval
84     Set Suite Variable    ${default_poll}    180
85     set Suite Variable    ${non_default_poll}    200
86     set Suite Variable    ${node_connector}    openflow:1_1
87     set suite Variable    ${portstats}    InterfaceMetrics
88
89 Initialize the Tsdr Suite
90     COMMENT    Initialize the HBase for TSDR
91     Start Tsdr Suite
92     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_QUERY}
93
94 Verify TSDR Configuration Interval
95     [Arguments]    ${interval}
96     [Documentation]    Verify Configuration interval of TSDR Collection
97     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_INTERVAL}
98     Should Be Equal As Strings    ${resp.status_code}    200
99     Should Contain    ${resp.content}    ${interval}
100
101 Post TSDR Configuration Interval
102     [Arguments]    ${interval}
103     [Documentation]    Configuration TSDR collection interval ${interval}
104     ${p1}    Create Dictionary    interval=${interval}
105     ${p2}    Create Dictionary    input=${p1}
106     ${p2_json}=    json.dumps    ${p2}
107     ${resp}    RequestsLibrary.Post Request    session    ${OPER_INTERVAL}    data=${p2_json}
108     Should Be Equal As Strings    ${resp.status_code}    200