Step 2: Move test folder to root
[integration/test.git] / csit / suites / openflowplugin / MD_SAL_NSF_OF10 / 010__restconf_inventory.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF inventory
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.robot
10
11 *** Variables ***
12 ${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
13 ${VENDOR}         Nicira, Inc.
14 ${HARDWARE}       Open vSwitch
15 @{node_list}      openflow:1    openflow:2    openflow:3
16
17 *** Test Cases ***
18 Get list of nodes
19     [Documentation]    Get the inventory
20     Set Suite Variable    ${SW_IPADDRESS}    "flow-node-inventory:ip-address":"${MININET}"
21     Set Suite Variable    ${SW_VENDOR}    "flow-node-inventory:manufacturer":"${VENDOR}"
22     Set Suite Variable    ${SW_HARDWARE}    "flow-node-inventory:manufacturer":"${HARDWARE}"
23     Set Suite Variable    @{SW_CAPABILITIES}    "flow-node-inventory:flow-feature-capability-flow-stats"    "flow-node-inventory:flow-feature-capability-table-stats"    "flow-node-inventory:flow-feature-capability-port-stats"    "flow-node-inventory:flow-feature-capability-queue-stats"
24     Wait Until Keyword Succeeds    30s    2s    Ensure All Nodes Are In Response    ${REST_CONTEXT}    ${node_list}
25     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
26     Log    ${resp.content}
27
28 Get node 1 inventory
29     [Documentation]    Get the inventory for a node
30     @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:1:1
31     ...    openflow:1:2
32     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1    ${list}
33
34 Get node 2 inventory
35     [Documentation]    Get the inventory for a node
36     @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:2:1
37     ...    openflow:2:2    openflow:2:3
38     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2    ${list}
39
40 Get node 3 inventory
41     [Documentation]    Get the inventory for a node
42     @{list}    Append To List    ${SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:3:1
43     ...    openflow:3:2    openflow:3:3
44     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:3    ${list}
45
46 Link Down
47     [Documentation]    Take link s1-s2 down
48     Write    link s1 s2 down
49     Read Until    mininet>
50     @{list}    Create List    "link-down":true
51     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1/node-connector/openflow:1:1    ${list}
52     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2/node-connector/openflow:2:3    ${list}
53
54 Link Up
55     [Documentation]    Take link s1-s2 up
56     Write    link s1 s2 up
57     Read Until    mininet>
58     @{list}    Create List    "link-down":false
59     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:1/node-connector/openflow:1:1    ${list}
60     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}/node/openflow:2/node-connector/openflow:2:3    ${list}
61
62 Remove Port
63     [Documentation]    Remove port s2-eth1
64     Write    sh ovs-vsctl del-port s2 s2-eth1
65     Read Until    mininet>
66     @{list}    Create List    openflow:2:1
67     Wait Until Keyword Succeeds    30s    2s    Check For Elements Not At URI    ${REST_CONTEXT}    ${list}
68
69 Add Port
70     [Documentation]    Add port s2-eth1, new id 4
71     Write    sh ovs-vsctl add-port s2 s2-eth1
72     Read Until    mininet>
73     @{list}    Create List    openflow:2:4
74     Wait Until Keyword Succeeds    30s    2s    Check For Elements At URI    ${REST_CONTEXT}    ${list}