Merge "Improve OF13 test - 2nd try"
[integration/test.git] / test / csit / suites / base-of13 / 115__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/Topologynew.py
11
12 *** Variables ***
13 ${REST_CONTEXT}    /controller/nb/v2/switchmanager
14
15 *** Test Cases ***
16
17 List all nodes
18     [Documentation]    List all nodes and their properties in the network.
19     [Tags]    list_info
20     Log    ${TOPO_TREE_LEVEL}
21     ${topo_nodes}    Get Nodes From Topology    ${TOPO_TREE_LEVEL}
22     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/nodes
23     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
24     ${jsondata}=    To JSON    ${resp.content}
25     ${nodes}    Extract All Nodes    ${jsondata}
26     List Should Contain Sublist   ${nodes}    ${topo_nodes}
27 Check node 1 connectors 
28     [Documentation]    List node connectors and verify all connectors are there
29     [Tags]    list_info
30     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/MD_SAL/openflow:1
31     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
32     Should Contain     ${resp.content}    openflow:1:1
33     Should Contain     ${resp.content}    openflow:1:2
34 Check node 2 connectors               
35     [Documentation]    List node connectors and verify all connectors are there                      
36     [Tags]    list_info
37     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/MD_SAL/openflow:2
38     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
39     Should Contain     ${resp.content}    openflow:2:1              
40     Should Contain     ${resp.content}    openflow:2:2  
41     Should Contain     ${resp.content}    openflow:2:3
42 Check node 3 connectors               
43     [Documentation]    List node connectors and verify all connectors are there                      
44     [Tags]    list_info
45     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/MD_SAL/openflow:3
46     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
47     Should Contain     ${resp.content}    openflow:3:1              
48     Should Contain     ${resp.content}    openflow:3:2  
49     Should Contain     ${resp.content}    openflow:3:3
50 Add property to node
51     [Documentation]    Add a property to node
52     Add property to node    MD_SAL    openflow:2    description     Switch2
53     Node property should exist    MD_SAL    openflow:2    description    Switch2
54 #    Standing bug #335
55 #Remove property from node
56 #    [Documentation]    Remove a property from node
57 #    Remove property from node    MD_SAL    openflow:2    description
58 #    Node property should not exist    MD_SAL    openflow:2     description    Switch2
59 Add property to nodeconnector
60     [Documentation]    Add a property to nodeconnector
61     Add property to nodeconnector    MD_SAL    openflow:2    MD_SAL    openflow:2:2    bandwidth    1000
62     Nodeconnector property should exist    MD_SAL    openflow:2    MD_SAL    openflow:2:2    bandwidth    ${1000}
63 Remove property from nodeconnector
64     [Documentation]    Remove a property from nodeconnector
65     Remove property from nodeconnector    MD_SAL    openflow:2    MD_SAL    openflow:2:2    bandwidth
66     Nodeconnector property should not exist    MD_SAL    openflow:2    MD_SAL    openflow:2:2    bandwidth    ${1000}
67
68 *** Keywords ***
69 Get node
70     [Arguments]    ${node_id}    ${node_type}
71     [Documentation]    Get a specific node
72     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/nodes
73     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
74     ${result}    TO JSON    ${resp.content}
75     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
76     ${content}    Extract All Nodes    ${result}
77     Log    ${content}
78     List Should Contain Value    ${content}    ${node}
79
80 Add property to node
81     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
82     [Documentation]    Add property to node
83     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}/${value}
84     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
85
86 Remove property from node
87     [Arguments]    ${node_type}    ${node_id}    ${property}
88     [Documentation]    Remove property from node
89     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}
90     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
91
92 Add property to nodeconnector
93     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
94     [Documentation]    Add property to nodeconnector
95     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}/${value}
96     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
97
98 Remove property from nodeconnector
99     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}
100     [Documentation]    Remove property from nodeconnector
101     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}
102     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
103
104 Node property should exist
105     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
106     [Documentation]    Property of node should exist
107     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
108     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
109     ${result}    TO JSON    ${resp.content}
110     Log    ${result}
111     ${nodes}    Extract All Nodes    ${result}
112     ${property_values}    Extract Node Property Values    ${result}    ${property}
113     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
114     ${property_value}    Create Dictionary    value    ${value}
115     Log    ${property_value}
116     List Should Contain Value    ${nodes}    ${node}
117     List Should Contain Value    ${property_values}    ${property_value}
118
119 Node property should not exist
120     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
121     [Documentation]    Property of node should not exist
122     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
123     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
124     ${result}    TO JSON    ${resp.content}
125     Log    ${result}
126     ${nodes}    Extract All Nodes    ${result}
127     ${properties}    Extract Node Property Values    ${result}    ${property}
128     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
129     ${property}    Create Dictionary    value    ${value}
130     Log    ${property}
131     List Should Contain Value    ${nodes}    ${node}
132     List Should Not Contain Value    ${properties}    ${property}
133
134 Nodeconnector property should exist
135     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
136     [Documentation]    Property of nodeconnector should exist
137     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
138     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
139     ${result}    TO JSON    ${resp.content}
140     Log    ${result}
141     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
142     Log    ${property_values}
143     ${property_value}    Create Dictionary    value    ${value}
144     List Should Contain Value    ${property_values}    ${property_value}
145
146 Nodeconnector property should not exist
147     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
148     [Documentation]    Property of nodeconnector should not exist
149     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
150     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
151     ${result}    TO JSON    ${resp.content}
152     Log    ${result}
153     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
154     Log    ${property_values}
155     ${property_value}    Create Dictionary    value    ${value}
156     List Should not Contain Value    ${property_values}    ${property_value}
157
158 List all nodeconnectors of node
159     [Arguments]    ${node_type}    ${node_id}
160     [Documentation]    List all nodeconnectors and properties of node