Commit d87017e9 authored by garciay's avatar garciay
Browse files

Implementation of CPE role test cases

parent 4d880839
Loading
Loading
Loading
Loading
+197 −36
Original line number Diff line number Diff line
@@ -6,46 +6,28 @@
module Ats6RD_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_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_CommonRfcs_TypesAndValues all;
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    import from LibIpv6_CommonRfcsDhcp_Functions {
        function f_sendDhcpv6Msg
    };
    import from LibIpv6_CommonRfcsDhcp_Functions all;
    
    // AtsCommon
    import from AtsCommon_Interfaces {
        type 
            TestAdapter, 
            DHCPv4Component
    };
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    import from AtsCommon_Interfaces all;
    import from AtsCommon_Functions all;
    
    // 6RDLite
    import from Ats6RD_Interfaces {
        type 
            SixRDComponent, 
            BRComponent, HostComponent;
    };
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    // Ats6RD
    import from Ats6RD_TypesAndValues all;
    import from Ats6RD_Interfaces all;
    
    group initialiseFunctions {
        
@@ -53,22 +35,22 @@ module Ats6RD_Functions {
         * @desc Setup communication port
         * @verdict Unchanged
         */
        function f_cf01Up() runs on SixRDComponent {
        function f_cf01Up_cpe() runs on SixRDComponent {
            var integer v_hosts;
            var integer v_host;
            
            // Connect port
            if (vc_brComponent != null) { 
            if (isbound(vc_brComponent)) { 
                connect(vc_brComponent:brPort, self:brPort);
            }
            if (vc_hostComponents != null) {
            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_dhcpv4Component != null) { 
            if (isbound(vc_dhcpv4Component)) { 
                connect(vc_dhcpv4Component:dhcpv4Port, self:dhcpv4Port);
            } 
            
@@ -81,7 +63,38 @@ module Ats6RD_Functions {
            
            // Default activation
            activate(a_default_MTC());
        } // End of function f_cf01Up
        } // End of function f_cf01Up_cpe
        
        /**
         * @desc Setup communication port
         * @verdict Unchanged
         */
        function f_cf02Up_cpe() runs on SixRDComponent {
            var integer v_hosts;
            var integer v_host;
            
            // Connect port
            if (isbound(vc_brComponent)) { 
                connect(vc_brComponent:brPort, self:brPort);
            }
            // TODO To be removed
//            if (isbound(vc_hostHttpComponents)) {
//                v_hosts := lengthof(vc_hostHttpComponents);
//                for (v_host:=0; v_host<v_hosts; v_host:=v_host + 1) {
//                    connect(vc_hostHttpComponents[v_host]:httpPort, self:httpPort); 
//                }
//            } 
            
            // 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_cpe
        
    } // End of group initialiseFunctions
    
@@ -120,6 +133,28 @@ module Ats6RD_Functions {
            
        } // End of function f_preamble_dhcpv4
        
        /**
         * @desc Preamble processing for HostHTTPv4Component
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_preamble_host_httpv4() runs on HostHTTPv4Component {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_host_httpv4
        
        /**
         * @desc Preamble processing for HostHTTPv6Component
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_preamble_host_httpv6() runs on HostHTTPv6Component {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_host_httpv6
        
    } // End of group preambleFunctions
    
    group postambleFunctions {
@@ -151,8 +186,90 @@ module Ats6RD_Functions {
            // Nothing to do
        } // End of function f_postamble_dhcpv4
        
        /**
         * @desc Postamble processing for HostHTTPv4Component
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_postamble_host_httpv4() runs on HostHTTPv4Component {
            // Nothing to do
        } // End of function f_postamble_host_httpv4
        
        /**
         * @desc Postamble processing for HostHTTPv6Component
         * @verdict Unchanged
         * @see HTTPComponent
         */
        function f_postamble_host_httpv6() runs on HostHTTPv6Component {
            // Nothing to do
        } // End of function f_postamble_host_httpv6
        
    } // End of group postambleFunctions
    
    group httpFunctions {
        
        /**
         * @desc Send multiple native V4 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 number of HTTP request to be sent
         * @param p_withHugePayload     Set to true if huge packet is required
         * @return e_success on success, e_timeout on call timeout, e_error otherwise
         */
        function f_httpv4SendData(in Ipv4Address p_srcAddress, in Ipv4Address p_httpServerAddress, in UInt p_noOfDataRequests, in boolean p_withHugePayload := false) runs on HostHTTPv4Component
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            httpPort.call (s_httpv4SendData:{p_srcAddress, p_httpServerAddress, p_noOfDataRequests, p_withHugePayload}, PX_TAC) {
                [] httpPort.getreply (s_httpv4SendData:{-, -, -, -} 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_httpv4SendData
        
        /**
         * @desc Send multiple native V6 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 number of HTTP request to be sent
         * @param p_withHugePayload     Set to true if huge packet is required
         * @return e_success on success, e_timeout on call timeout, e_error otherwise
         */
        function f_httpv6SendData(in Ipv6Address p_srcAddress, in Ipv6Address p_httpServerAddress, in UInt p_noOfDataRequests, in boolean p_withHugePayload := false) runs on HostHTTPv6Component
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            httpPort.call (s_httpv6SendData:{p_srcAddress, p_httpServerAddress, p_noOfDataRequests, p_withHugePayload}, PX_TAC) {
                [] httpPort.getreply (s_httpv6SendData:{-, -, -, -} 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_httpv6SendData
        
    } // End of group httpFunctions
    
    group globalSteps {
        
        /**
@@ -199,4 +316,48 @@ module Ats6RD_Functions {
        
    } // End of group globalSteps
    
    group auxiliary {
        
        /**
         * @desc Rebuild IPv6 HTTP message from fragmented Ipv4 packets
         * @param p_ipv4Packet
         * @param p_fragmentationContexts
         * @param v_ipv6MessageCounter
         * @return e_success if an IPv6 HTTP message was successfuly rebuilt, e_error otherwise 
         * @verdict Unchanged
         * @remark We assume the fragment are received in the right order
         */
        function f_rebuildIpv6HttpMessages(in Ipv4Packet p_ipv4Packet, inout FragmentationContexts p_fragmentationContexts, inout UInt v_ipv6MessageCounter) return FncRetCode {
            var FncRetCode v_result := e_error;
            var integer v_identifier;
            var template (present) Ipv6Packet v_ipv6Packet;
            
            // Extract the Indentifier field
            v_identifier := oct2int(p_ipv4Packet.ipv4Hdr.identification);
            
            // Concatenate the payload
            if (not isbound(p_fragmentationContexts[v_identifier])) {
                p_fragmentationContexts[v_identifier].identifier := p_ipv4Packet.ipv4Hdr.identification;
                p_fragmentationContexts[v_identifier].underConstructionMessage := ''O;
                p_fragmentationContexts[v_identifier].ipv6Packet := omit;
            }
            // TODO Add support of unordered framents
            p_fragmentationContexts[v_identifier].underConstructionMessage := p_fragmentationContexts[v_identifier].underConstructionMessage & p_ipv4Packet.ipv4Payload.rawPacket;
            
            // In case of last fragment, decode the IPv6 message
            if (p_ipv4Packet.ipv4Hdr.moreFragsFlag == c_moreFragsFlag0) { // This is the last fragment
                // Decode the IPv6 message
                if (decvalue(oct2bit(p_fragmentationContexts[v_identifier].underConstructionMessage), v_ipv6Packet) == 0) {
                    p_fragmentationContexts[v_identifier].ipv6Packet := valueof(v_ipv6Packet);
                    v_ipv6MessageCounter := v_ipv6MessageCounter + 1;
                    
                    v_result := e_success;
                } // else, nothing to do
            }
            
            return v_result;
        } // End of function f_rebuildIpv6HttpMessages
        
    } // End of group auxiliary
    
} // End of module Ats6RD_Functions
 No newline at end of file
+50 −19
Original line number Diff line number Diff line
@@ -6,25 +6,13 @@
module Ats6RD_Interfaces {
    
    // LibCommon
    import from LibCommon_DataStrings {
        const c_16ZeroBytes
    };
    import from LibCommon_Sync {
        type SelfSyncComp
    };
    import from LibCommon_Time {
        modulepar PX_TAC, PX_TNOAC, PX_TWAIT
    };
    import from LibCommon_DataStrings all;
    import from LibCommon_Sync all;
    import from LibCommon_Time all;
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {
        type Ipv6Address 
    };
    import from LibIpv6_Interface_TypesAndValues {
        type 
            LibIpv6Node,
            Ipv4Port, Ipv6Port 
    };
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    import from LibIpv6_Interface_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_Interfaces {
@@ -34,6 +22,9 @@ module Ats6RD_Interfaces {
            UtComponent
    };
    
    // Ats6RD
    import from Ats6RD_TypesAndValues all;
    
    group mtcDesc {
        
        type component SixRDComponent extends UtComponent, LibIpv6Node {
@@ -51,16 +42,34 @@ module Ats6RD_Interfaces {
            var HostComponents vc_hostComponents := null;
            /** DHCPv4 component reference */
            var DHCPv4Component vc_dhcpv4Component := null;
            /** Host HTTPv4 component reference */
            var HostHTTPv4Components vc_hostHttpv4Components := null;
            /** Host HTTPv6 component reference */
            var HostHTTPv6Components vc_hostHttpv6Components := null;
        } // End of component SixRDComponent
        
        type record of HostComponent HostComponents;
        
        type record of HostHTTPv4Component HostHTTPv4Components;
        
        type record of HostHTTPv6Component HostHTTPv6Components;
        
    } // End of group mtcDesc
    
    group componentDesc {
        
        group componentPorts {
            
            type port HttpV4Port mixed {
                out s_httpv4SendData; //initiate actions
                in Ipv4Packet; //monitors traffic
            }
            
            type port HttpV6Port mixed {
                out s_httpv6SendData; //initiate actions
                in Ipv6Packet; //monitors traffic
            }
            
            type component HostComponent extends UtComponent, SelfSyncComp {
                /** IPv6 message port */
                port Ipv6Port ipv6Port;
@@ -87,6 +96,28 @@ module Ats6RD_Interfaces {
                timer tc_twait:= PX_TWAIT;
            } // End of component BRComponent
            
            type component HostHTTPv4Component extends UtComponent, SelfSyncComp {
                /** HTTP message port */
                port HttpV4Port 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 meceige */
                timer tc_twait:= PX_TWAIT;
            } // End of component HostHTTPv4Component
            
            type component HostHTTPv6Component extends UtComponent, SelfSyncComp {
                /** HTTP message port */
                port HttpV6Port 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 meceige */
                timer tc_twait:= PX_TWAIT;
            } // End of component HostHTTPv6Component
            
        } // End of group componentPorts
        
    } // End of group componentDesc
+4 −4
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@
module Ats6RD_Pics {
    
    /**
     * @desc The host acts as a B4 device itself
     * @desc The SUT is the CPE equipment
     */
    modulepar boolean PICS_HOST_IS_B4 := false;
    modulepar boolean PICS_ROLE_IS_CPE := false;
    
    /**
     * @desc The host acts as a customer device
     * @desc The SUT is the BR equipment
     */
    modulepar boolean PICS_HOST_IS_B4_DEVICES := false;
    modulepar boolean PICS_ROLE_IS_BR := false;
    
} // End of module Ats6RD_Pics
 No newline at end of file
+45 −15
Original line number Diff line number Diff line
@@ -11,37 +11,67 @@ module Ats6RD_Pixits {
    };
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {
        type Ipv4Address, Ipv6Address 
    };
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    
    // Ats6RD
    import from Ats6RD_TypesAndValues all;
    
    /**
     * @desc Indicates the IPv6 address of the B4 equipment
     * @desc Indicates the IPv4 address of the CPE equipment
     */
    modulepar Ipv4Address PX_CPE_IPv4_ADDRESS := c_4ZeroBytes;
    
    /**
     * @desc Indicates the IPv6 address of the CPE equipment
     */
    modulepar Ipv6Address PX_CPE_IPv6_ADDRESS := c_16ZeroBytes;
    
    /**
     * @desc Indicates the IPv4 address of the CPE equipment
     */
    modulepar Ipv6Address PX_B4_ADDRESS := c_16ZeroBytes;
    modulepar Ipv4Address PX_CPE_ADDRESS := c_4ZeroBytes; // Such as 10.1.1.1
    
    /**
     * @desc Indicates the IPv6 address of the RR equipment
     * @desc Indicates the IPv4 address of the BR equipment
     */
    modulepar Ipv4Address PX_BR_GW_ADDRESS := c_4ZeroBytes;
    modulepar Ipv4Address PX_BR_GW_ADDRESS := c_4ZeroBytes; // Such as 10.1.3.1
    
    /**
     * @desc Defines a list of IPv6 host services
     * @desc Defines a list of IPv6 host services with a segment size greater than the IUT MSS value
     * @see TC_6RD_CPE_MSSC_BV_001
     */
    modulepar HostV6Descriptions PX_HOST_V6_LIST_B4 := {
    modulepar HostV6Descriptions PX_MSSC_HOST_V6_LIST_CPE := {
        {
            srcAddress  := c_16ZeroBytes, // Containing source address indicating a private IPv4 address
            srcAddress  := c_16ZeroBytes, // Containing source address indicating a private IPv6 address
            srcPort     := 3372,
            dstAddress  := c_16ZeroBytes, // Containing destination address indicating a public IPv4 address from multiple hosts
            dstPort     := 80,
            dstAddress  := c_16ZeroBytes, // Containing destination address indicating a public IPv6 address from multiple hosts
            dstPort     := 3373,
            payload     := {
                rawPayload := 'CAFEDECA'O // TODO To be enhanced
                rawPayload := 'CAFEDECA'O // TODO With a segment size greater than the IUT MSS value
            } 
        } // Host #0
        // TODO Could be extended 
    } // End of modulepar PX_HOST_V6_LIST_B4
    } // End of modulepar PX_MSSC_HOST_V6_LIST_CPE
    
    /**
     * @desc Defines a list of IPv6 HTTP services
     */
    modulepar HttpV6Descriptions PX_HTTP_V6_LIST_CPE := {
        {
            srcAddress  := c_16ZeroBytes, // Containing the HTTP source address
            dstAddress  := c_16ZeroBytes // Containing WEB server address
        } // Host #0
        // TODO Could be extended 
    } // End of modulepar PX_HTTP_V6_LIST_CPE
    
    /**
     * @desc The host address
     */
    modulepar Ipv6Address PX_HTTP_CLIENT_IPV6_ADDRESS :=  c_16ZeroBytes; 
    
    /**
     * @desc The HTTP server address
     */
    modulepar Ipv6Address PX_WEB_SERVER_IPv6 :=  c_16ZeroBytes; 
    
} // End of module Ats6RD_Pixits
 No newline at end of file
+18 −0
Original line number Diff line number Diff line
@@ -14,8 +14,14 @@ module Ats6RD_Templates {
    import from LibIpv6_Interface_Templates all;
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    
    // Ats6RD
    import from Ats6RD_Pixits all;
    
    group ipPackets {
        
        /**
         *  @param  p_src Binary IPv4 address associated with the
         *          test component.
@@ -33,5 +39,17 @@ module Ats6RD_Templates {
            }
        } // End of template mw_ipv4Packet_tcp
        
        // TODO To be removed
//        template (present) Ipv4Packet mw_ipv4Packet_http_fragment(
//            UInt8 p_protocol,
//            template (present) Ipv4Address p_src,
//            template (present) Ipv4Address p_dst
//        ) modifies mw_ipv4Hdr_protocol_fragment := {
//            ipv4Payload := {
//                rawPacket := ? // TODO To be refined
//            }
//        } // End of template mw_ipv4Packet_http
        
    } // End of group ipPackets 
    
} // End of module Ats6RD_Templates
 No newline at end of file
Loading