Commit 1fc11e1d authored by garciay's avatar garciay
Browse files

DS-Lite FTP ALG code review

parent 292d7fbd
Loading
Loading
Loading
Loading
+62 −1
Original line number Diff line number Diff line
@@ -108,6 +108,23 @@ module AtsDSLite_Functions {
            
         } // End of function f_preamble_ipv4Server
         
        /**
          * @desc Preamble processing for Ipv4 Server Component
          * @verdict Unchanged
          * @see AFTRComponent
          */
         function f_preamble_ipv4Server_ftp(in Ipv4Address p_ip4Address) runs on Ipv4ServerComponent system TestAdapter {
             // Connect synchronisation ports
             f_connect4SelfOrClientSync();
            
             // Map ports
             map(self:ftpPort, system:ftpPort);
             map(self:utPort, system:utPort);
            
             activate(a_default_ipv4Server_ftp());
            
         } // End of function f_preamble_ipv4Server_ftp
         
        /**
         * @desc Preamble processing for HostComponent
         * @verdict Unchanged
@@ -191,6 +208,18 @@ module AtsDSLite_Functions {
            // Nothing to do
        } // End of function f_postamble_ipv4Server
        
        /**
        /**
         * @desc Postamble processing for Ipv4ServerComponent
         * @verdict Unchanged
         * @see Ipv4ServerComponent
         */
        function f_postamble_ipv4Server_ftp() runs on Ipv4ServerComponent {
            // Nothing to do
        } // End of function f_postamble_ipv4Server_ftp


        
       /**
         * @desc Postamble processing for HostComponent
         * @verdict Unchanged
@@ -282,6 +311,38 @@ module AtsDSLite_Functions {
            }
        } // End of altstep a_default_aftr 
        
        /**
         * @desc 
         */
        altstep a_default_ipv4Server_ftp() runs on Ipv4ServerComponent {
            [] ftpPort.receive  { // Unsolicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv4 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_ipv4Server_ftp();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;
            }
        } // End of altstep a_default_ipv4Server_ftp
        
        /**
        /**
         * @desc 
+48 −24
Original line number Diff line number Diff line
@@ -2089,17 +2089,43 @@ module AtsDSLite_TestCases {
//                        
//                    } // End of function f_TC_DSLITE_AFTR_ALG_BV_01_host
                    
                    function f_TC_DSLITE_AFTR_ALG_BV_01_ipv4Server(in integer p_hostNum) runs on Ipv4ServerComponent {
                    function f_TC_DSLITE_AFTR_ALG_BV_01_ipv4Server(in UInt p_noOfDataRequests) runs on Ipv4ServerComponent {
                        
                        // Local variables
                        var integer v_hostNum := p_hostNum;  /** Expected number of IPv6 packets to be forwarded */
                        var ResultsList v_results;           /** List of flags indicating the linked IPv6 packet was forwarded */
                        var FncRetCode v_result;
                        var Ipv4Address v_localAddress := PX_AFTR_B4_IPv4ADDRESS;
                        var template(present) Ipv4Address v_srcAddress := ?;
                        var Ipv4Packet v_ipv4Packet;         /** Received IPv4 packet */
                        var integer v_host;                  /** 'for' statement counter */
                        var integer v_nbrReceived := 0;
                        var TcpPacket v_tcpPacket;
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_ipv4Server(PX_AFTR_B4_IPv4ADDRESS);
                        f_preamble_ipv4Server_ftp(v_localAddress);
                        tc_ac.start;
                        alt {
                            [] ftpPort.receive(
                              mw_ipv4Packet_dummy(
                                  v_srcAddress,
                                  v_localAddress,
                                  ?
                              )
                            ) -> value v_ipv4Packet {
                                tc_ac.stop;
                                if (e_success == f_decTcpPacket(v_ipv4Packet.ipv4Payload.rawPacket, v_tcpPacket)) {
                                    if (not match(v_tcpPacket.srcPort, 21)) {
                                        tc_ac.start;
                                        repeat;
                                    }
                                    v_srcAddress := v_ipv4Packet.ipv4Hdr.sourceAddress;
                                    log("*** " & __SCOPE__ & ": IPv4 packet was correctly forwarded. ***");
                                }
                            }
                            [] tc_ac.timeout {
                                v_result := e_timeout;
                                log("*** " & __SCOPE__ & ": Message was not received in time. ***");
                            }
                        } // End of 'altstep' statement
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
@@ -2107,29 +2133,27 @@ module AtsDSLite_TestCases {
                        // Clause 'when': the IUT receives multiple HTML IPv4 packets 
                        
                        // Clause 'then': the IUT forwards the FTP packet to the FTP server
                        v_host := 0;
                        tc_ac.start;
                        alt {
                            [] ipv4Port.receive(Ipv4Packet:?) -> value v_ipv4Packet { 
                            [] ftpPort.receive(
                              mw_ipv4Packet_dummy(
                                  v_srcAddress,
                                  v_localAddress,
                                  ?
                              )
                            ) -> value v_ipv4Packet {
                                tc_ac.stop;
                                for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) { 
                                    if ( // the IUT forwards packets to the destination with the same public IPv4 source address
                                        (v_ipv4Packet.ipv4Hdr.sourceAddress == PX_HOST_V4_LIST_FTP[v_host].srcAddress) and 
                                        (v_ipv4Packet.ipv4Hdr.destinationAddress == PX_HOST_V4_LIST_FTP[v_host].dstAddress) and             // containing destination address indicating a public IPv4 address (FTP server address)
                                        (oct2int(substr(v_ipv4Packet.ipv4Payload.rawPacket, 2, 2)) == PX_HOST_V4_LIST_FTP[v_host].dstPort)  // containing TCP payload indicating port number 20
                                    ) {
                                        log("*** " & __SCOPE__ & ": INFO: Receives IPv6 packet #", v_host, ". ***");
                                        v_results[v_host] := true;
                                        break;
                                    }
                                } // End of 'for' statement 
                                if (lengthof(v_results) == v_hostNum) { // Check current result
                                    log("*** " & __SCOPE__ & ": PASS: All IPv6 packets were forwarded. ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                } else {
                                if (e_success == f_decTcpPacket(v_ipv4Packet.ipv4Payload.rawPacket, v_tcpPacket)) {
                                    if (not match(v_tcpPacket.srcPort, 20)) {
                                        tc_ac.start;
                                        repeat;
                                    }
                                    log("*** " & __SCOPE__ & ": IPv4 packet was correctly forwarded. ***");
                                    if (v_nbrReceived != p_noOfDataRequests) {
                                        v_nbrReceived := v_nbrReceived + 1;
                                        repeat;
                                    }
                                }
                            }
                            [] tc_ac.timeout {
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
@@ -2138,7 +2162,7 @@ module AtsDSLite_TestCases {
                        } // End of 'altstep' statement
                        
                        // Postamble
                        f_postamble_ipv4Server();
                        f_postamble_ipv4Server_ftp();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
+2 −2

File changed.

Contains only whitespace changes.