Merge "robot integration tests for router rpc in datastore clustering"
[integration/test.git] / test / csit / suites / karaf-compatible / 040__AD_SAL_NSF_OF13 / 010__switch_manager.txt
1 *** Settings ***
2 Documentation     Test suite for Switch Manager
3 Suite Setup       Create Session    ${ODL_CONTROLLER_SESSION}    http://${CONTROLLER}:${RESTPORT}    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]    adsal
19     Log    ${TOPO_TREE_LEVEL}
20     ${topo_nodes}    Get Nodes From Topology    ${TOPO_TREE_LEVEL}
21     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/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     List Should Contain Sublist   ${nodes}    ${topo_nodes}
26 Check node 1 connectors 
27     [Documentation]    List node connectors and verify all connectors are there
28     [Tags]    adsal
29     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/OF/00:00:00:00:00:00:00:01
30     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
31     Should Contain     ${resp.content}    s1-eth1
32     Should Contain     ${resp.content}    s1-eth2
33 Check node 2 connectors               
34     [Documentation]    List node connectors and verify all connectors are there                      
35     [Tags]    adsal
36     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/OF/00:00:00:00:00:00:00:02
37     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
38     Should Contain     ${resp.content}    s2-eth1             
39     Should Contain     ${resp.content}    s2-eth2  
40     Should Contain     ${resp.content}    s2-eth3
41 Check node 3 connectors               
42     [Documentation]    List node connectors and verify all connectors are there                      
43     [Tags]    adsal
44     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/default/node/OF/00:00:00:00:00:00:00:03
45     Should Be Equal As Strings    ${resp.status_code}    200    Response   status code error
46     Should Contain     ${resp.content}    s3-eth1           
47     Should Contain     ${resp.content}    s3-eth2
48     Should Contain     ${resp.content}    s3-eth3
49 Add property to node
50     [Documentation]    Add a property to node
51     [Tags]    adsal 
52     Add property to node    OF    00:00:00:00:00:00:00:02    description     Switch2
53     Node property should exist    OF    00:00:00:00:00:00:00:02    description    Switch2
54 #Remove property from node
55 #    [Documentation]    Remove a property from node
56 #    Remove property from node    OF    00:00:00:00:00:00:00:02    description
57 #    Node property should not exist    OF    00:00:00:00:00:00:00:02     description    Switch2
58 Add property to nodeconnector
59     [Documentation]    Add a property to nodeconnector
60     [Tags]    adsal 
61     Add property to nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    1000
62     Nodeconnector property should exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
63
64 Remove property from nodeconnector
65     [Documentation]    Remove a property from nodeconnector
66     [Tags]    adsal 
67     Remove property from nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth
68     Nodeconnector property should not exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
69
70 *** Keywords ***
71 Get node
72     [Arguments]    ${node_id}    ${node_type}
73     [Documentation]    Get a specific node
74     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
75     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
76     ${result}    TO JSON    ${resp.content}
77     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
78     ${content}    Extract All Nodes    ${result}
79     Log    ${content}
80     List Should Contain Value    ${content}    ${node}
81
82 Add property to node
83     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
84     [Documentation]    Add property to node
85     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}/${value}
86     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
87
88 Remove property from node
89     [Arguments]    ${node_type}    ${node_id}    ${property}
90     [Documentation]    Remove property from node
91     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}
92     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
93
94 Add property to nodeconnector
95     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
96     [Documentation]    Add property to nodeconnector
97     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}/${value}
98     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
99
100 Remove property from nodeconnector
101     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}
102     [Documentation]    Remove property from nodeconnector
103     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}
104     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
105
106 Node property should exist
107     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
108     [Documentation]    Property of node should exist
109     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
110     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
111     ${result}    TO JSON    ${resp.content}
112     Log    ${result}
113     ${nodes}    Extract All Nodes    ${result}
114     ${property_values}    Extract Node Property Values    ${result}    ${property}
115     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
116     ${property_value}    Create Dictionary    value    ${value}
117     Log    ${property_value}
118     List Should Contain Value    ${nodes}    ${node}
119     List Should Contain Value    ${property_values}    ${property_value}
120
121 Node property should not exist
122     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
123     [Documentation]    Property of node should not exist
124     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
125     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
126     ${result}    TO JSON    ${resp.content}
127     Log    ${result}
128     ${nodes}    Extract All Nodes    ${result}
129     ${properties}    Extract Node Property Values    ${result}    ${property}
130     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
131     ${property}    Create Dictionary    value    ${value}
132     Log    ${property}
133     List Should Contain Value    ${nodes}    ${node}
134     List Should Not Contain Value    ${properties}    ${property}
135
136 Nodeconnector property should exist
137     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
138     [Documentation]    Property of nodeconnector should exist
139     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
140     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
141     ${result}    TO JSON    ${resp.content}
142     Log    ${result}
143     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
144     Log    ${property_values}
145     ${property_value}    Create Dictionary    value    ${value}
146     List Should Contain Value    ${property_values}    ${property_value}
147
148 Nodeconnector property should not exist
149     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
150     [Documentation]    Property of nodeconnector should not exist
151     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
152     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
153     ${result}    TO JSON    ${resp.content}
154     Log    ${result}
155     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
156     Log    ${property_values}
157     ${property_value}    Create Dictionary    value    ${value}
158     List Should not Contain Value    ${property_values}    ${property_value}
159
160 List all nodeconnectors of node
161     [Arguments]    ${node_type}    ${node_id}
162     [Documentation]    List all nodeconnectors and properties of node