#!/usr/bin/perl # # $Copyright$ # # $Id: hostRecvRaReachableTime.seq,v 1.1.1.1 2000/10/31 22:38:59 sekiya Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use nd; sub checkReachableTime($$\@\@\%\%\$); ndOptions(@ARGV); # The following generate debugging messages. $nd::debug=$ndOpt_v|$ndOpt_vv; # You can specifies debug optons to a remote control program. # If you want to know more detail, please see the following: # - V6evalTool.pm: perldoc V6evalTool # - V6evalRemote.pm: perldoc V6evalRemote $nd::remote_debug="-o1" if $ndOpt_vv; $IF=Link0; @null=(); $exit_rtn=$V6evalTool::exitPass; # # # $type=$V6evalTool::NutDef{Type}; if($type eq router) { vLogHTML("This test is for the host only
"); exit $V6evalTool::exitHostOnly; } $type=$V6evalTool::NutDef{Type}; if($type ne host) { vLogHTML(ndErrmsg("ERROR: $V6evalTool::NutDef{Type}: ". "Unknown target type
")); exit $V6evalTool::exitFail; } # # # $ra_name_30='ra_x2allnode_sll_reachable30'; $ra_msg_30='RA w/ SLL, ReachableTime=30sec'; @before_30=((30*0.5-2)); @after_30=((30*1.5+1)); $pktdesc{ra_x2allnode_sll_reachable30}= "Send $ra_msg_30"; $ra_name_60='ra_x2allnode_sll_reachable60'; $ra_msg_60='RA w/ SLL, ReachableTime=60sec'; @before_60=((60*0.5-2)); @after_60=((60*1.5+1)); $pktdesc{ra_x2allnode_sll_reachable60}= "Send $ra_msg_60"; $ra_name_90='ra_x2allnode_sll_reachable90'; $ra_msg_90='RA w/ SLL, ReachableTime=90sec'; @before_90=((90*0.5-2)); @after_90=((90*1.5+1)); $pktdesc{ra_x2allnode_sll_reachable90}= "Send $ra_msg_90"; @ra_name=( \$ra_name_60, \$ra_name_30, \$ra_name_90, ); @ra_msg=( \$ra_msg_60, \$ra_msg_30, \$ra_msg_90, ); @before=( \@before_60, \@before_30, \@before_90, ); @after=( \@after_60, \@after_30, \@after_90, ); # # # vCapture($IF); # # # $idx=0; $i=0; foreach(@ra_name) { my($name)=$_; my($msg)=@ra_msg[$i]; my($b)=@before[$i]; my($a)=@after[$i]; my($r); $r=checkReachableTime($$name, $$msg, @$b, @$a, %title, %result, $idx); $exit_rtn = $r if $r != $V6evalTool::exitPass; $i++; } $idx--; # # # clear(); # # # @col=('PTN', 'EXP', 'RESULT'); ndPrintSummaryHTML("*** Test Summary: RA vs. ReachableTimer ***", @col, %title, %result, $idx); # # # vLogHTML("*** EOT ***
"); exit $exit_rtn; sub checkReachableTime($$\@\@\%\%\$) { my( $my_ra_ptn, $my_ra_title, $before_reachable, $after_reachable, $my_title, $my_result, $my_idx, )=@_; my($my_exit_rtn)=$V6evalTool::exitPass; my($s, %rtn); my($reachable_time)=@$after_reachable[0]; vLogHTML("
*** $my_ra_title ***
"); vLogHTML("
". "*** Before RetransTimer * 0.5 sec ***
"); my($first)=1; foreach(@$before_reachable) { my($wait)=$_; vLogHTML("
". "*** $my_ra_title, $wait sec, exp:REACHABLE ***
"); vLogHTML("
Initialization
"); if($first) { %ret=vSend($IF, $my_ra_ptn); goto error if $ret{status} != 0; } if(nd2NoNceByPacket($IF, $reachable_time) != 0 || ndNoNce2Incomplete($IF) != 0 || ndIncomplete2Reachable($IF) != 0) { $s="ERROR"; } else { vClear($IF); vLogHTML("
Test
"); vSleep($wait); $s=ndIsReachable($IF); } if($s eq REACHABLE) { $$my_result{$$my_idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } else { $my_exit_rtn=$V6evalTool::exitFail; $$my_result{$$my_idx}=$V6evalTool::exitWarn; vLogHTML("The state should be REACHABLE
"); vLogHTML("".ndErrmsg(NG)."
"); } $$my_title{$$my_idx}= "$my_ra_title, $wait secexp:REACHABLE". "result:$s"; } continue { $$my_idx++; $first=0; } vLogHTML("
". "*** After RetransTimer * 1.5 sec ***
"); foreach(@$after_reachable) { my($wait)=$_; vLogHTML("
". "*** $my_ra_title, $wait sec, exp:STALE ***
"); vLogHTML("
Initialization
"); if(nd2NoNceByPacket($IF, $reachable_time) != 0 || ndNoNce2Incomplete($IF) != 0 || ndIncomplete2Reachable($IF) != 0) { $s="ERROR"; } else { vClear($IF); vLogHTML("
Test
"); vLogHTML("wait ($wait sec)
"); vSleep($wait); $s=ndIsReachable($IF); } if($s eq STALE) { $$my_result{$$my_idx}=$V6evalTool::exitPass; vLogHTML("OK
"); } else { $my_exit_rtn=$V6evalTool::exitFail; $$my_result{$$my_idx}=$V6evalTool::exitWarn; vLogHTML("The state should be STALE
"); vLogHTML("".ndErrmsg(NG)."
"); } $$my_title{$$my_idx}= "$my_ra_title, $wait secexp:STALE". "result:$s"; } continue { $$my_idx++; } # # # vLogHTML("
Termination
"); goto error if nd2NoNceByPacket($IF, $reachable_time) != 0; # # # return($my_exit_rtn); error: clear(); vLogHTML(vErrmsg(%ret)."
"); exit $V6evalTool::exitFail; } sub clear() { $pktdesc{ra_x2allnode_sll_reachable30}= 'Set ReachableTime to the default (30 sec)'; $pktdesc{ra_x2allnode_clrrtr}= 'Clear the Default Router List'; vSend($IF, ra_x2allnode_sll_reachable30); vSend($IF, ra_x2allnode_clrrtr); } ######################################################################## __END__ =head1 NAME hostRecvRaReachableTime - Verifying that NUT recognize ReachableTime =head1 TARGET Host only =head1 SYNOPSIS hostRecvRaReachableTime.seq [-tooloption ...] -p hostRecvRaReachableTime.def =head1 INITIALIZATION =begin html
  1. Set ReachableTtime by router X.
  2. Create the state of neighbor cache entry for TN.
  3. Set its state to REACHABLE whose IsRouter flag is FALSE.
  TN                 NUT
  ----------------------
  State: NONCE (for all)

==== unsolicited RA ===> src=X's link-local dst=all-node M=0, O=0 RouterLifetime=600 ReachableTime=a test condition RetransTimer=0 w/ SLLA
State: NONE (for TN), STALE(for X)
==== echo-request ===> src=TN's link-local dst=NUT's link-local
<=== multicast NS ==== src=NUT's link-local dst=solicited-node[TN's link-local] w/ SLLA timeout=RETRANS_TIMER * MAX_MULTICAST_SOLICIT
==== solicited NA ===> src=TN's link-local dst=NUT's link-local R=0, S=1, O=1 target=TN's link-local w/ TLLA
State: REACHABLE (for TN), STALE (for X)
=head1 TEST PROCEDURE B verifies that NUT recognize ReachableTime. =begin html
  TN               NUT
  ----------------------
  State: REACHABLE (for TN)

Wait for some seconds
Judgment: Examining NUT's neighbor cache state =end html =head1 JUDGMENT =begin html

6.3.4. Processing Received Router Advertisements
If the received Reachable Time value is non-zero the host SHOULD set its BaseReachableTime variable to the received value. If the new value differs from the previous value, the host SHOULD recompute a new random ReachableTime value. ReachableTime is computed as a uniformly-distributed random value between MIN_RANDOM_FACTOR and MAX_RANDOM_FACTOR times the BaseReachableTime. Using a random component eliminates the possibility Neighbor Unreachability Detection messages synchronize with each other.
==============+===================+================== RA received | Wait Time by NUT | --------------+-------------------+------------------ ReachableTime | t < | t > | ReachableTime * | ReachableTime * | MIN_RANDOM_FACTOR | MAX_RANDOM_FACTOR ==============+===================+================== 60 | t < 30, REACHABLE | t > 90, STALE --------------+-------------------+------------------ 30 | t < 15, REACHABLE | t > 45, STALE --------------+-------------------+------------------ 90 | t < 45, REACHABLE | t > 135, STALE ==============+===================+==================
=end html =head1 TERMINATION 1. Send RA with ReachableTime=30sec to set TN's reachable time to the default value. 2. Send RA with RouterLifetime=0 to clear the Default Router List. =head1 NOTE The test does not invoke any remote command. =head1 SEE ALSO perldoc V6evalTool perldoc V6evalRemote =cut