summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/tests/validation
diff options
context:
space:
mode:
authorZoran Milosavljevic2010-08-25 14:57:37 +0200
committerZoran Milosavljevic2010-08-25 14:59:45 +0200
commita77ec026e39ed32ccf7ef75a8aecbb959cd66c09 (patch)
tree2060e6c0bb3e2ada893a51ceedb2bfc58abbaade /cleopatre/devkit/tests/validation
parent0375a475747603c25ce46ea7b3253fb131aaaefe (diff)
cleo/devkit/tests/validation/scripts[eoc]: updates snmp test and adds check list tests, no refs
Diffstat (limited to 'cleopatre/devkit/tests/validation')
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/checklist_tests/checklist_tests25
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/checklist_tests/common_functions.pl682
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/checklist_tests/ct1058
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/test_snmp/common_functions.pl37
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/test_snmp/test_snmp13
-rwxr-xr-xcleopatre/devkit/tests/validation/scripts/test_snmp/tsnmp71
6 files changed, 1876 insertions, 10 deletions
diff --git a/cleopatre/devkit/tests/validation/scripts/checklist_tests/checklist_tests b/cleopatre/devkit/tests/validation/scripts/checklist_tests/checklist_tests
new file mode 100755
index 0000000000..acee389dde
--- /dev/null
+++ b/cleopatre/devkit/tests/validation/scripts/checklist_tests/checklist_tests
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# This is the main script to start full checklist tests.
+# Start this script with: sudo ./checklist_tests
+# The master board under test IP address (master_ip),
+# test PC eth used IP address (pc_eth1_ip_addr),
+# the location where test files will be stored (folder_name) and
+# list of slave IP addresses, space separated (slave_ip) has to be given.
+# When test is finished, file results.txt is generated and contains
+# test result. Test summary is given at the end of the file.
+# The scripts called ('ct') uses the Net::Telnet Perl module
+# which has to be installed (for example, using: cpan -> install Net::Telnet -> q)
+# Note: reset all boards under test before starting the test
+# Note: white list must not be full- at least there has to be place for one new entry (for wl set test)
+# Note: trefresh should be arround 5-10s to avoid long wait for test to complete
+
+master_ip="192.168.3.103"
+pc_eth1_ip_addr="192.168.3.3"
+folder_name="/home/zoran/Desktop/checklist_tests/test_folder/"
+slave_ip="192.168.3.172 192.168.3.160"
+
+echo "Checklist test started ..."
+
+# start test
+sudo ./ct $master_ip $pc_eth1_ip_addr $folder_name $slave_ip | tee $folder_name"results.txt"
diff --git a/cleopatre/devkit/tests/validation/scripts/checklist_tests/common_functions.pl b/cleopatre/devkit/tests/validation/scripts/checklist_tests/common_functions.pl
new file mode 100755
index 0000000000..52952227f9
--- /dev/null
+++ b/cleopatre/devkit/tests/validation/scripts/checklist_tests/common_functions.pl
@@ -0,0 +1,682 @@
+# This file contains common functions used by both, 'ff' and 'tsnmp' scripts
+
+sub CompleteTestPassFail
+{
+ my($test_passed) = @_;
+
+ print "\n-----------------------------------------------\n";
+ if ($test_passed) {
+ print "Test PASSED!\n";
+ } else {
+ print "Test FAILED!\n";
+ }
+}
+
+sub SingleTestPassFail
+{
+ my($test_name, $test_passed) = @_;
+ $global_test_result = $_[2];
+ $failed_tests_list = @_;
+
+ if (!$test_passed) {
+ print "Test $test_name FAILED!\n";
+ $global_test_result = 0;
+ push(@{failed_tests_list}, $test_name);
+ push(@{failed_tests_list}, "\n");
+ }
+}
+
+sub CompareStringEq
+{
+ my($file_value, $response, $test_passed) = @_;
+
+ ($response_key, $response_value) = split("= STRING: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ if ($file_value ne $response_value) {
+ $test_passed = 0;
+ } else {
+ $test_passed = 1;
+ }
+ return $test_passed;
+}
+
+sub CompareStringContained
+{
+ my(@arr, $str, $test_passed) = @_;
+ $test_passed = 0;
+
+ for ($i = 0; $i < $#arr; $i++)
+ {
+ if( $arr[$i] =~ /\b$str\b/ )
+ {
+ $test_passed = 1;
+ last;
+ }
+ }
+ return $test_passed;
+}
+
+# search array @arr from position nr. $from to position number $to
+# for strings contained in @str
+sub CompareMultipleStringContained
+{
+ my($ref_arr, $from, $to, $ref_str, $test_passed) = @_;
+ $$test_passed = 0;
+ $count = 0;
+ $j = 0;
+#print "\n==1==@{$ref_arr}==1==\n";
+#print "\n==2==@{$ref_str}==2==\n";
+
+ for ($i = $$from; $i < $$to; $i++)
+ {
+ for ($k = $j; $k < scalar @{$ref_str}; $k++)
+ {
+ ${$ref_arr}[$i] =~ s/00/0/g; # substitute two zero's from MAC address with one zero
+ ${$ref_str}[$k] =~ s/00/0/g; # substitute two zero's with one zero
+ if( ${$ref_arr}[$i] =~ /\b${$ref_str}[$k]\b/i ) {
+ $count++;
+ $j++;
+ } else {next;}
+ }
+ }
+ if ($count == scalar @{$ref_str}) {$$test_passed = 1;}
+ return $$test_passed;
+}
+
+sub GetString
+{
+ my($response) = @_;
+
+ ($response_key, $response_value) = split("= STRING: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ return $response_value;
+}
+
+sub GetInt
+{
+ my($response) = @_;
+
+ ($response_key, $response_value) = split("= INTEGER: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ return $response_value;
+}
+
+sub GetIPAddress
+{
+ my($response) = @_;
+
+ ($response_key, $response_value) = split("IpAddress: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ return $response_value;
+}
+
+sub ArrGetListOf
+{
+ my($type, $sort, $response) = @_;
+ @response_index_extracted = ();
+ $i = 0;
+
+ foreach $response (@response)
+ {
+ if ($type eq "int") {
+ ($response_key, $response_value) = split("= INTEGER: ", $response);
+ } elsif ($type eq "string") {
+ ($response_key, $response_value) = split("= STRING: ", $response);
+ } elsif ($type eq "timeticks") {
+ ($response_key, $response_value) = split("= Timeticks: ", $response);
+ } else {
+ ($response_key, $response_value) = split($type, $response);
+ }
+
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ @response_index_extracted[$i++] = $response_value;
+ }
+ if ($sort eq "sorted") {
+ return sort(@response_index_extracted );
+ } elsif ($sort eq "unsorted") {
+ return @response_index_extracted;
+ } else {
+ die ("Wrong parameter specified.");
+ }
+}
+
+sub CompareIPAddress
+{
+ my($file_value, $response, $test_passed) = @_;
+
+ ($response_key, $response_value) = split("= IpAddress: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ if ($file_value ne $response_value) {
+ $test_passed = 0;
+ } else {
+ $test_passed = 1;
+ }
+ return $test_passed;
+}
+
+sub CompareIntEq
+{
+ my($file_value, $response, $test_passed) = @_;
+
+ ($response_key, $response_value) = split("= INTEGER: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ if ($file_value ne $response_value) {
+ $test_passed = 0;
+ } else {
+ $test_passed = 1;
+ }
+ return $test_passed;
+}
+
+sub CompareOIDEq
+{
+ my($file_value, $response, $test_passed) = @_;
+
+ ($response_key, $response_value) = split("= OID: ", $response);
+ $response_value =~ tr/"//d;
+ chomp($response_value);
+ if ($file_value ne $response_value) {
+ $test_passed = 0;
+ } else {
+ $test_passed = 1;
+ }
+ return $test_passed;
+}
+
+sub ParseFile
+{
+ my($file_path) = @_;
+ @arr = ();
+ @arr_tmp = ();
+ $i = 0;
+ $k = 0;
+ open (FILE, $file_path) or die ("Can not open file $file_path");
+ $file_name = basename($file_path);
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+ if (($file_name eq "system.conf") or ($file_name eq "snmp.conf")
+ or ($file_name eq "alarm_analog.conf") or ($file_name eq "alarm_discrete.conf")
+ or ($file_name eq "eoc.conf") or ($file_name eq "master.conf")
+ or ($file_name eq "slave.conf") or ($file_name eq "nvram_full.txt"))
+ {
+ @arr_tmp = split(" = ", $line);
+ }
+ elsif (($file_name eq "ifconfig.txt") or ($file_name eq "etc_network_interfaces.txt")
+ or ($file_name eq "port.conf") or ($file_name eq "port.conf"))
+ {
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+ }
+ elsif ($file_name eq "nvram.txt")
+ {
+ # Split on two (or more) white space characters
+ @arr_tmp = split m/\s{2,}/, $line, -1;
+ }
+ elsif ($file_name eq "version.txt")
+ {
+ @arr_tmp = split(" ", $line);
+ }
+ elsif ($file_name eq "online.info")
+ {
+ @arr_tmp = split(";", $line);
+ }
+ elsif ($file_name eq "list_etc_conf_files.txt")
+ {
+ $str_to_delete = "/etc/";
+ $line =~ s/$str_to_delete//;
+ @arr_tmp[0] = $line;
+ }
+ elsif ($file_name eq "list_usr_local_etc_conf_files.txt")
+ {
+ $str_to_delete = "/usr/local/etc/";
+ $line =~ s/$str_to_delete//;
+ @arr_tmp[0] = $line;
+ }
+ elsif (($file_name eq "wl_show.txt") or ($file_name eq "wl_retrieve.txt"))
+ {
+ # skip the first 2 lines
+ if ($k lt 2) {
+ $k++;
+ next;
+ }
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+ }
+ elsif ($file_name eq "white_list.conf")
+ {
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+ }
+ else {}
+
+ $j = 0;
+ while ($arr_tmp[$j] ne "") {
+ @arr[$i + $j] = $arr_tmp[$j];
+#print @arr[$i].": and :".@arr[$i + $j]."\n";
+ $j++;
+ }
+
+ $i += $j * 2;
+ }
+ close (FILE);
+ return @arr;
+}
+
+sub ParseArr
+{
+ my($key, @arr) = @_;
+
+ for ($i = 0; $i < $#arr; $i+=2)
+ {
+ if ($arr[$i] eq $key) {return $arr[++$i];}
+ }
+}
+
+sub GetNumberOfSlavesFromWhiteList
+{
+ my($file_name, $authorized) = @_;
+ $number_of_slaves = 0;
+ @arr_tmp = ();
+
+ open (FILE, $file_name) or die ("Can not open file $file_name");
+
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+
+ if ($authorized eq "authorized") {
+ if ($arr_tmp[2] eq "1") {$number_of_slaves++;}
+ } elsif ($authorized eq "all") {
+ if (($arr_tmp[2] eq "1") or ($arr_tmp[2] eq "0")) {$number_of_slaves++;}
+ } else {
+ die ("Must be specified 'authorized' or 'all'");
+ }
+ }
+
+ close (FILE);
+
+ return $number_of_slaves;
+}
+
+sub GetNumberOfConnectedSlaves # from online.info
+{
+ my($file_name) = @_;
+ $number_of_connected_slaves = 0;
+
+ open (FILE, $file_name) or die ("Can not open file $file_name");
+
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+
+ $number_of_connected_slaves++;
+ }
+
+ close (FILE);
+
+ return $number_of_connected_slaves;
+}
+
+sub GetMACAddrOfConnectedSlaves # from online.info
+{
+ my($file_name) = @_;
+ @mac_addr = ();
+ @arr_tmp = ();
+ $i = 0;
+
+ open (FILE, $file_name) or die ("Can not open file $file_name");
+
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+
+ @arr_tmp = split(";", $line);
+ $mac_addr[$i++] = @arr_tmp[0];
+ }
+
+ close (FILE);
+
+ return @mac_addr;
+}
+
+sub FileGetListOf
+{
+ my($item, $sort, $file_path) = @_;
+ @list_of_items = ();
+ @arr_tmp = ();
+ $i = 0;
+
+ open (FILE, $file_path) or die ("Can not open file $file_name");
+
+ $file_name = basename($file_path);
+
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+
+ if (($file_name eq "wl_retrieve.txt") or ($file_name eq "wl_show.txt")
+ or ($file_name eq "port.conf") or ($file_name eq "service.conf")) {
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+ } elsif ($file_name eq "online.info") {
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+ # Split on ";"
+ @arr_tmp = split(";", $line);
+ } else {}
+
+ if ($item eq "WL_RETRIEVE_TXT_TEI") {
+ $index = 1;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /^[+-]?\d+$/)) {
+ $list_of_items[$i++] = $arr_tmp[$index] - 2;
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_TEI_UNSUBSTRACTED") {
+ $index = 1;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /^[+-]?\d+$/)) {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_MAC") {
+ $index = 0;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ !/~[f-z]/g)) {
+ $arr_tmp[$index] =~ s/00/0/g; # substitute two zero's from MAC address with one zero
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_AUTHORIZATION") {
+ $index = 2;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /^[+-]?\d+$/)) {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_OUTLEVEL") {
+ $index = 3;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /^[+-]?\d+$/)) {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_STIME") {
+ $index = 4;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /[^A-z]/)) {
+ $arr_tmp[$index] =~ s/^0//; # delete first zero
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_RETRIEVE_TXT_ETIME") {
+ $index = 5;
+ if (($arr_tmp[$index] ne "") and ($arr_tmp[$index] =~ /[^A-z]/)) {
+ $arr_tmp[$index] =~ s/^0//; # delete first zero
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_MODEL_NB") {
+ $index = 1;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_PORT_AMOUNT") {
+ $index = 2;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_AUTHORIZATION") {
+ $index = 3;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_SW_VERSION") {
+ $index = 4;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_DOWNSTR_ATT") {
+ $index = 5;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_UPSTR_ATT") {
+ $index = 6;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_DOWNSTR_DATARATE") {
+ $index = 7;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "ONLINE_INFO_UPSTR_DATARATE") {
+ $index = 8;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "WL_SHOW_DPW") {
+ $index = 6;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "PORT_CONF_PORT_EN") {
+ $index = 1;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "PORT_CONF_SERVICE_INDEX") {
+ $index = 2;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "PORT_CONF_VLAN_TAG_EN") {
+ $index = 3;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "PORT_CONF_VLAN_MARK_ID") {
+ $index = 4;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_INDEX") {
+ $index = 0;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_NAME") {
+ $index = 1;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_MATCHING_VAL") {
+ $index = 2;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_QOS_PRIO") {
+ $index = 3;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_DBA_DOWNSTREAM_PIR") {
+ $index = 4;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_DBA_UPSTREAM_PIR") {
+ $index = 5;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_DBA_DOWNSTREAM_CIR") {
+ $index = 6;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_DBA_UPSTREAM_CIR") {
+ $index = 7;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_MAX_LATENCY") {
+ $index = 8;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_MAX_JITTER") {
+ $index = 9;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "SERVICE_CONF_ACS_EN") {
+ $index = 10;
+ if ($arr_tmp[$index] ne "") {
+ $list_of_items[$i++] = $arr_tmp[$index];
+ }
+ } elsif ($item eq "PS") {
+ $list_of_items[$i++] = $line;
+ }
+ else {};
+ }
+ close (FILE);
+ if ($sort eq "sorted") {
+ return sort(@list_of_items);
+ } elsif ($sort eq "unsorted") {
+ return @list_of_items;
+ } else {
+ die ("Wrong parameter specified.");
+ }
+}
+
+# returns "1" if arrays are equal
+sub CompareArrays
+{
+ my ($first, $second) = @_;
+ my ($test_passed) = @_;
+
+ if (scalar @{$first} != scalar @{$second}) {$test_passed = 0; return $test_passed;}
+ for (my $i = 0; $i < scalar @{$first}; $i++) {
+ if (@{$first}[$i] ne @{$second}[$i]) {$test_passed = 0;}
+ }
+
+ return $test_passed;
+}
+
+sub GetIndexFromMACAddress
+{
+ my($file_name, @arr_of_mac_addr) = @_;
+ @list_of_indexes = ();
+ @arr_tmp = ();
+ $i = 0;
+
+ open (FILE, $file_name) or die ("Can not open file $file_name");
+
+ while (<FILE>)
+ {
+ $line = $_;
+ $line =~ s/^\s+//; #remove leading spaces
+ $line =~ s/\s+$//; #remove trailing spaces
+ chomp;
+
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+
+ # extract MAC address
+ if (($arr_tmp[0] ne "") and ($arr_tmp[0] =~ !/~[f-z]/g)) {
+ # check if extracted MAC address matches with MAC addres specified as input
+ foreach $mac_addr (@arr_of_mac_addr)
+ {
+ if ($arr_tmp[0] eq $mac_addr) {
+ # ... if it does, return it's index (TEI - 2)
+ $list_of_indexes[$i++] = $arr_tmp[1] - 2;
+ }
+ }
+ }
+ }
+ close (FILE);
+ return sort(@list_of_indexes);
+}
+
+sub GetMACFrom
+{
+ my @arr = @_;
+ $i = 0;
+
+ foreach $arr (@arr)
+ {
+ if ($i eq 2) {return $arr;}
+ if (($arr eq "br0") and ($i eq 0)) {
+ $i = 1;
+ next;
+ }
+ if (($arr eq "HWaddr") and ($i eq 1)) {
+ $i = 2;
+ next;
+ }
+ }
+}
+
+sub ConnectToBoard
+{
+ my($master_ip) = @_;
+
+ do {
+ $telnet = $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'return');
+ print "\nTrying to telnet to the board $master_ip ...\n";
+ } while ($telnet->errmsg ne "");
+
+ do {
+ $ok = $telnet->open($master_ip);
+ print " Connecting to port on remote host: $master_ip ...\n";
+ sleep(2);
+ } while ($ok ne 1);
+
+ $telnet->waitfor('/scr310_eoc_master login:/');
+ $telnet->print('root');
+ $telnet->waitfor('/#/');
+
+ return $telnet;
+}
+
+sub GetFileFromBoard
+{
+ my($telnet, $pc_eth1_ip_addr, $folder_name, $file_name) = @_;
+
+ print $telnet->cmd("ftpput -v -u spidcom -p spidcom $pc_eth1_ip_addr $file_name $file_name");
+ $copy = `cp /home/spidcom/$file_name $folder_name`;
+}
+
+sub PutFileToBoard
+{
+ my($telnet, $pc_eth1_ip_addr, $folder_name, $file_name) = @_;
+
+ $copy = `sudo cp $folder_name$file_name /home/spidcom`;
+ print $telnet->cmd("ftpget -v -u spidcom -p spidcom $pc_eth1_ip_addr $file_name $file_name");
+}
+1;
diff --git a/cleopatre/devkit/tests/validation/scripts/checklist_tests/ct b/cleopatre/devkit/tests/validation/scripts/checklist_tests/ct
new file mode 100755
index 0000000000..692514d912
--- /dev/null
+++ b/cleopatre/devkit/tests/validation/scripts/checklist_tests/ct
@@ -0,0 +1,1058 @@
+#!/usr/bin/perl
+
+# white list must not be full (for wl set test)
+# trefresh should be arround 5-10s to avoid long wait for test to complete
+
+use Net::Telnet;
+use File::Basename;
+require 'common_functions.pl';
+
+$master_ip = $ARGV[0];
+$pc_eth1_ip_addr = $ARGV[1];
+$folder_name = $ARGV[2];
+@slave_ip_addr_list = ();
+for ($i = 3; $i < $#ARGV + 1; $i++) {
+ push(@slave_ip_addr_list, $ARGV[$i]);
+ if (scalar(@slave_ip_addr_list) eq 0) {
+ print "\nNo slave selected. Test aborted.\n";
+ last;
+ exit;
+ }
+}
+
+$telnet = &ConnectToBoard($master_ip);
+
+$folder_name_choped = $folder_name;
+chop($folder_name_choped);
+$rename_remove_create = `rm -rf $folder_name_choped"_old"`;
+$rename_remove_create = `mv $folder_name $folder_name_choped"_old"`;
+$rename_remove_create = `mkdir -p $folder_name`;
+
+$current_folder = "./";
+$test_result = 1;
+$global_test_result = 1;
+@failed_tests_list = ();
+
+print $telnet->cmd("rm -f /usr/local/etc/test_file.txt");
+print $telnet->cmd("rm -f /etc/save.lst");
+print $telnet->cmd("touch /etc/test_file.txt");
+print $telnet->cmd("echo test > /etc/test_file.txt");
+print $telnet->cmd("echo test_file.txt > /etc/save.lst");
+print $telnet->cmd("ls /etc/*.conf > list_etc_conf_files.txt");
+print $telnet->cmd("ls /etc/test_file.txt >> list_etc_conf_files.txt");
+print $telnet->cmd("nvram show > nvram.txt");
+print $telnet->cmd("ifconfig > ifconfig.txt");
+print $telnet->cmd("/usr/local/lib/modules/readNVRAM > nvram_full.txt");
+print $telnet->cmd("ps -w > ps.txt");
+print $telnet->cmd("wl retrieve > wl_retrieve.txt");
+print $telnet->cmd("wl show > wl_show.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "wl_show.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "wl_retrieve.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram_full.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "ifconfig.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "list_etc_conf_files.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "ps.txt");
+print $telnet->cmd("cd /etc");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "white_list.conf");
+print $telnet->cmd("cd /var/run/info");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "online.info");
+print $telnet->cmd("cd /etc");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "master.conf");
+
+@list_etc_conf_files_txt_arr = &ParseFile($folder_name."list_etc_conf_files.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+@nvram_full_txt_arr = &ParseFile($folder_name."nvram_full.txt");
+@ifconfig_txt_arr = &ParseFile($folder_name."ifconfig.txt");
+@wl_show_txt_arr = &ParseFile($folder_name."wl_show.txt");
+@wl_retrieve_txt_arr = &ParseFile($folder_name."wl_retrieve.txt");
+@white_list_conf_arr = &ParseFile($folder_name."white_list.conf");
+@master_conf_arr = &ParseFile($folder_name."master.conf");
+
+
+
+$test_name = "wl show";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$test_result = &CompareArrays(\@wl_show_txt_arr, \@white_list_conf_arr, $test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+# checks if MAC addresses from all white list entries (from wl show) which has authorisation value 1,
+# appears in the wl_retrieve list
+$test_name = "wl retrieve";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$f = 0;
+$to = 500; # perhaps this in not enough for long white_list.conf
+@wl_show_allowed_mac = ();
+for ($i = 0; $i < scalar(@wl_show_txt_arr); $i+=7) {
+ if ($wl_show_txt_arr[$i + 2] eq 1) {
+ push(@wl_show_allowed_mac, $wl_show_txt_arr[$i]);
+ }
+}
+@wl_retrieve_txt_arr = sort (@wl_retrieve_txt_arr);
+@wl_show_allowed_mac = sort (@wl_show_allowed_mac);
+$test_result = CompareMultipleStringContained(\@wl_retrieve_txt_arr, \$f, \$to, \@wl_show_allowed_mac, \$test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+# takes first connected slave MAC address from online.info, gives command 'wl get <MAC>' and
+# compares received result with result of command 'wl show | grep <MAC>'
+$test_name = "wl get";
+$test_result = 1;
+print "\nStart test $test_name\n";
+@wl_online_info_mac = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+@wl_get = $telnet->cmd("wl get $wl_online_info_mac[0]");
+@wl_show = $telnet->cmd("wl show | grep $wl_online_info_mac[0]");
+if (@wl_get[2] ne @wl_show[0]) {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl get unknown slave";
+$test_result = 1;
+print "\nStart test $test_name\n";
+@wl_get = $telnet->cmd("wl get ff:ff:ff:ff:ff:ff");
+if (@wl_get[0] ne "Cannot retreive the ff:ff:ff:ff:ff:ff entry\n") {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl set enable and wl remove";
+$test_result = 1;
+print "\nStart test $test_name\n";
+print "\nFind first available TEI, starting from 254\n";
+# find the first unoccupied TEI, starting from 254 (occupied TEIs are fetched from 'wl retrieve')
+$tei = 254;
+@tei_occupied = &FileGetListOf("WL_RETRIEVE_TXT_TEI_UNSUBSTRACTED", "sorted", $folder_name."wl_retrieve.txt");
+while (1) {
+ if (exists {map { $_ => 1 } @tei_occupied}->{$tei} eq 1) {
+ if ($tei gt 3) {
+ $tei--;
+ } else {
+ print "\nAll TEI's are occupied.\n";
+ $test_result = 0;
+ }
+ } else {
+ last;
+ }
+}
+$cmd = "wl set ff:ff:ff:ff:ff:ff $tei 1 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+$cmd = "wl show | grep ff:ff:ff:ff:ff:ff";
+@wl_show = $telnet->cmd($cmd);
+print "$cmd\n@wl_show\n";
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, @wl_show[0], -1;
+if (($arr_tmp[0] ne "ff:ff:ff:ff:ff:ff") or ($arr_tmp[1] ne $tei) or ($arr_tmp[2] ne "1")
+ or ($arr_tmp[3] ne "110") or ($arr_tmp[4] ne "08:00") or ($arr_tmp[5] ne "22:00")
+ or ($arr_tmp[6] ne "SPIDCOM-SCR310-xx")) {
+ $test_result = 0;
+}
+# remove MAC
+$cmd = "wl remove ff:ff:ff:ff:ff:ff";
+@wl_remove = $telnet->cmd($cmd);
+@wl_show = $telnet->cmd("wl show | grep ff:ff:ff:ff:ff:ff");
+print "$cmd\n@wl_show\n";
+if ((@wl_remove[0] ne "Entry ff:ff:ff:ff:ff:ff successfully removed from the conf file\n") or
+ (scalar (@wl_show) ne 1) or ($wl_show[0] ne "")) {
+ print "\nTest entry added in the white list (ff:ff:ff:ff:ff:ff) can not be removed. Test canceled.\n";
+ $test_result = 0;
+ exit;
+}
+# remove not existing MAC
+$cmd = "wl remove ff:ff:ff:ff:ff:ff";
+@wl_remove = $telnet->cmd($cmd);
+print "$cmd\n@wl_remove\n";
+if (@wl_remove[0] ne "Entry removal failed\n") {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl set disable and wl remove";
+$test_result = 1;
+print "\nStart test $test_name\n";
+print "\nFind first available TEI, starting from 254\n";
+# find the first unoccupied TEI, starting from 254 (occupied TEIs are fetched from 'wl retrieve')
+$tei = 254;
+@tei_occupied = &FileGetListOf("WL_RETRIEVE_TXT_TEI_UNSUBSTRACTED", "sorted", $folder_name."wl_retrieve.txt");
+while (1) {
+ if (exists {map { $_ => 1 } @tei_occupied}->{$tei} eq 1) {
+ if ($tei gt 3) {
+ $tei--;
+ } else {
+ print "\nAll TEI's are occupied.\n";
+ $test_result = 0;
+ }
+ } else {
+ last;
+ }
+}
+$cmd = "wl set ff:ff:ff:ff:ff:ff $tei 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+$cmd = "wl show | grep ff:ff:ff:ff:ff:ff";
+@wl_show = $telnet->cmd($cmd);
+print "$cmd\n@wl_show\n";
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, @wl_show[0], -1;
+if (($arr_tmp[0] ne "ff:ff:ff:ff:ff:ff") or ($arr_tmp[1] ne $tei) or ($arr_tmp[2] ne "0")
+ or ($arr_tmp[3] ne "110") or ($arr_tmp[4] ne "08:00") or ($arr_tmp[5] ne "22:00")
+ or ($arr_tmp[6] ne "SPIDCOM-SCR310-xx")) {
+ $test_result = 0;
+}
+# remove MAC
+$cmd = "wl remove ff:ff:ff:ff:ff:ff";
+@wl_remove = $telnet->cmd($cmd);
+$cmd = "wl show | grep ff:ff:ff:ff:ff:ff";
+@wl_show = $telnet->cmd($cmd);
+print "$cmd\n@wl_show\n";
+if ((@wl_remove[0] ne "Entry ff:ff:ff:ff:ff:ff successfully removed from the conf file\n") or
+ (scalar (@wl_show) ne 1) or ($wl_show[0] ne "")) {
+ print "\nTest entry added in the white list (ff:ff:ff:ff:ff:ff) can not be removed. Test canceled.\n";
+ $test_result = 0;
+ exit;
+}
+print "Remove not existing MAC\n";
+# remove not existing MAC
+$cmd = "wl remove ff:ff:ff:ff:ff:ff";
+@wl_remove = $telnet->cmd($cmd);
+print "$cmd\n@wl_remove\n";
+if (@wl_remove[0] ne "Entry removal failed\n") {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl set malformed input parameters";
+print "\nStart test $test_name\n";
+$test_result = 1;
+# TEI = 0
+$cmd = "wl set ff:ff:ff:ff:ff:ff 0 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Wrong TEI value (expected: 3..254)\n") {$test_result = 0;}
+# TEI = 1
+$cmd = "wl set ff:ff:ff:ff:ff:ff 1 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Wrong TEI value (expected: 3..254)\n") {$test_result = 0;}
+# TEI = 2
+$cmd = "wl set ff:ff:ff:ff:ff:ff 2 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Wrong TEI value (expected: 3..254)\n") {$test_result = 0;}
+# TEI = 255
+$cmd = "wl set ff:ff:ff:ff:ff:ff 255 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Wrong TEI value (expected: 3..254)\n") {$test_result = 0;}
+# malformed MAC
+$cmd = "wl set ff:ff:ff:ff:ff 3 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Malformed MAC address\n") {$test_result = 0;}
+# malformed STIME
+$cmd = "wl set ff:ff:ff:ff:ff:ff 3 0 110 8 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Malformed start time (expected: hh:mm)\n") {$test_result = 0;}
+# malformed ETIME
+$cmd = "wl set ff:ff:ff:ff:ff:ff 3 0 110 08:00 2 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: Malformed end time (expected: hh:mm)\n") {$test_result = 0;}
+# incomplete entry (missing DPW)
+$cmd = "wl set ff:ff:ff:ff:ff:ff 3 0 110 08:00 22:00";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: A complete entry has to be specified\n") {$test_result = 0;}
+# incomplete entry (missing TEI)
+$cmd = "wl set ff:ff:ff:ff:ff:ff 0 110 08:00 22:00 SPIDCOM-SCR310-xx";
+@wl_set = $telnet->cmd($cmd);
+print "$cmd\n@wl_set\n";
+if ($wl_set[0] ne "ERROR: A complete entry has to be specified\n") {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl enable and disable";
+print "\nStart test $test_name\n";
+$test_result = 1;
+@wl_online_info_mac = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+@wl_show = $telnet->cmd("wl show | grep $wl_online_info_mac[0]");
+print "\nEntry to be disabled: @wl_show[0]";
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, @wl_show[0], -1;
+for ($i = 0; $i < scalar(@arr_tmp); $i++)
+{
+ if ($arr_tmp[$i] eq @wl_online_info_mac[0]) {
+ $cmd = "wl set $wl_online_info_mac[0] ".$arr_tmp[$i + 1]." 0 ".$arr_tmp[$i + 3]." ".$arr_tmp[$i + 4]." ".$arr_tmp[$i + 5]." ".$arr_tmp[$i + 6];
+ last;
+ }
+}
+print "\n$cmd\n";
+@disable = $telnet->cmd($cmd);
+print "\n@disable";
+@wl_sync = $telnet->cmd("wl sync");
+if ($wl_sync[0] ne "White List successfully synchronized\n") {
+ $test_result = 0;
+}
+print "\n@wl_sync";
+@wl_retieve = $telnet->cmd("wl retrieve | grep $wl_online_info_mac[0]");
+if ((scalar (@wl_retrieve) ne 0) or ($wl_retrieve[0] ne "")) {
+ $test_result = 0;
+}
+print "\nwl retrieve list after slave $wl_online_info_mac[0] is disabled:\n";
+@print = print $telnet->cmd("wl retrieve");
+print "\nEnable the slave again.\n";
+$cmd = "wl set $wl_online_info_mac[0] ".$arr_tmp[$i + 1]." 1 ".$arr_tmp[$i + 3]." ".$arr_tmp[$i + 4]." ".$arr_tmp[$i + 5]." ".$arr_tmp[$i + 6];
+print "$cmd\n";
+@enable = $telnet->cmd($cmd);
+print "\n@enable";
+@wl_sync = $telnet->cmd("wl sync");
+if ($wl_sync[0] ne "White List successfully synchronized\n") {
+ $test_result = 0;
+}
+print "\n@wl_sync";
+@wl_retieve = $telnet->cmd("wl retrieve | grep $wl_online_info_mac[0]");
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, $wl_retieve[0], -1;
+if (($arr_tmp[0] ne $wl_online_info_mac[0]) or ($arr_tmp[2] ne 1)) {
+ $test_result = 0;
+}
+print "\nwl retrieve list after slave $wl_online_info_mac[0] is enabled:\n";
+@print = print $telnet->cmd("wl retrieve");
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+# Test if master receives assoc request is done by checking if there is acording entry
+# in the online.info table after slave <MAC_SLAVE> is disabled:
+# <MAC_SLAVE> SPiDCOMUnauthorizedModem 0 0 unauthorized 00 00 00 00
+$test_name = "wl no_white_slave: master behavior";
+print "\nStart test $test_name\n";
+$test_result = 1;
+@online_info_before = $telnet->cmd("cat /var/run/info/online.info");
+$t_refresh = &ParseArr("TOPO_REFRESH_PERIOD", @master_conf_arr);
+# disable one slave
+@online_info_mac_to_disconnect = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+print "\nDisconnecting the slave: $online_info_mac_to_disconnect[0]\n";
+@wl_show = $telnet->cmd("wl show | grep $online_info_mac_to_disconnect[0]");
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, @wl_show[0], -1;
+if ($arr_tmp[0] eq $online_info_mac_to_disconnect[0]) {
+ $cmd_disable = "wl set $online_info_mac_to_disconnect[0] $arr_tmp[1] 0 $arr_tmp[3] $arr_tmp[4] $arr_tmp[5] $arr_tmp[6]";
+ $cmd_enable = "wl set $online_info_mac_to_disconnect[0] $arr_tmp[1] 1 $arr_tmp[3] $arr_tmp[4] $arr_tmp[5] $arr_tmp[6]";
+ print "$cmd_disable\n";
+ @disconnect_set = $telnet->cmd($cmd_disable);
+ print "@disconnect_set\n";
+ @disconnect_sync = $telnet->cmd("wl sync");
+ print "@disconnect_sync\n";
+}
+print "\n Waiting t_refresh to update online.info\n";
+sleep ($t_refresh + 5);
+@online_info = $telnet->cmd("cat /var/run/info/online.info");
+print "@online_info\n";
+if ($arr_tmp[0] eq $online_info_mac_to_disconnect[0]) {
+ if (($arr_tmp[1] ne "SPiDCOMUnauthorizedModem") or ($arr_tmp[2] ne 0) or ($arr_tmp[3] ne 0) or
+ ($arr_tmp[4] ne "unauthorized") or ($arr_tmp[5] ne "00") or ($arr_tmp[6] ne "00") or
+ ($arr_tmp[7] ne "00") or ($arr_tmp[8] ne "00")) {
+ $test_passed = 0;
+ }
+}
+print "\nReenabling disconnected slave.\n";
+print "$cmd_enable\n";
+@connect_set = $telnet->cmd($cmd_enable);
+print "@connect_set\n";
+@connect_sync = $telnet->cmd("wl sync");
+print "@connect_sync\n";
+print "\n Waiting t_refresh to update online.info\n";
+sleep ($t_refresh + 5);
+print "\nConnected slaves after reenabling slave $online_info_mac_to_disconnect[0].\n";
+@online_info_after = $telnet->cmd("cat /var/run/info/online.info");
+@online_info_before = sort(@online_info_before);
+@online_info_after = sort(@online_info_after);
+if (0 eq &CompareArrays(\@online_info_before, \@online_info_after, $test_result)) {
+ print "\nDisabled slave can not be reenabled. Test aborted.\n";
+ exit;
+}
+print "@online_info_after\n";
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl switch from enable to disable";
+print "\nStart test $test_name\n";
+$test_result = 1;
+$t_refresh = &ParseArr("TOPO_REFRESH_PERIOD", @master_conf_arr);
+print "\nCurrently connected slaves:\n";
+@online_info_before = $telnet->cmd("cat /var/run/info/online.info");
+print "@online_info_before\n";
+@online_info_mac_to_disconnect = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+print "\nDisconnecting the slave: $online_info_mac_to_disconnect[0]\n";
+@wl_show = $telnet->cmd("wl show | grep $online_info_mac_to_disconnect[0]");
+# Split on one (or more) white space characters
+@arr_tmp = split m/\s{1,}/, @wl_show[0], -1;
+if ($arr_tmp[0] eq $online_info_mac_to_disconnect[0]) {
+ $cmd_disable = "wl set $online_info_mac_to_disconnect[0] $arr_tmp[1] 0 $arr_tmp[3] $arr_tmp[4] $arr_tmp[5] $arr_tmp[6]";
+ $cmd_enable = "wl set $online_info_mac_to_disconnect[0] $arr_tmp[1] 1 $arr_tmp[3] $arr_tmp[4] $arr_tmp[5] $arr_tmp[6]";
+ print "$cmd_disable\n";
+ @disconnect_set = $telnet->cmd($cmd_disable);
+ print "@disconnect_set\n";
+ @disconnect_sync = $telnet->cmd("wl sync");
+ print "@disconnect_sync\n";
+}
+print "\n Waiting t_refresh to update online.info\n";
+sleep ($t_refresh + 5);
+print "\nConnected slaves after $online_info_mac_to_disconnect[0] is disabled:\n";
+@online_info = $telnet->cmd("cat /var/run/info/online.info");
+print "@online_info\n";
+@online_info_before = sort(@online_info_before);
+@online_info = sort(@online_info);
+if (1 eq &CompareArrays(\@online_info_before, \@online_info, $test_result)) {
+ $test_result = 0;
+}
+print "\nReenabling disconnected slave.\n";
+print "$cmd_enable\n";
+@connect_set = $telnet->cmd($cmd_enable);
+print "@connect_set\n";
+@connect_sync = $telnet->cmd("wl sync");
+print "@connect_sync\n";
+print "\n Waiting t_refresh to update online.info\n";
+sleep ($t_refresh + 5);
+print "\nConnected slaves after reenabling slave $online_info_mac_to_disconnect[0].\n";
+@online_info_after = $telnet->cmd("cat /var/run/info/online.info");
+@online_info_before = sort(@online_info_before);
+@online_info_after = sort(@online_info_after);
+if (0 eq &CompareArrays(\@online_info_before, \@online_info_after, $test_result)) {
+ print "\nDisabled slave can not be reenabled. Test aborted.\n";
+ exit;
+}
+print "@online_info_after\n";
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+# TODO: Ovaj test treba zavrsiti
+$test_name = "wl max entries";
+print "\nStart test $test_name\n";
+$test_result = 1;
+print "\nFlush the white list:\n";
+@wl_flush = $telnet->cmd("wl flush");
+print @wl_flush;
+@wl_show = $telnet->cmd("wl show");
+if ($wl_show[2] ne "\n") {
+ $test_result = 0; # wl show must be empty (only the header line)
+}
+print "\nwl show after flushing the white list:\n@wl_show";
+print "\nCreate wl with 129 entries\n";
+for ($i = 0; $i < 129; $i++) {
+ $hex_i = sprintf("%02X", $i);
+ $tei = $i + 3;
+ print "$cmd\n";
+ $cmd = "wl set 00:00:00:00:00:$hex_i $tei 1 110 08:00 22:00 SPIDCOM-SPK310-$i";
+ @wl_set = $telnet->cmd($cmd);
+ print @wl_set;
+}
+print "\nRebooting the master to retrieve the original white list.\n";
+@reboot = $telnet->cmd("reboot");
+$telnet->close;
+sleep(30);
+$telnet = &ConnectToBoard($master_ip);
+@wl_show_after = $telnet->cmd("wl show");
+if ($wl_show_after[2] eq "\n") {
+ $test_result = 0;
+}
+# TODO: izbrisati ovo kada se zavrsi test
+$test_result = 0;
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl flush";
+print "\nStart test $test_name\n";
+$test_result = 1;
+@wl_show_before = $telnet->cmd("wl show");
+if ($wl_show_before[2] eq "\n") {
+ $test_result = 0;
+}
+print "\nwl show before flushing the white list:\n@wl_show_before";
+@wl_flush = $telnet->cmd("wl flush");
+print @wl_flush;
+@wl_show = $telnet->cmd("wl show");
+if ($wl_show[2] ne "\n") {
+ $test_result = 0; # wl show must be empty (only the header line)
+}
+print "\nwl show after flushing the white list:\n@wl_show";
+print "\nRebooting the master to retrieve the white list.\n";
+@reboot = $telnet->cmd("reboot");
+$telnet->close;
+sleep(30);
+$telnet = &ConnectToBoard($master_ip);
+@wl_show_after = $telnet->cmd("wl show");
+if ($wl_show_after[2] eq "\n") {
+ $test_result = 0;
+}
+print "\nwl show after rebooting the board:\n@wl_show_after";
+# check if wl show command gives the same output as before board reset
+@wl_show_before = sort(@wl_show_before);
+@wl_show_after = sort(@wl_show_after);
+if (0 eq &CompareArrays(\@wl_show_before, \@wl_show_after, $test_result)) {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "wl remove enabled slave and wl sync";
+print "\nStart test $test_name\n";
+$test_result = 1;
+$t_refresh = &ParseArr("TOPO_REFRESH_PERIOD", @master_conf_arr);
+@wl_online_info_mac = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+@wl_show_entry_to_remove = $telnet->cmd("wl show | grep $wl_online_info_mac[0]");
+print "\nonline.info file content before removing slave $wl_online_info_mac[0]:\n";
+$cat = `cat $folder_name"online.info"`; print $cat;
+print "\nEntry to be removed: \n@wl_show_entry_to_remove\n";
+@wl_remove = $telnet->cmd("wl remove $wl_online_info_mac[0]");
+@wl_sync = $telnet->cmd("wl sync");
+if ($wl_sync[0] ne "White List successfully synchronized\n") {
+ $test_result = 0;
+} else {
+ print "\nEntry successfully removed. Waiting t_refresh to update online.info\n";
+}
+# wait for online.info to be updated: t_refresh + 5s (safety margin)
+sleep($t_refresh + 5);
+# fetch new online.info file from board and check if it's content is the same as before wl remove command
+print $telnet->cmd("cd /var/run/info");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "online.info");
+@wl_online_info_mac_after_remove = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+print "\nonline.info file content after removing slave $wl_online_info_mac[0]:\n";
+$cat = `cat $folder_name"online.info"`; print $cat;
+# if it is the same, test failed
+if (1 eq &CompareArrays(\@wl_online_info_mac, \@wl_online_info_mac_after_remove, $test_result)) {
+ $test_result = 0;
+}
+print "\nAdd removed slave $wl_online_info_mac[0]\n";
+# add removed slave
+@wl_add = $telnet->cmd("wl set $wl_show_entry_to_remove[0]");
+@wl_sync = $telnet->cmd("wl sync");
+if ($wl_sync[1] ne "White List successfully synchronized\n") {
+ $test_result = 0;
+} else {
+ print "\nEntry successfully added. Waiting t_refresh to update online.info\n";
+}
+# wait for online.info to be updated: t_refresh + 5s (safety margin)
+sleep($t_refresh + 5);
+# fetch new online.info file from board and check if it's content is the same as before wl remove command
+print $telnet->cmd("cd /var/run/info");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "online.info");
+@wl_online_info_mac_after_add = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+# if it is the same, test passed
+if (0 eq &CompareArrays(\@wl_online_info_mac, \@wl_online_info_mac_after_add, $test_result)) {
+ $test_result = 0;
+}
+print "\nonline.info file content after adding the slave $wl_online_info_mac[0]:\n";
+$cat = `cat $folder_name"online.info"`; print $cat;
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "ftpget";
+$test_result = 1;
+print "\nStart test $test_name\n";
+print "\nCreate test file.\n";
+$ok = `touch test_file.txt`;
+$ok = `echo some text > test_file.txt`;
+print $telnet->cmd("rm -f test_file.txt");
+&PutFileToBoard($telnet, $pc_eth1_ip_addr, $current_folder, "test_file.txt");
+@file_exists = $telnet->cmd("ls test_file.txt");
+if ($file_exists[0] ne "test_file.txt\n") {
+ $test_result = 0;
+}
+print "\nRemove test file.\n";
+$ok = `rm -f test_file.txt`;
+print $telnet->cmd("rm -f test_file.txt");
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "configuration saving";
+print "\nStart test $test_name\n";
+$test_result = 1;
+$f = 0;
+$to = 100;
+print "\nCreate test file.\n";
+print $telnet->cmd("rm -f /usr/local/etc/test_file.txt");
+print $telnet->cmd("touch /usr/local/etc/test_file.txt");
+print $telnet->cmd("echo some text > /usr/local/etc/test_file.txt");
+@file_exists = $telnet->cmd("ls /usr/local/etc/test_file.txt");
+if ($file_exists[0] ne "/usr/local/etc/test_file.txt\n") {
+ $test_result = 0;
+}
+print "\nSave current settings on board (cmd: save)\n";
+print $telnet->cmd("save");
+# generate file list_usr_local_etc_conf_files.txt
+print $telnet->cmd("ls /usr/local/etc/*.conf > list_usr_local_etc_conf_files.txt");
+print $telnet->cmd("ls /usr/local/etc/test_file.txt >> list_usr_local_etc_conf_files.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "list_usr_local_etc_conf_files.txt");
+@list_usr_local_etc_conf_files_txt = &ParseFile($folder_name."list_usr_local_etc_conf_files.txt");
+$test_result = CompareMultipleStringContained(\@list_usr_local_etc_conf_files_txt, \$f, \$to, \@list_etc_conf_files_txt_arr, \$test_result);
+print "\n==2=@list_etc_conf_files_txt_arr==2==\n";
+print "\n==2=@list_usr_local_etc_conf_files_txt==2==\n";
+print "\nRemove test file.\n";
+print $telnet->cmd("rm -f /usr/local/etc/test_file.txt");
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "compare eth0 MAC address with NVRAM MAC address";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_mac = &ParseArr("ETH MAC address", @nvram_txt_arr);
+@str_to_match = ("eth0", "HWaddr", uc($nvram_mac));
+$f = 20;
+$to = 80;
+$test_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "eth0 IP configuration";
+$test_result = 1;
+print "\nStart test $test_name\n";
+@str_to_match = ("eth0", "Link", "encap:Ethernet");
+$f = 20;
+$to = 100;
+$tmp_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+if ($tmp_result eq 0) {$test_result = 0;}
+@str_to_match = ("eth0", "inet", "addr:".$master_ip);
+$tmp_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+if ($tmp_result eq 0) {$test_result = 0;}
+@str_to_match = ("eth0", "Bcast:192.168.3.255");
+$tmp_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+if ($tmp_result eq 0) {$test_result = 0;}
+@str_to_match = ("eth0", "Mask:255.255.255.255");
+$tmp_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+if ($tmp_result eq 0) {$test_result = 0;}
+@str_to_match = ("UP", "BROADCAST", "RUNNING", "MULTICAST");
+$tmp_result = CompareMultipleStringContained(\@ifconfig_txt_arr, \$f, \$to, \@str_to_match, \$test_result);
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram show";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$read_nvram_value = &ParseArr("eth_address", @nvram_full_txt_arr);
+@tmp = split m/\s{1,}/, $read_nvram_value, -1;
+$read_nvram_value = "";
+foreach $tmp (@tmp)
+{
+ if (length($tmp) eq 1) {$tmp = "0".$tmp;}
+ $read_nvram_value = $read_nvram_value.$tmp.":";
+}
+chop($read_nvram_value);
+$read_nvram_value =~ s/00/0/g;
+$nvram_show_value = &ParseArr("ETH MAC address", @nvram_txt_arr);
+$nvram_show_value =~ s/00/0/g;
+if (lc($read_nvram_value) ne lc($nvram_show_value)) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+$read_nvram_value = &ParseArr("plc_address", @nvram_full_txt_arr);
+@tmp = split m/\s{1,}/, $read_nvram_value, -1;
+$read_nvram_value = "";
+foreach $tmp (@tmp)
+{
+ if (length($tmp) eq 1) {$tmp = "0".$tmp;}
+ $read_nvram_value = $read_nvram_value.$tmp.":";
+}
+chop($read_nvram_value);
+$read_nvram_value =~ s/00/0/g;
+$nvram_show_value = &ParseArr("PLC MAC address", @nvram_txt_arr);
+$nvram_show_value =~ s/00/0/g;
+if (lc($read_nvram_value) ne lc($nvram_show_value)) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+$read_nvram_value = &ParseArr("serial_number[64]", @nvram_full_txt_arr);
+$nvram_show_value = &ParseArr("Modem serial number", @nvram_txt_arr);
+if ($read_nvram_value ne $nvram_show_value) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+$read_nvram_value = &ParseArr("device_password[32]", @nvram_full_txt_arr);
+$nvram_show_value = &ParseArr("Device password", @nvram_txt_arr);
+if ($read_nvram_value ne $nvram_show_value) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+$read_nvram_value = &ParseArr("oem_info[64]", @nvram_full_txt_arr);
+$nvram_show_value = &ParseArr("OEM info", @nvram_txt_arr);
+if ($read_nvram_value ne $nvram_show_value) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+$read_nvram_value = &ParseArr("manufactory_info[64]", @nvram_full_txt_arr);
+$nvram_show_value = &ParseArr("Manufactory info", @nvram_txt_arr);
+if ($read_nvram_value ne $nvram_show_value) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change PLC MAC address";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_show_mac_before_change = &ParseArr("PLC MAC address", @nvram_txt_arr);
+print "\nSet NVRAM PLC MAC to ff:ff:ff:ff:ff:ff\n";
+print $telnet->cmd("nvram plc_mac ff:ff:ff:ff:ff:ff");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_mac_after_change = &ParseArr("PLC MAC address", @nvram_txt_arr);
+if ($nvram_show_mac_after_change ne "ff:ff:ff:ff:ff:ff") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM PLC MAC to previous value: $nvram_show_mac_before_change\n";
+print $telnet->cmd("nvram plc_mac $nvram_show_mac_before_change");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_mac_after_change = &ParseArr("PLC MAC address", @nvram_txt_arr);
+if ($nvram_show_mac_after_change ne $nvram_show_mac_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change ETH MAC address";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_show_mac_before_change = &ParseArr("ETH MAC address", @nvram_txt_arr);
+print "\nSet NVRAM ETH0 MAC to ff:ff:ff:ff:ff:ff\n";
+print $telnet->cmd("nvram eth_mac ff:ff:ff:ff:ff:ff");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_mac_after_change = &ParseArr("ETH MAC address", @nvram_txt_arr);
+if ($nvram_show_mac_after_change ne "ff:ff:ff:ff:ff:ff") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM ETH0 MAC to previous value: $nvram_show_mac_before_change\n";
+print $telnet->cmd("nvram eth_mac $nvram_show_mac_before_change");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_mac_after_change = &ParseArr("ETH MAC address", @nvram_txt_arr);
+if ($nvram_show_mac_after_change ne $nvram_show_mac_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change serial number";
+print "\nStart test $test_name\n";
+$test_result = 1;
+$nvram_show_before_change = &ParseArr("Modem serial number", @nvram_txt_arr);
+print "\nSet NVRAM modem serial number to 00000\n";
+print $telnet->cmd("nvram serial 00000");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Modem serial number", @nvram_txt_arr);
+if ($nvram_show_after_change ne "00000") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM modem serial number to previous value: $nvram_show_before_change\n";
+print $telnet->cmd("nvram serial $nvram_show_before_change");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Modem serial number", @nvram_txt_arr);
+if ($nvram_show_after_change ne $nvram_show_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change device password";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_show_before_change = &ParseArr("Device password", @nvram_txt_arr);
+print "\nSet NVRAM dpw to XXXXX-XXXXX\n";
+print $telnet->cmd("nvram dpw XXXXX-XXXXX");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Device password", @nvram_txt_arr);
+if ($nvram_show_after_change ne "XXXXX-XXXXX") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM dpw to previous value: $nvram_show_before_change\n";
+print $telnet->cmd("nvram dpw $nvram_show_before_change");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Device password", @nvram_txt_arr);
+if ($nvram_show_after_change ne $nvram_show_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change OEM information";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_show_before_change = &ParseArr("OEM info", @nvram_txt_arr);
+print "\nSet NVRAM oem to XXXXX-XXXXX\n";
+print $telnet->cmd("nvram oem XXXXX-XXXXX");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("OEM info", @nvram_txt_arr);
+if ($nvram_show_after_change ne "XXXXX-XXXXX") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM oem to previous value: $nvram_show_before_change\n";
+print $telnet->cmd("nvram oem \"$nvram_show_before_change\"");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("OEM info", @nvram_txt_arr);
+if ($nvram_show_after_change ne $nvram_show_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change manufactory info";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$nvram_show_before_change = &ParseArr("Manufactory info", @nvram_txt_arr);
+print "\nSet NVRAM manufactory to XXXXX-XXXXX\n";
+print $telnet->cmd("nvram manufactory XXXXX-XXXXX");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Manufactory info", @nvram_txt_arr);
+if ($nvram_show_after_change ne "XXXXX-XXXXX") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM manufactory to previous value: $nvram_show_before_change\n";
+print $telnet->cmd("nvram manufactory \"$nvram_show_before_change\"");
+@res = $telnet->cmd("nvram show > nvram.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram.txt");
+@nvram_txt_arr = &ParseFile($folder_name."nvram.txt");
+$nvram_show_after_change = &ParseArr("Manufactory info", @nvram_txt_arr);
+if ($nvram_show_after_change ne $nvram_show_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "nvram change package configuration";
+print "\nStart test $test_name\n";
+$test_result = 1;
+$nvram_before_change = &ParseArr("Manufactory info", @nvram_full_txt_arr);
+print "\nSet NVRAM pkg_cfg to 0xFFF\n";
+print $telnet->cmd("nvram pkg_cfg FFF");
+@res = $telnet->cmd("/usr/local/lib/modules/readNVRAM > nvram_full.txt");
+print "@res\n";
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram_full.txt");
+@nvram_full_txt_arr = &ParseFile($folder_name."nvram_full.txt");
+$nvram_after_change = &ParseArr("pkg_cfg", @nvram_full_txt_arr);
+if ($nvram_after_change ne "FFF") {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nSet NVRAM pkg_cfg to previous value: $nvram_before_change\n";
+print $telnet->cmd("nvram pkg_cfg \"$nvram_before_change\"");
+print $telnet->cmd("/usr/local/lib/modules/readNVRAM > nvram_full.txt");
+&GetFileFromBoard($telnet, $pc_eth1_ip_addr, $folder_name, "nvram_full.txt");
+@nvram_full_txt_arr = &ParseFile($folder_name."nvram_full.txt");
+$nvram_after_change = &ParseArr("pkg_cfg", @nvram_full_txt_arr);
+if ($nvram_after_change ne $nvram_before_change) {$tmp_result = 0;}
+if ($tmp_result eq 0) {$test_result = 0;}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "check if http service is available";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$f = 0;
+$to = 100;
+@available = &FileGetListOf("PS", "unsorted", $folder_name."ps.txt");
+@str_to_match = ("root", "httpd");
+$test_result = CompareMultipleStringContained(\@available, \$f, \$to, \@str_to_match, \$test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "check if telnet service is available";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$f = 0;
+$to = 100;
+@available = &FileGetListOf("PS", "unsorted", $folder_name."ps.txt");
+@str_to_match = ("root", "telnetd");
+$test_result = CompareMultipleStringContained(\@available, \$f, \$to, \@str_to_match, \$test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "check if snmp service is available";
+$test_result = 1;
+print "\nStart test $test_name\n";
+$f = 0;
+$to = 100;
+@available = &FileGetListOf("PS", "unsorted", $folder_name."ps.txt");
+@str_to_match = ("root", "snmpd");
+$test_result = CompareMultipleStringContained(\@available, \$f, \$to, \@str_to_match, \$test_result);
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "mme reboot wrong MAC";
+$test_result = 1;
+print "\nStart test $test_name\n";
+@cmd = $telnet->cmd("mme reboot $master_ip");
+if ($cmd[0] ne "mme: Malformed MAC address\n") {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "mme reboot all";
+$tmp_test_result = 1;
+print "\nStart test $test_name\n";
+print "Close the telnet session.\n";
+$telnet->close;
+foreach $slave_mac_addr (@slave_ip_addr_list)
+{
+ # generate test file (on all slaves from slave list) which has to be deleted if master
+ # is successfully reseted
+ print "\nTelnet to $slave_mac_addr.\n";
+ $telnet_slave = &ConnectToBoard($slave_mac_addr);
+ print "\nCreate test files on $slave_mac_addr.\n";
+ print $telnet_slave->cmd("cd /etc");
+ print $telnet_slave->cmd("touch has_to_be_deleted.txt");
+ print $telnet_slave->cmd("echo some text > has_to_be_deleted.txt");
+ @cmd = $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+ print $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+ if ($cmd[0] ne "/etc/has_to_be_deleted.txt\n") {
+ $tmp_test_result = 0;
+ print "\nFile has_to_be_deleted.txt can not be created on slave $slave_mac_addr.\n";
+ last;
+ }
+ print $telnet_slave->cmd("exit");
+ print "\nExit and close telnet session on $slave_mac_addr.\n";
+ $telnet_slave->close;
+}
+print "\nTelnet to master ($master_ip).\n";
+$telnet = &ConnectToBoard($master_ip);
+# reboot all slaves
+print "\nReboot all slaves.\n";
+@res = $telnet->cmd("mme reboot all");
+print "@res\n";
+print "\nClose the telnet session with master.\n";
+$telnet->close;
+print "\nWait 10s.\n";
+sleep(10);
+print "\nCheck if generated test files still exists on slaves after reset.\n";
+foreach $slave_mac_addr (@slave_ip_addr_list)
+{
+ # check if test file exists after reset
+ print "\nTelnet to $slave_mac_addr.\n";
+ $telnet_slave = &ConnectToBoard($slave_mac_addr);
+ print "\nCheck for files.\n";
+ @cmd = $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+ print $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+ if ($cmd[0] ne "ls: /etc/has_to_be_deleted.txt: No such file or directory\n") {
+ $tmp_test_result = 0;
+ last;
+ }
+ print $telnet_slave->cmd("exit");
+ print "\nExit and close telnet session on $slave_mac_addr.\n";
+ $telnet_slave->close;
+}
+print "\nTelnet to master ($master_ip).\n";
+$telnet = &ConnectToBoard($master_ip);
+if ($tmp_test_result eq 0) {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+$test_name = "mme reboot one slave";
+$tmp_test_result = 1;
+print "\nStart test $test_name\n";
+print "\nClose existing telnet session.\n";
+$telnet->close;
+# generate test file (on the first slave from slave mac address list) which has to be deleted
+# if master is successfully reseted
+print "\nTelnet to $slave_ip_addr_list[0]\n";
+$telnet_slave = &ConnectToBoard($slave_ip_addr_list[0]);
+print "\nGenerate test files.\n";
+print $telnet_slave->cmd("cd /etc");
+print $telnet_slave->cmd("touch has_to_be_deleted.txt");
+print $telnet_slave->cmd("echo some text > has_to_be_deleted.txt");
+@cmd = $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+print $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+if ($cmd[0] ne "/etc/has_to_be_deleted.txt\n") {
+ $tmp_test_result = 0;
+ print "\nFile has_to_be_deleted.txt can not be created on slave $slave_mac_addr.\n";
+}
+print $telnet_slave->cmd("ifconfig > ifconfig.txt");
+print "\nDownload ifconfig.txt.\n";
+&GetFileFromBoard($telnet_slave, $pc_eth1_ip_addr, $folder_name, "ifconfig.txt");
+@ifconfig_txt_arr = &ParseFile($folder_name."ifconfig.txt");
+$slave_mac_addr = lc(&GetMACFrom(@ifconfig_txt_arr));
+print $telnet_slave->cmd("exit");
+print "\nExit and close telnet session with $slave_ip_addr_list[0].\n";
+$telnet_slave->close;
+print "\nTelnet to master ($master_ip).\n";
+$telnet = &ConnectToBoard($master_ip);
+print "\nReboot slave $slave_mac_addr.\n";
+# reboot first slave from slave mac address list
+print $telnet->cmd("mme reboot $slave_mac_addr");
+$telnet->close;
+print "\nExit and close telnet session with $slave_ip_addr_list[0].\n";
+print "\nWait 10s.\n";
+sleep(10);
+# check if test file exists on first slave from slave mac address list after reset
+print "\nTelnet to slave ($slave_ip_addr_list[0]).\n";
+$telnet_slave = &ConnectToBoard($slave_ip_addr_list[0]);
+print "\nCheck for files.\n";
+@cmd = $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+print $telnet_slave->cmd("ls /etc/has_to_be_deleted.txt");
+if ($cmd[0] ne "ls: /etc/has_to_be_deleted.txt: No such file or directory\n") {
+ $tmp_test_result = 0;
+}
+print $telnet_slave->cmd("exit");
+print "\nExit and close telnet session with $slave_ip_addr_list[0].\n";
+$telnet_slave->close;
+print "\nTelnet to master ($master_ip).\n";
+$telnet = &ConnectToBoard($master_ip);
+if ($tmp_test_result eq 0) {
+ $test_result = 0;
+}
+print "\nEnd test $test_name\n";
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
+
+
+$telnet->close;
+&CompleteTestPassFail($global_test_result);
+print "\n\nList of failed tests: \n @failed_tests_list\n";
+print "\nTotal number of tests failed: ".(scalar (@failed_tests_list) / 2);
+print "\n-----------------------------------------------\n";
+exit;
diff --git a/cleopatre/devkit/tests/validation/scripts/test_snmp/common_functions.pl b/cleopatre/devkit/tests/validation/scripts/test_snmp/common_functions.pl
index bc436db8b3..52952227f9 100755
--- a/cleopatre/devkit/tests/validation/scripts/test_snmp/common_functions.pl
+++ b/cleopatre/devkit/tests/validation/scripts/test_snmp/common_functions.pl
@@ -65,21 +65,22 @@ sub CompareMultipleStringContained
$$test_passed = 0;
$count = 0;
$j = 0;
+#print "\n==1==@{$ref_arr}==1==\n";
+#print "\n==2==@{$ref_str}==2==\n";
for ($i = $$from; $i < $$to; $i++)
{
for ($k = $j; $k < scalar @{$ref_str}; $k++)
{
${$ref_arr}[$i] =~ s/00/0/g; # substitute two zero's from MAC address with one zero
+ ${$ref_str}[$k] =~ s/00/0/g; # substitute two zero's with one zero
if( ${$ref_arr}[$i] =~ /\b${$ref_str}[$k]\b/i ) {
$count++;
$j++;
} else {next;}
}
}
-
if ($count == scalar @{$ref_str}) {$$test_passed = 1;}
-
return $$test_passed;
}
@@ -195,7 +196,8 @@ sub ParseFile
@arr = ();
@arr_tmp = ();
$i = 0;
- open (FILE, $file_path) or die ("Can not open file $file_name");
+ $k = 0;
+ open (FILE, $file_path) or die ("Can not open file $file_path");
$file_name = basename($file_path);
while (<FILE>)
{
@@ -240,7 +242,24 @@ sub ParseFile
$str_to_delete = "/usr/local/etc/";
$line =~ s/$str_to_delete//;
@arr_tmp[0] = $line;
+ }
+ elsif (($file_name eq "wl_show.txt") or ($file_name eq "wl_retrieve.txt"))
+ {
+ # skip the first 2 lines
+ if ($k lt 2) {
+ $k++;
+ next;
+ }
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
}
+ elsif ($file_name eq "white_list.conf")
+ {
+ # skip the line containing comment character "#"
+ if (substr($line, 0, 1) eq "#") {next;}
+ # Split on one (or more) white space characters
+ @arr_tmp = split m/\s{1,}/, $line, -1;
+ }
else {}
$j = 0;
@@ -540,6 +559,8 @@ sub FileGetListOf
if ($arr_tmp[$index] ne "") {
$list_of_items[$i++] = $arr_tmp[$index];
}
+ } elsif ($item eq "PS") {
+ $list_of_items[$i++] = $line;
}
else {};
}
@@ -602,7 +623,7 @@ sub GetIndexFromMACAddress
return sort(@list_of_indexes);
}
-sub GetMasterMAC
+sub GetMACFrom
{
my @arr = @_;
$i = 0;
@@ -650,4 +671,12 @@ sub GetFileFromBoard
print $telnet->cmd("ftpput -v -u spidcom -p spidcom $pc_eth1_ip_addr $file_name $file_name");
$copy = `cp /home/spidcom/$file_name $folder_name`;
}
+
+sub PutFileToBoard
+{
+ my($telnet, $pc_eth1_ip_addr, $folder_name, $file_name) = @_;
+
+ $copy = `sudo cp $folder_name$file_name /home/spidcom`;
+ print $telnet->cmd("ftpget -v -u spidcom -p spidcom $pc_eth1_ip_addr $file_name $file_name");
+}
1;
diff --git a/cleopatre/devkit/tests/validation/scripts/test_snmp/test_snmp b/cleopatre/devkit/tests/validation/scripts/test_snmp/test_snmp
index d0644775e5..2ccf14ea0a 100755
--- a/cleopatre/devkit/tests/validation/scripts/test_snmp/test_snmp
+++ b/cleopatre/devkit/tests/validation/scripts/test_snmp/test_snmp
@@ -1,9 +1,11 @@
#!/bin/sh
-# This is the main script to start full SNMP agent test
-# The master board under test IP address (master_ip) and
-# test PC eth used IP address (pc_eth1_ip_addr) has to be given together
-# with the location where test files will be stored (folder_name).
+# This is the main script to start full SNMP agent test.
+# Start this script with: sudo ./test_snmp
+# The master board under test IP address (master_ip),
+# test PC eth used IP address (pc_eth1_ip_addr),
+# the location where test files will be stored (folder_name) and
+# list of slave IP addresses, space separated (slave_ip) has to be given.
# When test is finished, file results.txt is generated and contains
# test result. Test summary is given at the end of the file.
# The scripts called ('ff' and 'tsnmp') uses the Net::Telnet Perl module
@@ -12,6 +14,7 @@
master_ip="192.168.3.103"
pc_eth1_ip_addr="192.168.3.3"
folder_name="/home/zoran/Desktop/test_snmp/test_folder/"
+slave_ip="192.168.3.172 192.168.3.160"
echo "Test snmp started ..."
@@ -19,4 +22,4 @@ echo "Test snmp started ..."
./ff $master_ip $pc_eth1_ip_addr $folder_name
# start test
-sudo ./tsnmp $master_ip $pc_eth1_ip_addr $folder_name | tee $folder_name"results.txt"
+sudo ./tsnmp $master_ip $pc_eth1_ip_addr $folder_name $slave_ip | tee $folder_name"results.txt"
diff --git a/cleopatre/devkit/tests/validation/scripts/test_snmp/tsnmp b/cleopatre/devkit/tests/validation/scripts/test_snmp/tsnmp
index ab8e8eab67..81ed2ff203 100755
--- a/cleopatre/devkit/tests/validation/scripts/test_snmp/tsnmp
+++ b/cleopatre/devkit/tests/validation/scripts/test_snmp/tsnmp
@@ -40,6 +40,16 @@ $global_test_result = 1;
$master_ip = $ARGV[0];
$pc_eth1_ip_addr = $ARGV[1];
$folder_name = $ARGV[2];
+@slave_ip_addr_list = ();
+for ($i = 3; $i < $#ARGV + 1; $i++) {
+ push(@slave_ip_addr_list, $ARGV[$i]);
+ if (scalar(@slave_ip_addr_list) eq 0) {
+ print "\nNo slave selected. Test aborted.\n";
+ last;
+ exit;
+ }
+}
+
$snmp_get = "snmpget -v 2c -c spidcom ".$master_ip;
$snmp_set = "snmpset -v 2c -c spidcom ".$master_ip;
$snmp_walk = "snmpwalk -v 2c -c spidcom ".$master_ip;
@@ -836,7 +846,7 @@ foreach $response_index_not_extracted (@response_index_not_extracted)
&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
$test_name = "modEoCSoftwareUpgradeMACAddress";
-$master_mac_addr = &GetMasterMAC(@ifconfig_txt_arr);
+$master_mac_addr = &GetMACFrom(@ifconfig_txt_arr);
@file_value = &FileGetListOf("WL_RETRIEVE_TXT_MAC", "sorted", $folder_name."wl_retrieve.txt");
unshift(@file_value, lc($master_mac_addr));
@response = `$snmp_walk $test_name`; print @response;
@@ -1347,6 +1357,65 @@ $telnet->close;
$test_result = &CompareArrays(\@ls_test_file_before_reset, \@ls_test_file_after_reset, $test_result);
&SingleTestPassFail($test_name, !$test_result, $global_test_result, \@failed_tests_list);
+$test_name = "modEoCOnlineCNUReset";
+$test_result = 1;
+@online_info_connected_slave_mac = &GetMACAddrOfConnectedSlaves($folder_name."online.info");
+# Create test file on each board
+print "\nCreate test files on slaves.\n";
+foreach $slave_ip_addr_list (@slave_ip_addr_list)
+{
+ print "\nTelnet to board $slave_ip_addr_list.\n";
+ $telnet = &ConnectToBoard($slave_ip_addr_list);
+ print $telnet->cmd("cd /etc");
+ print $telnet->cmd("touch has_to_be_deleted.txt");
+ print $telnet->cmd("echo some text > has_to_be_deleted.txt");
+# @ls_test_file_before_reset = $telnet->cmd("ls /etc/has_to_be_deleted.txt");
+ $telnet->close;
+}
+foreach $online_info_connected_slave_mac (@online_info_connected_slave_mac)
+{
+ $online_info_connected_slave_mac =~ s/00/0/g; # substitute two zero's from MAC address with one zero
+}
+@response = `$snmp_walk modEoCOnlineCNUMACAddress`; print @response;
+@response_mac = &ArrGetListOf("string", "unsorted", @response);
+@response_index_tmp = &ArrGetListOf("SPIDCOM-EOC-MIB::modEoCOnlineCNUMACAddress.", "unsorted", @response);
+foreach $response_index_tmp (@response_index_tmp)
+{
+ ($response_key, $response_value) = split("= STRING: ", $response_index_tmp);
+ push(@response_index, $response_key);
+}
+if (scalar(@response_mac) eq scalar(@response_index)) {
+ @response_hash{@response_mac} = @response_index;
+} else {
+ print "\n Wrong response. Test failed.\n";
+ $test_result = 0;
+}
+#reset each slave
+foreach $online_info_connected_slave_mac (@online_info_connected_slave_mac)
+{
+ if ($response_hash{$online_info_connected_slave_mac} ne "") {
+ @response = `$snmp_set modEoCOnlineCNUReset.$response_hash{$online_info_connected_slave_mac} i 1`; print @response;
+ } else {
+ print "\n Slave stated in online.info was not found with modEoCOnlineCNUMACAddress. Test failed.\n";
+ $test_result = 0;
+ }
+}
+print "\nWait 10s to allow slaves to reconnect after reset.\n";
+sleep(10);
+# Check existance of test file on each board
+print "\nCheck if test files exists on slaves.\n";
+foreach $slave_ip_addr_list (@slave_ip_addr_list)
+{
+ print "\nTelnet to board $slave_ip_addr_list.\n";
+ $telnet = &ConnectToBoard($slave_ip_addr_list);
+ @cmd = $telnet->cmd("ls /etc/has_to_be_deleted.txt");
+ if ($cmd[0] ne "ls: /etc/has_to_be_deleted.txt: No such file or directory\n") {
+ $test_result = 0;
+ }
+ $telnet->close;
+}
+&SingleTestPassFail($test_name, $test_result, $global_test_result, \@failed_tests_list);
+
&CompleteTestPassFail($global_test_result);
print "\n\nList of failed tests: \n @failed_tests_list\n";
print "\nTotal number of tests failed: ".(scalar (@failed_tests_list) / 2);