Commit 37f3e8a3 authored by tepelmann's avatar tepelmann
Browse files

Added initial version of TC_464XLAT_PLATLSN_NP_BV_001.

parent 386971b5
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -57,6 +57,41 @@ module Ats464XLat_Pixits {
        }
    }
    
    modulepar NatMappingTable_Pool PX_464XLAT_MAPPING_TABLE_POOL := {
        {
            clientInfos := {
                {
                    ip6Address := '20010db8000000000000000000000001'O,
                    srcPort    := 6001
                },
                {
                    ip6Address := '20010db8000000000000000000000002'O,
                    srcPort    := 6002
                }
            },
            ip4Addresses := {
                '91fea0ed'O,
                '91fea0ee'O
            }
        },
        {
            clientInfos := {
                {
                    ip6Address := '20010db8000000000000000000000003'O,
                    srcPort    := 6003
                },
                {
                    ip6Address := '20010db8000000000000000000000004'O,
                    srcPort    := 6004
                }
            },
            ip4Addresses := {
                '91fea0ef'O,
                '91fea0f0'O
            }
        }
    }
    
    modulepar float PX_TCP_TIME_WAIT := 15.0;
    
    modulepar Ipv6Address PX_FTP_CLIENT_IPV6_ADDRESS := '20010db8000000000000000000000001'O;
+162 −0
Original line number Diff line number Diff line
@@ -218,6 +218,168 @@ module Ats464XLat_TestCases {
            
            group validBehaviour {
                
                /**
                 * @desc Check that the IUT supports the functionality of multiple NAT pools per prefix
                 * @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 and, 
                 *      the six clients being configured with two separate prefixes, one prefix for three clients
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives multiple IPv6 packets 
                 *              containing IPv6 transport header
                 *                  containing source address
                 *                      indicating client IPv6 address
                 *                  containing destination address
                 *                      indicating IUT GW IPv6 prefix first 64 bits
                 *                      indicating IUT IPv4 embedded into the IPv6 address in last 32 bits
                 *      }
                 *      then {
                 *          the IUT does a 1:n NAT mapping for multiple public IPv6 client addresses sourced and,
                 *          the IUT forwards packets to the destination with some of the same and some different public IPv4 source 
                 *              address matching the NAT pools dependent on the prefix assigned
                 *      }
                 *  }
                 * </pre>
                 * 
                 * @version 0.0.1
                 * @reference ETSI TS 101 569-1 Clause 6.6.6.4 Port Block Allocation
                 * @see     ETSI TS xxx xxx-x V0.0.1.5a-draft (2013-07) TP/464XLAT/PLAT-LSN/NP/BV/01
                 */
                testcase TC_464XLAT_PLATLSN_NP_BV_001() runs on FourSixFourXLatComponent system TestAdapter {
                    
                    // Local variables
                    var integer v_groupNum := lengthof(PX_464XLAT_MAPPING_TABLE_POOL);
                    var integer v_hostNum := 0;
                    var Ipv4Packet v_ipv4Packet;                                /** IPv4 packets */
                    var Ipv6Packet v_ipv6Packet;                                /** IPv6 packets address to IPv4 */
                    var integer v_group;                                        /** 'for' statement counter */
                    var integer v_host;                                         /** 'for' statement counter */
                    
                    // Test control
                    
                    // Test component configuration
                    for (v_group := 0; v_group < v_groupNum; v_group := v_group + 1) {
                        v_hostNum := v_hostNum + lengthof(PX_464XLAT_MAPPING_TABLE_POOL[v_group].clientInfos);
                    } // End of 'for' statement 
                    
                    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_PLAT();
                    
                    // Test adapter configuration
                    
                    // Test Body
                    // Start all components
                    for (v_group := 0; v_group < v_groupNum; v_group := v_group + 1) {
                        v_hostNum := lengthof(PX_464XLAT_MAPPING_TABLE_POOL[v_group].ip4Addresses);
                        for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                            f_finalyzeIpv4Packet(
                                m_ipv4Packet_dummy(
                                    PX_464XLAT_MAPPING_TABLE_POOL[v_group].ip4Addresses[v_host],
                                    PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                                    m_tcp_packet(
                                        PX_464XLAT_MAPPING_TABLE_POOL[v_group].clientInfos[v_host].srcPort,
                                        PX_IPV4_DESTINATION_INFORMATION.iutPort,
                                        PX_IPV4_DESTINATION_INFORMATION.payload,
                                        m_tcp_flags_syn
                                    )
                                ),
                                v_ipv4Packet
                            );
                            v_ipv6Packet := m_generalIpv6_ipv4Payload(
                              c_ipv4Hdr,
                              PX_464XLAT_MAPPING_TABLE_POOL[v_group].clientInfos[v_host].ip6Address,
                              PX_464XLAT_PREFIX & c_4ZeroBytes & PX_464XLAT_MAPPING_TABLE_POOL[v_group].ip4Addresses[v_host],
                              v_ipv4Packet
                            );
                            
                            vc_lsnComponents[v_host].start(f_TC_464XLAT_PLATLSN_NP_BV_001_lsn(v_ipv4Packet));
                            vc_hostComponents[v_host].start(f_TC_464XLAT_PLATLSN_NP_BV_001_host(v_ipv6Packet));
                        } // End of 'for' statement 
                    } // End of 'for' statement 
                    
                    f_serverSyncNClientsAndStop(v_hostNum * 2, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_464XLAT_PLATLSN_NP_BV_001
                
                group f_TC_464XLAT_PLATLSN_NP_BV_001 {
                    
                    /**
                     * @desc Simulates LSN side
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_464XLAT_PLATLSN_NP_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
                        // Clause 'when': the IUT does a 1:1 NAT mapping for each public IPv6 client addresses sourced and,
                        //                the IUT forwards packets to the destination with different IPv4 public addresses
                        tc_ac.start;
                        alt {
                            [] ipv4Port.receive(p_ipv4Packet) { 
                                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_lsn();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_PLATLSN_NP_BV_001_lsn
                    
                    /**
                     * @desc Simulates client side
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_464XLAT_PLATLSN_NP_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
                        f_sendIpv6Packet(p_ipv6Packet);
                        
                        // Postamble
                        f_postamble_host();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_PLATLSN_NP_BV_001_host
                    
                } // End of group f_TC_464XLAT_PLATLSN_NP_BV_001 
                
            } // End of group validBehaviour
            
        } // End of group natPools