Step 1: Move vm scripts to the right place
[integration/test.git] / test / tools / Robot_Tool / suites / base / switch_manager.txt
1 *** Settings ***
2 Documentation     Test suite for the switch manager bundle.
3 Suite Setup       Create Session    ${ODL_CONTROLLER_SESSION}    http://${CONTROLLER}:8080    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Library           ../../libraries/Common.py
8 Library           ../../libraries/SwitchManager.py
9 Variables         ../../variables/Variables.py
10 Library           ../../libraries/Topology.py
11
12 *** Variables ***
13 ${REST_CONTEXT}    /controller/nb/v2/switchmanager
14
15 *** Test Cases ***
16 List all nodes
17     [Documentation]    List all nodes and their properties in the network.
18     [Tags]    list_info
19     Log    ${TOPO_TREE_LEVEL}
20     ${topo_nodes}    Get Nodes From Topology    ${TOPO_TREE_LEVEL}
21     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
22     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
23     ${jsondata}=    To JSON    ${resp.content}
24     ${nodes}    Extract All Nodes    ${jsondata}
25     Collection Should Contain    ${nodes}    ${topo_nodes}
26
27 Get a node
28     [Documentation]    Get a node
29     Get node    00:00:00:00:00:00:00:02    OF
30
31 Add property to node
32     [Documentation]    Add a property to node
33     Add property to node    OF    00:00:00:00:00:00:00:02    description    Switch2
34     Node property should exist    OF    00:00:00:00:00:00:00:02    description    Switch2
35
36 Remove property from node
37     [Documentation]    Remove a property from node
38     Remove property from node    OF    00:00:00:00:00:00:00:02    description
39     Node property should not exist    OF    00:00:00:00:00:00:00:02    description    Switch2
40
41 Add property to nodeconnector
42     [Documentation]    Add a property to nodeconnector
43     Add property to nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    1000
44     Nodeconnector property should exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
45
46 Remove property from nodeconnector
47     [Documentation]    Remove a property from nodeconnector
48     Remove property from nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth
49     Nodeconnector property should not exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
50
51 *** Keywords ***
52 Get node
53     [Arguments]    ${node_id}    ${node_type}
54     [Documentation]    Get a specific node
55     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
56     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
57     ${result}    TO JSON    ${resp.content}
58     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
59     ${content}    Extract All Nodes    ${result}
60     Log    ${content}
61     List Should Contain Value    ${content}    ${node}
62
63 Add property to node
64     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
65     [Documentation]    Add property to node
66     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}/${value}
67     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
68
69 Remove property from node
70     [Arguments]    ${node_type}    ${node_id}    ${property}
71     [Documentation]    Remove property from node
72     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}
73     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
74
75 Add property to nodeconnector
76     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
77     [Documentation]    Add property to nodeconnector
78     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}/${value}
79     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
80
81 Remove property from nodeconnector
82     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}
83     [Documentation]    Remove property from nodeconnector
84     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}
85     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
86
87 Node property should exist
88     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
89     [Documentation]    Property of node should exist
90     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
91     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
92     ${result}    TO JSON    ${resp.content}
93     Log    ${result}
94     ${nodes}    Extract All Nodes    ${result}
95     ${property_values}    Extract Node Property Values    ${result}    ${property}
96     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
97     ${property_value}    Create Dictionary    value    ${value}
98     Log    ${property_value}
99     List Should Contain Value    ${nodes}    ${node}
100     List Should Contain Value    ${property_values}    ${property_value}
101
102 Node property should not exist
103     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
104     [Documentation]    Property of node should not exist
105     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
106     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
107     ${result}    TO JSON    ${resp.content}
108     Log    ${result}
109     ${nodes}    Extract All Nodes    ${result}
110     ${properties}    Extract Node Property Values    ${result}    ${property}
111     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
112     ${property}    Create Dictionary    value    ${value}
113     Log    ${property}
114     List Should Contain Value    ${nodes}    ${node}
115     List Should Not Contain Value    ${properties}    ${property}
116
117 Nodeconnector property should exist
118     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
119     [Documentation]    Property of nodeconnector should exist
120     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
121     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
122     ${result}    TO JSON    ${resp.content}
123     Log    ${result}
124     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
125     Log    ${property_values}
126     ${property_value}    Create Dictionary    value    ${value}
127     List Should Contain Value    ${property_values}    ${property_value}
128
129 Nodeconnector property should not exist
130     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
131     [Documentation]    Property of nodeconnector should not exist
132     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
133     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
134     ${result}    TO JSON    ${resp.content}
135     Log    ${result}
136     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
137     Log    ${property_values}
138     ${property_value}    Create Dictionary    value    ${value}
139     List Should not Contain Value    ${property_values}    ${property_value}
140
141 List all nodeconnectors of node
142     [Arguments]    ${node_type}    ${node_id}
143     [Documentation]    List all nodeconnectors and properties of node