Signed-off-by: Veerendra C <[EMAIL PROTECTED]>
This patch consists of the files..
containers/netns/ch_ftp.sh
containers/netns/container_ftp.pl
containers/netns/par_chld_ftp.c
containers/netns/par_ftp.sh
Regards
Veerendra C
Index: containers/netns/ch_ftp.sh
===================================================================
--- /dev/null
+++ containers/netns/ch_ftp.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# This script checks that the parent namespace is reachable from the child
+TCID=${TCID:-ch_ftp.sh}
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+
+ping -qc2 $IP1
+if [ $? -ne 0 ] ; then
+ tst_resm TFAIL "Pinging parent NS from child : FAIL"
+ status=-1
+else
+ tst_resm TINFO "Pinging parent NS from child : PASS"
+ status=0
+ eval ./container_ftp.pl $IP1
+ status=$?
+ if [ $status -ne 0 ] ; then
+ tst_resm TFAIL "ftp failed"
+ status=-1
+ fi
+fi
+cleanup $sshpid $vnet1
+tst_resm TINFO "After ftp status is $status";
Index: containers/netns/container_ftp.pl
===================================================================
--- /dev/null
+++ containers/netns/container_ftp.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use Net::FTP;
+
+my $host = $ARGV[0];
+
+my $newname;
+my $i = 0;
+my $kount = 51;
+my $file="junkfile";
+my $dir="/tmp/ftpdir";
+
+mkdir $dir;
+chdir $dir;
+system("dd if=/dev/zero of=$putdir$file bs=512 count=10 > /dev/null 2>&1 ");
+
+while ( $i < $kount )
+{
+ $ftp=Net::FTP->new($host,Timeout=>240) or $newerr=1;
+ push @ERRORS, "Can't ftp to $host: $!\n" if $newerr;
+ printerr() if $newerr;
+
+ $ftp->login("anonymous","passwd") or $newerr=1;
+ push @ERRORS, "Can't login to $host: $!\n" if $newerr;
+ $ftp->quit if $newerr;
+ printerr() if $newerr;
+
+ $ftp->cwd($dir) or $newerr=1;
+ push @ERRORS, "Can't cd $!\n" if $newerr;
+ $ftp->quit if $newerr;
+ printerr() if $newerr;
+
+ $newname = $file . "_" . $i ;
+ $ftp->put($file,$newname) or $newerr=1;
+ push @ERRORS, "Can't get file $file $!\n" if $newerr;
+ printerr() if $newerr;
+
+ $i++;
+ $ftp->quit;
+}
+system("rm -rf $dir");
+exit 0;
+
+sub printerr {
+ print "Error: \n";
+ print @ERRORS;
+ exit -1;
+}
Index: containers/netns/par_chld_ftp.c
===================================================================
--- /dev/null
+++ containers/netns/par_chld_ftp.c
@@ -0,0 +1,36 @@
+/*************************************************************************
+* Copyright (c) International Business Machines Corp., 2008
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+* the GNU General Public License for more details.
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*
+***************************************************************************/
+/* ============================================================================
+* This testcase uses the libnetns.c from the library to create network NS.
+* In libnetns.c it uses 2 scripts parentns.sh and childns.sh to create this.
+* After creating the NS, this program verifies that the network is reachable
+* from parent-NS to child-NS and vice-versa.
+*
+* Scripts Used: parentns.sh, childns.sh, par_ftp.sh , ch_ftp.sh container_ftp.pl
+*
+* Author: Veerendra C <[EMAIL PROTECTED]>
+* 31/07/2008
+* =============================================================================*/
+
+extern int create_net_namespace(char *, char *);
+
+int main()
+{
+ int status;
+ status = create_net_namespace("par_ftp.sh", "ch_ftp.sh");
+ return status;
+}
Index: containers/netns/par_ftp.sh
===================================================================
--- /dev/null
+++ containers/netns/par_ftp.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# This script checks whether child NS is reachable from parent NS.
+#set -x
+
+# The test case ID, the test case count and the total number of test case
+TCID=${TCID:-par_ftp.sh}
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+ping -c 5 $IP2 > /dev/null
+
+if [ $? == 0 ] ; then
+ tst_resm TINFO "PASS: Pinging ChildNS from ParentNS"
+else
+ tst_resm TFAIL "FAIL: Unable to ping ChildNS from ParentNS"
+ status=-1
+fi
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list