Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / suites / ovsdb / Southbound_Domain / 020__connection_manager.robot
1 *** Settings ***
2 Documentation     Test suite for Connection Manager
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           OperatingSystem
6 Library           String
7 Library           RequestsLibrary
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.robot
10
11 *** Variables ***
12 ${OVSDB_PORT}     6634
13 ${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${MININET}:${OVSDB_PORT}
14 ${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
15 @{node_list}      ovsdb://${MININET}:${OVSDB_PORT}    ${MININET}    ${OVSDB_PORT}    br-int
16
17 *** Test Cases ***
18 Connecting an OVS instance to the controller
19     [Tags]    Southbound
20     Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-manager
21     Run Command On Remote System    ${MININET}    sudo ovs-vsctl set-manager tcp:${CONTROLLER}:6640
22
23 Get Operational Topology to verify the ovs instance is connected to the controller
24     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
25     [Tags]    Southbound
26     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
27
28 Get Config Topology
29     [Documentation]    This request will fetch the configuration topology from configuration data store
30     [Tags]    Southbound
31     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
32     Log    ${resp.content}
33     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
34     Should Contain    ${resp.content}    ovsdb://${MININET}:${OVSDB_PORT}/bridge/br-int
35
36 Create bridge manually
37     [Tags]    Southbound
38     Run Command On Remote System    ${MININET}    sudo ovs-vsctl add-br br-s1
39
40 Get Operational Topology to verify the bridge has been added
41     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
42     [Tags]    Southbound
43     @{list}    Create List    br-s1
44     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
45
46 Get Config Topology to verify the manually added bridge is not added to the config datastore
47     [Documentation]    This request will fetch the configuration topology from configuration data store
48     [Tags]    Southbound
49     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
50     Log    ${resp.content}
51     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
52     Should not Contain    ${resp.content}    ovsdb://${MININET}:${OVSDB_PORT}/bridge/br-s1
53
54 Create a Bridge through controller
55     [Documentation]    This will create bridge on the specified OVSDB node.
56     [Tags]    Southbound
57     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
58     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${CONTROLLER}:6633
59     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
60     ${sample3}    Replace String    ${sample2}    br01    br-s2
61     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
62     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-s2
63     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-s2    data=${body}
64     Log    ${resp.content}
65     Should Be Equal As Strings    ${resp.status_code}    200
66
67 Get Operational Topology to verify the bridge has been added through rest call
68     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
69     [Tags]    Southbound
70     @{list}    Create List    br-s2
71     Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
72
73 Get Config Topology to verify the entry added to the config datastore
74     [Documentation]    This request will fetch the configuration topology from configuration data store
75     [Tags]    Southbound
76     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
77     Log    ${resp.content}
78     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
79     Should Contain    ${resp.content}    ovsdb://${MININET}:${OVSDB_PORT}/bridge/br-s2
80
81 Create bridge of already added bridge
82     [Documentation]    This will add bridge to the config datastore
83     [Tags]    Southbound
84     ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_bridge.json
85     ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6633    tcp:${CONTROLLER}:6633
86     ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
87     ${sample3}    Replace String    ${sample2}    br01    br-s1
88     ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
89     Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-s1
90     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-s1    data=${body}
91     Log    ${resp.content}
92     Should Be Equal As Strings    ${resp.status_code}    200
93
94 Get Config Topology to verify the entry of existing bridge added to the config datastore
95     [Documentation]    This request will fetch the configuration topology from configuration data store
96     [Tags]    Southbound
97     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
98     Log    ${resp.content}
99     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
100     Should Contain    ${resp.content}    ovsdb://${MININET}:${OVSDB_PORT}/bridge/br-s1
101
102 Delete bridge manually
103     [Tags]    Southbound
104     Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-br br-s2
105
106 Get Operational Topology to verify the bridge has been deleted manually
107     [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
108     [Tags]    Southbound
109     @{list}    Create List    br-s2
110     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
111
112 Get Config Topology to verify the entry deleted from the config datastore
113     [Documentation]    This request will fetch the configuration topology from configuration data store
114     [Tags]    Southbound
115     ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
116     Log    ${resp.content}
117     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
118     Should not Contain    ${resp.content}    ovsdb://${MININET}:${OVSDB_PORT}/bridge/br-s2
119
120 Delete the Bridge through rest call
121     [Documentation]    This request will delete the bridge node from the config data store.
122     [Tags]    Southbound
123     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-s1
124     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
125
126 Get Operational Topology after Deletion of Bridge
127     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
128     [Tags]    Southbound
129     @{list}    Create List    br-s1
130     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
131
132 Delete the integration Bridge
133     [Documentation]    This request will delete the bridge node from the config data store.
134     [Tags]    Southbound
135     ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2Fbr-int
136     Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
137
138 Get Operational Topology after Deletion of integration Bridge
139     [Documentation]    This request will fetch the operational topology after the Bridge is deleted
140     [Tags]    Southbound
141     @{list}    Create List    br-int    br-s1
142     Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}