Commit 551d3d6c authored by tepelmann's avatar tepelmann
Browse files

Initial checkin of TC_NAT64_LSN_SPR_BV_001.

parent 5ec0fc21
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
    group natMappings {
        
        type record NatMappingTable_1_to_1 {
            UInt16      srcPort,
            UInt16      etsPort,
            record of record {
                Ipv6Address ip6Address,
                Ipv4Address ip4Address
@@ -58,9 +58,9 @@
    
    group ipv4Hosts {
        
        type record Ipv4DestInfo {
            Ipv4Address dstAddress,
            UInt16      dstPort,
        type record Ipv4IutInfo {
            Ipv4Address iutAddress,
            UInt16      iutPort,
            TcpPayload  payload
        }
        
+4 −4
Original line number Diff line number Diff line
@@ -15,16 +15,16 @@ module AtsNat64_Pixits {
     */
    modulepar Oct8 PX_NAT64_PREFIX := '0064FF9B00000000'O;
    
    modulepar Ipv4DestInfo PX_IPV4_DESTINATION_INFORMATION := {
        dstAddress := '41d0e4df'O,
        dstPort    := 80,
    modulepar Ipv4IutInfo PX_IPV4_DESTINATION_INFORMATION := {
        iutAddress := '41d0e4df'O,
        iutPort    := 80,
        payload    := {
            rawPayload := 'CAFEDECA'O // TODO To be enhanced
        }
    }
    
    modulepar NatMappingTable_1_to_1 PX_NAT64_MAPPING_TABLE_1_TO_1 := {
        srcPort    := 6001,
        etsPort    := 6001,
        mapInfos := { 
            {
                ip6Address := '20010db8000000000000000000000001'O,
+166 −18
Original line number Diff line number Diff line
@@ -102,10 +102,10 @@ module AtsNat64_TestCases {
                        f_finalyzeIpv4Packet(
                            m_ipv4Packet_dummy(
                                PX_NAT64_MAPPING_TABLE_1_TO_1.mapInfos[v_host].ip4Address,
                                PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                m_tcp_packet(
                                    PX_NAT64_MAPPING_TABLE_1_TO_1.srcPort,
                                    PX_IPV4_DESTINATION_INFORMATION.dstPort,
                                    PX_NAT64_MAPPING_TABLE_1_TO_1.etsPort,
                                    PX_IPV4_DESTINATION_INFORMATION.iutPort,
                                    PX_IPV4_DESTINATION_INFORMATION.payload,
                                    m_tcp_flags_syn
                                )
@@ -115,7 +115,7 @@ module AtsNat64_TestCases {
                        v_ipv6Packet := m_generalIpv6_extHdr_data(
                          c_tcpHdr,
                          PX_NAT64_MAPPING_TABLE_1_TO_1.mapInfos[v_host].ip6Address,
                          PX_NAT64_PREFIX & c_4ZeroBytes & PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                          PX_NAT64_PREFIX & c_4ZeroBytes & PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                          omit,
                          v_ipv4Packet.ipv4Payload.rawPacket
                        );
@@ -261,7 +261,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -297,7 +297,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result := e_success;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'
@@ -431,10 +431,10 @@ module AtsNat64_TestCases {
                            f_finalyzeIpv4Packet(
                                m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_POOL[v_group].ip4Addresses[v_host],
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_POOL[v_group].clientInfos[v_host].srcPort,
                                        PX_IPV4_DESTINATION_INFORMATION.dstPort,
                                        PX_IPV4_DESTINATION_INFORMATION.iutPort,
                                        PX_IPV4_DESTINATION_INFORMATION.payload,
                                        m_tcp_flags_syn
                                    )
@@ -602,7 +602,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -638,7 +638,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'
@@ -762,7 +762,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -798,7 +798,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'
@@ -922,7 +922,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -958,7 +958,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'
@@ -1048,6 +1048,154 @@ module AtsNat64_TestCases {
            
            group validBehaviour {
                
                /**
                 * @desc Check that the IUT functions with static port reservation per prefix downstream
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
                 * Initial conditions:
                 *  with {
                 *      the IUT is properly provisioned
                 *      the interfaces are connected & functional
                 *      the static entries of well known ports for a singular prefix is configured on the IUT
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives multiple IPv4 packets downstream
                 *              containing IPv4 transport header
                 *                  containing source address
                 *                      indicating client IPv4 public address
                 *                  containing destination address
                 *                      indicating IUT client IPv4 public static address
                 *      }
                 *      then {
                 *          Traffic using static port forward is forwarded to an internal client by the IUT
                 *      }
                 *  }
                 * </pre>
                 * 
                 * @version 0.0.1
                 * @reference ETSI TS 101 569-1 Clause 6.4.6.22 Port Reservation
                 * @see     ETSI TS xxx xxx-x V0.0.1.5a-draft (2013-07) TP/NAT64/LSN/SPR/VB/01
                 */
                testcase TC_NAT64_LSN_SPR_BV_001() runs on Nat64Component system TestAdapter {
                    
                    // Local variables
                    var integer v_hostNum := lengthof(PX_NAT64_MAPPING_TABLE_1_TO_1.mapInfos);     /** Expected number of IPv6 packets to be forwarded */
                    var Ipv4Packet v_ipv4Packet;                                /** IPv4 packets */
                    var Ipv6Packet v_ipv6Packet;                                /** IPv6 packets address to IPv4 */
                    var integer v_host;                                         /** 'for' statement counter */
                    
                    // Test control
                    
                    // Test component configuration
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                        vc_lsnComponents[v_host] := LSNComponent.create(c_COMP_LSN & int2str(v_host));
                        vc_hostComponents[v_host] := HostComponent.create(c_COMP_HOST & int2str(v_host));
                    } // End of 'for' statement 
                    f_cf01Up();
                    
                    // Test adapter configuration
                    
                    // Test Body
                    // Start all components
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                        f_finalyzeIpv4Packet(
                            m_ipv4Packet_dummy(
                                PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                PX_NAT64_MAPPING_TABLE_1_TO_1.mapInfos[v_host].ip4Address,
                                m_tcp_packet(
                                    PX_IPV4_DESTINATION_INFORMATION.iutPort,
                                    PX_NAT64_MAPPING_TABLE_1_TO_1.etsPort,
                                    PX_IPV4_DESTINATION_INFORMATION.payload,
                                    m_tcp_flags_syn
                                )
                            ),
                            v_ipv4Packet
                        );
                        v_ipv6Packet := m_generalIpv6_extHdr_data(
                          c_tcpHdr,
                          PX_NAT64_PREFIX & c_4ZeroBytes & PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                          PX_NAT64_MAPPING_TABLE_1_TO_1.mapInfos[v_host].ip6Address,
                          omit,
                          v_ipv4Packet.ipv4Payload.rawPacket
                        );
                        
                        vc_lsnComponents[v_host].start(f_TC_NAT64_LSN_SPR_BV_001_lsn(v_ipv4Packet));
                        vc_hostComponents[v_host].start(f_TC_NAT64_LSN_SPR_BV_001_host(v_ipv6Packet));
                    } // End of 'for' statement 
                    
                    f_serverSyncNClientsAndStop(v_hostNum, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_NAT64_LSN_SPR_BV_001
                
                group f_TC_NAT64_LSN_SPR_BV_001 {
                    
                    /**
                     * @desc Simulates LSN side
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_NAT64_LSN_SPR_BV_001_lsn(Ipv4Packet p_ipv4Packet) runs on LSNComponent {
                        
                        // Local variables
                         
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_lsn(p_ipv4Packet.ipv4Hdr.destinationAddress);
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        ipv4Port.send(p_ipv4Packet);
                        
                        // Postamble
                        f_postamble_lsn();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_NAT64_LSN_SPR_BV_001_lsn
                    
                    /**
                     * @desc Simulates client side
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_NAT64_LSN_SPR_BV_001_host(Ipv6Packet p_ipv6Packet) runs on HostComponent {
                        
                        // Local variables
                         
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_host();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        tc_ac.start;
                        alt {
                            [] ipv6Port.receive(p_ipv6Packet) { 
                                tc_ac.stop;
                                log("*** " & __SCOPE__ & ": PASS: IPv4 packet was forwarded. ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                                log("*** " & __SCOPE__ & ": INCONC: Message was not received in time. ***");
                            }
                        } // End of 'altstep' statement
                        
                        // Postamble
                        f_postamble_host();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_NAT64_LSN_SPR_BV_001_host
                    
                } // End of group f_TC_NAT64_LSN_SPR_BV_001 
                
            } // End of group validBehaviour
            
        } // End of group staticPortAndIpReservation
@@ -1164,7 +1312,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -1200,7 +1348,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'
@@ -1326,7 +1474,7 @@ module AtsNat64_TestCases {
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                      v_ipv4Packet := m_ipv4Packet_dummy(
                                    PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                                    PX_IPV4_DESTINATION_INFORMATION.dstAddress,
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.portInfos[v_host].srcPort,
                                        PX_NAT64_MAPPING_TABLE_1_TO_N.dstPort,
@@ -1362,7 +1510,7 @@ module AtsNat64_TestCases {
                        
                        // Local variables
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.dstAddress;
                        var Ipv4Address v_localAddress := PX_IPV4_DESTINATION_INFORMATION.iutAddress;
                        
                        // Preamble
                        // Clause 'Initial conditions'