Commit 41d99169 authored by tepelmann's avatar tepelmann
Browse files

Resolved TODO in 464XLAT and Nat64.

Pulled up functions to AtsCommon.
parent 82f9cc96
Loading
Loading
Loading
Loading
+0 −287
Original line number Diff line number Diff line
@@ -207,66 +207,6 @@ module Ats464XLat_Functions {
            activate(a_default_host());
        } // End of function f_preamble_host
        
        /**
         * @desc Preamble processing for HostComponent using FTP
         * @see HostComponent
         */
        function f_preamble_host_ftp() runs on HostComponent system TestAdapter {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Map ports
            map(self:ftpPort, system:ftpPort);
            map(self:utPort, system:utPort);
            
            activate(a_default_host_ftp());
        } // End of function f_preamble_host_ftp
        
        /**
         * @desc Preamble processing for HostComponent using SIP
         * @see HostComponent
         */
        function f_preamble_host_sip() runs on HostComponent system TestAdapter {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Map ports
            map(self:sipPort, system:sipPort);
            map(self:utPort, system:utPort);
            
            activate(a_default_host_sip());
        } // End of function f_preamble_host_sip
        
        /**
         * @desc Preamble processing for HostComponent using RTSP
         * @see HostComponent
         */
        function f_preamble_host_rtsp() runs on HostComponent system TestAdapter {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Map ports
            map(self:rtspPort, system:rtspPort);
            map(self:utPort, system:utPort);
            
            activate(a_default_host_rtsp());
        } // End of function f_preamble_host_rtsp
        
        /**
         * @desc Preamble processing for HostComponent using PPTP
         * @see HostComponent
         */
        function f_preamble_host_pptp() runs on HostComponent system TestAdapter {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Map ports
            map(self:pptpPort, system:pptpPort);
            map(self:utPort, system:utPort);
            
            activate(a_default_host_pptp());
        } // End of function f_preamble_host_pptp
        
    } // End of preambleFunctions
    
    group postambleFunctions {
@@ -339,38 +279,6 @@ module Ats464XLat_Functions {
            // Nothing to do
        } // End of function f_postamble_host
        
        /**
         * @desc Postamble processing for HostComponent using FTP
         * @see HostComponent
         */
        function f_postamble_host_ftp() runs on HostComponent {
            // Nothing to do
        } // End of function f_postamble_host_ftp
        
        /**
         * @desc Postamble processing for HostComponent using SIP
         * @see HostComponent
         */
        function f_postamble_host_sip() runs on HostComponent {
            // Nothing to do
        } // End of function f_postamble_host_sip
        
        /**
         * @desc Postamble processing for HostComponent using RTSP
         * @see HostComponent
         */
        function f_postamble_host_rtsp() runs on HostComponent {
            // Nothing to do
        } // End of function f_postamble_host_rtsp
        
        /**
         * @desc Postamble processing for HostComponent using PPTP
         * @see HostComponent
         */
        function f_postamble_host_pptp() runs on HostComponent {
            // Nothing to do
        } // End of function f_postamble_host_pptp
        
    } // End of group postambleFunctions
    
    group commonfunctions {
@@ -623,73 +531,6 @@ module Ats464XLat_Functions {
         * @desc 
         */
        altstep a_default_MTC() runs on FourSixFourXLatComponent {
            var Ipv6Packet v_ipv6Pkt;
            var Ipv4Packet v_ipv4Pkt;
            var DHCPv6Msg v_dhcpMsg;
            var DnsMsg v_dnsMsg;
            
            [] ipPort.receive(mw_ipPkt) -> value v_ipv6Pkt { // Await IPv6 packet
                if (ispresent(v_ipv6Pkt.ipv6Payload)) {
                    if (ischosen(v_ipv6Pkt.ipv6Payload.udpMsg)
                            and ispresent(v_ipv6Pkt.ipv6Payload.udpMsg.data)) {
                        // Shall DHCP be handled?
                        if (
                                (vc_dhcpv6Component != null) and 
                                (
                                    (v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dhcpv6ServerPort, 2)) 
                                    or (v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dhcpv6ServerPort, 2))
                                )
                            ) {
                            // Process DHCPv6 packet
                            if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dhcpMsg)!=0) {
                                //dhcpv6Port.send(v_dhcpMsg);//TODO
                                repeat;
                            } else {
                                log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DHCPv6 message ***");
                                f_selfOrClientSyncAndVerdict("error", e_error);
                            }
                        }
//                        // Shall DNS be handled?
//                        if (
//                                vc_dnsComponent!=null and 
//                                (
//                                    (v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dnsServerPort, 2))
//                                    or (v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dnsServerPort, 2))
//                                )
//                            ) {
//                            if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dnsMsg)!=0) {
//                                dnsPort.send(v_dnsMsg);
//                                repeat;
//                            }
//                            else {
//                                log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DNS message ***");
//                                f_selfOrClientSyncAndVerdict("error", e_error);
//                            }
//                        }
                    }
                    //any other cases are handled as error
                    log("*** " & __SCOPE__ & "ERROR: Could not successfully dispatch received message ***");
                    f_selfOrClientSyncAndVerdict("error", e_error);
                }
            }
//            [] ipv4HostPort.receive(Ipv4Packet:?) -> value v_ipv4Pkt {
//                ipv4Port.send(v_ipv4Pkt);
//                repeat;
//            }
//            [] ipv6HostPort.receive(Ipv6Packet:?) -> value v_ipv6Pkt {
//                ipPort.send(v_ipv6Pkt);
//                repeat;
//            }
            [] ipPort.receive { // Unsupported IPv6 messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv6 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] ipv4Port.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv4 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
@@ -965,134 +806,6 @@ module Ats464XLat_Functions {
            }
        } // End of altstep a_default_host
        
        /**
         * @desc 
         */
        altstep a_default_host_ftp() runs on HostComponent {
            [] ftpPort.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv6 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] utPort.receive {
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected UT command, ignoring it ***");
                repeat;
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_postamble_host_ftp();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_default_host_ftp
        
        /**
         * @desc 
         */
        altstep a_default_host_sip() runs on HostComponent {
            [] sipPort.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv6 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] utPort.receive {
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected UT command, ignoring it ***");
                repeat;
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_postamble_host_sip();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_default_host_sip
        
        /**
         * @desc 
         */
        altstep a_default_host_rtsp() runs on HostComponent {
            [] rtspPort.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv6 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] utPort.receive {
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected UT command, ignoring it ***");
                repeat;
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_postamble_host_rtsp();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_default_host_rtsp
        
        /**
         * @desc 
         */
        altstep a_default_host_pptp() runs on HostComponent {
            [] pptpPort.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv6 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] utPort.receive {
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected UT command, ignoring it ***");
                repeat;
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_postamble_host_pptp();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_default_host_pptp
        
    } // End of group globalSteps
    
    group getFunctions {
+90 −14
Original line number Diff line number Diff line
@@ -46,6 +46,12 @@ module Ats464XLat_TestCases {
         */
        group basicFunction {
            
            group standardSyncPointNames {
                
                const charstring c_startDefaultRouteCheck := "startDefaultRouteCheck";
                
            } // End of group standardSyncPointNames
            
            group validBehaviour {
                
                /**
@@ -76,19 +82,38 @@ module Ats464XLat_TestCases {
                testcase TC_464XLAT_CLAT_BF_BV_01() runs on FourSixFourXLatComponent system TestAdapter {
                    
                    // Local variables
                    var Ipv4Packet v_ipv4Packet;                                /** IPv4 packets */
                    var integer v_index := 0;
                    
                    // Test control
                    
                    // Test component configuration
                    vc_dhcpv6Component := HostComponent.create(c_COMP_DHCP);
                    vc_hostComponents[v_index] := HostComponent.create(c_COMP_HTTP);
                    f_mtcUp();
                    
                    // Test adapter configuration
                    
                    // Start all components
                    f_finalyzeIpv4Packet(
                        m_ipv4Packet_df(
                            0,
                            PX_IPV4_DESTINATION_INFORMATION.iutAddress,
                            PX_464XLAT_MAPPING_TABLE_1_TO_N.ip4Address,
                            m_tcp_packet(
                                PX_IPV4_DESTINATION_INFORMATION.iutPort,
                                PX_464XLAT_MAPPING_TABLE_1_TO_N.portInfos[v_index].srcPort,
                                m_tcpHttpPayload(int2oct(42, PX_464XLAT_PLAT_MTU)),
                                m_tcp_flags_syn
                            )
                        ),
                        v_ipv4Packet
                    );
                    
                    vc_dhcpv6Component.start(f_TC_464XLAT_CLAT_BF_BV_01_dhcpv6());
                    vc_hostComponents[v_index].start(f_TC_464XLAT_CLAT_BF_BV_01_host_http(v_ipv4Packet));
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    f_serverSyncNClientsAndStop(2, { c_prDone, c_startDefaultRouteCheck, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
@@ -163,7 +188,8 @@ module Ats464XLat_TestCases {
                            }
                        } // End of 'altstep' statement
                        
                        //TODO check the default route configuration using v_ia_naAddress
                        // Check the default route configuration using v_ia_naAddress
                        f_selfOrClientSyncAndVerdict(c_startDefaultRouteCheck, e_success);
                        
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        log("*** " & __SCOPE__ & ": PASS: Successfully received DHCPv6 Reply from the DHCPv6 Server. ***");
@@ -175,6 +201,59 @@ module Ats464XLat_TestCases {
                        
                    } // End of function f_TC_464XLAT_CLAT_BF_BV_01_dhcpv6
                    
                    /**
                     * @desc Implements multiple host side behavior
                     * @param p_srcAddress          The HTTP client address
                     * @param p_httpServerAddress   The HTTP server address
                     * @param p_noOfDataRequests    The number of hosts to simulate
                     * @verdict pass on success, inconc on timeout, fail otherwise
                     */
                    function f_TC_464XLAT_CLAT_BF_BV_01_host_http(Ipv4Packet p_ipv4Packet) runs on HostComponent {
                        
                        // Local variables
                        var Ipv4Packet v_ipv4Packet;    /** Used to store received IPv4 messages */
                        var InterCompDataMsg v_data;    /** Used to send received IPv4 messages to BRComponent */
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_host_http();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // 
                        // Test Body: Check the default route configuration using v_ia_naAddress
                        f_selfOrClientSyncAndVerdict(c_startDefaultRouteCheck, e_success);
                        if (
                            f_httpSendDataV4(
                                p_ipv4Packet.ipv4Hdr.sourceAddress,             // containing source address indicating a private IPv4 address 
                                p_ipv4Packet.ipv4Hdr.destinationAddress,        // containing destination address indicating a public IPv4 address
                                1                                               // from multiple hosts
                            ) == e_error) { 
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            log("*** " & __SCOPE__ & ": FAIL: Unaible to send HTTP messages. ***");
                        }
                        tc_ac.start;
                        alt {
                            [] httpPort.receive(
                                mw_ipv4Packet_df(
                                    p_ipv4Packet.ipv4Hdr.destinationAddress,
                                    p_ipv4Packet.ipv4Hdr.sourceAddress
                            )) {
                                tc_ac.stop;
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout { 
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                        } // End of 'altstep' statement
                        
                        // Postamble
                        f_postamble_host_http();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_CLAT_BF_BV_01_host_http
                    
                } // End of group f_TC_464XLAT_CLAT_BF_BV_01 
                
            } // End of group validBehaviour
@@ -239,7 +318,6 @@ module Ats464XLat_TestCases {
                    
                    // Test Body
                    // Start all components
                    //TODO introduce new PIXITs for address/port information
                    f_finalyzeIpv4Packet(
                        m_ipv4Packet_df(
                            0,
@@ -263,7 +341,7 @@ module Ats464XLat_TestCases {
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_464XLAT_CLATB4_PF_BV_01
                } // End of testcase TC_464XLAT_CLATB4_FRAG_BV_01
                
                group f_TC_464XLAT_CLAT_FRAG_BV_01 {
                    
@@ -290,7 +368,7 @@ module Ats464XLat_TestCases {
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_CLATB4_PF_BV_01_b4
                    } // End of function f_TC_464XLAT_CLATB4_FRAG_BV_01_b4
                    
                    /**
                     * @desc Simulates PLAT side
@@ -372,9 +450,9 @@ module Ats464XLat_TestCases {
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_CLAT_PF_BV_01_plat
                    } // End of function f_TC_464XLAT_CLAT_FRAG_BV_01_plat
                    
                } // End of group f_TC_464XLAT_CLAT_PF_BV_01 
                } // End of group f_TC_464XLAT_CLAT_FRAG_BV_01 
                
            } // End of group validBehaviour
            
@@ -1718,9 +1796,9 @@ module Ats464XLat_TestCases {
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_464XLAT_PLAT_PF_BV_01
                } // End of testcase TC_464XLAT_PLAT_FRAG_BV_01
                
                group f_TC_464XLAT_PLAT_PF_BV_01 {
                group f_TC_464XLAT_PLAT_FRAG_BV_01 {
                    
                    /**
                     * @desc Simulates LSN side
@@ -1745,7 +1823,7 @@ module Ats464XLat_TestCases {
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_PLAT_PF_BV_01_lsn
                    } // End of function f_TC_464XLAT_PLAT_FRAG_BV_01_lsn
                    
                    /**
                     * @desc Simulates client side
@@ -1827,11 +1905,9 @@ module Ats464XLat_TestCases {
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_464XLAT_PLAT_PF_BV_01_host
                    
                } // End of group f_TC_464XLAT_PLAT_PF_BV_01 
                    } // End of function f_TC_464XLAT_PLAT_FRAG_BV_01_host
                    
                //TODO add TC_464XLAT_PLAT_PF_BV_02
                } // End of group f_TC_464XLAT_PLAT_FRAG_BV_01 
                
            } // End of group validBehaviour
            
+0 −122

File changed.

Preview size limit exceeded, changes collapsed.

+347 −1

File changed.

Preview size limit exceeded, changes collapsed.

+0 −110

File changed.

Preview size limit exceeded, changes collapsed.

Loading