Commit 3afe392d authored by rennoch's avatar rennoch
Browse files

- consideration of vender id flag/length in header

- new SN test
parent 7c25c346
Loading
Loading
Loading
Loading
+152 −78
Original line number Diff line number Diff line
@@ -224,9 +224,7 @@ module LibDiameter_Templates {
                hopid := *,
                endid := *
            }
        } //end group DiameterHeaderGroup
            
        group DummyAVPHeaders{
            template AVP_Flags m_avpFlags := {
                v_bit := '0'B,
                m_bit := '1'B,
@@ -234,7 +232,6 @@ module LibDiameter_Templates {
                reserved_bits := '00000'B
            }


            template AVP_Header m_aVP_Header(AVP_Code p_avpCode) := {
            aVP_Code := p_avpCode,
            aVP_flags := m_avpFlags,
@@ -242,6 +239,36 @@ module LibDiameter_Templates {
            aVP_vid := omit
        	}

			
         /**
          * @desc complete AVP header field template
          * @param p_avpCode specific Code of the AVP parameter
          * @param p_avpDataLen additional length caused if AVP data field is present
          * @param p_avpVid vendor id if needed
          */
            template AVP_Header m_aVP_HeaderVid(AVP_Code p_avpCode, integer p_avpDataLen, template AVP_Vendor_ID p_avpVid) := {
            aVP_Code := p_avpCode,
            aVP_flags := {v_bit := f_aVPvBit(p_avpVid),
                m_bit := '1'B,
                p_bit := '0'B,
                reserved_bits := '00000'B},
            aVP_len := 8 + p_avpDataLen + f_lengthVid(p_avpVid), // add length of avpData and optioal 4 (if Vid is present)
            aVP_vid := p_avpVid
            }
            
            function f_lengthVid(template AVP_Vendor_ID p_avpVid) return integer { 
                if(isvalue(p_avpVid)){return 4} else{return 0}
            }
            
            function f_aVPvBit(template AVP_Vendor_ID p_avpVid) return Bit1 { 
                if(isvalue(p_avpVid)){return '1'B} else{return '0'B}
            }
            
                    	
        } //end group DiameterHeaderGroup
        
        group DummyAVPHeaders{            
            
            template Origin_Host_AVP m_originHost_dummy := {
                aVP_Header := m_aVP_Header(c_vendIdOrigin_Host_AVP),
                aVP_Data := ""
@@ -321,18 +348,12 @@ module LibDiameter_Templates {
			Media_Component_Description_AVP m_mediaComponentDescription_dummy :=
			{
                aVP_Header :=
                {  aVP_Code := c_vendIdMedia_Component_Description_AVP,
                                        aVP_flags := m_avpFlags,
                                        aVP_len := 8 + 12,
                                        aVP_vid := omit
                                    },
                    m_aVP_HeaderVid(c_vendIdMedia_Component_Description_AVP, 
                                    12, omit), // considers lengths: media_Component_Nr
				media_Component_Nr := {
					aVP_Header := {
						aVP_Code := c_vendIdMedia_Component_Number_AVP,
						aVP_flags := m_avpFlags,
						aVP_len := 8+4,
						aVP_vid := omit
					},
				    
                    aVP_Header := m_aVP_HeaderVid(c_vendIdMedia_Component_Number_AVP, 
                                    4, omit),                                    
					aVP_Data := 1 //     TODO parameterize
				},  
				media_Sub_component := omit,
@@ -352,39 +373,47 @@ module LibDiameter_Templates {

        group SpecificAVPHeaders {
            
            template Origin_Host_AVP m_originHost(charstring p_avpData)
                modifies m_originHost_dummy := {
                aVP_Header := {aVP_len := 8+lengthof(p_avpData)},
            template Origin_Host_AVP m_originHost(charstring p_avpData) := {
				aVP_Header :=
					m_aVP_HeaderVid(c_vendIdOrigin_Host_AVP,
									lengthof(p_avpData), omit),
				aVP_Data := p_avpData
			}

            template Destination_Host_AVP m_destinationHost(charstring
                                                                p_avpData)
                modifies m_destinationHost_dummy := {
                aVP_Header := {aVP_len := 8+lengthof(p_avpData)},
                := {
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdDestination_Host_AVP,
                                    lengthof(p_avpData), omit),
                aVP_Data := p_avpData
            }
            
            template Destination_Realm_AVP m_destinationRealm(charstring
																  p_avpData)
				modifies m_destinationRealm_dummy := {
                aVP_Header := {aVP_len := 8+lengthof(p_avpData)},
				:= {
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdDestination_Realm_AVP,
                                    lengthof(p_avpData), omit),
				aVP_Data := p_avpData
			}

            
            
            template Session_Id_AVP m_sessionId(UTF8String p_avpData)
                modifies m_sessionId_dummy := {
                aVP_Header := {aVP_len := 8+lengthof(p_avpData)},
            template Session_Id_AVP m_sessionId(UTF8String p_avpData) := {
				aVP_Header :=
					m_aVP_HeaderVid(c_vendIdSession_Id_AVP,
									lengthof(p_avpData), omit),
				aVP_Data := p_avpData
			}
            
                        
            template Auth_Application_Id_AVP m_authApplicationId(LibCommon_BasicTypesAndValues.UInt32
																	 p_avpData)
				modifies m_authApplicationId_dummy := {
                aVP_Header := {aVP_len := 8+4},
				:= {
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdAuth_Application_Id_AVP,
                                    4, omit),
				aVP_Data := p_avpData
			}            
            
@@ -400,9 +429,8 @@ module LibDiameter_Templates {
        }
        

        template Result_Code_AVP m_resultCode(template integer p_avpData)
            modifies m_resultCode_dummy := {
            aVP_Header := {aVP_len := 8+4},
        template Result_Code_AVP m_resultCode(template integer p_avpData) := {
			aVP_Header := m_aVP_HeaderVid(c_vendIdResult_Code_AVP, 4, omit),
			aVP_Data := p_avpData
		}
        
@@ -445,12 +473,9 @@ module LibDiameter_Templates {
                                                              octetstring
                                                                  p_avpData) :=
            { 
                aVP_Header := {
                    aVP_Code := c_vendIdFramed_IP_Address_AVP,
                    aVP_flags := m_avpFlags,
                    aVP_len :=  8 + lengthof(p_avpData),
                    aVP_vid := omit
                },
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdFramed_IP_Address_AVP,
                                    lengthof(p_avpData), omit),
                aVP_Data := p_avpData
            }
			
@@ -458,26 +483,18 @@ module LibDiameter_Templates {
                                                              octetstring
                                                                  p_avpData) :=
            {
                aVP_Header := {
                    aVP_Code := c_vendIdFramed_IPv6_Prefix_AVP,
                    aVP_flags := m_avpFlags,
                    aVP_len := 8 + lengthof(p_avpData),
                    aVP_vid := omit
                },
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdFramed_IPv6_Prefix_AVP,
                                    lengthof(p_avpData), omit),
                aVP_Data := p_avpData
            }
            
            
            
			//const LibCommon_BasicTypesAndValues.UInt32 myUInt32 := 1;
			template Origin_Realm_AVP m_originRealm(template(value) charstring
														p_avpData) := {
				aVP_Header := {
					aVP_Code := c_vendIdOrigin_Realm_AVP, //296,
					aVP_flags := m_avpFlags,
					aVP_len :=  8 + lengthof(p_avpData),
					aVP_vid := omit
				},
				aVP_Header :=
					m_aVP_HeaderVid(c_vendIdOrigin_Realm_AVP,
									lengthof(p_avpData), omit),
				aVP_Data := p_avpData
			}

@@ -486,12 +503,8 @@ module LibDiameter_Templates {
													 Termination_Cause_Type
														 p_terminationCauseData)
				:= {
				aVP_Header := {
                    aVP_Code := c_vendIdTermination_Cause_AVP,
                    aVP_flags := m_avpFlags,
                    aVP_len := 0, // TODO calculation
                    aVP_vid := omit
				},
                aVP_Header :=
                    m_aVP_HeaderVid(c_vendIdTermination_Cause_AVP, 4, omit),
				aVP_Data := p_terminationCauseData //DIAMETER_LOGOUT_E
			}

@@ -500,6 +513,14 @@ module LibDiameter_Templates {
            	aVP_Header := ?, aVP_Data := p_avpData
            }
            
            template Specific_Action_AVP m_specificAction(template
														  Specific_Action_Type
															  p_avpData) := {
				aVP_Header :=
					m_aVP_HeaderVid(c_vendIdSpecific_Action_AVP, 4, omit),
				aVP_Data := p_avpData
			}
            
            template Media_Component_Description_AVP mw_mediaComponentDescription := {
                aVP_Header := {
                    aVP_Code := ?,
@@ -531,12 +552,38 @@ module LibDiameter_Templates {
            
            template
            Media_Component_Description_AVP 
            m_mediaComponentDescription_flowStatus (template Flow_Status_AVP p_flowStatus)
            mw_mediaComponentDescription_mediaSubComponent1 (template Media_Sub_Component_AVP p_mediaSubComponent)
                modifies mw_mediaComponentDescription := {
                media_Component_Nr := {aVP_Header := ?, aVP_Data := 1},
                media_Sub_component := {p_mediaSubComponent} //TODO remove restriction to one element
            }
            
            template
			Media_Component_Description_AVP m_mediaComponentDescription_flowStatus
			(template Flow_Status_AVP p_flowStatus)
				modifies m_mediaComponentDescription_dummy := {
                    aVP_Header := {aVP_len := 8 + 12 + 12}, // considers lengths: media_Component_Nr, flowstatus
				aVP_Header :=
					m_aVP_HeaderVid(c_vendIdMedia_Component_Description_AVP,
									12 + 12, omit),  //     considers lengths:
													 //     media_Component_Nr,
													 //     flowstatus
				flow_Status := p_flowStatus
			}
			

         template Media_Sub_Component_AVP mw_mediaSubComponent := {
			 aVP_Header := ?,
			 flow_Number := ?,
			 flow_Description := ?,
			 flow_Status := *,
			 flow_Usage := {aVP_Header := ?, aVP_Data := AF_SIGNALLING_E},
			 max_Requested_Bw_Ul := *,
			 max_Requested_Bw_Dl := *,
			 af_Signalling_Protocol := *,
			 aVP_Type := *
		 }

   
          template Sponsored_Connectivity_Data_AVP mw_sponsoredConnectivityData
		  (template Sponsor_Identity_AVP p_sponsorIdentity,
		   template Application_Service_Provider_Identity_AVP
@@ -1258,6 +1305,33 @@ module LibDiameter_Templates {
				  media_Component_Description := {p_mediaComponentDescription}
			  }
			  
              template
              AAR_MSG mw_AAR_FIP_supSA_supMedia(template Session_Id_AVP p_sessionId,
                                        template Origin_Host_AVP p_originHost,
                                        template Origin_Realm_AVP
                                            p_originRealm,
                                        template Destination_Realm_AVP
                                            p_destinationRealm,
                                        template Destination_Host_AVP
                                            p_destinationHost,
                                        template Auth_Application_Id_AVP
                                            p_authApplicationId,
                                        template Framed_IP_Address_AVP
                                            p_framedIpAddress,
                                        template Framed_IPv6_Prefix_AVP
                                            p_framedIp6Address,
                                        template Specific_Action_AVP
                                            p_specificAction,
                                        template
                                        Media_Component_Description_AVP
                                            p_mediaComponentDescription)
                  modifies mw_AAR_basic := {
                  framed_IP_Address := p_framedIpAddress,
                  framed_IPv6_Address := p_framedIp6Address,
                  media_Component_Description := superset(p_mediaComponentDescription),
                  specific_Action := superset(p_specificAction)
              }
			  
              template
              AAR_MSG mw_AAR_SCD(template Session_Id_AVP p_sessionId,
                                        template Origin_Host_AVP p_originHost,