Commit 0f815911 authored by tepelmann's avatar tepelmann
Browse files

First initial version of TC_464XLAT_CLAT_B4_BF_BV_001.

Extracted DHCPv6 definitions to be re-used in multiple sub folders.
parent 0e42261f
Loading
Loading
Loading
Loading
+130 −0
Original line number Diff line number Diff line
@@ -6,5 +6,135 @@
module Ats464XLat_Functions {
    
    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    
    // LibIpv6
    import from LibIpv6_Interface_TypesAndValues all;
    import from LibIpv6_Interface_Templates all;
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues all;
    
    // Ats464XLat
    import from Ats464XLat_Interfaces all;
    
    group initialiseFunctions {
        
        /**
         * @desc Setup communication port
         * @verdict Unchanged
         * TODO change name!
         */
        function f_cf01Up_xx() runs on FourSixFourXLatComponent {
            
            // Connect port
            if (vc_dhcpv6Component != null) { 
                connect(vc_dhcpv6Component:dhcpv6Port, self:dhcpv6Port);
            } 
            
            // 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_xx
        
    } // End of group initialiseFunctions
    
    group globalSteps {
        
        /**
         * @desc 
         * TODO enable functionality!
         */
        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);
                                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);
            }
            [] 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 Ats464XLat_Functions
 No newline at end of file
+8 −24
Original line number Diff line number Diff line
@@ -8,35 +8,19 @@ module Ats464XLat_Interfaces {
    // LibCommon
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {
        type Ipv6Address 
    };
    import from LibIpv6_Interface_TypesAndValues {
        type 
            LibIpv6Node,
            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
    import from LibIpv6_Interface_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_Interfaces all;
    
    } // End of component TestAdapter
    
    group mtcDesc {
        
        type component FourSixFourXLatComponent extends LibIpv6Node {
            
            /** DHCPv6 port for DHCPv6Msg message exchanges */
            port DHCPv6Port dhcpv6Port;
            /** DHCPv6 component reference */
            var DHCPv6Component vc_dhcpv6Component := null;
        } // End of component FourSixFourXLatComponent
        
    } // End of group mtcDesc
+57 −5
Original line number Diff line number Diff line
/*
/**
 *  @author     STF 440
 *  @version    $Id$
 *  @desc       This module defines the ATS interface
@@ -6,17 +6,21 @@
module Ats464XLat_TestCases {
    
    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    
    // LibIPv6
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    
    // Ats464XLat
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues {
        type DnsMsg
    };
    import from Ats464XLat_Functions all;
    import from Ats464XLat_Templates all;
    import from Ats464XLat_Interfaces all;
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_Interfaces all;
    import from AtsCommon_Functions all;
    import from AtsCommon_Templates all;
    
    
    /**
@@ -65,10 +69,15 @@ module Ats464XLat_TestCases {
                    // Test control
                    
                    // Test component configuration
                    vc_dhcpv6Component := DHCPv6Component.create(c_COMP_DHCP);
                    f_cf01Up_xx();
                    
                    // Test adapter configuration
                    
                    // Start all components
                    vc_dhcpv6Component.start(f_TC_464XLAT_CLAT_B4_BF_BV_001_dhcpv6());
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
@@ -77,11 +86,54 @@ module Ats464XLat_TestCases {
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    // Postamble
                    f_down();
                    
                } // End of testcase TC_464XLAT_CLAT_B4_BF_BV_001
                
                group f_TC_464XLAT_CLAT_B4_BF_BV_001 {
                    
                    /**
                     * @desc Implement DHCPv6 client/server protocol
                     * @verdict 'pass' on success, 'inconc' on 'timeout', fail otherwise
                     */
                    function f_TC_464XLAT_CLAT_B4_BF_BV_001_dhcpv6() runs on DHCPv6Component {
                        
                        // Local variables
                        var DHCPv6Msg 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 {
                            [] dhcpv6Port.receive(
                                mdw_dhcpv6_Request_options(                    // Await Sollicit DHCPv6 Request to DHCPv6 Server
                                    mw_dhcpv6_options_optionRequest(           //     containing the Option field
                                        ?
                            ))) { 
                                tc_ac.stop;
                                // Nothing to do
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                log("*** " & __SCOPE__ & ": PASS: Solicit DHCPv6 Request 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_464XLAT_CLAT_B4_BF_BV_001_dhcpv6
                    
                } // End of group f_TC_464XLAT_CLAT_B4_BF_BV_001 
                
            } // End of group validBehaviour
+127 −0
Original line number Diff line number Diff line
/**
 *  @author     STF 440
 *  @version    $Id$
 *  @desc       This module defines the ATS interface
 */
module AtsCommon_Functions {
    
    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    
    // LibIpv6
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_Interfaces all;
    
    
    group uninitialiseFunctions {
        
        /**
         * @desc Shutdown communication port
         * @verdict Unchanged
         */
        function f_down() {
            // Unmap all ports
            unmap(all component: all port);
            // Stop components
            all component.stop;
            // Wait for all components terminated
            all component.done;
            // Disconnect all ports
            disconnect(all component: all port);
            // De-activation
            deactivate;
        } // End of function f_down
        
    } // End of group uninitialiseFunctions
    
    group preambleFunctions {
        
        /**
         * @desc Preamble processing for DHCPv6Component
         * @verdict Unchanged
         * @see DHCPv6Component
         */
        function f_preamble_dhcpv6() runs on DHCPv6Component {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            activate(a_dhcpv6Default());
            
        } // End of function f_preamble_dhcpv6
        
    } // End of group preambleFunctions
    
    group postambleFunctions {
        
        /**
         * @desc Postamble processing for DHCPv6Component
         * @verdict Unchanged
         * @see DHCPv6Component
         */
        function f_postamble_dhcpv6() runs on DHCPv6Component {
            // Nothing to do
        } // End of function f_postamble_dhcpv6
        
    } // End of group postambleFunctions
        
    group globalSteps {
        
        altstep a_dhcpv6Default() runs on DHCPv6Component {
            [] dhcpv6Port.receive(DHCPv6Msg:?) { // Ignore these DHCPv6 messages
                if (tc_ac.running) {
                    tc_ac.stop;
                    tc_ac.start;
                }
                repeat;
            }
        } // End of altstep a_dhcpv6Default
        
    } // End of group globalSteps
    
    group auxiliary {
        
        function f_getDHCPv6RetrievedIpv6Address(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.ipv6Address p_ipv6Address)
        return FncRetCode {
            var FncRetCode v_result := e_error;
            var integer i, j;
            var integer v_optionsLength := lengthof(p_dhcpv6Msg.options);
            var integer v_optionsLength2;
            
            for (i:=0; i<v_optionsLength; i:=i + 1) {
                if (ischosen(p_dhcpv6Msg.options[i].ia_na)) {
                    var DHCPv6Options v_ia_na_options :=  p_dhcpv6Msg.options[i].ia_na.iA_NA_options;
                    v_optionsLength2 := lengthof(v_ia_na_options);
                    for (j:=0; j<v_optionsLength2; j:=j + 1) {
                        if (ischosen(v_ia_na_options[j].ia_address)) {
                            p_ipv6Address := v_ia_na_options[j].ia_address.ipv6Address;
                            return e_success;
                        }
                    }
                }
            }
            
            return v_result;
        }
        
        function f_getDHCPv6RetrievedDomainSearchList(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.domainSearchList p_dsl)
        return FncRetCode {
            var FncRetCode v_result := e_error;
            var integer i;
            var integer v_optionsLength := lengthof(p_dhcpv6Msg.options);
            
            for (i:=0; i<v_optionsLength; i:=i + 1) {
                if (ischosen(p_dhcpv6Msg.options[i].domainSearchList)) {
                    p_dsl := p_dhcpv6Msg.options[i].domainSearchList.searchList;
                    return e_success;
                }
            }
            
            return v_result;
        }
        
    } // End of group auxiliary
    
} // End of module AtsCommon_Functions
+135 −0
Original line number Diff line number Diff line
/**
 *  @author     STF 440
 *  @version    $Id$
 *  @desc       This module defines common ATS interfaces
 */
module AtsCommon_Interfaces {
    
    // LibCommon
    import from LibCommon_Sync {
        type SelfSyncComp
    };
    import from LibCommon_Time {
        modulepar PX_TAC, PX_TNOAC, PX_TWAIT
    };
    
    // LibIPv6
    import from LibIpv6_CommonRfcs_TypesAndValues {
        type Ipv6Address 
    };
    import from LibIpv6_Interface_TypesAndValues {
        type 
            LibIpv6Node,
            Ipv4Port, Ipv6Port 
    };
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues {
        type 
            DHCPv6Msg, DomainName, DomainNameList 
    };
    import from LibIpv6_Rfc6334Dhcp_TypesAndValues {
        type AFTRNameOption
    };
    
    // DS-Lite
    import from AtsCommon_DNS_CommonRfcs_TypesAndValues {
        type DnsMsg
    };
    
    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
    
    group componentDesc {
        
        group componentPorts {
            
            /**
             * @desc DHCPv6 messages port
             */
            type port DHCPv6Port message {
                inout DHCPv6Msg
            } // End of port DHCPv6Port
            
            /**
             * @desc DNS messages port
             */
            type port DNSPort message {
                inout DnsMsg
            } // End of port DNSPort
            
            /**
             * @desc Port for inter-component data exchanges
             */
            type port InterCompDataPort message {
                inout InterCompDataMsg
            } // End of port InterCompDataPort
            
            /**
             * @desc Message description for inter-component data exchanges
             * @member vc_aftrIPv6Address The AFTR IPv6 address
             * @member vc_aftrNameOption The AFTR-name option
             * @member vc_dnsIPv6AddressThe DNS IPv6 address
             */
            type record InterCompDataMsg {
                Ipv6Address     ipv6Address,
                DomainName      aftrName,
                DomainNameList  domainSearchList
            } // End of type InterCompDataMsg
            
        } // End of group componentPorts
        
        /**
         * @desc 
         * @member dhcpv6Port
         * @member tc_ac
         * @member tc_noac
         * @member tc_wait
         */
        type component DHCPv6Component extends SelfSyncComp {
            /** DHCPv6 message port */
            port DHCPv6Port dhcpv6Port;
            /** Inter-component communication port */
            port InterCompDataPort dataPort;
            /** 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_wait:= PX_TWAIT;
        } // End of component DHCPv6Component
        
        /**
         * @desc 
         * @member dnsPort
         * @member tc_ac
         * @member tc_noac
         * @member tc_twait
         */
        type component DNSComponent extends SelfSyncComp {
            /** IPv4 message port */
            port DNSPort dnsPort;
            /** Inter-component communication port */
            port InterCompDataPort dataPort;
            /** 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 DNSComponent
        
    } // End of group componentDesc
    
} // End of module AtsCommon_Interfaces
 No newline at end of file
Loading