Integration tests for the new l2switch project, released in Helium.
authorAlex Fan <railor33@gmail.com>
Fri, 1 Aug 2014 00:51:01 +0000 (17:51 -0700)
committerAlex Fan <railor33@gmail.com>
Fri, 1 Aug 2014 18:16:45 +0000 (11:16 -0700)
Change-Id: Ie0fcfa6d48167538b85719e06ace209ec67832a1
Signed-off-by: Alex Fan <railor33@gmail.com>
test/csit/suites/l2switch/010__AddressTracking_OF13/010__restconf_inv_addresses.txt [new file with mode: 0644]
test/csit/suites/l2switch/010__AddressTracking_OF13/__init__.txt [new file with mode: 0644]
test/csit/suites/l2switch/020__FlowProgramming_OF13/010__restconf_inv_flows.txt [new file with mode: 0644]
test/csit/suites/l2switch/020__FlowProgramming_OF13/__init__.txt [new file with mode: 0644]
test/csit/suites/l2switch/030__LoopRemoval_OF13/010__loop_of_3.txt [new file with mode: 0644]
test/csit/suites/l2switch/030__LoopRemoval_OF13/020__ping.txt [new file with mode: 0644]
test/csit/suites/l2switch/030__LoopRemoval_OF13/__init__.txt [new file with mode: 0644]
test/csit/suites/l2switch/topologies/loop.py [new file with mode: 0644]

diff --git a/test/csit/suites/l2switch/010__AddressTracking_OF13/010__restconf_inv_addresses.txt b/test/csit/suites/l2switch/010__AddressTracking_OF13/010__restconf_inv_addresses.txt
new file mode 100644 (file)
index 0000000..5b1f6ce
--- /dev/null
@@ -0,0 +1,74 @@
+*** Settings ***
+Documentation     Test suite for AddressObservations in RESTCONF inventory
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+${IP_1}           "10.0.0.1"
+${IP_2}           "10.0.0.2"
+${IP_3}           "10.0.0.3"
+
+*** Test Cases ***
+Get list of nodes
+    [Documentation]    Get the inventory, should not contain address observations
+        ${resp}    Get    session    ${REST_CONTEXT}
+        Should Be Equal As Strings    ${resp.status_code}    200
+        Should Contain     ${resp.content}     openflow:1
+        Should Contain     ${resp.content}     openflow:2
+        Should Contain     ${resp.content}     openflow:3
+        Should Contain X Times    ${resp.content}   forwarding  4
+        Should Not Contain    ${resp.content}    ${IP_1}
+        Should Not Contain    ${resp.content}    ${IP_2}
+        Should Not Contain    ${resp.content}    ${IP_3}
+
+Ping All
+    [Documentation]    Pingall, verify no packet loss
+    [Tags]   Get
+        Write   pingall
+        Sleep   5
+        ${result}    Read
+        Should Contain   ${result}   0% dropped
+        Should Not Contain    ${result}    X
+
+Get node 1 addresses
+    [Documentation]    Get the address observations for node 1
+        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:1
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      openflow:1:1
+        Should Contain     ${resp.content}      openflow:1:2
+        Should Contain     ${resp.content}      address-tracker:addresses
+        Should Contain X Times    ${resp.content}   ${IP_1}  1
+        Should Contain X Times    ${resp.content}   ${IP_2}  1
+        Should Contain X Times    ${resp.content}   ${IP_3}  1
+
+Get node 2 addresses
+    [Documentation]    Get the address observations for node 2
+        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:2
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      openflow:2:1
+        Should Contain     ${resp.content}      openflow:2:2
+        Should Contain     ${resp.content}      openflow:2:3
+        Should Contain     ${resp.content}      address-tracker:addresses
+        Should Contain X Times    ${resp.content}   ${IP_1}  1
+        Should Contain X Times    ${resp.content}   ${IP_2}  1
+        Should Contain X Times    ${resp.content}   ${IP_3}  1
+
+Get node 3 addresses
+    [Documentation]    Get the address observations for node 3
+       ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:3
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}     openflow:3:1
+        Should Contain     ${resp.content}     openflow:3:2
+        Should Contain     ${resp.content}      address-tracker:addresses
+        Should Contain X Times    ${resp.content}   ${IP_1}  1
+        Should Contain X Times    ${resp.content}   ${IP_2}  1
+        Should Contain X Times    ${resp.content}   ${IP_3}  1
+
+
+
diff --git a/test/csit/suites/l2switch/010__AddressTracking_OF13/__init__.txt b/test/csit/suites/l2switch/010__AddressTracking_OF13/__init__.txt
new file mode 100644 (file)
index 0000000..942d12c
--- /dev/null
@@ -0,0 +1,27 @@
+*** Settings ***
+Documentation     Test suite for L2switch's Address Tracking using mininet OF13
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ovsk,protocols=OpenFlow13
+
+** Keywords ***
+Start Suite
+    Log    Start mininet
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any
+    Write    sudo ovs-vsctl set-manager ptcp:6644
+    Write    sudo mn -c
+    Sleep    2
+    Write    ${start}
+    Sleep    30
+    Read
+Stop Suite
+    Log    Stop mininet
+    Read
+    Write    exit
+    Sleep    6
+    Read
+    Close Connection
diff --git a/test/csit/suites/l2switch/020__FlowProgramming_OF13/010__restconf_inv_flows.txt b/test/csit/suites/l2switch/020__FlowProgramming_OF13/010__restconf_inv_flows.txt
new file mode 100644 (file)
index 0000000..37174aa
--- /dev/null
@@ -0,0 +1,64 @@
+*** Settings ***
+Documentation     Test suite for FlowProgramming in RESTCONF inventory
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+
+*** Test Cases ***
+Get flows before ping through console
+    [Documentation]    Dump flows shouldn't list any flows
+        Write   sh ovs-ofctl dump-flows s1 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Not Contain    ${result}    actions
+        Write   sh ovs-ofctl dump-flows s2 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Not Contain    ${result}    actions
+        Write   sh ovs-ofctl dump-flows s3 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Not Contain    ${result}    actions
+
+# Get flows before ping through restconf
+#    [Documentation]    Get the inventory, should not contain flows
+#        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:1/table/0
+#        Should Be Equal As Strings    ${resp.status_code}    200
+#        Should Not Contain    ${resp.content}    flow
+
+Ping All
+    [Documentation]    Pingall, verify no packet loss
+    [Tags]   Get
+        Write   pingall
+        Sleep   5
+        ${result}    Read
+        Should Contain   ${result}   0% dropped
+        Should Not Contain    ${result}    X
+
+Get flows after ping through console
+    [Documentation]    Dump flows should list flows
+        Write   sh ovs-ofctl dump-flows s1 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Contain X Times    ${result}    actions    4
+        Write   sh ovs-ofctl dump-flows s2 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Contain X Times    ${result}    actions    6
+        Write   sh ovs-ofctl dump-flows s3 -O OpenFlow13
+        Sleep   5
+        ${result}    Read
+        Should Contain X Times    ${result}    actions    4
+
+
+#Get flows after ping through restconf
+#    [Documentation]    Get the inventory, should not contain flows
+#        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:1/table/0
+#        Should Be Equal As Strings    ${resp.status_code}    200
diff --git a/test/csit/suites/l2switch/020__FlowProgramming_OF13/__init__.txt b/test/csit/suites/l2switch/020__FlowProgramming_OF13/__init__.txt
new file mode 100644 (file)
index 0000000..b0eb299
--- /dev/null
@@ -0,0 +1,27 @@
+*** Settings ***
+Documentation     Test suite for L2switch's Flow Programming using mininet OF13
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER} --topo=linear,3 --switch ovsk,protocols=OpenFlow13
+
+** Keywords ***
+Start Suite
+    Log    Start mininet
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any
+    Write    sudo ovs-vsctl set-manager ptcp:6644
+    Write    sudo mn -c
+    Sleep    2
+    Write    ${start}
+    Sleep    30
+    Read
+Stop Suite
+    Log    Stop mininet
+    Read
+    Write    exit
+    Sleep    6
+    Read
+    Close All Connections
diff --git a/test/csit/suites/l2switch/030__LoopRemoval_OF13/010__loop_of_3.txt b/test/csit/suites/l2switch/030__LoopRemoval_OF13/010__loop_of_3.txt
new file mode 100644 (file)
index 0000000..e2bcf43
--- /dev/null
@@ -0,0 +1,47 @@
+*** Settings ***
+Documentation     Test suite for Ring/Loop topology of size 3
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+
+*** Test Cases ***
+Get opendaylight-inventory
+    [Documentation]    Get all nodes and all link states (forwarding/discarding)
+       ${resp}    Get    session    ${REST_CONTEXT}
+        Should Be Equal As Strings    ${resp.status_code}    200
+        Should Contain     ${resp.content}     openflow:1
+        Should Contain     ${resp.content}     openflow:2
+        Should Contain     ${resp.content}     openflow:3
+        Should Contain X Times    ${resp.content}   forwarding  4
+        Should Contain X Times    ${resp.content}   discarding  2
+
+Get nodeconnectors for node 1
+    [Documentation]    Get the inventory for node 1
+        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:1
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      openflow:1:1
+        Should Contain     ${resp.content}      openflow:1:2
+        Should Contain     ${resp.content}      openflow:1:3
+
+Get nodeconnectors for node 2
+    [Documentation]    Get the inventory for node 2
+        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:2
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      openflow:2:1
+        Should Contain     ${resp.content}      openflow:2:2
+        Should Contain     ${resp.content}      openflow:2:3
+
+Get nodeconnectors for node 3
+    [Documentation]    Get the inventory for node 3
+        ${resp}    Get    session    ${REST_CONTEXT}/node/openflow:3
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      openflow:3:1
+        Should Contain     ${resp.content}      openflow:3:2
+        Should Contain     ${resp.content}      openflow:3:3
+
diff --git a/test/csit/suites/l2switch/030__LoopRemoval_OF13/020__ping.txt b/test/csit/suites/l2switch/030__LoopRemoval_OF13/020__ping.txt
new file mode 100644 (file)
index 0000000..4a49d11
--- /dev/null
@@ -0,0 +1,38 @@
+*** Settings ***
+Documentation     Test suite for Pinging in Ring/Loop topology of size 3
+Suite Setup       Create Session   session   http://${CONTROLLER}:8080   auth=${AUTH}   headers=${HEADERS_XML}
+Suite Teardown    Delete All Sessions
+Library           SSHLibrary
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+
+*** Test Cases ***
+Ping All
+    [Documentation]    Pingall, verify no packet loss
+    [Tags]   Get
+        Write   pingall
+        Sleep   5
+        ${result}    Read
+        Should Contain   ${result}   0% dropped
+        Should Contain X Times    ${result}   h1    3
+        Should Contain X Times    ${result}   h2    3
+        Should Contain X Times    ${result}   h3    3
+        Should Not Contain    ${result}    X
+
+
+Ping h1 to h2
+    [Documentation]    Ping h1 to h2, verify no packet loss or duplicates
+    [Tags]   Get
+        Write   h1 ping -w 6 h2
+        Sleep   5
+        Write   h2 ping -w 6 h1
+        Sleep   5
+        ${result}    Read
+        Should Contain   ${result}   0% packet loss
+        Should Not Contain    ${result}    duplicates
+
diff --git a/test/csit/suites/l2switch/030__LoopRemoval_OF13/__init__.txt b/test/csit/suites/l2switch/030__LoopRemoval_OF13/__init__.txt
new file mode 100644 (file)
index 0000000..d4d6eae
--- /dev/null
@@ -0,0 +1,27 @@
+*** Settings ***
+Documentation     Test suite for L2switch's LoopRemoval using mininet OF13
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=  sudo mn --controller=remote,ip=${CONTROLLER} --custom ${USER_HOME}/integration/test/csit/suites/l2switch/topologies/loop.py --topo loop --switch ovsk,protocols=OpenFlow13
+
+** Keywords ***
+Start Suite
+    Log    Start mininet
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any
+    Write    sudo ovs-vsctl set-manager ptcp:6644
+    Write    sudo mn -c
+    Sleep    2
+    Write    ${start}
+    Sleep    30
+    Read
+Stop Suite
+    Log    Stop mininet
+    Read
+    Write    exit
+    Sleep    6
+    Read
+    Close Connection
diff --git a/test/csit/suites/l2switch/topologies/loop.py b/test/csit/suites/l2switch/topologies/loop.py
new file mode 100644 (file)
index 0000000..884b142
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+
+# usage: sudo mn --controller=remote,ip=<controller_ip> --switch=ovsk,protocols=OpenFlow13 --custom <path to createtopo.py> --topo loop ...
+
+from mininet.topo import Topo
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.cli import CLI
+
+class LoopTopo(Topo):
+        def __init__(self, switches = 3, hosts_per = 1, **opts):
+            Topo.__init__(self, **opts)
+            sws = []
+            hnum = 0
+            for i in range(switches):
+                sw = self.addSwitch('s%s' % (i+ 1))
+
+                for _ in range(hosts_per):
+                    hnum += 1
+                    host = self.addHost('h%s' % hnum)
+                    self.addLink(sw, host)
+
+                for rhs in sws:
+                    self.addLink(sw, rhs)
+
+                sws.append(sw)
+
+topos = { 'loop': LoopTopo }
\ No newline at end of file