Step 1: Move vm scripts to the right place
[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 Library           SSHLibrary
6 Library           Collections
7 Library           String
8 Library           RequestsLibrary
9 Library           ../../../libraries/Common.py
10 Resource          ../../../libraries/KarafKeywords.robot
11 Resource          ../../../libraries/TsdrUtils.robot
12 Variables         ../../../variables/Variables.py
13
14 *** Variables ***
15 @{INTERFACE_METRICS}    TransmittedPackets    TransmittedBytes    TransmitErrors    TransmitDrops    ReceivedPackets    ReceivedBytes    ReceiveOverRunError
16 ...               ReceiveFrameError    ReceiveErrors    ReceiveDrops    ReceiveCrcError    CollisionCount
17 @{CATEGORY}       FlowGroupStats    FlowMeterStats    FlowStats    FlowTableStats    PortStats    QueueStats
18 ${TSDR_PORTSTATS}    tsdr:list PortStats
19 ${CONFIG_INTERVAL}    /restconf/config/TSDRDC:TSDRDCConfig
20 ${OPER_INTERVAL}    /restconf/operations/TSDRDC:setPollingInterval
21
22 *** Test Cases ***
23 Verification of TSDR HBase Feature Installation
24     [Documentation]    Install and Verify the TSDR HBase Features
25     COMMENT    Install a Feature    odl-tsdr-hbase    ${CONTROLLER}    ${KARAF_SHELL_PORT}    60
26     Verify Feature Is Installed    odl-tsdr-hbase
27     Verify Feature Is Installed    odl-tsdr-hbase-persistence
28     Verify Feature Is Installed    odl-hbaseclient
29
30 Verification TSDR Command is exist in Help
31     [Documentation]    Verify the TSDR List command on Help
32     ${output}=    Issue Command On Karaf Console    tsdr\t
33     Should Contain    ${output}    tsdr:list
34     ${output}=    Issue Command On Karaf Console    tsdr:list\t\t
35     : FOR    ${list}    IN    @{CATEGORY}
36     \    Should Contain    ${output}    ${list}
37     Wait Until Keyword Succeeds    620s    1s    Verify the Metric is Collected?    ${TSDR_PORTSTATS}    openflow
38
39 Verification of TSDR PortStats
40     [Documentation]    Verify the TSDR InterfaceMetrics
41     : FOR    ${list}    IN    @{INTERFACE_METRICS}
42     \    ${tsdr_cmd}=    Concatenate the String    ${TSDR_PORTSTATS}    | grep ${list} | head
43     \    ${output}=    Issue Command On Karaf Console    ${tsdr_cmd}    ${CONTROLLER}    ${KARAF_SHELL_PORT}    30
44     \    Should Contain    ${output}    ${list}
45
46 Verification of InterfaceMetrics-Attributes on HBase Client
47     [Documentation]    Verify the InterfaceMetrics has been updated on HBase Datastore
48     : FOR    ${list}    IN    @{INTERFACE_METRICS}
49     \    Verify the Metrics Attributes on Hbase Client    ${list}    openflow:1_1    InterfaceMetrics
50
51 Verify Configuration Interval-change
52     [Documentation]    Verify the TSDR Collection configuration changes
53     Verify TSDR Configuration Interval    180
54     Post TSDR Configuration Interval    200
55     Verify TSDR Configuration Interval    200
56     Post TSDR Configuration Interval    180
57     Verify TSDR Configuration Interval    180
58
59 *** Keywords ***
60 Initialize the Tsdr Suite
61     COMMENT    Initialize the HBase for TSDR
62     Start Tsdr Suite
63     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
64
65 Verify TSDR Configuration Interval
66     [Arguments]    ${interval}
67     [Documentation]    Verify Configuration interval of TSDR Collection
68     ${resp}    RequestsLibrary.Get    session    ${CONFIG_INTERVAL}
69     Should Be Equal As Strings    ${resp.status_code}    200
70     Should Contain    ${resp.content}    ${interval}
71
72 Post TSDR Configuration Interval
73     [Arguments]    ${interval}
74     [Documentation]    Configuration TSDR collection interval ${interval}
75     ${p1}    Create Dictionary    interval    ${interval}
76     ${p2}    Create Dictionary    input    ${p1}
77     ${post_data}    Create Dictionary    setPollingInterval    ${p2}
78     Log    ${post_data}
79     ${resp}    RequestsLibrary.Post    session    ${OPER_INTERVAL}    ${post_data}
80     Should Be Equal As Strings    ${resp.status_code}    201