LACP Integration suites 58/18358/2
authormahesh.manivasagam <mahesh_manivasagam@dell.com>
Wed, 15 Apr 2015 15:49:04 +0000 (21:19 +0530)
committerLuis Gomez <ecelgp@gmail.com>
Tue, 28 Apr 2015 22:48:20 +0000 (22:48 +0000)
Change-Id: I5b082027d9a4d34b2e027ee9b9cb8d2e4829f29e
Signed-off-by: mahesh.manivasagam <mahesh_manivasagam@dell.com>
test/csit/suites/lacp/Lacp_Feature_OF13/010__lacp_inventory.txt [new file with mode: 0644]
test/csit/suites/lacp/Lacp_Feature_OF13/LACP_custom1.py [new file with mode: 0644]
test/csit/suites/lacp/Lacp_Feature_OF13/__init__.txt [new file with mode: 0644]
test/csit/suites/lacp/Lacp_Feature_OF13/bonding.conf [new file with mode: 0644]
test/csit/suites/lacp/Lacp_Feature_OF13/h1-bond0.sh [new file with mode: 0755]
test/csit/suites/lacp/Lacp_Feature_OF13/h2-bond0.sh [new file with mode: 0755]
test/csit/suites/lacp/Lacp_Feature_OF13/m [new file with mode: 0755]
test/csit/testplans/lacp.txt [new file with mode: 0644]

diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/010__lacp_inventory.txt b/test/csit/suites/lacp/Lacp_Feature_OF13/010__lacp_inventory.txt
new file mode 100644 (file)
index 0000000..9f88310
--- /dev/null
@@ -0,0 +1,116 @@
+*** Settings ***
+Documentation     Test suite for RESTCONF LACP inventory
+Suite Setup       Create Session   session   http://${CONTROLLER}:8181   auth=${AUTH}   headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library     SSHLibrary
+Library           Collections
+Library           ../../../libraries/RequestsLibrary.py
+Library           ../../../libraries/Common.py
+Library           robot.libraries.XML
+Variables         ../../../variables/Variables.py
+
+
+*** Variables ***
+${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
+${node1}    openflow:1
+${agg-id1}   1
+${agg-id2}   2
+${agg1-connector-id1}  1
+${agg1-connector-id2}  2
+${agg2-connector-id1}  3
+${agg2-connector-id2}  4
+${lacp-mac}    01:80:c2:00:00:02
+${lacp-ether-type}     0x8809
+
+*** Test Cases *** 
+Get list of nodes and LACP reference on Inventory
+    [Documentation]    Get the nodes data
+       ${resp}    Get    session    ${REST_CONTEXT}
+       Should Be Equal As Strings    ${resp.status_code}    200
+       Should Contain     ${resp.content}      ${node1} 
+        Should Contain     ${resp.content}      non-lag-groupid 
+        Should Contain     ${resp.content}      lacp-aggregators
+        
+Get the Specific Node Inventory and Lacp aggregator details
+    [Documentation]    Get the lacp-aggregator data for specific node
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}
+        Should Be Equal As Strings    ${resp.status_code}    200
+        Should Contain     ${resp.content}      ${node1}
+        Should Contain     ${resp.content}      <agg-id>${agg-id1}</agg-id>
+        Should Contain     ${resp.content}      <agg-id>${agg-id2}</agg-id>
+        ${non-lag-group-id}=      Get_Element    ${resp}     non-lag-groupid
+
+Get information of each lacp-aggregator for a node
+    [Documentation]    Get each lacp-aggregator data for a node
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/lacp-aggregators/${agg-id1}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      ${agg-id1}
+        Should Contain     ${resp.content}      ${node1}
+        Should Contain     ${resp.content}      ${node1}:${agg1-connector-id1}
+        Should Contain     ${resp.content}      ${node1}:${agg1-connector-id2}
+        Should Contain     ${resp.content}      lag-groupid
+        ${lag-group-id1}=      Get_Element    ${resp}     lag-groupid        
+
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/lacp-aggregators/${agg-id2}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain     ${resp.content}      ${agg-id2}
+        Should Contain     ${resp.content}      ${node1}
+        Should Contain     ${resp.content}      ${node1}:${agg2-connector-id1}
+        Should Contain     ${resp.content}      ${node1}:${agg2-connector-id2}
+        Should Contain     ${resp.content}      lag-groupid
+        ${lag-group-id2}=      Get_Element    ${resp}     lag-groupid   
+
+Get node connector data for node 1
+    [Documentation]    Get the node connector inventory for node 1
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/node-connector/${node1}:${agg1-connector-id1}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain      ${resp.content}      ${node1}
+        Should Contain      ${resp.content}      agg-id='${agg-id1}'
+
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/node-connector/${node1}:${agg1-connector-id2}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain      ${resp.content}      ${node1}
+        Should Contain      ${resp.content}      agg-id='${agg-id1}'
+
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/node-connector/${node1}:${agg2-connector-id1}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain      ${resp.content}      ${node1}
+        Should Contain      ${resp.content}      agg-id='${agg-id2}'
+
+        ${resp}    Get    session    ${REST_CONTEXT}/node/${node1}/node-connector/${node1}:${agg2-connector-id2}
+        Should Be Equal As Strings   ${resp.status_code}    200
+        Should Contain      ${resp.content}      ${node1}
+        Should Contain      ${resp.content}      agg-id='${agg-id2}'
+
+Verification of Switch(S1) Flow and Group tables
+    [Documentation]    Verification of Switch(S1) Flow and Group tables
+        Verify Switch S1 Flow Table
+        Verify Switch S1 Group Table
+
+*** Keywords ***
+Verify Switch S1 Flow Table for LACP flow
+    Log    OVS Switch(S1) Flow table Verification
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any
+    Sleep    15
+    Write    clear
+    Sleep    5
+    Write    sudo ovs-ofctl dump-flows s1 -O OpenFlow13
+    Sleep    5
+    ${s1_flow}=    Read
+    Should Contain    ${s1_flow}    dl_dst=${lacp-mac},dl_type=${lacp-ether-type} actions=CONTROLLER:65535
+
+Verify Switch S1 Group Table
+    Log    OVS Switch(S1) Group table Verification
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any
+    Sleep    15
+    Write    clear
+    Sleep    5
+    Write    sudo ovs-ofctl dump-groups s1 -O OpenFlow13
+    Sleep    5
+    $(s1_group}=   Read
+    Should Contain    ${s1_group}   group_id=${lag-group-id1},type=select
+    Should Contain    ${s1_group}   group_id=${lag-group-id2},type=select
+    Should Contain    ${s1_group}   group_id=${non-lag-group-id},type=all
+
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/LACP_custom1.py b/test/csit/suites/lacp/Lacp_Feature_OF13/LACP_custom1.py
new file mode 100644 (file)
index 0000000..18edaad
--- /dev/null
@@ -0,0 +1,62 @@
+"""Custom LACP topology for LACP Module testing 
+
+1.Two hosts(H1,H2) two interface each  connected with Switch(S1)     
+2.Two hosts(H3,H4) one interface each  connected with Switch(S1)
+
+
+                   - - - -
+                   | H2   |
+                   |      | 
+                   - - - -
+                     |  |
+                     |  |
+                   - - - - -   
+- - -  eth1        |        |         - - -
+| H1 |- - - - - - -| S1     |- - - - -| H3 |
+|    |- - - - - - -|        |         |    |
+- - -  eth2         - - - - -         - - -
+                       |
+                     - - - 
+                    |  H4 |             
+                     - - -  
+
+Execute Custom topology: 
+sudo mn  --custom LACP_custom1.py --switch ovsk,protocols=OpenFlow13 --topo=lacp
+
+Note:
+ 1.remoteController IP will be replaced in LACP_custom1.py using sed command during the robot execution
+ 2.bonding.conf will be copied the mininet server under /etc/modprobe.d
+ 3.h1-bonding.sh h2-bonding.sh will be executed in respective h1,h2 host console  
+"""
+
+from mininet.cli import CLI
+from mininet.net import Mininet
+from mininet.node import OVSController,RemoteController
+from mininet.topo import Topo
+from mininet.link import Link
+
+class LacpTopo( Topo):
+    net = Mininet(controller=RemoteController)
+    c0 = net.addController('c0',controller=RemoteController,ip='CONTROLLER')
+    s1 = net.addSwitch('s1')
+    h1 = net.addHost('h1',mac='00:00:00:00:00:11')
+    h2 = net.addHost('h2',mac='00:00:00:00:00:22')
+    h3 = net.addHost('h3',mac='00:00:00:00:00:33',ip='10.1.1.3')
+    h4 = net.addHost('h4',mac='00:00:00:00:00:44',ip='10.1.1.4')
+
+    Link(s1, h1)
+    Link(s1, h1)
+    Link(s1, h2)
+    Link(s1, h2)
+    Link(s1, h3)
+    Link(s1, h4)
+    net.build()
+    s1.start([c0])
+    s1.cmd('sudo ovs-vsctl set bridge s1 protocols=OpenFlow13')
+    print h1.cmd('./h1-bond0.sh')
+    print h2.cmd('./h2-bond0.sh')
+    CLI(net)
+    net.stop()
+
+topos = { 'lacp': (lambda: LacpTopo() ) }
+
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/__init__.txt b/test/csit/suites/lacp/Lacp_Feature_OF13/__init__.txt
new file mode 100644 (file)
index 0000000..d0f3d55
--- /dev/null
@@ -0,0 +1,39 @@
+*** Settings ***
+Documentation     Test suite for MD-SAL LACP  mininet OF13
+Suite Setup       Start Suite
+Suite Teardown    Stop Suite
+Library     SSHLibrary
+
+*** Variables ***
+${start}=   sudo mn --custom LACP_custom1.py --switch ovsk,protocols=OpenFlow13 
+${bond}=     "/etc/modprobe.d/bonding.conf"
+
+** Keywords ***
+Start Suite  
+    Log    Start mininet
+    Open Connection   ${MININET}     prompt=>
+    Login With Public Key    ${MININET_USER}   ${USER_HOME}/.ssh/id_rsa   any 
+    Sleep    5
+    Write    sudo ovs-vsctl set-manager ptcp:6633
+    Write    sudo mn -c
+    Sleep    2
+    Write    rm -rf ${bond} 
+    Sleep    2
+    Write    cp bonding.conf ${bond}
+    Sleep    2
+    Write    sed -i -- 's/CONTROLLER/${CONTROLLER}/g' LACP_custom1.py
+    Sleep    2
+    Write    ${start}
+    Sleep    30
+    Read
+Stop Suite
+    Log    Stop mininet
+    Read
+    Write    exit 
+    Sleep    4
+    Write    sed -i -- 's/${CONTROLLER}/CONTROLLER/g' LACP_custom1.py
+    Sleep    2
+    Write    rm -rf ${bond}
+    Sleep    2 
+    Read 
+    Close Connection 
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/bonding.conf b/test/csit/suites/lacp/Lacp_Feature_OF13/bonding.conf
new file mode 100644 (file)
index 0000000..1a13546
--- /dev/null
@@ -0,0 +1,2 @@
+alias bond0 bonding
+options bonding mode=4
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/h1-bond0.sh b/test/csit/suites/lacp/Lacp_Feature_OF13/h1-bond0.sh
new file mode 100755 (executable)
index 0000000..92d3bd8
--- /dev/null
@@ -0,0 +1,19 @@
+modprobe bonding
+ip link add bond0 type bond
+ip link set bond0 address 02:01:02:03:04:08
+
+ip link set h1-eth0 down
+ip link set h1-eth0 address 00:00:00:00:00:11
+ip link set h1-eth0 master bond0
+ip link set h1-eth1 down
+ip link set h1-eth1 address 00:00:00:00:00:12
+ip link set h1-eth1 master bond0
+
+ip addr add 10.1.1.1/8 dev bond0
+ip addr del 10.0.0.1/8 dev h1-eth0
+ip link set bond0 up
+
+ifconfig
+
+cat /proc/net/bonding/bond0
+
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/h2-bond0.sh b/test/csit/suites/lacp/Lacp_Feature_OF13/h2-bond0.sh
new file mode 100755 (executable)
index 0000000..cd40fed
--- /dev/null
@@ -0,0 +1,19 @@
+modprobe bonding
+ip link add bond0 type bond
+ip link set bond0 address 02:01:02:03:04:09
+
+ip link set h2-eth0 down
+ip link set h2-eth0 address 00:00:00:00:00:22
+ip link set h2-eth0 master bond0
+ip link set h2-eth1 down
+ip link set h2-eth1 address 00:00:00:00:00:23
+ip link set h2-eth1 master bond0
+
+ip addr add 10.1.1.2/8 dev bond0
+ip addr del 10.0.0.2/8 dev h2-eth0
+ip link set bond0 up
+
+ifconfig
+
+cat /proc/net/bonding/bond0
+
diff --git a/test/csit/suites/lacp/Lacp_Feature_OF13/m b/test/csit/suites/lacp/Lacp_Feature_OF13/m
new file mode 100755 (executable)
index 0000000..06900fc
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Attach to a Mininet host and run a command
+
+if [ -z $1 ]; then
+  echo "usage: $0 host cmd [args...]"
+  exit 1
+else
+  host=$1
+fi
+
+pid=`ps ax | grep "mininet:$host$" | grep bash | grep -v mnexec | awk '{print $1};'`
+
+if echo $pid | grep -q ' '; then
+  echo "Error: found multiple mininet:$host processes"
+  exit 2
+fi
+
+if [ "$pid" == "" ]; then
+  echo "Could not find Mininet host $host"
+  exit 3
+fi
+
+if [ -z $2 ]; then
+  cmd='bash'
+else
+  shift
+  cmd=$*
+fi
+
+cgroup=/sys/fs/cgroup/cpu/$host
+if [ -d "$cgroup" ]; then
+  cg="-g $host"
+fi
+
+# Check whether host should be running in a chroot dir
+rootdir="/var/run/mn/$host/root"
+if [ -d $rootdir -a -x $rootdir/bin/bash ]; then
+    cmd="'cd `pwd`; exec $cmd'"
+    cmd="chroot $rootdir /bin/bash -c $cmd"
+fi
+
+cmd="exec sudo mnexec $cg -a $pid $cmd"
+eval $cmd
diff --git a/test/csit/testplans/lacp.txt b/test/csit/testplans/lacp.txt
new file mode 100644 (file)
index 0000000..9ba00f0
--- /dev/null
@@ -0,0 +1,2 @@
+# Place the suites in run order:
+integration/test/csit/suites/lacp/Lacp_Feature_OF13