Commit 4d880839 authored by garciay's avatar garciay
Browse files

Add Http and Ftp ports. To be moved in AtsCommon later

parent 3be36ac9
Loading
Loading
Loading
Loading
+185 −28
Original line number Diff line number Diff line
@@ -6,49 +6,32 @@
module AtsDSLite_Functions {
    
    // LibCommon
    import from LibCommon_DataStrings {
        const c_16ZeroBytes
    };
    import from LibCommon_Sync {
        function 
            f_connect4SelfOrClientSync, 
            f_selfOrClientSyncAndVerdict;
        altstep 
            a_shutdown;
        const 
            c_prDone, c_tbDone, c_poDone;
    };
    import from LibCommon_VerdictControl {
        type
            FncRetCode;
    };
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_AbstractData all;
    import from LibCommon_DataStrings  all;
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;
    
    // LibIpv6
    import from LibIpv6_Interface_Templates all;
    import from LibIpv6_Interface_TypesAndValues all;
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_Interfaces {
        type 
            TestAdapter, 
            DHCPv6Component, DNSComponent,
            InterCompDataMsg;
    };
    import from AtsCommon_Interfaces all;
    import from AtsCommon_Functions all;
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    
    // DSLite
    import from AtsDSLite_Interfaces {
        type 
            DSLiteComponent, 
            AFTRComponent, HostComponent;
    };
    import from AtsDSLite_TypesAndValues all;
    import from AtsDSLite_Interfaces all;
    
    group initialiseFunctions {
        
        /**
         * @desc Setup communication port
         * @desc Setup communication port for simulation purposes
         * @verdict Unchanged
         */
        function f_cf01Up_B4() runs on DSLiteComponent {
@@ -87,6 +70,60 @@ module AtsDSLite_Functions {
            activate(a_default_MTC());
        } // End of function f_cf01Up_B4
        
        /**
         * @desc Setup communication port for sniffing purpose
         * @verdict Unchanged
         */
        function f_cf02Up_B4() runs on DSLiteComponent {
            var integer v_hosts;
            var integer v_host;
            
            // Connect port
            if (vc_aftrComponent != null) { 
                connect(vc_aftrComponent:aftrPort, self:aftrPort);
            }
            if (isbound(vc_hostComponents)) {
                v_hosts := lengthof(vc_hostComponents);
                for (v_host:=0; v_host<v_hosts; v_host:=v_host + 1) {
                    connect(vc_hostComponents[v_host]:ipv6Port, self:ipv6HostPort); 
                    connect(vc_hostComponents[v_host]:ipv4Port, self:ipv4HostPort); 
                }
            } 
            if (vc_dhcpv6Component != null) { 
                connect(vc_dhcpv6Component:dhcpv6Port, self:dhcpv6Port);
            } 
            if (vc_dnsComponent != null) { 
                connect(vc_dnsComponent:dnsPort, self:dnsPort);
            }
            if ((vc_dhcpv6Component != null) and (vc_dnsComponent != null)) { 
                connect(vc_dhcpv6Component:dataPort, vc_dnsComponent:dataPort);
            }
            
//            if (isbound(vc_httpComponents)) {
//                v_hosts := lengthof(vc_httpComponents);
//                for (v_host:=0; v_host<v_hosts; v_host:=v_host + 1) {
//                    connect(vc_httpComponents[v_host]:httpPort, self:httpPort); 
//                }
//            } 
            
//            if (isbound(vc_ftpComponents)) {
//                v_hosts := lengthof(vc_ftpComponents);
//                for (v_host:=0; v_host<v_hosts; v_host:=v_host + 1) {
//                    connect(vc_ftpComponents[v_host]:ftpPort, self:ftpPort); 
//                }
//            } 
            
            // Map ports
            map(self:ipPort, system:ipPort);
            map(self:ipv4Port, system:ipv4Port);
            
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Default activation
            activate(a_default_MTC());
        } // End of function f_cf02Up_B4
        
    } // End of group initialiseFunctions
    
    group preambleFunctions {
@@ -124,6 +161,27 @@ module AtsDSLite_Functions {
            
        } // End of function f_preamble_dns
        
        /**
         * @desc Preamble processing for HostHTTPComponent
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_preamble_host_http() runs on HostHTTPComponent {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_host_http
        
        /**
         * @desc Preamble processing for HostFTPComponent
         * @verdict Unchanged
         * @see FTPComponent
         */
        function f_preamble_host_ftp() runs on HostFTPComponent {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
        } // End of function f_preamble_host_ftp
        
    } // End of group preambleFunctions
    
    group postambleFunctions {
@@ -155,6 +213,24 @@ module AtsDSLite_Functions {
            // Nothing to do
        } // End of function f_postamble_dns
        
        /**
         * @desc Postamble processing for HostHTTPComponent
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_postamble_host_http() runs on HostHTTPComponent {
            // Nothing to do
        } // End of function f_postamble_host_http
        
        /**
         * @desc Postamble processing for HostFTPComponent
         * @verdict Unchanged
         * @see FTPComponent
         */
        function f_postamble_host_ftp() runs on HostFTPComponent {
            // Nothing to do
        } // End of function f_postamble_host_ftp
        
    } // End of group postambleFunctions
    
    group globalSteps {
@@ -261,6 +337,87 @@ module AtsDSLite_Functions {
        
    } // End of group globalSteps
    
    group httpFunctions {
        
        /**
         * @desc Send multiple HTTP requests to the specified HTTP server
         * @param p_srcAddress          The host HTTP address
         * @param p_httpServerAddress   The HTTP server address
         * @param p_noOfDataRequests    The nimber of HTTP request to be sent
         * @return e_success on success, e_timeout on call timeout, e_error otherwise
         */
        function f_httpSendData(in Ipv4Address p_srcAddress, in Ipv4Address p_httpServerAddress, in UInt p_noOfDataRequests) runs on HostHTTPComponent
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            httpPort.call (s_httpSendData:{p_srcAddress, p_httpServerAddress, p_noOfDataRequests}, PX_TAC) {
                [] httpPort.getreply (s_httpSendData:{-, -, -} value true) {
                    log("*** " & __SCOPE__ & ": Successfully sent HTTP data. ***");
                    v_result := e_success;
                }
                [] httpPort.getreply {
                    log("*** " & __SCOPE__ & ": Could not send HTTP data. ***");
                    v_result := e_error;
                }
                [] httpPort.catch (timeout) {
                    log("*** " & __SCOPE__ & ": Timeout during sending of HTTP data. ***");
                    v_result := e_timeout
                }
            }
            
            return v_result;
        } // End of function f_httpSendData
        
    } // End of group httpFunctions
    
    group ftpFunctions {
        
        function f_ftpLogin(in Ipv4Address p_srcAddress, in Ipv4Address p_dstAddress) runs on HostFTPComponent
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            ftpPort.call (s_ftpLogin:{p_srcAddress, p_dstAddress}, PX_TAC) {
                [] ftpPort.getreply (s_ftpLogin:{-, -} value true) {
                    log("*** " & __SCOPE__ & ": FTP client successfully authenticated. ***");
                    v_result := e_success;
                }
                [] ftpPort.getreply {
                    log("*** " & __SCOPE__ & ": FTP client authentication was not successful. ***");
                    v_result := e_error;
                }
                [] ftpPort.catch (timeout) {
                    log("*** " & __SCOPE__ & ": Timeout during FTP client authentication. ***");
                    v_result := e_timeout
                }
            }
            
            return v_result;
        } // End of function f_ftpLogin
        
        function f_ftpSendData(in Ipv4Address p_srcAddress, in Ipv4Address p_dstAddress, in UInt16 p_dataPort, in UInt p_noOfDataRequests) runs on HostFTPComponent
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            ftpPort.call (s_ftpSendData:{p_srcAddress, p_dstAddress, p_dataPort, p_noOfDataRequests}, PX_TAC) {
                [] ftpPort.getreply (s_ftpSendData:{-, -, -, -} value true) {
                    log("*** " & __SCOPE__ & ": Successfully sent FTP data. ***");
                    v_result := e_success;
                }
                [] ftpPort.getreply {
                    log("*** " & __SCOPE__ & ": Could not send FTP data. ***");
                    v_result := e_error;
                }
                [] ftpPort.catch (timeout) {
                    log("*** " & __SCOPE__ & ": Timeout during sending of FTP data. ***");
                    v_result := e_timeout
                }
            }
            
            return v_result;
        } // End of function f_ftpSendData
        
    } // End of group ftpFunctions
    
    group auxiliary {
        
        function f_getDHCPv6RetrievedAftrName(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.aftrName p_aftrName)
+89 −50
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ module AtsDSLite_Interfaces {
            UtComponent
    };
    
    import from AtsNat64_Interfaces all; // TODO Move FTP port and others
    
    // AtsDSLite
    import from AtsDSLite_TypesAndValues all;
    
    group mtcDesc {
        
        /**
@@ -77,17 +82,27 @@ module AtsDSLite_Interfaces {
            var DHCPv6Component vc_dhcpv6Component := null;
            /** DNS component reference */
            var DNSComponent vc_dnsComponent := null;
            /** HTTP component reference */
            var HostHTTPComponents vc_hostHttpComponents := null;
            /** FTP component reference */
            var HostFTPComponents vc_hostFtpComponents := null;
        } // End of component DSLiteComponent
        
        type record of HostComponent HostComponents;
        
        type record of HostHTTPComponent HostHTTPComponents;
        
        type record of HostFTPComponent HostFTPComponents;
        
    } // End of group mtcDesc
    
    group componentDesc {
        
        group componentPorts {
            
        } // End of group componentPorts
            type port HttpPort mixed {
                out s_httpSendData; //initiate actions
            }
            
            /**
             * @desc 
@@ -106,7 +121,7 @@ module AtsDSLite_Interfaces {
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
                /** Timer used for receive message */
                timer tc_twait:= PX_TWAIT;
            } // End of component HostComponent
            
@@ -126,10 +141,34 @@ module AtsDSLite_Interfaces {
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
                /** Timer used for receive message */
                timer tc_twait:= PX_TWAIT;
            } // End of component AFTRComponent
            
            type component HostHTTPComponent extends UtComponent, SelfSyncComp {
                /** HTTP message port */
                port HttpPort httpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_twait:= PX_TWAIT;
            } // End of component HostHTTPComponent
            
            type component HostFTPComponent extends UtComponent, SelfSyncComp {
                /** FTP message port */
                port FtpPort ftpPort;
                /** Timer used for expected received message */
                timer tc_ac:= PX_TAC;
                /** Timer used for unexpected received message */
                timer tc_noac:= PX_TNOAC;
                /** Timer used for receive message */
                timer tc_twait:= PX_TWAIT;
            } // End of component HostFTPComponent
            
        } // End of group componentPorts
        
    } // End of group componentDesc
    
} // End of module AtsDSLite_Interfaces
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@
module AtsDSLite_Pics {
    
    /**
     * @desc The host acts as a B4 device itself
     * @desc The SUT is the B4 equipment
     */
    modulepar boolean PICS_HOST_IS_B4 := false;
    modulepar boolean PICS_ROLE_IS_B4 := false;
    
    /**
     * @desc The host acts as a customer device
     * @desc The SUT is the AFTR equipment
     */
    modulepar boolean PICS_HOST_IS_B4_DEVICES := false;
    modulepar boolean PICS_ROLE_IS_AFTR := false;
    
} // End of module AtsDSLite_Pics
 No newline at end of file
+9 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ module AtsDSLite_Pixits {
    import from LibCommon_DataStrings {const c_16ZeroBytes;}
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {type Ipv6Address;}
    import from LibIpv6_CommonRfcs_TypesAndValues {type Ipv4Address, Ipv6Address;}
    
    // DSLite
    import from AtsDSLite_TypesAndValues all;
@@ -107,4 +107,12 @@ module AtsDSLite_Pixits {
    
    modulepar integer PX_DS_MTU := 1500;
    
    modulepar Ipv4Address PX_FTP_SERVER_IPv4 := '00000000'O;
    
    modulepar charstring PX_FTP_USER := "ftpuser";
    
    modulepar charstring PX_FTP_PASSWORD := "ftppassword";
    
    modulepar charstring PX_FTP_FILENAME := "filename.toget";
    
} // End of module AtsDSLite_Pixits
 No newline at end of file
+4 −1
Original line number Diff line number Diff line
@@ -18,10 +18,14 @@ module AtsDSLite_Templates {
    import from LibIpv6_Rfc6334Dhcp_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from AtsCommon_Templates all;
    
    // AtsDSLite
    import from AtsDSLite_Pixits all;
    
    group dhcpv6MessageTemplates {
        
        group dhcpv6OptionsDummyRecvTemplates {
@@ -303,5 +307,4 @@ module AtsDSLite_Templates {
        
    } // End of group tcpPackets 
    
    
} // End of module AtsDSLite_Templates
Loading