Commit 07b4c6cf authored by garciay's avatar garciay
Browse files

Add DHCPv4 test case template

parent 6a9ddd9d
Loading
Loading
Loading
Loading
+168 −0
Original line number Diff line number Diff line
@@ -6,5 +6,173 @@
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;
    };
    
    // LibIpv6
    import from LibIpv6_Interface_Templates all;
    import from LibIpv6_Interface_TypesAndValues all;
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    import from LibIpv6_CommonRfcsDhcp_Functions {
        function f_sendDhcpv6Msg
    };
    
    // AtsCommon
    import from AtsCommon_Interfaces {
        type 
            TestAdapter, 
            DHCPv6Component, DNSComponent,
            InterCompDataMsg;
    };
    import from AtsCommon_Functions all;
    
    // 6RDLite
    import from Ats6RD_Interfaces {
        type 
            SixRDComponent, 
            BRComponent, HostComponent;
    };
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    
    group initialiseFunctions {
        
        /**
         * @desc Setup communication port
         * @verdict Unchanged
         */
        function f_cf01Up() runs on SixRDComponent {
            
            // Connect port
            if (vc_brComponent != null) { 
                connect(vc_brComponent:brPort, self:brPort);
            }
            if (vc_hostComponent != null) { 
                connect(vc_hostComponent:ipv6Port, self:ipv6HostPort); 
                connect(vc_hostComponent:ipv4Port, self:ipv4HostPort); 
            } 
            if (vc_dhcpv4Component != null) { 
                connect(vc_dhcpv4Component:dhcpv4Port, self:dhcpv4Port);
            } 
            
            // 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_cf01Up
        
    } // End of group initialiseFunctions
    
    group preambleFunctions {
        
        /**
         * @desc Preamble processing for BRComponent
         * @verdict Unchanged
         * @see BRComponent
         */
        function f_preamble_br() runs on BRComponent {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_aftr
        
        /**
         * @desc Preamble processing for HostComponent
         * @verdict Unchanged
         * @see HostComponent
         */
        function f_preamble_host() runs on HostComponent {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_host
        
    } // End of group preambleFunctions
    
    group postambleFunctions {
        
        /**
         * @desc Postamble processing for BRComponent
         * @verdict Unchanged
         * @see BRComponent
         */
        function f_postamble_br() runs on BRComponent {
            // Nothing to do
        } // End of function f_postamble_aftr
        
        /**
         * @desc Postamble processing for HostComponent
         * @verdict Unchanged
         * @see HostComponent
         */
        function f_postamble_host() runs on HostComponent {
            // Nothing to do
        } // End of function f_postamble_host
        
    } // End of group postambleFunctions
    
    group globalSteps {
        
        /**
         * @desc 
         * TODO enable functionality!
         */
        altstep a_default_MTC() runs on SixRDComponent {
            var Ipv6Packet v_ipv6Pkt;
            var Ipv4Packet v_ipv4Pkt;
            var DHCPv6Msg v_dhcpMsg;
            var DnsMsg v_dnsMsg;
            
//            [] 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);
            }
            [] 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);
            }
        } // End of altstep a_default_MTC 
        
    } // End of group globalSteps
    
} // End of module Ats6RD_Functions
 No newline at end of file
+56 −17
Original line number Diff line number Diff line
@@ -6,6 +6,15 @@
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
    };
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {
@@ -17,26 +26,30 @@ module Ats6RD_Interfaces {
            Ipv4Port, Ipv6Port 
    };
    
    group systemDesc {
        
        /**
         * @desc System interface description
         * @member ipv4Port IPv4 port to be mapped to the Test Adapter
         * @member ipPort IPv6 port to be mapped to the Test Adapter
         */
        type component TestAdapter {
            /** IPv4 port. Only UDP protocol is used */
            port Ipv4Port ipv4Port;
            /** IPv6 port. Only UDP protocol is used */
            port Ipv6Port ipPort;
        } // End of type TestAdapter
        
    } // End of component TestAdapter
    // AtsCommon
    import from AtsCommon_Interfaces {
        type 
            DHCPv4Port, DHCPv6Port,
            DHCPv4Component, DHCPv6Component
    };
    
    group mtcDesc {
        
        type component SixRDComponent extends LibIpv6Node {
            
            /** DHCPv4 port for DHCPv4Msg message exchanges */
            port DHCPv4Port dhcpv4Port;
            /** BR port */
            port Ipv4Port brPort;
            /** Host IPv6 port to simulate IPv6 client */
            port Ipv6Port ipv6HostPort;
            /** Host IPv4 port to simulate IPv4 client */
            port Ipv4Port ipv4HostPort;
            /** BR component reference */
            var BRComponent vc_brComponent := null;
            /** Host component reference */
            var HostComponent vc_hostComponent := null;
            /** DHCPv4 component reference */
            var DHCPv4Component vc_dhcpv4Component := null;
        } // End of component SixRDComponent
        
    } // End of group mtcDesc
@@ -45,6 +58,32 @@ module Ats6RD_Interfaces {
        
        group componentPorts {
        
            type component HostComponent extends SelfSyncComp {
                /** IPv6 message port */
                port Ipv6Port ipv6Port;
                /** IPv4 message port */
                port Ipv4Port ipv4Port;
                /** 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 HostComponent
        
            type component BRComponent extends SelfSyncComp {
                /** IPv6 message port */
                port Ipv6Port ipPort;
                /** IPv4 message port */
                port Ipv4Port brPort;
                /** 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 BRComponent
        
        } // End of group componentPorts
        
    } // End of group componentDesc
+132 −55
Original line number Diff line number Diff line
@@ -6,6 +6,8 @@
module Ats6RD_TestCases {
    
    // LibCommon
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    
    // Ats6RD
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues {
@@ -17,6 +19,22 @@ module Ats6RD_TestCases {
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    import from AtsCommon_Interfaces all;
    import from AtsCommon_Functions all;
    import from AtsCommon_Templates all;
    
    // Ats6RD
    import from Ats6RD_Pixits all;
    import from Ats6RD_Functions all;
    import from Ats6RD_Templates all;
    import from Ats6RD_Interfaces all;
    
    /**
     * @desc CPE
     * @reference ETSI TS xxx xxx-x V0.0.1 (2013-12) Clause 5.1
     */
    group cpeRole {
        
        /**
         * @desc Gateway/Prefix Assignment
@@ -49,7 +67,7 @@ module Ats6RD_TestCases {
                 * </pre>
                 * 
                 * @version 0.0.1
             * @reference [TS: 6.8.9.3] Feature: 6RD Configuration
                 * @reference ETSI TS 101 569-1 Clause 6.8.9.3 Feature: 6RD Configuration
                 * @see     ETSI TS xxx xxx-x V0.0.1.5a-draft (2014-01) TP/6RD/GWPA/VB/01
                 */
                testcase TC_6RD_GWPA_BV_001() runs on SixRDComponent system TestAdapter {
@@ -59,10 +77,16 @@ module Ats6RD_TestCases {
                    // Test control
                    
                    // Test component configuration
                    vc_dhcpv4Component := DHCPv4Component.create(c_COMP_DHCPv4);
                    f_cf01Up();
                    
                    
                    // Test adapter configuration
                    
                    // Start all components
                    vc_dhcpv4Component.start(f_TC_6RD_GWPA_BV_001_dhcpv4());
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
@@ -71,11 +95,54 @@ module Ats6RD_TestCases {
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_6RD_GWPA_BV_001
                
                group f_TC_6RD_GWPA_BV_001 {
                    
                    /**
                     * @desc Implement DHCPv6 client/server protocol
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_6RD_GWPA_BV_001_dhcpv4() runs on DHCPv4Component {
                        
                        // Local variables
//                        var DHCPv4Msg v_dhcpMsg;
                         
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_dhcpv6();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT sends a DHCPv6 Request to DHCPv6 Server
                        tc_ac.start;
                        alt {
//                            [] dhcpv4Port.receive(
//                                mdw_dhcpv4_Request_options(                    // Await Solicit DHCPv6 Request to DHCPv6 Server
//                                    mw_dhcpv4_options_optionRequest(           //     containing the Option field
//                                        mdw_dhcpv4_optionRequest_aftrName      //         indicating the AFTR-name DHCPv6 Option (value 64)
//                            ))) { 
//                                tc_ac.stop;
//                                // Nothing to do
//                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
//                                log("*** " & __SCOPE__ & ": PASS: Solicit DHCPv6 Request with AFTR-name option set was sent by the IUT. ***");
//                            }
                            [] 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_dhcpv6();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_6RD_GWPA_BV_001_dhcpv4
                    
                } // End of group f_TC_6RD_GWPA_BV_001 
                
            } // End of group validBehaviour
@@ -86,4 +153,14 @@ module Ats6RD_TestCases {
            
        } // End of group gatewayPrefixAssignment 
        
    } // End of group cpeRole 
    
    /**
     * @desc BR
     * @reference ETSI TS xxx xxx-x V0.0.1 (2013-12) Clause 5.2
     */
    group brRole {
        
    } // End of group brRole 
    
} // End of Ats6RD_TestCases
 No newline at end of file