regress: Provide support for testing Open vSwitch
Change submitted by: Jean Tourrilhes <jt@hpl.hp.com>
This commit is contained in:
1 parent
319065259b
commit
f0e9c6f92d
10 files changed
+402
No files matched your search
@@ -0,0 +1,8 @@
|
||||
eth1:eth10.91
|
||||
eth2:eth10.92
|
||||
eth3:eth10.93
|
||||
eth4:eth10.94
|
||||
eth5:eth11.91
|
||||
eth6:eth11.92
|
||||
eth7:eth11.93
|
||||
eth8:eth11.94
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Jean Tourrilhes - HP-Labs
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
|
||||
# The map file is necessary. It assing the real interface to the
|
||||
# fictious names used by the test suite.
|
||||
# eth1->eth4 are capture interfaces used to send/receive probe packets
|
||||
# eth5->eth8 are configured to run the OpenFlow switch
|
||||
# Jean II
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# If not specified on command line, use enviroment variable.
|
||||
# Try specific first, then try generic - Jean II
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_OVS_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_MAP_ETH}";
|
||||
}
|
||||
|
||||
# Set up the mappings
|
||||
if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
# Debug...
|
||||
#for ( my $i = 1 ; $i <= 8 ; $i++ ) {
|
||||
# my $iface = nftest_get_iface("eth$i");
|
||||
# print "iface($i) = $iface\n";
|
||||
#}
|
||||
|
||||
# Start capturing on eth1->eth4
|
||||
setup_pcap_interfaces();
|
||||
|
||||
# Get the directly where Open vSwitch resides
|
||||
my $ovs_dir = $ENV{'OFT_OVS_ROOT'};
|
||||
my $of_port = get_of_port();
|
||||
|
||||
# create Open vSwitch openflow switch on four ports eth5->eth9
|
||||
`insmod ${ovs_dir}/datapath/linux-2.6/openvswitch_mod.ko`;
|
||||
`${ovs_dir}/utilities/ovs-dpctl add-dp dp0`;
|
||||
|
||||
for ( my $i = 5 ; $i <= 8 ; $i++ ) {
|
||||
my $iface = nftest_get_iface("eth$i");
|
||||
`${ovs_dir}/utilities/ovs-dpctl add-if dp0 $iface`;
|
||||
}
|
||||
|
||||
# Up to 0.90.6, you would use secchan, after that you need to use ovs-openflowd
|
||||
#system("${ovs_dir}/secchan/secchan dp0 tcp:127.0.0.1:${of_port} --listen=ptcp:6634 --fail=closed --inactivity-probe=999999 &");
|
||||
system("${ovs_dir}/utilities/ovs-openflowd dp0 tcp:127.0.0.1:${of_port} --listen=ptcp:6634 --fail=closed --inactivity-probe=999999 &");
|
||||
Executable
+59
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Jean Tourrilhes - HP-Labs
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# If not specified on command line, use enviroment variable.
|
||||
# Try specific first, then try generic - Jean II
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_OVS_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_MAP_ETH}";
|
||||
}
|
||||
|
||||
if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
# Get the directly where Open vSwitch resides
|
||||
my $ovs_dir = $ENV{'OFT_OVS_ROOT'};
|
||||
|
||||
# Start by killing secchan or ovs-openflowd
|
||||
`killall secchan`;
|
||||
`killall ovs-openflowd`;
|
||||
|
||||
# check if openflow kernel module loaded
|
||||
my $of_kmod_loaded = `lsmod | grep openvswitch_mod`;
|
||||
if ( $of_kmod_loaded eq "" ) { exit 0; }
|
||||
|
||||
print "tearing down interfaces and datapaths\n";
|
||||
|
||||
# remove interfaces from openflow
|
||||
for ( my $i = 5 ; $i <= 8 ; $i++ ) {
|
||||
my $iface = nftest_get_iface("eth$i");
|
||||
`${ovs_dir}/utilities/ovs-dpctl del-if dp0 $iface`;
|
||||
}
|
||||
|
||||
`${ovs_dir}/utilities/ovs-dpctl del-dp dp0`;
|
||||
|
||||
my $of_kmod_removed = `rmmod openvswitch_mod`;
|
||||
if ( $of_kmod_removed ne "" ) {
|
||||
die "failed to remove kernel module... please fix!\n";
|
||||
}
|
||||
|
||||
$of_kmod_loaded = `lsmod | grep openvswitch_mod`;
|
||||
if ( $of_kmod_loaded ne "" ) {
|
||||
die "failed to remove kernel module... please fix!\n";
|
||||
}
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Wrapper for running OpenFlow regression tests against Open vSwitch
|
||||
# Jean Tourrilhes - HP-Labs - copyright 2009-2010
|
||||
# $Id: of_regress_test.pl 105 2008-06-06 04:07:05Z brandonh $
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use OF::Base;
|
||||
use Test::RegressTest;
|
||||
use strict;
|
||||
use OF::OFUtil;
|
||||
|
||||
# check vars are set.
|
||||
check_OF_vars_set();
|
||||
|
||||
sub INT_Handler {
|
||||
my $signame = shift;
|
||||
print "\nNo interrupt handler implemented yet...\n";
|
||||
print "\nExited with SIG$signame\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# For Open vSwitch
|
||||
|
||||
# Open vSwitch starts at port 1
|
||||
# Get a bit of speedup by tweaking send_delay and base_idle
|
||||
# Jean II
|
||||
my $of_port = get_of_port();
|
||||
push @ARGV, "--root=$ENV{'OFT_ROOT'}", "--common-st-args=ovs", "--controller=tcp:localhost:$of_port,tcp:localhost:$of_port", "--listener=tcp:127.0.0.1:6634", "--port_base=1", "--send_delay=2000", "--base_idle=2";
|
||||
|
||||
# Use a single random port instead of all four
|
||||
push @ARGV, "--less_ports";
|
||||
|
||||
# Don't bother with VLAN if we go outside the box, too many issues...
|
||||
#push @ARGV, "--no_vlan";
|
||||
|
||||
# Don't bother with QoS currently, it's broken...
|
||||
push @ARGV, "--no_slicing";
|
||||
|
||||
# Don't forget to configure the OVS_ROOT environment variable
|
||||
# Jean II
|
||||
|
||||
# Check for specific MAP file...
|
||||
if ( defined($ENV{'OFT_OVS_MAP_ETH'}) ) {
|
||||
push @ARGV, "--map=$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
|
||||
run_regress_test( \&INT_Handler, @ARGV );
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Jean Tourrilhes - HP-Labs
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
|
||||
# The map file is necessary. It assing the real interface to the
|
||||
# fictious names used by the test suite.
|
||||
# eth1->eth4 are capture interfaces used to send/receive probe packets
|
||||
# eth5->eth8 are configured to run the OpenFlow switch
|
||||
# Jean II
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# If not specified on command line, use enviroment variable.
|
||||
# Try specific first, then try generic - Jean II
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_OVS_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_MAP_ETH}";
|
||||
}
|
||||
|
||||
# Set up the mappings
|
||||
if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
# Debug...
|
||||
#for ( my $i = 1 ; $i <= 8 ; $i++ ) {
|
||||
# my $iface = nftest_get_iface("eth$i");
|
||||
# print "iface($i) = $iface\n";
|
||||
#}
|
||||
|
||||
# Start capturing on eth1->eth4
|
||||
setup_pcap_interfaces();
|
||||
|
||||
# Get the directly where Open vSwitch resides
|
||||
my $ovs_dir = $ENV{'OFT_OVS_ROOT'};
|
||||
my $of_port = get_of_port();
|
||||
|
||||
# create command line arguments containing all four ports
|
||||
my $if_string = '';
|
||||
for ( my $i = 5 ; $i <= 7 ; $i++ ) {
|
||||
$if_string .= nftest_get_iface("eth$i") . ',';
|
||||
}
|
||||
$if_string .= nftest_get_iface("eth8");
|
||||
|
||||
# create userspace Open vSwitch openflow switch on four ports
|
||||
system("${ovs_dir}/utilities/ovs-openflowd netdev:br0 --ports=${if_string} tcp:127.0.0.1:${of_port} --listen=ptcp:6634 --fail=closed --inactivity-probe=999999 &");
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/perl -w
|
||||
# Jean Tourrilhes - HP-Labs
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use OF::OFUtil;
|
||||
use Test::TestLib;
|
||||
|
||||
my $mapFile;
|
||||
|
||||
# Process command line options
|
||||
unless ( GetOptions( "map=s" => \$mapFile, ) ) {
|
||||
print "unrecognized option\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# If not specified on command line, use enviroment variable.
|
||||
# Try specific first, then try generic - Jean II
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_OVS_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
if ( (! defined($mapFile) ) && (defined($ENV{'OFT_MAP_ETH'})) ) {
|
||||
$mapFile = "$ENV{OFT_MAP_ETH}";
|
||||
}
|
||||
|
||||
if ( defined($mapFile) ) {
|
||||
nftest_process_iface_map($mapFile);
|
||||
}
|
||||
|
||||
# Get the directly where Open vSwitch resides
|
||||
my $ovs_dir = $ENV{'OFT_OVS_ROOT'};
|
||||
|
||||
# Just kill ovs-openflowd
|
||||
`killall ovs-openflowd`;
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Wrapper for OpenFlow regression tests
|
||||
# $Id: of_regress_test.pl 105 2008-06-06 04:07:05Z brandonh $
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use OF::Base;
|
||||
use Test::RegressTest;
|
||||
use strict;
|
||||
use OF::OFUtil;
|
||||
|
||||
# check vars are set.
|
||||
check_OF_vars_set();
|
||||
|
||||
sub INT_Handler {
|
||||
my $signame = shift;
|
||||
print "\nNo interrupt handler implemented yet...\n";
|
||||
print "\nExited with SIG$signame\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# For Open vSwitch
|
||||
|
||||
# Open vSwitch starts at port 1
|
||||
# Get a bit of speedup by tweaking send_delay and base_idle
|
||||
# Jean II
|
||||
my $of_port = get_of_port();
|
||||
push @ARGV, "--root=$ENV{'OFT_ROOT'}", "--common-st-args=ovs_user", "--controller=tcp:localhost:$of_port,tcp:localhost:$of_port", "--listener=tcp:127.0.0.1:6634", "--port_base=1", "--send_delay=2000", "--base_idle=2";
|
||||
|
||||
# Use a single random port instead of all four
|
||||
push @ARGV, "--less_ports";
|
||||
|
||||
# Don't forget to configure the OVS_ROOT environment variable
|
||||
# Jean II
|
||||
|
||||
# Check for specific MAP file...
|
||||
if ( defined($ENV{'OFT_OVS_MAP_ETH'}) ) {
|
||||
push @ARGV, "--map=$ENV{OFT_OVS_MAP_ETH}";
|
||||
}
|
||||
|
||||
run_regress_test( \&INT_Handler, @ARGV );
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Wrapper for running OpenFlow regression tests against Open vSwitch
|
||||
# using veth
|
||||
# Jean Tourrilhes - HP-Labs - copyright 2009-2010
|
||||
# $Id: of_regress_test.pl 105 2008-06-06 04:07:05Z brandonh $
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use OF::Base;
|
||||
use Test::RegressTest;
|
||||
use strict;
|
||||
use OF::OFUtil;
|
||||
|
||||
# check vars are set.
|
||||
check_OF_vars_set();
|
||||
|
||||
sub INT_Handler {
|
||||
my $signame = shift;
|
||||
print "\nNo interrupt handler implemented yet...\n";
|
||||
print "\nExited with SIG$signame\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# For Open vSwitch
|
||||
|
||||
# Open vSwitch starts at port 1
|
||||
# Get a bit of speedup by tweaking send_delay and base_idle
|
||||
# Jean II
|
||||
my $of_port = get_of_port();
|
||||
push @ARGV, "--root=$ENV{'OFT_ROOT'}", "--common-st-args=ovs_user", "--controller=tcp:localhost:$of_port,tcp:localhost:$of_port", "--listener=tcp:127.0.0.1:6634", "--port_base=1", "--send_delay=2000", "--base_idle=2", "--map=$ENV{'OFT_ROOT'}/bin/veth.map";
|
||||
|
||||
# Use a single random port instead of all four
|
||||
push @ARGV, "--less_ports";
|
||||
|
||||
# Don't forget to configure the OVS_ROOT environment variable
|
||||
# Jean II
|
||||
|
||||
run_regress_test( \&INT_Handler, @ARGV );
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Wrapper for running OpenFlow regression tests against Open vSwitch
|
||||
# using veth
|
||||
# Jean Tourrilhes - HP-Labs - copyright 2009-2010
|
||||
# $Id: of_regress_test.pl 105 2008-06-06 04:07:05Z brandonh $
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use OF::Base;
|
||||
use Test::RegressTest;
|
||||
use strict;
|
||||
use OF::OFUtil;
|
||||
|
||||
# check vars are set.
|
||||
check_OF_vars_set();
|
||||
|
||||
sub INT_Handler {
|
||||
my $signame = shift;
|
||||
print "\nNo interrupt handler implemented yet...\n";
|
||||
print "\nExited with SIG$signame\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# For Open vSwitch
|
||||
|
||||
# Open vSwitch starts at port 1
|
||||
# Get a bit of speedup by tweaking send_delay and base_idle
|
||||
# Jean II
|
||||
my $of_port = get_of_port();
|
||||
push @ARGV, "--root=$ENV{'OFT_ROOT'}", "--common-st-args=ovs", "--controller=tcp:localhost:$of_port,tcp:localhost:$of_port", "--listener=tcp:127.0.0.1:6634", "--port_base=1", "--send_delay=2000", "--base_idle=2", "--map=$ENV{'OFT_ROOT'}/bin/veth.map";
|
||||
|
||||
# Use a single random port instead of all four
|
||||
push @ARGV, "--less_ports";
|
||||
|
||||
# Don't bother with QoS currently, it's broken...
|
||||
push @ARGV, "--no_slicing";
|
||||
|
||||
# Don't forget to configure the OVS_ROOT environment variable
|
||||
# Jean II
|
||||
|
||||
run_regress_test( \&INT_Handler, @ARGV );
|
||||
@@ -8,3 +8,5 @@ export OFT_HP_SWITCH_IP=10.10.10.2
|
||||
export OFT_HP_VLAN=10
|
||||
export OFT_HP_CONTROLLER="tcp:10.10.10.3:6633"
|
||||
export OFT_HP_LISTENER="tcp:10.10.10.2:6633"
|
||||
export OFT_OVS_ROOT=/home/yourname/openvswitch
|
||||
export OFT_OVS_MAP_ETH=${OFT_ROOT}/bin/of_ovs_eth.map
|
||||
Reference in new issue
Block a user