Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

huangapple go评论89阅读模式
英文:

Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

问题

我想使用Go-Diameter创建直径流量模拟,以便我可以获得Wireshark转储文件中的3GPP-User-Location-Info值,如下图所示:

Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

我已经阅读了Etsi TS 129 061的文档,但我不知道如何在Go-Diameter中确定这个变量,以便我可以获取之前提到的值和地理位置类型(130)。这是我代码的示例片段:

	m.NewAVP(avp.ServiceInformation, avp.Mbit, 10415, &diam.GroupedAVP{
	AVP: []*diam.AVP{
		diam.NewAVP(avp.PSInformation, avp.Mbit, 10415, &diam.GroupedAVP{
			AVP: []*diam.AVP{
				diam.NewAVP(avp.TGPPChargingID, avp.Mbit, 10415, cid),
				diam.NewAVP(avp.PDPType, avp.Mbit, 10415, datatype.Enumerated(0)),
				diam.NewAVP(avp.TGPPUserLocationInfo, avp.Mbit, 10415, datatype.OctetString("如何确定这个变量")),
			},
		}),
...
英文:

I would like to create diameter traffic simulation with Go-Diameter so that I get Wireshark dump with 3GPP-User-Location-Info value as shown in this screenshot

Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

I already read documentation from Etsi TS 129 061, but I could not understand how to determine this variable in Go-Diameter so I will get the value that i mentioned before and the Geographic Location Type (130). Here is the sample snippet of my code

	m.NewAVP(avp.ServiceInformation, avp.Mbit, 10415, &diam.GroupedAVP{
	AVP: []*diam.AVP{
		diam.NewAVP(avp.PSInformation, avp.Mbit, 10415, &diam.GroupedAVP{
			AVP: []*diam.AVP{
				diam.NewAVP(avp.TGPPChargingID, avp.Mbit, 10415, cid),
				diam.NewAVP(avp.PDPType, avp.Mbit, 10415, datatype.Enumerated(0)),
				diam.NewAVP(avp.TGPPUserLocationInfo, avp.Mbit, 10415, datatype.OctetString("howToDetermineThisVar")),
			},
		}),
...

答案1

得分: 1

将值分为两部分(TAI和ECGI)
8202f4808790 ---- 02f480003a0d21

忽略前两位数字,我们从'02..'开始

所以我们得到TAI的值为02f4808790

根据图8.21.4-1:TAI在TS 29.274 V8.11.0(2011-12)中
Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

MCC是204,MNC是f08。考虑到'f'为空,所以MNC是08。

剩下的值8790是十六进制格式的TAC(跟踪区域码)。

对于ECGI,值为02f480003a0d21,我们参考这个表格
Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

其中'02f480'是mcc-mnc,'0'为空闲,'03a0d21'是E-UTRAN小区标识符(ECI)

为了得到在Wireshark中显示的期望值,我们应该将十六进制转换为文本(utf-8),并将其用作Go-Diameter程序中的TGPPUserLocationInfo变量。
转换是每两个数字执行一次。例如,在给定的示例中

82 02 f4 80 87 90 - 02 f4 80 00 3a 0d 21

我们得到变量

x82 c \xf4 \x80 \x87 \x90 - c \xf4 \x80 \x00 : \x0d !

前缀'\x'表示无法转换为文本的数字

所以"howToDetermineThisVar"的值是"x82c\xf4\x80\x87\x90c\xf4\x80\x00:\x0d!"

英文:

separate value into two parts (TAI & ECGI)
8202f4808790 ---- 02f480003a0d21

ignore the first two digits, we start from '02..'

so we get value of TAI 02f4808790

based on Figure 8.21.4-1: TAI in TS 29.274 V8.11.0 (2011-12)
Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

MCC is 204 and MNC is f08. Consider 'f' is null, so MNC is 08.

The rest of the value, 8790, is TAC (Tracking Area Code) in hex format.

for ECGI, the value is 02f480003a0d21 we refer to this table
Go-Diameter: how to determine data variable in NewAVP of TGPPUserLocationInfo to get desired value in Wireshark dump

where '02f480' is mcc-mnc, '0' as spare, and '03a0d21' is E-UTRAN Cell Identifier (ECI)

To get desired value as shown in Wireshark, we should use conversion from hexadecimal to text (utf-8) and use it as TGPPUserLocationInfo variable in Go-Diameter program.
The conversion is performed in every two digits. For instance in the given example

82 02 f4 80 87 90 - 02 f4 80 00 3a 0d 21

we get variable

x82 c \xf4 \x80 \x87 \x90 - c \xf4 \x80 \x00 : \x0d !

prefix '\x' is for digits that cannot be converted into text

so the value of "howToDetermineThisVar" is "x82c\xf4\x80\x87\x90c\xf4\x80\x00:\x0d!"

huangapple
  • 本文由 发表于 2022年4月25日 04:14:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/71992006.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定