Commit 62ccd23b authored by tepelmann's avatar tepelmann
Browse files

Added initial version of address withdrawal test cases.

Extracted 1:n NAT64 mapping for re-usage.
Refined UT handling.
parent 32721d17
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ module AtsCommon_Functions {
    
    // AtsCommon
    import from AtsCommon_Interfaces all;
    
    import from AtsCommon_Templates all;
    
    group uninitialiseFunctions {
        
@@ -85,6 +85,37 @@ module AtsCommon_Functions {
        
    } // End of group globalSteps
    
    group utFunctions {
        
        function f_utSendCommand(charstring p_command, boolean p_awaitResult := false) runs on UtComponent 
        return FncRetCode {
            var FncRetCode v_result := e_success;
            
            utPort.send(m_utCommand(p_command));
            if (p_awaitResult) {
                tc_ut_ac.start;
                alt {
                    [] utPort.receive(m_utResOk) {
                        tc_ut_ac.stop;
                    }
                    [] utPort.receive(m_utResNotOk) {
                        tc_ut_ac.stop;
                        v_result := e_error;
                    }
                    [] utPort.receive {
                        tc_ut_ac.stop;
                        v_result := e_error;
                    }
                    [] tc_ut_ac.timeout {
                        v_result := e_timeout;
                    }
                }
            }
            return v_result;
        } // End of function f_utSendCommand
        
    } // End of group utFunctions
    
    group auxiliary {
        
        function f_getDHCPv6RetrievedIpv6Address(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.ipv6Address p_ipv6Address)
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ module AtsCommon_Interfaces {
        type component UtComponent {
            /** Upper tester port. Used for requesting actions at IUT side */
            port UtPort   utPort;
            
            /** Timer used for expected received message */
            timer tc_ut_ac:= PX_TAC;
        } // End of type TestAdapter
        
        /**
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ module AtsCommon_Templates {
    import from LibIpv6_Rfc6334Dhcp_TypesAndValues all;
    
    // AtsCommon
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from AtsCommon_Dhcpv4_CommonRfcs_TypesAndValues all;
    import from AtsCommon_Dhcpv4_Rfc1533_TypesAndValues all;
@@ -447,4 +448,14 @@ module AtsCommon_Templates {
        
    } // End of group dhcpv6Templates
    
    group utTemplates {
        
        template UtCmd m_utCommand(template (value) charstring p_command) := p_command;
        
        template UtResult m_utResOk := true;
        
        template UtResult m_utResNotOk := false;
        
    } // End of group utTemplates
    
} // End of module AtsCommon_Templates
+14 −0
Original line number Diff line number Diff line
@@ -88,6 +88,20 @@
        
    } // End of group ipv4Hosts
    
    group ut {
        
        /**
         * @desc The Upper Tester command.
         */
        type charstring UtCmd;
        
        /**
         * @desc The Upper Tester result.
         */
        type boolean UtResult;
        
    } // End of group ut
    
    group auxiliary {
        
        type set of integer IntList;
+61 −6
Original line number Diff line number Diff line
@@ -5,11 +5,8 @@
 */
module AtsNat64_Functions {
    
    // AtsCommon
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from AtsCommon_Interfaces all;

    // LibCommon
    import from LibIpv6_Interface_TypesAndValues all;
    import from LibCommon_DataStrings {const c_16ZeroBytes;}
    import from LibCommon_Sync {
        function f_connect4SelfOrClientSync, f_selfOrClientSyncAndVerdict;
@@ -19,8 +16,15 @@ module AtsNat64_Functions {
    import from LibCommon_VerdictControl all;
    import from LibIpv6_CommonRfcs_TypesAndValues all;
    
    // Nat64
    import from AtsNat64_Interfaces {type Nat64Component, LSNComponent, HostComponent;}
    // AtsCommon
    import from AtsCommon_Tcp_Rfc793_TypesAndValues all;
    import from AtsCommon_Interfaces all;
    import from AtsCommon_TypesAndValues all;
    import from AtsCommon_Templates all;
    
    // AtsNat64
    import from AtsNat64_Pixits all;
    import from AtsNat64_Interfaces all;
    
    group initialiseFunctions {
        
@@ -69,6 +73,7 @@ module AtsNat64_Functions {
            
            // Map ports
            map(self:ipv4Port, system:ipv4Port) param (p_ip4Address);
            map(self:utPort, system:utPort);
            
        } // End of function f_preamble_aftr
        
@@ -83,6 +88,7 @@ module AtsNat64_Functions {
            
            // Map ports
            map(self:ipv6Port, system:ipPort);
            map(self:utPort, system:utPort);
            
        } // End of function f_preamble_host
        
@@ -110,6 +116,55 @@ module AtsNat64_Functions {
        
    } // End of group postambleFunctions
    
    group commonfunctions {
        
        function f_lsn_check_1_to_n_NAT_mapping(Ipv4Address p_localAddress, integer p_hostNum) runs on LSNComponent
        return FncRetCode {
            var FncRetCode v_result := e_success;
            var IntList v_portList;
            var Ipv4Packet v_ipv4Packet;
            var TcpPacket v_tcpPacket;
            var integer v_receivedNo := 0;
            
            tc_ac.start;
            alt {
                [] ipv4Port.receive(
                  mw_ipv4Packet_dummy(
                      PX_NAT64_MAPPING_TABLE_1_TO_N.ip4Address,
                      p_localAddress,
                      ?
                  )
                ) -> value v_ipv4Packet {
                    if (e_success == f_decTcpPacket(v_ipv4Packet.ipv4Payload.rawPacket, v_tcpPacket)) {
                        if (match(v_portList, superset(v_tcpPacket.srcPort))) {
                            log("*** " & __SCOPE__ & ": IPv4 packet was forwarded with already used source port. ***");
                        }
                        else {
                            v_portList[lengthof(v_portList)] := v_tcpPacket.srcPort;
                            v_receivedNo := v_receivedNo + 1;
                            if (v_receivedNo == p_hostNum) {
                              tc_ac.start;
                              repeat;
                            }
                        }
                    }
                    else {
                        v_result := e_error;
                    }
                    tc_ac.stop;
                    log("*** " & __SCOPE__ & ": IPv4 packets were correctly forwarded. ***");
                }
                [] tc_ac.timeout {
                    v_result := e_timeout;
                    log("*** " & __SCOPE__ & ": Message was not received in time. ***");
                }
            } // End of 'altstep' statement
            
            return v_result;
        } // End of function f_lsn_check_1_to_n_NAT_mapping
        
    } // End of group commonFunctions
    
    group globalSteps {
        
        /**
Loading