#!/usr/bin/perl
#
# Copyright (C) 2003, 2004, 2005 Yokogawa Electric Corporation,
# INTAP(Interoperability Technology Association
# for Information Processing, Japan). 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. However, using this software for the
# purpose of testing or evaluating any products including merchantable
# products may be permitted without any notification to the copyrighters.
#
#
#
# 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.
#
# $TAHI: ct/default-addr-select/DstSelectRule7.seq,v 1.3 2003/04/22 03:57:46 akisada Exp $
#
######################################################################
BEGIN {
$V6evalTool::TestVersion = '$Name: REL_2_1_2 $';
}
use V6evalTool;
use ADDR_SELECT;
$TRUE = $ADDR_SELECT::TRUE;
$FALSE = $ADDR_SELECT::FALSE;
$IF = $ADDR_SELECT::IF;
$NUT_LLA = nutLLA($IF);
$TEST_STRING = "Test for Default Destination Address Selection Rule7(Prefer native transport)";
$C_BLUE = $ADDR_SELECT::C_BLUE;
$DST_FQDN= "server.tahi.org";
@RESULT;
$RESULT_TABLE = "
| Destination Address List & Candidate Source Address | Judgment |
";
$RESULT_TEST = $TRUE;
#====== Test #======
vLogHTML("#### $TEST_STRING ####
");
vLogHTML("#### Jump to Test Result ####
");
vLogHTML("#### Initialization for Configured Tunnel ####
");
nutInitialize_ConfiguredTunnel("192.168.0.1","192.168.0.2","192.168.7.1","3ffe:1:1:1::") || exit $V6evalTool::exitFail;
$RESULT[@RESULT] = check_NoOpt("01",$FALSE,"3fff::2","2001::1","fec0::1","2001::3","fec0::3","3ffe:1:1:1::2","3fff::2","2001::9");
#====== Test Result #======
vLogHTML("
#### Test ($TEST_STRING) Result ####
");
$RESULT_TABLE .= "
";
vLogHTML("$RESULT_TABLE");
foreach $RESULT_CHECK (@RESULT){
if(!$RESULT_CHECK){
$RESULT_TEST = $FALSE;
}
}
if($RESULT_TEST){
vLogHTML("#### All Check: PASS ####
");
exit $V6evalTool::exitPass;
}else{
vLogHTML('#### Some Checks are Fail: NG ####
');
exit $V6evalTool::exitFail;
}
#======================================================================
# check_NoOpt($CHECK_NUM,$NEED_NCE_DST,$DESTINATION,$SOURCE1,$SOURCE2,$SOURCE3,$TEST_DST1,$TEST_DST2,$TEST_DST3,$DESTINATION1,$DESTINATION2)
# $CHECK_NUM : check number
# $NEED_NCE_DST : need nutMakeNCE_Destination() flag
# $DESTINATION : expected destination address
# $SOURCE1 : expected source address
# $SOURCE2
# $TEST_DST1 : destination of SOURCE1 at checkNUT_SrcAddr
# $TEST_DST2 : destination of SOURCE2 at checkNUT_SrcAddr
# $DESTINATION1
# $DESTINATION2
#======================================================================
sub check_NoOpt($$$$$$$$$) {
my ($CHECK_NUM,$ON_LINK,$DESTINATION,$SOURCE1,$SOURCE2,$TEST_DST1,$TEST_DST2,$DESTINATION1,$DESTINATION2,$DNS_ADDR) = @_;
my $SOURCE3 = $NUT_LLA;
my $CHECK_TXT = "Destination List = $DESTINATION1, $DESTINATION2
Candidate Source = $SOURCE1, $SOURCE2, $SOURCE3, $SOURCE4
Expected Destination(Source) = $DESTINATION($SOURCE1)";
my $RESULT_LINE = "| $CHECK_NUM | $CHECK_TXT | ";
my $RESULT = $TRUE;
#====== Check : Initialize Add source address & NCE in NUT #======
vLogHTML(" #### Check $CHECK_NUM: Start ($CHECK_TXT) #### ");
nutInitialize() || exit $V6evalTool::exitFatal;
nutDnsSet($DNS_ADDR) || exit $V6evalTool::exitFatal;
$CPP = "-DSOURCE1=\\\"$SOURCE1\\\" -DSOURCE2=\\\"$SOURCE2\\\" -DSOURCE3=\\\"$SOURCE3\\\" -DDESTINATION=\\\"$DESTINATION\\\" -DDESTINATION1=\\\"$DESTINATION1\\\" -DDESTINATION2=\\\"$DESTINATION2\\\" -DDST_FQDN=\\\"$DST_FQDN\\\" -DDNS_ADDR=\\\"$DNS_ADDR\\\"";
vCPP($CPP);
nutIPv6AddrAdd($SOURCE1,"64") || exit $V6evalTool::exitFatal;
nutIPv6AddrAdd($SOURCE2,"64") || exit $V6evalTool::exitFatal;
$ret = checkNUT_SrcAddr($CPP,$SOURCE1,$TEST_DST1,$SOURCE2,$TEST_DST2);
if (!$ret) {
vLogHTML("#### Check $CHECK_NUM: Fail #### ");
nutReboot() || exit $V6evalTool::exitFatal;
$RESULT_LINE .= "Fail |
";
$RESULT_TABLE .= $RESULT_LINE;
return $FALSE;
}
if($RESULT){
if(!nutPing62Dest_Dns($CPP,2,$ON_LINK,$TRUE)){
$RESULT = $FALSE;
}
}
if($RESULT){
vLogHTML("#### Check $CHECK_NUM: PASS ####
");
$RESULT_LINE .= "PASS";
$RESULT_TABLE .= $RESULT_LINE;
nutClear($SOURCE1,"64",$SOURCE2,"64",$SOURCE3,"64") || exit $V6evalTool::exitFatal;
nutDnsRemove();
return $TRUE;
}else{
vLogHTML("#### Check $CHECK_NUM: Fail ####
");
$RESULT_LINE .= "Fail";
$RESULT_TABLE .= $RESULT_LINE;
nutClear($SOURCE1,"64",$SOURCE2,"64",$SOURCE3,"64") || exit $V6evalTool::exitFatal;
nutDnsRemove();
return $FALSE;
}
}
######################################################################
__END__
=head1 NAME
DstSelectRule7.seq - Destination Address Selection
Check Rule 7(Prefer native transport)
Rule 7: Prefer native transport.
If DA is reached via an encapsulating transition mechanism (eg, IPv6
in IPv4) and DB is not, then prefer DB.
Source addresses used for this test are "preferred address".
=head1 TARGET
Host and Router
=head1 SYNOPSIS
=begin html
DstSelectRule7.seq [-tooloption ...] -pkt ADDR_SELECT.def
-tooloption : v6eval tool option
=end html
=head1 INITIALIZATION
None
=head1 TEST PROCEDURE
This TEST performs the following Check procedures for
every address group defined by Check 01 - *.
*Check procedure
1. Initialize :
1.1. Set Configured Tunnel in NUT
1.2. Set static route (prefix(3ffe:1:1:1::) use Configured Tunnel) in NUT
1.3. Set IPv6 Default Route in NUT
(Default Router address = )
1.4. Set DNS setting in NUT
1.5. Add Candidate Source Addresses in NUT
1.6. Check Candidate Source Addresses by Ping6 (TN->NUT)
2. Send Ping6 from NUT to Destination(FQDN)
2.1. NUT send DNS query (question) (NUT->TN)
2.2. TN send DNS query (answer) (TN->NUT)
2.3. NUT send ICMPv6 echo request (NUT->TN)
3. Judgment :
if (recive packet's Destination & Source Addresses)
= (expected Destination & Source Addresses), Check pass
4. Cleanup :
4.1. Delete Candidate Source Addresses in NUT
4.2. Clear prefix list & NCE & default router list in NUT
4.3. Remove DNS setting in NUT
NUT TN Default DNS Destination
| | Router | |
| | | | |
======(INITIALIZE)=========
| | | | |
|<-<-<-+ | | | Set Configured Tunnel
|<-<-<-+ | | | Set IPv6 Default Route
|<-<-<-+ | | | Set DNS setting
|<-<-<-+ | | | Add Candidate Source Addresses
| | | | |
|<------------+ | | Echo Request to Candidate Source Addresses 1
+------------>| | | Echo Reply
| | | | |
|<------------+ | | Echo Request to Candidate Source Addresses 2
+------------>| | | Echo Reply
| | | | |
|<------------+ | | Echo Request to Candidate Source Addresses 3
+------------>| | | Echo Reply
| | | | |
======(INITIALIZE)=========
| | | | |
|<-<-<-+ | | | Excute ping6 command
| | | | |
+------------------>| | DNS query question
<-------------------+ | DNS query answer
+------------------------>| Echo Request
| | | | |
LLA(Link Local Address)
*This test expected default policy table
*Following address grouup does not match Rule 1-6
Check 01:
DNS Address: 2001::9
Candidate Source Addresses: 2001::1 or fec0::1 or fec0::1 or LLA
Destination Address List: 3ffe:1:1:1::2 or 3fff::2
Result: 3fff::2 (src 2001::1) then 3ffe:1:1:1::2 (src 2001::1)
=head1 JUDGEMENT
Check 01:
PASS: Receive Echo Request & destination(source) = 3fff::2(2001::1)
TEST
PASS: All Check = PASS
=head1 SEE ALSO
perldoc V6evalTool
=begin html
ADDR_SELECT.html "Default Address Selection for IPv6" Test Common Utility
das_rules.html "Default Address Selection for IPv6" Rules
=end html
=cut