Commit 5020c9ff authored by tepelmann's avatar tepelmann
Browse files

Restructured DHCPv6 options.

Implemented getter functions.
parent 189f6bc2
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -310,11 +310,21 @@ module AtsDSLite_Functions {
        function f_getDHCPv6RetrievedIpv6Address(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.ipv6Address p_ipv6Address)
        return FncRetCode {
            var FncRetCode v_result := e_error;
            var integer i;
            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) {
                //TODO
                if (p_dhcpv6Msg.options[i].optionCode == e_OPTION_IA_NA) {
                    var DHCPv6Options v_ia_na_options :=  p_dhcpv6Msg.options[i].optionData.ia_na.iA_NA_options;
                    v_optionsLength2 := lengthof(v_ia_na_options);
                    for (j:=0; j<v_optionsLength2; j:=j + 1) {
                        if (v_ia_na_options[j].optionCode == e_OPTION_IAADDR) {
                            p_ipv6Address := v_ia_na_options[j].optionData.ia_address.ipv6Address;
                            return e_success;
                        }
                    }
                }
            }
            
            return v_result;
@@ -322,15 +332,17 @@ module AtsDSLite_Functions {
        
        function f_getDHCPv6RetrievedAftrName(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.aftrName p_aftrName)
        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) {
                //TODO
                if (p_dhcpv6Msg.options[i].optionCode == e_OPTION_AFTR_NAME) {
                    p_aftrName := p_dhcpv6Msg.options[i].optionData.aftrName.tunnelEndpointName;
                    return e_success;
                }
            }
            
            return v_result;
            return e_error;
        }
        
        function f_getDHCPv6RetrievedDomainSearchList(DHCPv6Msg p_dhcpv6Msg, out InterCompDataMsg.domainSearchList p_dsl)
@@ -340,7 +352,10 @@ module AtsDSLite_Functions {
            var integer v_optionsLength := lengthof(p_dhcpv6Msg.options);
            
            for (i:=0; i<v_optionsLength; i:=i + 1) {
                //TODO
                if (p_dhcpv6Msg.options[i].optionCode == e_OPTION_DOMAIN_LIST) {
                    p_dsl := p_dhcpv6Msg.options[i].optionData.domainSearchList.searchList;
                    return e_success;
                }
            }
            
            return v_result;
+45 −22
Original line number Diff line number Diff line
@@ -78,36 +78,50 @@ module AtsDSLite_Templates {
             * @reference http://tools.ietf.org/html/rfc3315#section-22
             */  
            template (present) DHCPv6Options mw_dhcpv6_options_dummy := {
                {
                    ia_na           := ?
                },
                {
                    optionRequest   := ?
                },
                {
                    aftrName        := ?
                },
                mw_dhcpv6_ia_na_dummy,
                mw_dhcpv6_optionRequest_dummy,
                mw_dhcpv6_aftrName_dummy,
                *
            } // End of template mw_dhcpv6_options_dummy
            
            /**
             * @desc Genercic receive DHCPv6 IA_NA option
             * @reference http://tools.ietf.org/html/rfc3315#section-22.4
             */  
            template (present) DHCPv6Option mw_dhcpv6_ia_na_dummy := {
                optionCode              := e_OPTION_IA_NA,
                optionLen               := ?,
                optionData          := {
                    ia_na := ?
                }
            } // End of template mw_dhcpv6_optionRequestOption_dummy
            
            /**
             * @desc Genercic receive DHCPv6 ORO option
             * @reference http://tools.ietf.org/html/rfc3315#section-22.7
             */  
            template (present) OptionRequestOption mw_dhcpv6_optionRequestOption_dummy := {
            template (present) DHCPv6Option mw_dhcpv6_optionRequest_dummy := {
                optionCode              := e_OPTION_ORO,
                optionLen               := ?,
                optionData          := {
                    optionRequest := {
                        requestedOptionCodes    := ?
                    }
                }
            } // End of template mw_dhcpv6_optionRequestOption_dummy
            
            /**
             * @desc Genercic receive DHCP AFTR-name option
             * @reference https://tools.ietf.org/html/rfc6334#section-3
             */  
            template (present) AFTRNameOption mw_dhcpv6_aftrName_dummy := {
            template (present) DHCPv6Option mw_dhcpv6_aftrName_dummy := {
                optionCode          := e_OPTION_AFTR_NAME,
                optionLen           := ?,
                optionData          := {
                    aftrName := {
                        tunnelEndpointName  := ?
                    }
                }
            } // End of template mw_dhcpv6_aftrName_dummy
            
        } // End of group dhcpv6OptionsDummyRecvTemplates 
@@ -144,22 +158,25 @@ module AtsDSLite_Templates {
             * @param p_optionRequest
             * @reference 
             */
            template (present) DHCPv6Options mdw_dhcpv6_options_optionRequest(
            template (present) DHCPv6Options mw_dhcpv6_options_optionRequest(
                                                                              in template (present) OptionRequestOption p_optionRequest
            ) := {
                {
                    optionCode  := e_OPTION_ORO,
                    optionLen   := ?,
                    optionData := {
                        optionRequest := p_optionRequest
                    }
                },
                *
            } // End of template mdw_dhcpv6_options_optionRequest
            } // End of template mw_dhcpv6_options_optionRequest
            
            /**
             * @desc Genercic receive DHCPv6 AFTR-name option
             */  
            template (present) OptionRequestOption mdw_dhcpv6_optionRequestOption_aftrName 
            modifies mw_dhcpv6_optionRequestOption_dummy := {
            template (present) OptionRequestOption mw_dhcpv6_optionRequest_aftrName := {
                requestedOptionCodes    := superset(e_OPTION_AFTR_NAME)
            } // End of template mw_dhcpv6_optionRequestOption_aftrName
            } // End of template mw_dhcpv6_optionRequest_aftrName
            
            /**
             * @desc Receive template including at least the DHCPv6 options 'e_OPTION_AFTR_NAME' and 'OPTION_DOMAIN_LIST'
@@ -170,13 +187,19 @@ module AtsDSLite_Templates {
                                                                      in template (present) DomainSearchListOption p_domainSearchListOption
            ) := {
                {
                    aftrName        := ?
                    optionCode  := e_OPTION_AFTR_NAME,
                    optionLen   := ?,
                    optionData  := ?
                },
                {
                    optionCode  := e_OPTION_DOMAIN_LIST,
                    optionLen   := ?,
                    optionData := {
                        domainSearchList := p_domainSearchListOption
                    }
                },
                *
            } // End of template mdw_dhcpv6_options_optionRequest
            } // End of template mw_dhcpv6_aftr_dsl_options
            
        } // End of group dhcpv6OptionsRecvTemplates
        
+4 −4
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ module AtsDSLite_TestCases {
                        alt {
                            [] dhcpv6Port.receive(
                                mdw_dhcpv6_Request_options(                    // Await Sollicit DHCPv6 Request to DHCPv6 Server
                                    mdw_dhcpv6_options_optionRequest(           //     containing the Option field
                                        mdw_dhcpv6_optionRequestOption_aftrName  //         indicating the AFTR-name DHCPv6 Option (value 64)
                                    mw_dhcpv6_options_optionRequest(           //     containing the Option field
                                        mw_dhcpv6_optionRequest_aftrName  //         indicating the AFTR-name DHCPv6 Option (value 64)
                            ))) { 
                                tc_ac.stop;
                                // Nothing to do
@@ -212,8 +212,8 @@ module AtsDSLite_TestCases {
                        alt {
                            [] dhcpv6Port.receive(
                                mdw_dhcpv6_Request_options(                    // Await DHCPv6 Request to DHCPv6 Server
                                    mdw_dhcpv6_options_optionRequest(           //     containing the Option field
                                        mdw_dhcpv6_optionRequestOption_aftrName  //         indicating the AFTR-name DHCPv6 Option (value 64)
                                    mw_dhcpv6_options_optionRequest(           //     containing the Option field
                                        mw_dhcpv6_optionRequest_aftrName  //         indicating the AFTR-name DHCPv6 Option (value 64)
                            ))) { 
                                tc_ac.stop;
                                // Nothing to do