Robot Test Suites for Southbound API.
authorChaudhry Usama <chaudhryusama@gmail.com>
Thu, 21 May 2015 16:00:53 +0000 (09:00 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 29 May 2015 16:44:41 +0000 (16:44 +0000)
Change-Id: If9c9556ef820d743c4957820c03542949d7cc35b
Signed-off-by: Chaudhry Usama <chaudhryusama@gmail.com>
test/csit/suites/ovsdb/Southbound_Domain/010__connection_manager.robot [new file with mode: 0644]
test/csit/suites/ovsdb/Southbound_Domain/020__configure_1_ovsdb_node.robot [new file with mode: 0644]
test/csit/variables/Variables.py
test/csit/variables/ovsdb/connect.json [new file with mode: 0644]
test/csit/variables/ovsdb/create_bridge.json [new file with mode: 0644]
test/csit/variables/ovsdb/create_port.json [new file with mode: 0644]

diff --git a/test/csit/suites/ovsdb/Southbound_Domain/010__connection_manager.robot b/test/csit/suites/ovsdb/Southbound_Domain/010__connection_manager.robot
new file mode 100644 (file)
index 0000000..68f2d74
--- /dev/null
@@ -0,0 +1,51 @@
+*** Settings ***
+Documentation     Test suite for Connection Manager
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           OperatingSystem
+Library           String
+Library           RequestsLibrary
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
+
+*** Variables ***
+${OVSDB_PORT}     6644
+${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${MININET}:${OVSDB_PORT}
+${FILE}           ${CURDIR}/../../../variables/ovsdb
+@{node_list}      ovsdb://${MININET}:${OVSDB_PORT}    ${MININET}    ${OVSDB_PORT}
+
+*** Test Cases ***
+Connect to OVSDB Node
+    [Documentation]    Initiate the connection to OVSDB node from controller
+    [Tags]    Southbound
+    ${sample}    OperatingSystem.Get File    ${FILE}/connect.json
+    ${sample1}    Replace String    ${sample}    127.0.0.1    ${MININET}
+    ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
+    Log    URL is ${SOUTHBOUND_CONFIG_API}
+    ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get Config Topology
+    [Documentation]    This will fetch the configuration topology from configuration data store
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Should Contain    ${resp.content}    ${MININET}:${OVSDB_PORT}
+
+Get Operational Topology
+    [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
+    [Tags]    Southbound
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
+
+Delete the OVSDB Node
+    [Documentation]    This request will delete the OVSDB node
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+
+Get Operational Topology after Deletion
+    [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
+    [Tags]    Southbound
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
diff --git a/test/csit/suites/ovsdb/Southbound_Domain/020__configure_1_ovsdb_node.robot b/test/csit/suites/ovsdb/Southbound_Domain/020__configure_1_ovsdb_node.robot
new file mode 100644 (file)
index 0000000..6b152db
--- /dev/null
@@ -0,0 +1,105 @@
+*** Settings ***
+Documentation     Test suite for Connection Manager
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           OperatingSystem
+Library           String
+Library           RequestsLibrary
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
+
+*** Variables ***
+${OVSDB_PORT}     6644
+${BRIDGE}         br01
+${SOUTHBOUND_CONFIG_API}    ${CONFIG_TOPO_API}/topology/ovsdb:1/node/ovsdb:%2F%2F${MININET}:${OVSDB_PORT}
+${FILE}           ${CURDIR}/../../../variables/ovsdb
+
+*** Test Cases ***
+Connect to OVSDB Node
+    [Documentation]    Initiate the connection to OVSDB node from controller
+    [Tags]    Southbound
+    ${sample}    OperatingSystem.Get File    ${FILE}/connect.json
+    ${sample1}    Replace String    ${sample}    127.0.0.1    ${MININET}
+    ${body}    Replace String    ${sample1}    61644    ${OVSDB_PORT}
+    Log    URL is ${SOUTHBOUND_CONFIG_API}
+    ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Create a Bridge
+    [Documentation]    This will create bridge on the specified OVSDB node.
+    [Tags]    Southbound
+    ${sample}    OperatingSystem.Get File    ${FILE}/create_bridge.json
+    ${sample1}    Replace String    ${sample}    tcp:127.0.0.1:6630    tcp:${CONTROLLER}:6633
+    ${sample2}    Replace String    ${sample1}    127.0.0.1    ${MININET}
+    ${sample3}    Replace String    ${sample2}    br01    ${BRIDGE}
+    ${body}    Replace String    ${sample3}    61644    ${OVSDB_PORT}
+    Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
+    ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get Config Topology with Bridge
+    [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the data store
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_TOPO_API}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+    Should Contain    ${resp.content}    ${BRIDGE}
+
+Get Operational Topology with Bridge
+    [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify the bridge is added to the data store
+    [Tags]    Southbound
+    @{list}    Create List    ${BRIDGE}
+    Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Create Port and attach to a Bridge
+    [Documentation]    This request will creates port/interface and attach it to the specific bridge
+    [Tags]    Southbound
+    ${body}    OperatingSystem.Get File    ${FILE}/create_port.json
+    Log    URL is ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
+    ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get Operational Topology with Port
+    [Documentation]    This request will fetch the operational topology after the Port is added to the bridge
+    [Tags]    Southbound
+    @{list}    Create List    ${BRIDGE}    vxlanport
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Delete the Port
+    [Documentation]    This request will delete the port node from the bridge node and data store.
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}/termination-point/vxlanport/
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+
+Get Operational Topology after Deletion of Port
+    [Documentation]    This request will fetch the operational topology after the Port is deleted
+    [Tags]    Southbound
+    @{list}    Create List    vxlanport
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Delete the Bridge
+    [Documentation]    This request will delete the bridge node from the config data store.
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}%2Fbridge%2F${BRIDGE}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+
+Get Operational Topology after Deletion of Bridge
+    [Documentation]    This request will fetch the operational topology after the Bridge is deleted
+    [Tags]    Southbound
+    @{list}    Create List    ${BRIDGE}    vxlanport
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Delete the OVSDB Node
+    [Documentation]    This request will delete the OVSDB node
+    [Tags]    Southbound
+    ${resp}    RequestsLibrary.Delete    session    ${SOUTHBOUND_CONFIG_API}
+    Should Be Equal As Strings    ${resp.status_code}    200    Response    status code error
+
+Get Operational Topology after Deletion of OVSDB Node
+    [Documentation]    This request will fetch the operational topology after the OVSDB node is deleted
+    [Tags]    Southbound
+    @{list}    Create List    ovsdb://${MININET}:${OVSDB_PORT}    ${BRIDGE}    vxlanport
+    Wait Until Keyword Succeeds    6s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
index d22b970857b9183a9baac91e903faf487e8063d3..e60d51439487f71b9ce9aeabb32f97497fe08dcf 100644 (file)
@@ -70,6 +70,7 @@ PORTS = 'ports/detail.json'
 CONFIG_NODES_API = '/restconf/config/opendaylight-inventory:nodes'
 OPERATIONAL_NODES_API = '/restconf/operational/opendaylight-inventory:nodes'
 OPERATIONAL_TOPO_API = '/restconf/operational/network-topology:network-topology'
+CONFIG_TOPO_API = '/restconf/config/network-topology:network-topology'
 CONTROLLER_CONFIG_MOUNT = ('/restconf/config/network-topology:network-topology/topology'
                            '/topology-netconf/node/controller-config/yang-ext:mount')
 
diff --git a/test/csit/variables/ovsdb/connect.json b/test/csit/variables/ovsdb/connect.json
new file mode 100644 (file)
index 0000000..a192497
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "network-topology:node": [
+        {
+              "node-id": "ovsdb://127.0.0.1:61644",
+              "connection-info": {
+                  "ovsdb:remote-port": 61644,
+                  "ovsdb:remote-ip": "127.0.0.1"
+              }
+        }
+    ]
+}
diff --git a/test/csit/variables/ovsdb/create_bridge.json b/test/csit/variables/ovsdb/create_bridge.json
new file mode 100644 (file)
index 0000000..55f4660
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "network-topology:node": [
+        {
+            "node-id": "ovsdb://127.0.0.1:61644/bridge/br01",
+             "ovsdb:bridge-name": "br01",
+             "ovsdb:datapath-id": "00:00:b2:ff:ff:25:f2:4b",
+             "ovsdb:protocol-entry": [
+                {
+                  "protocol": "ovsdb:ovsdb-bridge-protocol-openflow-13"
+                }
+              ],
+              "ovsdb:controller-entry": [
+                {
+                  "target": "tcp:127.0.0.1:6630"
+                }
+              ],
+             "ovsdb:managed-by": "/network-topology:network-topology/network-topology:topology[network-topology:topology-id='ovsdb:1']/network-topology:node[network-topology:node-id='ovsdb://127.0.0.1:61644']"
+        }
+    ]
+}
diff --git a/test/csit/variables/ovsdb/create_port.json b/test/csit/variables/ovsdb/create_port.json
new file mode 100644 (file)
index 0000000..77bfbb2
--- /dev/null
@@ -0,0 +1,25 @@
+{
+    "network-topology:termination-point": [
+        {
+            "ovsdb:options": [
+                      {
+                          "ovsdb:option": "remote_ip",
+                          "ovsdb:value" : "10.10.11.11"
+                      }
+                         ],
+                "ovsdb:name": "vxlanport",
+                "ovsdb:interface-type": "ovsdb:interface-type-vxlan",
+                         "tp-id": "vxlanport",
+                 "vlan-tag": "1",
+                 "trunks": [
+                {
+                    "trunk": "2"
+                },
+                {
+                    "trunk": "3"
+                }
+             ],
+             "vlan-mode":"access"
+                }
+    ]
+}