Test case 2: OVSDB openflow extension 16/24716/32
authorChaudhry Muhammad Usama <chaudhryusama@gmail.com>
Sun, 2 Aug 2015 12:27:01 +0000 (05:27 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Tue, 18 Aug 2015 06:35:21 +0000 (23:35 -0700)
Use OF1.3 tunnel-id match and action to read VxLAN incoming packet tunnel-id
and write VxLAN outgoing packet tunnel-id.

Restoring original patch...

Change-Id: I0c376568e8bf1e78bdc7d6a626a06eddf183e585
Signed-off-by: Chaudhry Muhammad Usama <chaudhryusama@gmail.com>
test/csit/libraries/OVSDB.robot
test/csit/suites/ovsdb/Southbound_Domain/050__Vxlan_Extension_Tunnel_Test.robot [new file with mode: 0644]
test/csit/variables/ovsdb/add_flow_rule3.xml [new file with mode: 0644]
test/csit/variables/ovsdb/add_flow_rule4.xml [new file with mode: 0644]
test/csit/variables/ovsdb/create_port_key.json [new file with mode: 0644]

index 9e9aac326b16356f416a5d318d4ee5f168b2db0e..7fd901d51f6650f328880be4dd8c0ab126e8c146 100644 (file)
@@ -49,9 +49,9 @@ Delete Bridge From Ovsdb Node
     Should Be Equal As Strings    ${resp.status_code}    200
 
 Add Vxlan To Bridge
-    [Arguments]    ${mininet_ip}    ${bridge_num}    ${vxlan_port}    ${remote_ip}
+    [Arguments]    ${mininet_ip}    ${bridge_num}    ${vxlan_port}    ${remote_ip}    ${custom_port}=create_port.json
     [Documentation]    This request will create vxlan port for vxlan tunnel and attach it to the specific bridge
-    ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/create_port.json
+    ${sample}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/${custom_port}
     ${body}    Replace String    ${sample}    192.168.0.21    ${remote_ip}
     Log    URL is ${SOUTHBOUND_CONFIG_API}${mininet_ip}:${OVSDB_PORT}%2Fbridge%2F${bridge_num}/termination-point/${vxlan_port}/
     ${resp}    RequestsLibrary.Put    session    ${SOUTHBOUND_CONFIG_API}${mininet_ip}:${OVSDB_PORT}%2Fbridge%2F${bridge_num}/termination-point/${vxlan_port}/    data=${body}
diff --git a/test/csit/suites/ovsdb/Southbound_Domain/050__Vxlan_Extension_Tunnel_Test.robot b/test/csit/suites/ovsdb/Southbound_Domain/050__Vxlan_Extension_Tunnel_Test.robot
new file mode 100644 (file)
index 0000000..ce66113
--- /dev/null
@@ -0,0 +1,178 @@
+*** 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           Collections
+Library           SSHLibrary
+Library           RequestsLibrary
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/Utils.txt
+Resource          ../../../libraries/OVSDB.robot
+
+*** Variables ***
+${OVSDB_PORT}     6634
+${OVSDB_CONFIG_DIR}    ${CURDIR}/../../../variables/ovsdb
+@{node_list1}     ovsdb://${MININET1}:${OVSDB_PORT}    ${MININET1}    ${OVSDB_PORT}    ovsdb://${MININET}:${OVSDB_PORT}    ${MININET}    ${OVSDB_PORT}    br-int
+${start1}         sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,1
+${start2}         sudo mn --controller=remote,ip=${CONTROLLER} --switch=ovsk,protocols=OpenFlow13 --custom ovsdb.py --topo host,2
+
+*** Test Cases ***
+Make the OVS instance to listen for connection
+    [Tags]    Southbound
+    Run Command On Remote System    ${MININET1}    sudo ovs-vsctl del-manager
+    Run Command On Remote System    ${MININET1}    sudo ovs-vsctl set-manager ptcp:6634
+    Run Command On Remote System    ${MININET}    sudo ovs-vsctl del-manager
+    Run Command On Remote System    ${MININET}    sudo ovs-vsctl set-manager ptcp:6634
+
+Connect controller to OVSDB Node1 and OVSDB Node2
+    [Documentation]    Initiate the connection to OVSDB node from controller
+    [Tags]    Southbound
+    Connect To Ovsdb Node    ${MININET1}
+    Connect To Ovsdb Node    ${MININET}
+
+Get Operational Topology from OVSDB Node1 and OVSDB Node2
+    [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes
+    [Tags]    Southbound
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list1}
+
+Delete the integration Bridge from OVSDB node 1 and 2 and Verify it
+    [Documentation]    This request will delete the integation bridge node from the OVSDB as we don't need it and verify the operation.
+    [Tags]    Southbound
+    Delete Bridge From Ovsdb Node    ${MININET}    br-int
+    Delete Bridge From Ovsdb Node    ${MININET1}    br-int
+    @{list}    Create List    br-int
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Start the Mininet and create custom topology
+    [Documentation]    This will start mininet with custom topology on both the Virtual Machines
+    [Tags]    Southbound
+    ${conn_id1}    Start Mininet    ${MININET1}    ${start1}    ${OVSDB_CONFIG_DIR}/ovsdb.py
+    Set Global Variable    ${conn_id1}
+    ${conn_id2}    Start Mininet    ${MININET}    ${start2}    ${OVSDB_CONFIG_DIR}/ovsdb.py
+    Set Global Variable    ${conn_id2}
+
+Get Operational Topology with custom topology
+    [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to make sure the mininet created custom topology
+    [Tags]    Southbound
+    @{list}    Create List    s1    s2
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Add the bridge s1 in the config datastore of OVSDB Node1
+    [Documentation]    This request will add already operational bridge to the config data store of the OVSDB node.
+    [Tags]    Southbound
+    Add Bridge To Ovsdb Node    ${MININET1}    s1    0000000000000001
+
+Add the bridge s2 in the config datastore of OVSDB Node2
+    [Documentation]    This request will add already operational bridge to the config data store of the OVSDB node.
+    [Tags]    Southbound
+    Add Bridge To Ovsdb Node    ${MININET}    s2    0000000000000002
+
+Get Config Topology with s1 and s2 Bridges
+    [Documentation]    This will fetch the configuration topology from configuration data store to verify the bridge is added to the config data store
+    [Tags]    Southbound
+    @{list}    Create List    s1    s2
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${CONFIG_TOPO_API}    ${list}
+
+Create Vxlan Port and attach to s1 Bridge
+    [Documentation]    This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s1 of OVSDB node 1
+    [Tags]    Southbound
+    Add Vxlan To Bridge    ${MININET}    s2    vxlanport    ${MININET1}    create_port_key.json
+
+Create Vxlan Port and attach to s2 Bridge
+    [Documentation]    This request will create vxlan port/interface for vxlan tunnel and attach it to the specific bridge s2 of OVSDB node 2
+    [Tags]    Southbound
+    Add Vxlan To Bridge    ${MININET1}    s1    vxlanport    ${MININET}    create_port_key.json
+
+Get Operational Topology with vxlan tunnel
+    [Documentation]    This request will fetch the operational topology from the connected OVSDB nodes to verify that the vxlan tunnel is created
+    [Tags]    Southbound
+    @{list}    Create List    vxlanport    ${MININET1}    ${MININET}
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Add Flow1 Rule for s1 and verify
+    [Documentation]    This request will add flow to the switch and after that verify through the config datastore flow
+    [Tags]    Southbound
+    ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/add_flow_rule3.xml
+    Set Suite Variable    ${body}
+    Log    URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1
+    ${resp}    RequestsLibrary.Put    session    ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1    headers=${HEADERS_XML}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/1    headers=${ACCEPT_XML}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    compare xml    ${body}    ${resp.content}
+
+Add Flow2 Rule for s1 and verify
+    [Documentation]    This request will add flow to the switch and after that verify through the config datastore flow
+    [Tags]    Southbound
+    ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/add_flow_rule4.xml
+    Log    URL is ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2
+    ${resp}    RequestsLibrary.Put    session    ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2    headers=${HEADERS_XML}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_NODES_API}/node/openflow:1/table/0/flow/2    headers=${ACCEPT_XML}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    compare xml    ${body}    ${resp.content}
+
+Get Operational Topology to verify the flows successfully installed in the bridge s1
+    [Documentation]    This request will fetch the operational topology and verify that the flows has been installed in the switch
+    [Tags]    Southbound
+    @{list}    Create List    openflow:1
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Add Flow1 Rule for s2 and verify
+    [Documentation]    This request will add flow to the switch and after that verify through the config datastore flow
+    [Tags]    Southbound
+    ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/add_flow_rule3.xml
+    Log    URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1
+    ${resp}    RequestsLibrary.Put    session    ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1    headers=${HEADERS_XML}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/1    headers=${ACCEPT_XML}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    compare xml    ${body}    ${resp.content}
+
+Add Flow2 Rule for s2 and verify
+    [Documentation]    This request will add flow to the switch and after that verify through the config datastore flow
+    [Tags]    Southbound
+    ${body}    OperatingSystem.Get File    ${OVSDB_CONFIG_DIR}/add_flow_rule4.xml
+    Log    URL is ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2
+    ${resp}    RequestsLibrary.Put    session    ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2    headers=${HEADERS_XML}    data=${body}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${resp}    RequestsLibrary.Get    session    ${CONFIG_NODES_API}/node/openflow:2/table/0/flow/2    headers=${ACCEPT_XML}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    compare xml    ${body}    ${resp.content}
+
+Get Operational Topology to verify the flows successfully installed in the bridge s2
+    [Documentation]    This request will fetch the operational topology and verify that the flows has been installed in the switch
+    [Tags]    Southbound
+    @{list}    Create List    openflow:2
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+
+Ping host2 to IP of host1
+    [Documentation]    This step will verify the functionality of the vxlan tunnel between two OVSDB nodes. Ping h2(10.0.0.2)---> 10.0.0.1 , verify no packet loss
+    Switch Connection    ${conn_id2}
+    SSHLibrary.Write    h2 ping -w 1 10.0.0.1
+    ${result}    Read Until    mininet>
+    Should Contain    ${result}    1 received, 0% packet loss
+
+Cleanup work after test completed
+    [Documentation]    Cleanup/Shutdown work that should be done at the completion of all tests
+    Stop Mininet    ${conn_id2}
+    Stop Mininet    ${conn_id1}
+
+Disconnect controller connection from the connected OVSDBs nodes
+    [Documentation]    This request will disconnect the controller from the connected OVSDB node for clean startup for next suite.
+    [Tags]    Southbound
+    Disconnect From Ovsdb Node    ${MININET}
+    Disconnect From Ovsdb Node    ${MININET1}
+
+Verify that the operational topology is clean
+    [Documentation]    This request will verify the operational toplogy after the mininet is cleaned.
+    [Tags]    Southbound
+    @{list}    Create List    ${MININET}    ${MININET1}    s1    s2
+    Wait Until Keyword Succeeds    8s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
diff --git a/test/csit/variables/ovsdb/add_flow_rule3.xml b/test/csit/variables/ovsdb/add_flow_rule3.xml
new file mode 100644 (file)
index 0000000..2153982
--- /dev/null
@@ -0,0 +1,25 @@
+<flow xmlns="urn:opendaylight:flow:inventory">
+    <priority>2</priority>
+    <flow-name>flow1</flow-name>
+    <match>
+        <tunnel>
+            <tunnel-id>2</tunnel-id>
+        </tunnel>
+        <in-port>openflow:1:2</in-port>
+    </match>
+    <id>1</id>
+    <table_id>0</table_id>
+    <instructions>
+        <instruction>
+            <order>0</order>
+            <apply-actions>
+                <action>
+                    <order>0</order>
+                    <output-action>
+                        <output-node-connector>1</output-node-connector>
+                    </output-action>
+                </action>
+            </apply-actions>
+        </instruction>
+    </instructions>
+</flow>
diff --git a/test/csit/variables/ovsdb/add_flow_rule4.xml b/test/csit/variables/ovsdb/add_flow_rule4.xml
new file mode 100644 (file)
index 0000000..3979987
--- /dev/null
@@ -0,0 +1,32 @@
+<flow xmlns="urn:opendaylight:flow:inventory">
+    <hard-timeout>0</hard-timeout>
+    <idle-timeout>0</idle-timeout>
+    <priority>2</priority>
+    <flow-name>flow2</flow-name>
+    <match>
+        <in-port>openflow:1:1</in-port>
+    </match>
+    <id>2</id>
+    <table_id>0</table_id>
+    <instructions>
+        <instruction>
+            <order>0</order>
+            <apply-actions>
+                <action>
+                    <order>0</order>
+                    <set-field>
+                        <tunnel>
+                            <tunnel-id>2</tunnel-id>
+                        </tunnel>
+                    </set-field>
+                </action>
+                <action>
+                    <order>2</order>
+                    <output-action>
+                        <output-node-connector>2</output-node-connector>
+                    </output-action>
+                </action>
+            </apply-actions>
+        </instruction>
+    </instructions>
+</flow>
diff --git a/test/csit/variables/ovsdb/create_port_key.json b/test/csit/variables/ovsdb/create_port_key.json
new file mode 100644 (file)
index 0000000..8b46afe
--- /dev/null
@@ -0,0 +1,20 @@
+{
+   "network-topology:termination-point": [
+      {
+             "ovsdb:options": [
+                    {
+                  "ovsdb:option": "remote_ip",
+                  "ovsdb:value" : "192.168.0.21"
+                        },
+                        {
+                  "ovsdb:option": "key",
+                  "ovsdb:value" : "flow"
+                        }
+                        ],
+                   "ovsdb:interface-type": "ovsdb:interface-type-vxlan",
+                        "ovsdb:name": "vxlanport",
+                        "tp-id": "vxlanport",
+                        "ofport": 2
+             }
+     ]
+}