Fix python3 issues in OFP
[integration/test.git] / csit / suites / openflowplugin / MD_SAL_NSF_OF13 / 010_restconf_inventory.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF inventory
3 Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${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 ${VENDOR}         Nicira, Inc.
13 ${HARDWARE}       Open vSwitch
14 @{node_list}      openflow:1    openflow:2    openflow:3
15 ${SW_IPADDRESS}    "flow-node-inventory:ip-address":"${TOOLS_SYSTEM_IP}"
16 ${SW_VENDOR}      "flow-node-inventory:manufacturer":"${VENDOR}"
17 ${SW_HARDWARE}    "flow-node-inventory:hardware":"${HARDWARE}"
18 @{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"
19
20 *** Test Cases ***
21 Get list of nodes
22     [Documentation]    Get the inventory
23     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}    ${node_list}
24
25 Check No Link Down
26     [Documentation]    Check there is no link down. We have 8 ports in total: s1=2, s2=3, s3=3.
27     Wait Until Keyword Succeeds    10s    2s    Check For Specific Number Of Elements At URI    ${OPERATIONAL_NODES_API}    "link-down":false    8
28
29 Get node 1 inventory
30     [Documentation]    Get the inventory for a node
31     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:1:1
32     ...    openflow:1:2
33     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:1    ${list}
34
35 Get node 2 inventory
36     [Documentation]    Get the inventory for a node
37     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:2:1
38     ...    openflow:2:2    openflow:2:3
39     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:2    ${list}
40
41 Get node 3 inventory
42     [Documentation]    Get the inventory for a node
43     ${list}    Create List    @{SW_CAPABILITIES}    ${SW_VENDOR}    ${SW_IPADDRESS}    ${SW_HARDWARE}    openflow:3:1
44     ...    openflow:3:2    openflow:3:3
45     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:3    ${list}
46
47 Link Down
48     [Documentation]    Take link s1-s2 down
49     Write    link s1 s2 down
50     Read Until    mininet>
51     @{list}    Create List    "link-down":true
52     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:1/node-connector/openflow:1:1    ${list}
53     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:2/node-connector/openflow:2:3    ${list}
54
55 Link Up
56     [Documentation]    Take link s1-s2 up
57     Write    link s1 s2 up
58     Read Until    mininet>
59     @{list}    Create List    "link-down":false
60     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:1/node-connector/openflow:1:1    ${list}
61     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}/node/openflow:2/node-connector/openflow:2:3    ${list}
62
63 Remove Port
64     [Documentation]    Remove port s2-eth1
65     [Tags]    exclude
66     Write    sh ovs-vsctl del-port s2 s2-eth1
67     Read Until    mininet>
68     @{list}    Create List    openflow:2:1
69     Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${OPERATIONAL_NODES_API}    ${list}
70
71 Add Port
72     [Documentation]    Add port s2-eth1, new id 4
73     [Tags]    exclude
74     Write    sh ovs-vsctl add-port s2 s2-eth1
75     Read Until    mininet>
76     @{list}    Create List    openflow:2:4
77     Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_NODES_API}    ${list}