in reply to Re^11: issue with code to save config on brocade swicth
in thread issue with code to save config on brocade switch

its working now,tested it couple of times and sure now

posting the formatted code

#!/usr/bin/perl use strict; use warnings; use List::Util qw( first ); use Net::OpenSSH; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($INFO); $Net::OpenSSH::debug = -1; my $logger = get_logger(); my $username = 'admin'; my $password = 'password'; my $ip = '10.227.0.216'; $logger->info( "performing ssh to the swicth" ); my $ssh = Net::OpenSSH->new( $ip, user => "$username", password => "$password", master_opts => [-o => "StrictHostKeyChecking=no"] ); $logger->info( "listing zone on the switch $ip using zoneshow" ); my ( $out, $err ) = $ssh->capture2( "zoneshow" ); print "$out\n"; $logger->info( "zoneshow successful" ); $logger->info( "listing zone on the switch $ip using nsshow" ); ( $out, $err ) = $ssh->capture2( "nsshow" ); print "$out\n"; $logger->info( "nsshow successful" ); sleep 3; $logger->info( "create zone on the switch $ip using zonecreate" ); ( $out, $err ) = $ssh->capture2( "zonecreate \"test15\", \" 20:01:00:1 +1:0d:34:57:00\" " ); $ssh->error and die "remote find command failed: $!" . $ssh->error; print "$out\n"; $logger->info( "zonecreate successful" ); ##now add the zone to the config and save it ( $out, $err ) = $ssh->capture2( "cfgadd \"FC_DVT\", \"test15\"" ); $ssh->error and die "remote find command failed: $!" . $ssh->error; print "$out\n"; ( $out, $err ) = $ssh->capture2( { stdin_data =>"yes\n"}, "cfgsave" ) +; $ssh->error and die "remote find command failed: $!" . $ssh->error; print "$out\n"; ( $out, $err ) = $ssh->capture2( { stdin_data =>"yes\n"},"cfgenable \" +FC_DVT\""); $ssh->error and die "remote find command failed: $!" . $ssh->error; print "$out\n";

thanks all,salva,soonix,corion