Commit 9d5dbd78 authored by Bostjan Pintar's avatar Bostjan Pintar
Browse files
parents 7308eae1 ff6e9ca7
Loading
Loading
Loading
Loading
Compare 11702720 to 2ca6880f
Original line number Diff line number Diff line
Subproject commit 11702720b3309494f91f3855a7b08d510607cddb
Subproject commit 2ca6880f0661b173515d9dc4d2cdc1ee94d51434
+141 −1
Original line number Diff line number Diff line
module DiameterShDh_PIXITS {
}
 No newline at end of file
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    
    // LibDiameter
    import from LibDiameter_Types_Base_AVPs all;
    import from LibDiameter_Types_ShDh_AVPs all;
    
    group Port_and_addresses{
        
        group TS_ShDh_Port_and_addresses{
            
            /** @desc    charstring, PIXIT item A-7/1
             * IP address of the test system
             */
            modulepar charstring PX_DIAMETER_SH_ETS_IPADDR := "1.1.1.10";
            
            /** @desc    integer, PIXIT item A-7/2
             * Port number of the test system
             */
            modulepar integer PX_DIAMETER_SH_ETS_PORT := 3868;
            
            /** @desc    charstring, PIXIT item A-7/3
             * IP address of the test system
             */
            modulepar charstring PX_DIAMETER_SH_ETS_IPADDR2 := "1.1.1.11";
            
            /** @desc    integer, PIXIT item A-7/4
             * Port number of the test system
             */
            modulepar integer PX_DIAMETER_SH_ETS_PORT2 := 3868;
            
        } // End of group TS_ShDh_Port_and_addresses
        
        group SUT_ShDh_Port_and_addresses{
            
            /** @desc    charstring,  PIXIT item A-8/1
             * IP address of the system under test
             */
            modulepar charstring PX_DIAMETER_SH_SUT_IPADDR := "1.1.2.10";
            
            /** @desc    integer, PIXIT item A-8/2
             * Port number of the system under test
             */
            modulepar integer PX_DIAMETER_SH_SUT_PORT := 3868;
            
        }//end group SUT_ShDh_Port_and_addresses{
        
    } // End of group Port_and_addresses
    
    group DiameterCommonShDhData{
       
       /** @desc    UTF8String, PIXIT item A-10/1
                     
       The Session-Id AVP (AVP Code 263) is of type UTF8String and is used
       to identify a specific session (see Section 8);  All messages
       pertaining to a specific session MUST include only one Session-Id AVP
       and the same value MUST be used throughout the life of a session;
       When present, the Session-Id SHOULD appear immediately following the
       Diameter Header (see Section 3);
    
                    Ref: RFC 3588 section 8-8
        */
        modulepar UTF8String PX_SessionID := "ctf.etsi.org;1317059245;52;21823490";
        
        /** @desc    charstring, PIXIT item A-10/2
                     
       The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and
       MUST be present in all Diameter messages;  This AVP identifies the
       endpoint that originated the Diameter message;  Relay agents MUST NOT
       modify this AVP;
       
       The value of the Origin-Host AVP is guaranteed to be unique within a
       single host;
    
                    Ref: RFC 3588 section 6-3.
                    NOTE: could be AF or PCRF role:
                        pcscf.example.com
                        pcrf.example.com
        */
        modulepar charstring PX_OriginHost := "origin.etsi.org";
        
        /** @desc    charstring, PIXIT item A-10/3
                     
       The Origin-Host AVP (AVP Code 264) is of type DiameterIdentity, and
       MUST be present in all Diameter messages;  This AVP identifies the
       endpoint that originated the Diameter message;  Relay agents MUST NOT
       modify this AVP;
       
       The value of the Origin-Host AVP is guaranteed to be unique within a
       single host;
    
                    Ref: RFC 3588 section 6-3.
                    NOTE: could be AF or PCRF role:
                        pcscf.example.com
                        pcrf.example.com
        */
        modulepar charstring PX_OriginHost_2nd := "origin2.etsi.org";
        
        /** @desc    charstring, PIXIT item A-10/4
                     
       The Origin-Realm AVP (AVP Code 296) is of type DiameterIdentity;
       This AVP contains the Realm of the originator of any Diameter message
       and MUST be present in all messages;
    
                    Ref: RFC 3588 section 6-4
        */
        modulepar charstring PX_OriginRealm := "etsi.org";
        
        /** @desc    charstring, PIXIT item A-10/5 
                     
       The Destination-Host AVP (AVP Code 293) is of type DiameterIdentity;
       This AVP MUST be present in all unsolicited agent initiated messages,
       MAY be present in request messages, and MUST NOT be present in Answer
       messages;
    
                    Ref: RFC 3588 section 6-5.
                    NOTE: could be AF or PCRF role:
                        pcscf.example.com
                        pcrf.example.com
        */
        modulepar charstring PX_DestinationHost := "destination.etsi.org";
        
        /** @desc    charstring, PIXIT item A-10/6 
                     
       The Destination-Realm AVP (AVP Code 283) is of type DiameterIdentity,
       and contains the realm the message is to be routed to;  The
       Destination-Realm AVP MUST NOT be present in Answer messages.
       Diameter Clients insert the realm portion of the User-Name AVP;
       Diameter servers initiating a request message use the value of the
       Origin-Realm AVP from a previous message received from the intended
       target host (unless it is known a priori);  When present, the
       Destination-Realm AVP is used to perform message routing decisions;
    
                    Ref: RFC 3588 section 6-6
        */
        modulepar charstring PX_DestinationRealm := "myalupcrf.etsi.org";
        
    } // End of group DiameterCommonShDhData
    
} // End of module DiameterShDh_PIXITS 
 No newline at end of file
+129 −1
Original line number Diff line number Diff line
module DiameterShDh_Steps {

    //LibCommon
    import from LibCommon_DataStrings {type Bit1, Bit4, Bit5, Bit8;}//all;
    import from LibCommon_BasicTypesAndValues {type UInt8;type UInt32;};//LibCommon
    import from LibCommon_Sync all ;
    import from LibCommon_VerdictControl all ;

    //LibDiameter
    import from LibDiameter_Types_RfRo_AVPs all;
    import from LibDiameter_Types_Base_AVPs all;
    import from LibDiameter_TypesAndValues all;
    import from LibDiameter_Templates all;
    import from LibDiameter_Steps  all;
    import from LibDiameter_PIXITS all;
    import from LibDiameter_Interface all;
    
    //DiameterRFRo
    import from DiameterShDh_PIXITS all;
    import from DiameterShDh_Templates all;
    import from DiameterShDh_TestConfiguration all;
    import from DiameterShDh_TestSystem all;

    group GlobalSteps {

        /*
        *  @desc    This is a test step that init global variables
        *  @param   
        */
        function f_DiameterSh_init()
        runs on DiameterShDh {

            //Defaults
            vc_default_diameter := activate (a_diameter_default());
            
            //Base LibDiameter init function if there will be any base initialisation
            f_Diameter_Init_Component();
            
            vc_ETS_address := PX_DIAMETER_SH_ETS_IPADDR;
            vc_ETS_port    := PX_DIAMETER_SH_ETS_PORT;
            vc_SUT_address := PX_DIAMETER_SH_SUT_IPADDR;
            vc_SUT_port    := PX_DIAMETER_SH_SUT_PORT;
            
            vc_sessionId := m_sessionId(PX_SessionID);
            
            vc_originHost := m_originHost(PX_OriginHost);
            vc_originRealm := m_originRealm(PX_OriginRealm); // realm of the originator (TS)
            
            vc_originHost_IUT := m_originHost(PX_DestinationHost);
            vc_originRealm_IUT := m_originRealm(PX_DestinationRealm); // realm of the originator (TS)
            
            vc_destinationHost := m_destinationHost(PX_DestinationHost);
            vc_destinationRealm := m_destinationRealm(PX_DestinationRealm);
            
            vc_destinationHost_IUT := m_destinationHost(PX_OriginHost);
            vc_destinationRealm_IUT := m_destinationRealm(PX_OriginRealm);
            
            vc_hostIPAddress := valueof(f_IPV4or6_String2Address (PX_DIAMETER_SH_ETS_IPADDR));
            
            vc_send_hopid:=hex2int('00000100'H);
            vc_send_endid:=hex2int('01000000'H);
            
        } // End of function f_DiameterSh_init
        
    } // End of group GlobalSteps 
    
    
    group Preambles {
        
        function f_preamble_Sh_HSS() runs on DiameterShDh
        {
            var default     v_def_diameter_catchEvent;
            if(PX_DIAM_LLP_ENABLED)
            {
                f_preambleServer();
            }
            
            f_DiameterSh_init();
            f_preambleDiameterBaseServer(c_applIdSh);
            v_def_diameter_catchEvent := activate (a_diameter_event());
            
            //delay before preamble is done - SIP starts with MESSAGE, INVITE request later
            f_wait(0.5);
        }
        
    } // End of group Preambles
    
    group Postambles {
        
        function f_postamble_Sh_HSS() runs on DiameterShDh
        {
            f_postambleDiameterBase();
            
            if(PX_DIAM_LLP_ENABLED)
            {
                f_postambleDisconnect();
            }
            
            // Deactivate defaults
            deactivate;
        }
        
    } // End of group Postambles
    
    group DefaultTestStep {
        
        altstep a_diameter_event() runs on DiameterShDh
        {

            [] DIAMP.receive (DIAMETER_MSG:{uDR_MSG := 
                mdw_uDR
            }) -> value vc_recvDiamMsgDefault
              {
                vc_recv_hopid:= vc_recvDiamMsgDefault.uDR_MSG.header.hopid;
                vc_recv_endid:= vc_recvDiamMsgDefault.uDR_MSG.header.endid;
                vc_accountingRecordNumber := vc_recvDiamMsgDefault.uDR_MSG.uDR_Body.accounting_Record_Number;

                /* TODO f_send_UDA(
                    md_uDA( 
                        vc_sessionId
                    ))
                );*/
                repeat;
              }
        }//end altstep a_diameter_event()
        
    }//end group DefaultTestStep
    
    
} // End of module DiameterShDh_Steps 
 No newline at end of file
+31 −0
Original line number Diff line number Diff line
@@ -37,6 +37,37 @@ module DiameterShDh_TCFunctions {
                 * @verdict pass on success, fail on error or inconc on timeout only 
                 */
                function f_TC_SH_HSS_M() runs on DiameterShDh { 
                    // Local variables
                    
                    // Preamble
                    f_preamble_Sh_HSS();
                    f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict()); 
                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");

                    f_send_UDR(
                        md_uDR(
                            vc_sessionId
                        )
                    );

                    /* TODO f_awaiting_UDA(
                        mdw_uDA( 
                            vc_sessionId,                       // containing a Session-ID AVP
                            mdw_udaBodyAvps(
                                mw_resultCode(                  // containing a Result-Code AVP
                                    DIAMETER_SUCCESS_E          //     indicating DIAMETER_SUCCESS
                                ),
                                vc_originHost_IUT,              // containing an Origin-Host AVP
                                vc_originRealm_IUT
                        ))
                    );*/

                    f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict()); 

                    f_postamble_Sh_HSS();
                    f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict()); 
                    log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                    
                } // End of function f_TC_SH_HSS_M
                
            }
+141 −1
Original line number Diff line number Diff line
module DiameterShDh_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibDiameter
    import from LibDiameter_Types_Base_AVPs all;
    import from LibDiameter_TypesAndValues all;
    import from LibDiameter_Types_Gx_AVPs all;
    import from LibDiameter_Types_Rx_AVPs all;
    import from LibDiameter_Types_ShDh_AVPs all;
    import from LibDiameter_Templates all;
    
    group SubFields{
    } // End of group SubFields

    group HeaderFieldTemplates {

        template (value) Command_Flags m_cmdFlagsAns_CmdFlags_T modifies m_cmdFlagsAns := {
            t_bit := '1'B
        }

        template (value) Command_Flags m_cmdFlagsReq_CmdFlags_T modifies m_cmdFlagsReq := {
            t_bit := '1'B
        }
        
        template (value) DiameterHeader m_diameterHeaderReq_CmdFlags_T(
                                                                      in Command_Code p_cmdcode, 
                                                                      in UInt32 p_applid
        ) modifies m_diameterHeaderReq_dummy := {
            cmdflags := m_cmdFlagsReq_CmdFlags_T
        }
        
        template DiameterHeader mw_diameterHeaderReq_CmdFlags(Command_Code p_cmdcode, template (present) UInt32 p_applid, template (present) Command_Flags p_commandFlags) modifies mw_diameterHeaderReq_dummy := {
            cmdflags := p_commandFlags
        }

        template (present) DiameterHeader mw_diameterHeaderAns_CmdFlags(
                                                                        Command_Code p_cmdcode, 
                                                                        template (present) UInt32 p_applid, 
                                                                        template (present) Command_Flags p_commandFlags
        ) modifies mw_diameterHeaderAns_dummy := {
            cmdflags := p_commandFlags
        } // End of template mw_diameterHeaderAns_CmdFlags

        /**
         * @desc Received generic command flag template
         */
        template (present) Command_Flags mw_cmdFlagsReq_PET(in template Bit1 p_P, in Bit1 p_E,in Bit1 p_T) := {
            r_bit           := '1'B,            //Request message
            p_bit           := p_P,
            e_bit           := p_E,
            t_bit           := p_T,
            reserved_bits    := '0000'B
        } // End of template mw_cmdFlagsReq_PET
        
        /**
         * @desc Received generic command flag template
         */
        template (present) Command_Flags mw_cmdFlagsAns_PET(in template Bit1 p_P, in Bit1 p_E,in Bit1 p_T) := {
            r_bit           := '0'B,            //Answer message
            p_bit           := p_P,
            e_bit           := p_E,
            t_bit           := p_T,
            reserved_bits    := '0000'B
        } // End of template mw_cmdFlagsAns_PET
        
    } // End of group HeaderFieldTemplates
    
    // Even if template is defined in DiameterS9_Templates module we keep it here to have ShDh specific 
    template (value) Subscription_Id_AVP m_subscription_Id(
                                                           in template (value) Subscription_Id_Type_AVP p_typeAVP, 
                                                           in template (value) Subscription_Id_Data_AVP p_dataAVP
    ) := {
        aVP_Header := m_aVP_HeaderVid_Mbit1(
                                            c_subscription_Id_AVP_Code,
                                            f_getByteAlignedLength(p_typeAVP.aVP_Header.aVP_len) + 
                                            f_getByteAlignedLength(p_dataAVP.aVP_Header.aVP_len),
                                            omit),
        subscription_Id_Type := p_typeAVP,
        subscription_Id_Data := p_dataAVP
    } // End of template m_subscription_Id
    
    template (value) Subscription_Id_Type_AVP m_subscription_Id_Type(
                                                                     in template (value) Subscription_Id_Ty_Type p_aVPData
    ):= {
        aVP_Header  := m_aVP_HeaderVid_Mbit1(c_subscription_Id_Type_AVP_Code, f_getEnumLength()),
        aVP_Data    := p_aVPData
    } // End of template m_subscription_Id_Type

    template (value) Subscription_Id_Data_AVP m_subscription_Id_Data(
                                                                     in template (value) UTF8String p_aVPData
    ) := {
        aVP_Header  := m_aVP_HeaderVid_Mbit1(c_subscription_Id_Data_AVP_Code, f_getUTF8StringLength(valueof(p_aVPData))),
        aVP_Data    := p_aVPData
    } // End of template  m_subscription_Id_Data
    
    group Sh_modified_message_templates { 
        
        group Sh_request_message_templates_send {
            
            /**
             * @desc Send template for UDR
             * @param p_sessionId   Session identifier
             * @param p_acrBody     UDR message body
             */
            template (value) UDR_MSG md_uDR(
                                            in template (value) Session_Id_AVP  p_sessionId,
                                            in template (value) UDR_Body_AVP    p_acrBody
            ) modifies m_UDR_dummy := {
                header := m_diameterHeaderReq_dummy(UDR_E, c_applIdSh),
                session_Id  := p_sessionId,
                uDR_Body    := p_acrBody
            } // End of template md_uDR
            
        } // End of group Sh_request_message_templates_send 
        
        group Sh_request_message_templates_receive {
            
            group UDR_MSG_{
                    
                /**
                * @desc Main receive message for CDF_Sh port
                * @param p_uDR_MSG AC-Request message
                 */
                template (present) UDR_MSG mdw_uDR(
                                                   in template (present) Session_Id_AVP  p_sessionId,
                                                   in template (present) UDR_Body_AVP    p_acrBody
                ) modifies mw_UDR_dummy := {
                    header      := mw_diameterHeaderReq_dummy(UDR_E, c_applIdSh),
                    session_Id  := p_sessionId,
                    uDR_Body    := p_acrBody
                } // End of template mdw_uDR
                
            }
            
        }
        
    } // End of group Sh_modified_message_templates 
    
} // End of module DiameterShDh_Templates 
 No newline at end of file