From 4cfba3ff18c39f8a227807a90e6ba5e27e34faad Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 26 Oct 2007 15:54:15 +0000 Subject: [PATCH] some more source re-org git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@119 836a5e1a-633d-0410-964b-294494ad4392 --- scripts/tcli.pl | 44 +++++++++++++++++++++++++++++++++++++++ scripts/thompson-cwmp.txt | 7 +++++++ 2 files changed, 51 insertions(+) create mode 100755 scripts/tcli.pl create mode 100644 scripts/thompson-cwmp.txt diff --git a/scripts/tcli.pl b/scripts/tcli.pl new file mode 100755 index 0000000..162a4b4 --- /dev/null +++ b/scripts/tcli.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w + +use strict; +use Expect; +use Net::Telnet; + +my $modem = '192.168.1.254'; +my @commands = ( +':system config led=flash', +); + +while(<>) { + chomp; + next if (/^#/ || /^\s*$/); + push @commands, $_; +} + +push @commands, ':system config led=off'; + +my $debug = 0; + +my $telnet = new Net::Telnet( $modem ) or die "Cannot telnet to $modem: $!\n"; +my $exp = Expect->exp_init($telnet); +$exp->debug( $debug ); + +$exp->log_stdout( 1 ); + +my ( $username, $password ) = ('Administrator',''); +my $timeout = 3; + +$exp->expect($timeout, 'Username : '); +$exp->send("$username\r\n"); +$exp->expect($timeout, 'Password :'); +$exp->send("$password\r\n"); +$exp->expect($timeout, '=>'); + +foreach my $cmd ( @commands ) { + $exp->send( "$cmd\r\n" ); + $exp->expect($timeout, '=>'); +} + +$exp->send( "exit\r\n" ); +$exp->soft_close(); + diff --git a/scripts/thompson-cwmp.txt b/scripts/thompson-cwmp.txt new file mode 100644 index 0000000..02d7736 --- /dev/null +++ b/scripts/thompson-cwmp.txt @@ -0,0 +1,7 @@ +# just a comment +:cwmp config state=disabled +:cwmp debug traceconfig level=1 +:cwmp server config url=http://192.168.1.90:3333/ +:cwmp config state=enabled mode=full periodicInform=enabled periodicInfInt=15 + + -- 2.20.1