#!/usr/bin/perl # # Copyright (C) 1999,2000 Yokogawa Electric Corporation and # YDC Corporation. # All rights reserved. # # Redistribution and use of this software in source and binary # forms, with or without modification, are permitted provided that # the following conditions and disclaimer are agreed and accepted # by the user: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with # the distribution. # # 3. Neither the names of the copyrighters, the name of the project # which is related to this software (hereinafter referred to as # "project") nor the names of the contributors may be used to # endorse or promote products derived from this software without # specific prior written permission. # # 4. No merchantable use may be permitted without prior written # notification to the copyrighters. # # 5. The copyrighters, the project and the contributors may prohibit # the use of this software at any time. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHTERS, THE PROJECT AND # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING # BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # $Id: ADDRSTATE_reset_VLT.seq,v 1.1.1.1 2000/10/31 22:39:55 sekiya Exp $ ######################################################################## BEGIN { $V6evalTool::TestVersion = '$Name: $ '; } use V6evalTool; use DAD; #----- get sequence arguments $howto_initNUT="none"; $send = "ok"; foreach (@ARGV) { /^sequence=(\S+)/ && do {$sequence=$1; # next; }; # sample: usolra_vlt60,wait30,usolra_vlt120 # /^addrconf=(\S+)/ && do {$DAD::howto_addrconf=$1; # How to configure address of NUT? # next; }; # sample: boot, ra, manual+_GLOBAL0A0N_UCAST /^init=(\S+)/ && do {$howto_initNUT=$1; # How to initialize NUT? next; }; # sample: none, DADSuccess_boot, DADFail_boot /^sd=(\S+)/ && do {$seqdebugopt=$1; # sequence debug options next; }; # sample: qR seqERROR("Unknown sequence option '$_'"); } #----- test condition $IF=Link0; # network interface seqSetDADParam($seqdebugopt); $reset_ok = "YES"; #YES/NO, reset OK? for 1st RA ValidLifetime by 2nd RA ValidLifetime # YES for ./ADDRSTATE_reset_VLT.seq # NO for ./ADDRSTATE_not_reset_VLT.seq @vltlist = (30, 60, 90, 120, 150, 180); # this is for seqProbeLT(), not for sending RA #----- set %pktdesc seqSetPktdesc(); #----- initialize NUT vLog("*** Target initialization phase ***"); seqInitNUT($IF, $howto_initNUT); #----- start Capturing vLog("*** Target testing phase ***"); vCapture($IF); #----- Configure Address on NUT and wait and reconfigure @sequence = split(/,/ , $sequence); while($usolra_to_NUT = shift(@sequence)) { #----- get VLT from framename push (@usolra_vlt, ($usolra_to_NUT =~ /usolra_vlt([0-9]+)/)); #----- Configure Address on NUT # stateless addrconf by RA vLog("Stateless address configuration by sending RA to NUT: $usolra_to_NUT"); %ret=vSend($IF, $usolra_to_NUT); $seektime_for_dadns = $ret{'sentTime1'}; #----- wait a DAD NS comming from NUT $timeout_for_dadns = $DAD::wait_dadns{"ra"}; vLog("TN wait the DAD NS sends from NUT : $DAD::dadns_from_NUT"); %ret=vRecv($IF,$timeout_for_dadns, $seektime_for_dadns, 1, $DAD::dadns_from_NUT); #----- if received frame is a DAD NS if( $ret{status} == 0) { vLog("TN received the DAD NS sends from NUT."); #----- wait for NUT to finish DAD vSleep($DAD::RetransTimerSec, "Wait for NUT to finish DAD. ($DAD::RetransTimerSec [sec])"); }elsif( $ret{status} == 1 ) { #----- timeout vLog("TN received no DAD NS sends from NUT. It seems that NUT doesn't perform DAD process."); }else{ #----- error seqERROR(vErrmsg(%ret)); #exit } #----- check if NUT's address is configured #seqWaitNUTbeReady(); vSleep($DAD::RetransTimerSec); if (seqCheckNUTAddrConfigured($IF) eq TRUE) { vLog("The address is configured (valid preferred)."); }else{ vLog("The address is not configured although address must be valid preferred."); seqNG(); } if ($sequence_waitsec = shift(@sequence)) { ($reconfig_waitsec) = ($sequence_waitsec =~ /wait([0-9]+)/); vSleep($reconfig_waitsec, "Wait $reconfig_waitsec [sec] to spent NUT's address lifetime."); } } #----- Probing ValidLifetime vLog(" *** Probing ValidLifetime phase ***"); ($total_waitsec, $vlt_index) = seqProbeVLT($IF, 30, @vltlist); # check which ValidLifetime is set (probe interval 30[sec]) vLog("total_waitsec=$total_waitsec, vlt_index=$vlt_index, vlt=$vltlist[$vlt_index]") if $debug > 0; seqNG() if $vlt_index < 0; vLog("$total_waitsec [sec] spent to wait for NUT's address becomes invalid."); if ( $usolra_vlt[0] < $reconfig_waitsec) { vLog("After expiration of 1st ValidLifetime=$usolra_vlt[0]"); }else{ vLog("Before expiration of 1st ValidLifetime=$usolra_vlt[0]"); } if ($vltlist[$vlt_index] == $usolra_vlt[1]) { vLog("1st ValidLifetime=$usolra_vlt[0] were reset by 2nd RA(ValidLifetime=$usolra_vlt[1]). "); ($reset_ok eq "YES")? seqOK() : seqNG() ; }else{ vLog("1st ValidLifetime=$usolra_vlt[0] were not reset by 2nd RA(ValidLifetime=$usolra_vlt[1]). "); ($reset_ok eq "YES")? seqNG() : seqOK() ; } #end ######################################################################## __END__ =head1 NAME ADDRSTATE_reset_VLT - Check if ValidLifetime is reset by RA with same prefix =head1 TARGET Host =head1 SYNOPSIS ADDRSTATE_reset_VLT.seq [-tooloption ...] -pkt [sequence=,,] [init=,...] [sd=] -tooloption : v6eval tool option : packet definition file (v6eval tool option) : send RA to NUT ; usolra_vlt(30|60|90|120) : wait NN [sec]; waitNN : how to initialize NUT; DADSuccess_boot/DADFail_boot/ra : debug options =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
 detail of parameters: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =head1 INITIALIZATION =begin html
 detail of Initialization: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =head1 TEST PROCEDURE The following test is prepared in this test package. See INDEX file. B Check if ValidLifetime is reset by RA with same prefix (before expiry, greater VLT) Check if ValidLifetime is reset by RA with same prefix (after expiry, greater VLT) Check if ValidLifetime is reset by RA with same prefix (after expiry, same VLT) Check if ValidLifetime is reset by RA with same prefix (after expiry, less VLT) B TN(or X) NUT ------------------------------ Initialize NUT (see ...) Send Unsolicited RA to configure address of NUT ==== Action #1: Unsolicited RA ===> name: src: TN's Link-local address dst: allnodes multicast SLL option exists Prefix option PrefixLength: 64 LFlag: 1 AFlag: 1 ValidLifetime: PreferredLifetime: Prefix: _GLOBAL0_UCAST_PRFX TN wait the DAD NS sends from NUT. (This judgement is informational only.) <=== Judgement #1: DAD NS ==== name: dadns_from_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's tentative _GLOBAL0_UCAST_PRFX + interface-id Wait for NUT to finish DAD. (sleep $RetransTimerSec=1 [sec]) Check if NUT's address is configured. ==== Action #2: DAD NS ====> name: chkconf_dadns_to_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id DAD NA come from NUT because NUT's address is configured (valid preferred). <=== Judgement #2: DAD NA come==== name: chkconf_dadna_from_NUT src: NUT's Link-local address or TargetAddress dst: allnodes multicast TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id OFlag: 1 RFlag: 0 Wait for NUT's to spent NUT's address lifetime. Action #3: wait [sec] Send Unsolicited RA to configure address of NUT ==== Action #4: Unsolicited RA ===> name: src: TN's Link-local address dst: allnodes multicast SLL option exists Prefix option PrefixLength: 64 LFlag: 1 AFlag: 1 ValidLifetime: PreferredLifetime: Prefix: _GLOBAL0_UCAST_PRFX TN wait the DAD NS sends from NUT. (This judgement is informational only.) <=== Judgement #4: DAD NS ==== name: dadns_from_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's tentative _GLOBAL0_UCAST_PRFX + interface-id Wait for NUT to finish DAD. (sleep $RetransTimerSec=1 [sec]) Check if NUT's address is configured. ==== Action #5: DAD NS ====> name: chkconf_dadns_to_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id DAD NA come from NUT because NUT's address is configured (valid preferred). <=== Judgement #5: DAD NA come==== name: chkconf_dadna_from_NUT src: NUT's Link-local address or TargetAddress dst: allnodes multicast TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id OFlag: 1 RFlag: 0 permanent loop { Wait 30 [sec] to spent NUT's address lifetime. Count up totoal wait [sec] to spent NUT's address lifetime. Check if NUT's address is configured. ==== Action #6: DAD NS ====> name: chkconf_dadns_to_NUT src: ::0 dst: solnode[TargetAddress] TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id Check if DAD NA come from NUT (check if NUT's address configured) Exit the permanent loop if DAD NA doesn't come. <=== Judgement #6: DAD NA come==== name: chkconf_dadna_from_NUT (or chkconf_dadna_from_NUT_rf1 if NUT is a Router) src: NUT's Link-local address or TargetAddress dst: allnodes multicast TargetAddress: NUT's _GLOBAL0_UCAST_PRFX + interface-id OFlag: 1 RFlag: 0 ( if NUT is a Router then 1) } Judgement #6: it must be 0 < total wait [sec] == ValidLifetime of =head1 JUDGEMENT B B B< -pkt GLOBAL0_valRA_sameprfxes.def sequence=usolra_vlt60,wait30,usolra_vlt120 init=DADSuccess_boot> Action #1: send the Unsolicited RA to NUT name: usolra_vlt60 Prefix option ValidLifetime: 60 PreferredLifetime: 60 Judgement #1: DAD NS come from NUT. (This judgement is informational only.) Action #2: Send DAD NS to NUT Judgement #2: DAD NA must come from NUT because NUT's address is configured Action #3: wait 30 [sec] (not expire the ValidLifetime:60) Action #4: send the Unsolicited RA to NUT name: usolra_vlt120 Prefix option ValidLifetime: 120 PreferredLifetime: 120 Judgement #4: DAD NS come from NUT. (This judgement is informational only.) Action #5: Send DAD NS to NUT Judgement #5: DAD NA must come from NUT because NUT's address is configured permanent loop { Wait 30 [sec] to spent NUT's address lifetime. Count up totoal wait [sec] to spent NUT's address lifetime. Action #6: Send DAD NS to NUT Judgement #6: DAD NA come from NUT if NUT's address is valid exit the permanent loop if DAD NA doesn't come. } Judgement #6: it must be 0 < total wait [sec] == 120 (ValidLifetime of usolra_vlt120) B B< -pkt GLOBAL0_valRA_sameprfxes.def sequence=usolra_vlt60,wait70,usolra_vlt120 init=DADSuccess_boot> Action #1: send the Unsolicited RA to NUT name: usolra_vlt60 Prefix option ValidLifetime: 60 PreferredLifetime: 60 Judgement #1: DAD NS come from NUT. (This judgement is informational only.) Action #2: Send DAD NS to NUT Judgement #2: DAD NA must come from NUT because NUT's address is configured Action #3: wait 70 [sec] (expire the ValidLifetime:60) Action #4: send the Unsolicited RA to NUT name: usolra_vlt120 Prefix option ValidLifetime: 120 PreferredLifetime: 120 Judgement #4: DAD NS come from NUT. (This judgement is informational only.) Action #5: Send DAD NS to NUT Judgement #5: DAD NA must come from NUT because NUT's address is configured permanent loop { Wait 30 [sec] to spent NUT's address lifetime. Count up totoal wait [sec] to spent NUT's address lifetime. Action #6: Send DAD NS to NUT Judgement #6: DAD NA come from NUT if NUT's address is valid exit the permanent loop if DAD NA doesn't come. } Judgement #6: it must be 0 < total wait [sec] == 120 (ValidLifetime of usolra_vlt120) B B< -pkt GLOBAL0_valRA_sameprfxes.def :sequence=usolra_vlt60,wait70,usolra_vlt60 init=DADSuccess_boot> Action #1: send the Unsolicited RA to NUT name: usolra_vlt60 Prefix option ValidLifetime: 60 PreferredLifetime: 60 Judgement #1: DAD NS come from NUT. (This judgement is informational only.) Action #2: Send DAD NS to NUT Judgement #2: DAD NA must come from NUT because NUT's address is configured Action #3: wait 70 [sec] (expire the ValidLifetime:60) Action #4: send the Unsolicited RA to NUT name: usolra_vlt60 Prefix option ValidLifetime: 60 PreferredLifetime: 60 Judgement #4: DAD NS come from NUT. (This judgement is informational only.) Action #5: Send DAD NS to NUT Judgement #5: DAD NA must come from NUT because NUT's address is configured permanent loop { Wait 30 [sec] to spent NUT's address lifetime. Count up totoal wait [sec] to spent NUT's address lifetime. Action #6: Send DAD NS to NUT Judgement #6: DAD NA come from NUT if NUT's address is valid exit the permanent loop if DAD NA doesn't come. } Judgement #6: it must be 0 < total wait [sec] == 60 (ValidLifetime of usolra_vlt60) B B< -pkt GLOBAL0_valRA_sameprfxes.def :sequence=usolra_vlt120,wait130,usolra_vlt60 init=DADSuccess_boot> Action #1: send the Unsolicited RA to NUT name: usolra_vlt120 Prefix option ValidLifetime: 120 PreferredLifetime: 120 Judgement #1: DAD NS come from NUT. (This judgement is informational only.) Action #2: Send DAD NS to NUT Judgement #2: DAD NA must come from NUT because NUT's address is configured Action #3: wait 130 [sec] (expire the ValidLifetime:120) Action #4: send the Unsolicited RA to NUT name: usolra_vlt60 Prefix option ValidLifetime: 60 PreferredLifetime: 60 Judgement #4: DAD NS come from NUT. (This judgement is informational only.) Action #5: Send DAD NS to NUT Judgement #5: DAD NA must come from NUT because NUT's address is configured permanent loop { Wait 30 [sec] to spent NUT's address lifetime. Count up totoal wait [sec] to spent NUT's address lifetime. Action #6: Send DAD NS to NUT Judgement #6: DAD NA come from NUT if NUT's address is valid exit the permanent loop if DAD NA doesn't come. } Judgement #6: it must be 0 < total wait [sec] == 60 (ValidLifetime of usolra_vlt60) =head1 SEE ALSO =begin html
 detail of v6eval tool option: see perldoc V6evalTool.pm, perldoc V6evalRemote.pm
 detail of parameters: see Test sequence for IPv6 Stateless Address Autoconfiguration.
=end html =cut