#!/usr/bin/perl
#
#$Copyright$
#
#$Id: C_RFC3315_18_1_2_RetransCnf.seq,v 1.11 2005/12/16 03:49:34 zhang Exp $
###############################################################################
BEGIN{
$V6evalTool::TestVersion = '$Name: $';
}
use V6evalTool;
use DHCPv6_common;
use Client_pktdesc;
#--------------------------------------------------------------#
# Initialization variables
#--------------------------------------------------------------#
$IF0_NUT = $V6evalTool::NutDef{Link0_device};
$IF0 = Link0;
my ($start,$rd,$MRD) = (0,0,$DHCPv6_common::CNF_MAX_RD);
my $timeout = 2*$DHCPv6_common::CNF_MAX_RT;
#--------------------------------------------------------------#
# Initialize DHCPv6 Client
#--------------------------------------------------------------#
dhcpCltStart();
# Capture the packet from NUT
vCapture($IF0);
#--------------------------------------------------------------#
#1. Wait until Solicit arrives
#--------------------------------------------------------------#
my ($retsol,%sol) = wait_for_solicit($IF0,30);
if($retsol != 0){
dhcpExitFail;
}
vClear($IF0);
#--------------------------------------------------------------#
#2. Send Advertise to reply to Solicit
#--------------------------------------------------------------#
$SID_OPTION = "opt_SID_LLT_server1";
$IA_NA_OPTION = "opt_IA_NA_Addr_woStatus";
my ($retadv, %adv) = send_advertise($IF0, "advertise_server1_to_nut", \%sol, "");
if($retadv != 0){
dhcpExitFail;
}
#--------------------------------------------------------------#
#3. Wait until Request arrives
#--------------------------------------------------------------#
my ($retreq, %req) = wait_for_request($IF0,30);
if($retreq != 0){
dhcpExitFail;
}
vClear($IF0);
#--------------------------------------------------------------#
#4. send Reply message
#--------------------------------------------------------------#
$StatusCode_OPTION = "opt_StatusCode";
my ($retrep, %rep) = send_reply($IF0, "reply_server1_to_nut", \%req, "");
if($retrep !=0){
dhcpExitFail;
}
# wait for DAD completion
vRecv($IF0, 3, 0, 0, dadns_nutga);
vSleep(3);
$ret = ping_test($IF0);
if($ret != 0){
dhcpExitFail;
}
vClear($IF0);
#--------------------------------------------------------------#
# Restart DHCP Client
#--------------------------------------------------------------#
dhcpCltRestart();
#--------------------------------------------------------------#
#5. Wait until confirm arrives
#--------------------------------------------------------------#
my ($retcnf1,%cnf1) = wait_for_confirm($IF0, $timeout);
if($retcnf1 != 0){
dhcpExitFail;
}
$start = getElapsedtime(\%cnf1);
my $ago = $start;
my $now = $start;
#First retransmitted RT
my ($retcnf2,%cnf2) = wait_for_confirm($IF0, $timeout);
if($retcnf2 != 0){
dhcpExitFail;
}
vClear($IF0);
$now = getElapsedtime(\%cnf2);
$rd = $now - $start;
$RT = $now - $ago;
my $RTnextMAX = $RT*2 + $RAND*$RT;
my $RTnextMIN = $RT*2 - $RAND*$RT;
$ago = $now;
#--------------------------------------------------------------#
#6. Wait until retransmitted message arrives
#--------------------------------------------------------------#
while($rd + $RTnextMIN <= $MRD){
($retcnf2,%cnf2) = wait_for_confirm($IF0,$RTnextMAX);
if($retcnf2 != 0){
dhcpExitFail;
}
$now = getElapsedtime(\%cnf2);
$rd = $now - $start;
$RT = $now - $ago;
$RTnextMAX = $RT*2 + $RAND*$RT;
$RTnextMIN = $RT*2 - $RAND*$RT;
$ago = $now;
vClear($IF0);
}
($retcnf2,%cnf2) = wait_for_confirm($IF0, $timeout);
if($retcnf2 == 0){
vLogHTML(" RD more than CNF_MAX_RD($MRD) !
");
dhcpExitFail;
}
dhcpExitPass;
###############################################################################
__END__
=head1 NAME
C_RFC3315_18_1_2_RetransCnf.seq - Test MRD for retransmission of Confirm
=head1 TARGET
Client
=head1 SYNOPSIS
=begin html
C_RFC3315_18_1_2_RetransCnf.seq [-tooloption...] -pkt C_RFC3315_18_1_2_RetransCnf.def -tooloption : v6eval tool option=end html =head1 INITIALIZATION =begin html
See Also DHCPv6.def
NUT(Client)
| fe80::20d:56ff:fe0e:10f7
|
Link0 --+--------+------------------------ 3ffe:501:ffff:101::/64
|
| fe80::211:9ff:feb0:eb6c
TN(Server) 3ffe:501:ffff:101:211:9ff:feb0:eb6c/64
| Device Name | Device Type | Interface | Assigned Prefix | Link Local Addr | MAC Addr |
| Client | NUT | Link0 | 3ffe:501:ffff:101::/64 | fe80::20d:56ff:fe0e:10f7/64 | 00:0d:56:0e:10:f7 |
| Server | TN | Link0 | 3ffe:501:ffff:101::/64 | fe80::211:9ff:feb0:eb6c/64 | 00:11:09:b0:eb:6c |
The TN should know the value of CNF_MAX_MRD.
=end html
=head1 TEST PROCEDURE
=begin html
=end html =head1 JUDGEMENT =begin html
NUT TN | | | |Initialize NUT(as a DHCPv6 client) | ----> |Solicit(1*) | <---- |Adverstise(2*) | ----> |Request(3*) | <---- |Reply(4*) | |Reboot NUT (5*) | ----> |Confirm(6*) | |waiting for retransmitted Confirm (7*) | ----> |Confirm(8*) | |Repeat unitl evaluating retransmission time is more than MRD | ----> |Confirm(9*) | |
(1*)TN receives Solicit from NUT. (2*)As a DHCPv6 Server, TN sends Advertise to NUT. (3*)TN receives Request from NUT. (4*)As a DHCPv6 Server, TN sends Reply to NUT. (5*)Reboot NUT. (6*)TN receives the Confirm from NUT. (7*)As a DHCPv6 Server, TN does not send reply to NUT. (8*)NUT retransmits the confirm; (9*)TN waits for Confirm from NUT.
=end html =head1 TERMINATION =begin html
If TN gets Confirm(9*) from NUT after MRD, test will Fail. Or else, PASS.
N/A=end html =head1 REFERENCE =begin html
Also see RFC3315=end html =head1 SEE ALSO =begin html
18.1.2. Creation and Transmission of Confirm Messages From line 2275 to line 2275.
=end html
perldoc V6evalTool