Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / openflowplugin / MD_SAL_NSF_OF13 / 010_restconf_inventory.robot
1 *** Settings ***
2 Documentation       Test suite for RESTCONF inventory
3
4 Library             Collections
5 Library             RequestsLibrary
6 Library             ../../../libraries/Common.py
7 Variables           ../../../variables/Variables.py
8 Resource            ../../../libraries/Utils.robot
9 Resource            ../../../variables/openflowplugin/Variables.robot
10
11 Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
12 Suite Teardown      Delete All Sessions
13
14
15 *** Variables ***
16 ${VENDOR}               Nicira, Inc.
17 ${HARDWARE}             Open vSwitch
18 @{node_list}            openflow:1    openflow:2    openflow:3
19 ${SW_IPADDRESS}         "flow-node-inventory:ip-address":"${TOOLS_SYSTEM_IP}"
20 ${SW_VENDOR}            "flow-node-inventory:manufacturer":"${VENDOR}"
21 ${SW_HARDWARE}          "flow-node-inventory:hardware":"${HARDWARE}"
22 @{SW_CAPABILITIES}
23 ...                     "flow-node-inventory:flow-feature-capability-flow-stats"
24 ...                     "flow-node-inventory:flow-feature-capability-table-stats"
25 ...                     "flow-node-inventory:flow-feature-capability-port-stats"
26 ...                     "flow-node-inventory:flow-feature-capability-queue-stats"
27
28
29 *** Test Cases ***
30 Get list of nodes
31     [Documentation]    Get the inventory
32     Wait Until Keyword Succeeds
33     ...    10s
34     ...    2s
35     ...    Check For Elements At URI
36     ...    ${RFC8040_OPERATIONAL_NODES_API}
37     ...    ${node_list}
38
39 Check No Link Down
40     [Documentation]    Check there is no link down. We have 8 ports in total: s1=2, s2=3, s3=3.
41     Wait Until Keyword Succeeds
42     ...    10s
43     ...    2s
44     ...    Check For Specific Number Of Elements At URI
45     ...    ${RFC8040_OPERATIONAL_NODES_API}
46     ...    "link-down":false
47     ...    8
48
49 Get node 1 inventory
50     [Documentation]    Get the inventory for a node
51     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:1:1
52     ...    openflow:1:2
53     Wait Until Keyword Succeeds
54     ...    10s
55     ...    2s
56     ...    Check For Elements At URI
57     ...    ${RFC8040_NODES_API}/node=openflow%3A1?${RFC8040_OPERATIONAL_CONTENT}
58     ...    ${list}
59
60 Get node 2 inventory
61     [Documentation]    Get the inventory for a node
62     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:2:1
63     ...    openflow:2:2    openflow:2:3
64     Wait Until Keyword Succeeds
65     ...    10s
66     ...    2s
67     ...    Check For Elements At URI
68     ...    ${RFC8040_NODES_API}/node=openflow%3A2?${RFC8040_OPERATIONAL_CONTENT}
69     ...    ${list}
70
71 Get node 3 inventory
72     [Documentation]    Get the inventory for a node
73     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:3:1
74     ...    openflow:3:2    openflow:3:3
75     Wait Until Keyword Succeeds
76     ...    10s
77     ...    2s
78     ...    Check For Elements At URI
79     ...    ${RFC8040_NODES_API}/node=openflow%3A3?${RFC8040_OPERATIONAL_CONTENT}
80     ...    ${list}
81
82 Link Down
83     [Documentation]    Take link s1-s2 down
84     Write    link s1 s2 down
85     Read Until    mininet>
86     @{list}    Create List    "link-down":true
87     Wait Until Keyword Succeeds
88     ...    10s
89     ...    2s
90     ...    Check For Elements At URI
91     ...    ${RFC8040_NODES_API}/node=openflow%3A1/node-connector=openflow%3A1%3A1?${RFC8040_OPERATIONAL_CONTENT}
92     ...    ${list}
93     Wait Until Keyword Succeeds
94     ...    10s
95     ...    2s
96     ...    Check For Elements At URI
97     ...    ${RFC8040_NODES_API}/node=openflow%3A2/node-connector=openflow%3A2%3A3?${RFC8040_OPERATIONAL_CONTENT}
98     ...    ${list}
99
100 Link Up
101     [Documentation]    Take link s1-s2 up
102     Write    link s1 s2 up
103     Read Until    mininet>
104     @{list}    Create List    "link-down":false
105     Wait Until Keyword Succeeds
106     ...    10s
107     ...    2s
108     ...    Check For Elements At URI
109     ...    ${RFC8040_NODES_API}/node=openflow%3A1/node-connector=openflow%3A1%3A1?${RFC8040_OPERATIONAL_CONTENT}
110     ...    ${list}
111     Wait Until Keyword Succeeds
112     ...    10s
113     ...    2s
114     ...    Check For Elements At URI
115     ...    ${RFC8040_NODES_API}/node=openflow%3A2/node-connector=openflow%3A2%3A3?${RFC8040_OPERATIONAL_CONTENT}
116     ...    ${list}
117
118 Remove Port
119     [Documentation]    Remove port s2-eth1
120     [Tags]    exclude
121     Write    sh ovs-vsctl del-port s2 s2-eth1
122     Read Until    mininet>
123     @{list}    Create List    openflow:2:1
124     Wait Until Keyword Succeeds
125     ...    10s
126     ...    2s
127     ...    Check For Elements Not At URI
128     ...    ${RFC8040_OPERATIONAL_NODES_API}
129     ...    ${list}
130
131 Add Port
132     [Documentation]    Add port s2-eth1, new id 4
133     [Tags]    exclude
134     Write    sh ovs-vsctl add-port s2 s2-eth1
135     Read Until    mininet>
136     @{list}    Create List    openflow:2:4
137     Wait Until Keyword Succeeds
138     ...    10s
139     ...    2s
140     ...    Check For Elements At URI
141     ...    ${RFC8040_OPERATIONAL_NODES_API}
142     ...    ${list}