#!/usr/bin/perl # #$Copyright$ # #$Id: C_RFC3315_18_1_4_RetransReb.seq,v 1.13 2005/12/20 03:41:41 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 ($plifetime, $vlifetime) = (800, 1000); my ($time1, $time2) = (100, 600); my ($start, $rd, $MRD) = (0, 0, $vlifetime); my $timeout = $time2 + 100; my $RAND = $DHCPv6_common::RAND; #--------------------------------------------------------------# # Initialize DHCPv6 Client #--------------------------------------------------------------# my $ret = vRemote("dhcp6c.rmt", "start","link0=$IF0_NUT"); if($ret != 0) { vLogHTML('Cannot Initialize DHCPv6 Client program.
'); dhcpExitFail; }; 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 #--------------------------------------------------------------# $IA_NA_OPTION = "opt_IA_NA_Addr"; $StatusCode_OPTION = "opt_StatusCode"; my ($retrep, %rep) = send_reply($IF0, "reply_server1_to_nut", \%req, "-DIA_NA_TIME1=$time1 -DIA_NA_TIME2=$time2 -DIA_ADDR_PLTIME=$plifetime -DIA_ADDR_VLTIME=$vlifetime "); 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); #--------------------------------------------------------------# #5. Wait until Rebind arrives #--------------------------------------------------------------# my ($retreb1,%reb1) = wait_for_rebind($IF0, $timeout); if($retreb1 != 0){ dhcpExitFail; } $start = getElapsedtime(\%reb1); my $ago = $start; my $now = $start; vClear($IF0); #--------------------------------------------------------------# #6. Wait until retransmitted message arrives #--------------------------------------------------------------# my ($retreb2,%reb2) = wait_for_rebind($IF0, $timeout); if($retreb2 != 0){ dhcpExitFail; } vClear($IF0); $now = getElapsedtime(\%reb2); $rd = $now - $start; $RT = $now - $ago; my $RTnextMAX = $RT*2 + $RAND*$RT; my $RTnextMIN = $RT*2 - $RAND*$RT; $ago = $now; #vLogHTML(" RT = $RT
"); #vLogHTML(" RTnextMIN=$RTnextMIN
"); #vLogHTML(" RTnextMAX=$RTnextMAX
"); while($rd + $RTnextMIN <= $MRD){ ($retreb2,%reb2) = wait_for_rebind($IF0,$RTnextMAX + 30); if($retreb2 != 0){ dhcpExitFail; } $now = getElapsedtime(\%reb2); $rd = $now - $start; $RT = $now - $ago; $RTnextMAX = $RT*2 + $RAND*$RT; $RTnextMIN = $RT*2 - $RAND*$RT; # vLogHTML(" duration = $RT
"); # vLogHTML(" RT = $RT
"); # vLogHTML(" RTnextMIN=$RTnextMIN
"); # vLogHTML(" RTnextMAX=$RTnextMAX
"); $ago = $now; vClear($IF0); } #--------------------------------------------------------------# #7. Wait for Next message from NUT, it should not be Rebind #--------------------------------------------------------------# ($retreb2,%reb2) = wait_for_rebind($IF0, $timeout); if($retreb2 != 0){ vLogHTML("Retransmission Duration more than REB_MAX_RD($MRD)!
"); dhcpExitFail; } dhcpExitPass; #--------------------------------------------------------------# #7. Wait until Solicit arrives #--------------------------------------------------------------# #($retsol, %sol) = wait_for_solicit($IF0, $timeout); #if($retsol != 0){ # dhcpExitFail; #} #vStop($IF0); #dhcpExitPass; ###NEED ############################################################################### __END__ =head1 NAME C_RFC3315_18_1_4_RetransReb.seq - Test the retransmission of Rebind =head1 TARGET Client =head1 SYNOPSIS =begin html
   C_RFC3315_18_1_4_RetransReb.seq [-tooloption...] -pkt   C_RFC3315_18_1_4_RetransReb.def -tooloption : v6eval tool option

See Also DHCPv6.def
=end html =head1 INITIALIZATION =begin html
  • Configurations

  •     
    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
    =end html =head1 TEST PROCEDURE =begin html

    NUT TN | | | |Initialize NUT(as a DHCPv6 client) | ----> |Solicit (1*) | <---- |Adverstise (2*) | ----> |Request (3*) | <---- |Reply (4*) | |waiting until Rebind arrives | ----> |Rebind (5*) | |waiting for retransmitted Rebind | ----> |Rebind (6*) . .Repeat until evaluating retransmission time is more than MRD(valid lifetime) | ----> |Rebind (7*) | |
    (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*)TN receives Rebind from NUT. (6*)NUT repeat retransmitting Rebind until evaluating retransmission time is more than MRD(valid lifetime). (7*)TN waits for Rebind form NUT.
    =end html =head1 JUDGEMENT =begin html

    If TN gets Rebind(7*) from NUT after MRD, test will Fail. Or else, PASS.
    =end html =head1 TERMINATION =begin html
      N/A
    
    =end html =head1 REFERENCE =begin html
      Also see RFC3315
    
    18.1.4. Creation and Transmission of Rebind Messages
    From line 2394 to line 2395.
    =end html =head1 SEE ALSO =begin html

    perldoc V6evalTool
    =end html