Fixing mininet reads so that we always clear mininet
[integration/test.git] / test / csit / suites / sp-of13 / 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]    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}/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]    list_info
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]    list_info
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]    list_info
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     Add property to node    OF    00:00:00:00:00:00:00:02    description     Switch2
52     Node property should exist    OF    00:00:00:00:00:00:00:02    description    Switch2
53 #Remove property from node
54 #    [Documentation]    Remove a property from node
55 #    Remove property from node    OF    00:00:00:00:00:00:00:02    description
56 #    Node property should not exist    OF    00:00:00:00:00:00:00:02     description    Switch2
57 Add property to nodeconnector
58     [Documentation]    Add a property to nodeconnector
59     Add property to nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    1000
60     Nodeconnector property should exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
61
62 Remove property from nodeconnector
63     [Documentation]    Remove a property from nodeconnector
64     Remove property from nodeconnector    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth
65     Nodeconnector property should not exist    OF    00:00:00:00:00:00:00:02    OF    2    bandwidth    ${1000}
66
67 *** Keywords ***
68 Get node
69     [Arguments]    ${node_id}    ${node_type}
70     [Documentation]    Get a specific node
71     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
72     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
73     ${result}    TO JSON    ${resp.content}
74     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
75     ${content}    Extract All Nodes    ${result}
76     Log    ${content}
77     List Should Contain Value    ${content}    ${node}
78
79 Add property to node
80     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
81     [Documentation]    Add property to node
82     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}/${value}
83     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
84
85 Remove property from node
86     [Arguments]    ${node_type}    ${node_id}    ${property}
87     [Documentation]    Remove property from node
88     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}/property/${property}
89     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
90
91 Add property to nodeconnector
92     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
93     [Documentation]    Add property to nodeconnector
94     ${resp}    Put    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}/${value}
95     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
96
97 Remove property from nodeconnector
98     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}
99     [Documentation]    Remove property from nodeconnector
100     ${resp}    Delete    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodeconnector/${node_type}/${node_id}/${nc_type}/${nc_id}/property/${property}
101     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
102
103 Node property should exist
104     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
105     [Documentation]    Property of node should exist
106     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
107     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
108     ${result}    TO JSON    ${resp.content}
109     Log    ${result}
110     ${nodes}    Extract All Nodes    ${result}
111     ${property_values}    Extract Node Property Values    ${result}    ${property}
112     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
113     ${property_value}    Create Dictionary    value    ${value}
114     Log    ${property_value}
115     List Should Contain Value    ${nodes}    ${node}
116     List Should Contain Value    ${property_values}    ${property_value}
117
118 Node property should not exist
119     [Arguments]    ${node_type}    ${node_id}    ${property}    ${value}
120     [Documentation]    Property of node should not exist
121     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/nodes
122     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
123     ${result}    TO JSON    ${resp.content}
124     Log    ${result}
125     ${nodes}    Extract All Nodes    ${result}
126     ${properties}    Extract Node Property Values    ${result}    ${property}
127     ${node}    Create Dictionary    id    ${node_id}    type    ${node_type}
128     ${property}    Create Dictionary    value    ${value}
129     Log    ${property}
130     List Should Contain Value    ${nodes}    ${node}
131     List Should Not Contain Value    ${properties}    ${property}
132
133 Nodeconnector property should exist
134     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
135     [Documentation]    Property of nodeconnector should exist
136     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
137     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
138     ${result}    TO JSON    ${resp.content}
139     Log    ${result}
140     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
141     Log    ${property_values}
142     ${property_value}    Create Dictionary    value    ${value}
143     List Should Contain Value    ${property_values}    ${property_value}
144
145 Nodeconnector property should not exist
146     [Arguments]    ${node_type}    ${node_id}    ${nc_type}    ${nc_id}    ${property}    ${value}
147     [Documentation]    Property of nodeconnector should not exist
148     ${resp}    Get    ${ODL_CONTROLLER_SESSION}    ${REST_CONTEXT}/${CONTAINER}/node/${node_type}/${node_id}
149     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
150     ${result}    TO JSON    ${resp.content}
151     Log    ${result}
152     ${property_values}    Extract Nodeconnector Property Values    ${result}    ${property}
153     Log    ${property_values}
154     ${property_value}    Create Dictionary    value    ${value}
155     List Should not Contain Value    ${property_values}    ${property_value}
156
157 List all nodeconnectors of node
158     [Arguments]    ${node_type}    ${node_id}
159     [Documentation]    List all nodeconnectors and properties of node