Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / lacp / Lacp_Feature_OF13 / 010__lacp_inventory.robot
1 *** Settings ***
2 Documentation       Test suite for RESTCONF LACP inventory
3
4 Library             SSHLibrary
5 Library             Collections
6 Library             RequestsLibrary
7 Library             ../../../libraries/Common.py
8 Variables           ../../../variables/Variables.py
9
10 Suite Setup         LACP Inventory Suite Setup
11 Suite Teardown      Delete All Sessions
12
13
14 *** Variables ***
15 ${node1}                    openflow:1
16 ${agg-id1}                  1
17 ${agg-id2}                  2
18 ${agg1-connector-id1}       1
19 ${agg1-connector-id2}       2
20 ${agg2-connector-id1}       3
21 ${agg2-connector-id2}       4
22
23
24 *** Test Cases ***
25 Get the Specific Node Inventory and Lacp aggregator details
26     [Documentation]    Get the lacp-aggregator data for specific node
27     ${resp}    Get Request    session    ${OPERATIONAL_NODES_API}/node/${node1}
28     Verify LACP RESTAPI Response Code for node    ${resp}
29     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    ${agg-id1}
30     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    ${agg-id2}
31
32 Get information of each lacp-aggregator for a node
33     [Documentation]    Get each lacp-aggregator data for a node
34     ${resp}    Get Request    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id1}
35     Verify LACP RESTAPI Response Code for node    ${resp}
36     Verify LACP connector associated for aggregator    ${resp.content}    ${node1}    ${agg1-connector-id1}
37     Verify LACP connector associated for aggregator    ${resp.content}    ${node1}    ${agg1-connector-id2}
38     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
39     ${resp}    Get Request    session    ${OPERATIONAL_NODES_API}/node/${node1}/lacp-aggregators/${agg-id2}
40     Verify LACP RESTAPI Response Code for node    ${resp}
41     Verify LACP connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id1}
42     Verify LACP connector associated for aggregator    ${resp.content}    ${node1}    ${agg2-connector-id2}
43     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lag-groupid
44
45 Get node connector data for node 1
46     [Documentation]    Get the node connector inventory for node 1
47     ${resp}    Get Request
48     ...    session
49     ...    ${OPERATIONAL_NODES_API}/node/${node1}/node-connector/${node1}:${agg1-connector-id1}
50     Verify LACP RESTAPI Response Code for node    ${resp}
51     Verify specific LACP node connector data for node    ${resp.content}    ${agg-id1}    agg-id
52     ${resp}    Get Request
53     ...    session
54     ...    ${OPERATIONAL_NODES_API}/node/${node1}/node-connector/${node1}:${agg1-connector-id2}
55     Verify LACP RESTAPI Response Code for node    ${resp}
56     Verify specific LACP node connector data for node    ${resp.content}    ${agg-id1}    agg-id
57     ${resp}    Get Request
58     ...    session
59     ...    ${OPERATIONAL_NODES_API}/node/${node1}/node-connector/${node1}:${agg2-connector-id1}
60     Verify LACP RESTAPI Response Code for node    ${resp}
61     Verify specific LACP node connector data for node    ${resp.content}    ${agg-id2}    agg-id
62     ${resp}    Get Request
63     ...    session
64     ...    ${OPERATIONAL_NODES_API}/node/${node1}/node-connector/${node1}:${agg2-connector-id2}
65     Verify LACP RESTAPI Response Code for node    ${resp}
66     Verify specific LACP node connector data for node    ${resp.content}    ${agg-id2}    agg-id
67
68
69 *** Keywords ***
70 Verify LACP RESTAPI Response Code for node
71     [Documentation]    Will check for the response code of the REST query
72     [Arguments]    ${resp}
73     Should Be Equal As Strings    ${resp.status_code}    200
74     Should Contain    ${resp.content}    ${node1}
75
76 Verify LACP RESTAPI Aggregator and Tag Contents
77     [Documentation]    Will check for the LACP Specific tags or Aggregator ID for node
78     [Arguments]    ${resp.content}    ${content-lookup}
79     Should Contain    ${resp.content}    ${content-lookup}
80
81 Verify LACP connector associated for aggregator
82     [Documentation]    Will check for the LACP connector info for each aggregator
83     [Arguments]    ${resp.content}    ${node}    ${agg-connector-id}
84     Should Contain    ${resp.content}    ${node}:${agg-connector-id}
85
86 Verify specific LACP node connector data for node
87     [Documentation]    Will check for node connectory info for node
88     [Arguments]    ${resp.content}    ${agg-id}    ${connector}
89     Should Contain    ${resp.content}    ${connector}='${agg-id}'
90
91 Verify LACP Tags Are Formed
92     [Documentation]    Fundamental Check That LACP is working
93     ${resp}    Get Request    session    ${OPERATIONAL_NODES_API}
94     Verify LACP RESTAPI Response Code for node    ${resp}
95     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    non-lag-groupid
96     Verify LACP RESTAPI Aggregator and Tag Contents    ${resp.content}    lacp-aggregators
97
98 LACP Inventory Suite Setup
99     [Documentation]    If these basic checks fail, there is no need to continue any of the other test cases
100     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
101     Wait Until Keyword Succeeds    10s    1s    Verify LACP Tags Are Formed