blob: 54885785bf7163c3c1af1d3d4257c5191ee9b7bf [file] [log] [blame]
# GTPv2 unit tests
#
# Type the following command to launch start the tests:
# $ test/run_tests -P "load_contrib('gtp_v2')" -t scapy/contrib/gtp_v2.uts
+ GTPv2
= GTPHeader v2, basic instanciation
gtp = IP()/UDP(dport=2123)/GTPHeader(gtp_type=1)
gtp.dport == 2123 and gtp.gtp_type == 1
= GTPV2EchoRequest, basic instantiation
gtp = IP()/UDP(dport=2123) / GTPHeader(seq=12345) / GTPV2EchoRequest()
gtp.dport == 2123 and gtp.seq == 12345 and gtp.gtp_type == 1 and gtp.T == 0
= GTPV2CreateSessionRequest, basic instantiation
gtp = IP() / UDP(dport=2123) / \
GTPHeader(gtp_type="create_session_req", teid=2807, seq=12345) / \
GTPV2CreateSessionRequest()
gtp.dport == 2123 and gtp.teid == 2807 and gtp.seq == 12345
= GTPV2EchoRequest, dissection
h = "333333333333222222222222810080c808004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e4001000900000100030001000daa000000003f1f382f"
gtp = Ether(hex_bytes(h))
gtp.gtp_type == 1
= GTPV2EchoResponse, dissection
h = "3333333333332222222222228100e384080045fc002fd6d70000f21180d40a2a00010a2a0002084b084b001b00004002000f000001000300010001020002001000731cd7c5"
gtp = Ether(hex_bytes(h))
gtp.gtp_type == 2
= GTPV2ModifyBearerRequest, dissection
h = "3333333333332222222222228100a384080045b8004300000000fc1185350a2a00010a2a00027a76084b002f6c344822002392e9e1143652540052000100065d00120049000100055700090080000010927f000002ac79a28e"
gtp = Ether(hex_bytes(h))
gtp.gtp_type == 34
= IE_IMSI, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd00000000661759000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100235700090385000010927f00000250001600580700000000000000000000000000000000000000007200020040005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0]
ie.IMSI == b"2080112345670000"
= IE_IMSI, basic instantiation
ie = IE_IMSI(ietype='IMSI', length=8, IMSI='2080112345670000')
ie.ietype == 1 and ie.IMSI == b'2080112345670000'
= IE_Cause, dissection
h = "3333333333332222222222228100838408004588004a00000000fd1193160a2a00010a2a0002084b824600366a744823002a45e679235ea151000200020010005d001800490001006c0200020010005700090081000010927f000002558d3b69"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0]
ie.Cause == 16
= IE_Cause, basic instantiation
ie = IE_Cause(
ietype='Cause', length=2, Cause='Request Accepted', PCE=1, BCE=0, CS=0)
ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 1 and ie.BCE == 0 and ie.CS == 0
= IE_Cause, basic instantiation 2
ie = IE_Cause(
ietype='Cause', length=2, Cause='Request Accepted', PCE=0, BCE=1, CS=0)
ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 0 and ie.BCE == 1 and ie.CS == 0
= IE_Cause, basic instantiation 3
ie = IE_Cause(
ietype='Cause', length=2, Cause='Request Accepted', PCE=0, BCE=0, CS=1)
ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 0 and ie.BCE == 0 and ie.CS == 1
= IE_RecoveryRestart, dissection
h = "3333333333332222222222228100838408004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e400100095e4b1f00030001000daa000000003f1f382f"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[0]
ie.ietype == 3 and ie.restart_counter == 13
= IE_RecoveryRestart, basic instantiation
ie = IE_RecoveryRestart(
ietype='Recovery Restart', length=1, restart_counter=17)
ie.ietype == 3 and ie.restart_counter == 17
= IE_APN, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[7]
ie.APN == b'aaaaaaaaaaaaaaaaaaaaaaaaa'
= IE_APN, basic instantiation
ie = IE_APN(ietype='APN', length=26, APN='aaaaaaaaaaaaaaaaaaaaaaaaa')
ie.ietype == 71 and ie.APN == b'aaaaaaaaaaaaaaaaaaaaaaaaa'
= IE_AMBR, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[11]
ie.AMBR_Uplink == 5888 and ie.AMBR_Downlink == 42000
= IE_AMBR, basic instantiation
ie = IE_AMBR(
ietype='AMBR', length=8, AMBR_Uplink=5888, AMBR_Downlink=42000)
ie.ietype == 72 and ie.AMBR_Uplink == 5888 and ie.AMBR_Downlink == 42000
= IE_EPSBearerID, dissection
h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[2]
ie.EBI == 50
= IE_EPSBearerID, basic instantiation
ie = IE_EPSBearerID(ietype='EPS Bearer ID', length=1, EBI=50)
ie.ietype == 73 and ie.EBI == 50
= IE_IPv4, dissection
h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d84530d5a4cdee2000200020010004c00060011111111111149000100b248000800000061a8000249f07f000100005d00130049000100da0200020010005e00040039004f454a0004007f00000436f73a63"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[6]
ie.address == '127.0.0.4'
= IE_IPv4, basic instantiation
ie = IE_IPv4(ietype='IPv4', length=4, address='127.0.0.4')
ie.ietype == 74 and ie.address == '127.0.0.4'
= IE_MEI, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[1]
ie.MEI == 123456
= IE_MEI, basic instantiation
ie = IE_MEI(ietype='MEI', length=1, MEI=123456)
ie.ietype == 75 and ie.MEI == 123456
= IE_MSISDN, dissection
h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[1]
ie.digits == b'111111111111'
= IE_MSISDN, basic instantiation
ie = IE_MSISDN(ietype='MSISDN', length=6, digits='111111111111')
ie.ietype == 76 and ie.digits == b'111111111111'
= IE_Indication, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[10]
ie.DAF == 0 and ie.DTF == 0 and ie.PS == 1 and ie.CCRSI == 0 and ie.CPRAI == 0 and ie.PPON == 0 and ie.CLII == 0 and ie.CPSR == 0
= IE_Indication, basic instantiation
ie = IE_Indication(ietype='Indication', length=8, PS=1, CPRAI=1)
ie.ietype == 77 and ie.PS == 1 and ie.CPRAI == 1
= IE_Indication, basic instantiation 2
ie = IE_Indication(ietype='Indication', length=8, DTF=1, PPSI=1)
ie.ietype == 77 and ie.DTF == 1 and ie.PPSI == 1
= IE_PCO, dissection
h = "333333333333222222222222810083840800458800a500000000fd1183bb0a2a00010a2a0002084b76a00091cf0b48210085bd574af24c68e300020002001000570009008b000010927f0000025700090187000010927f0000024f000500017f0000037f000100004e00220080000d040a2a0003000d040a2a00038021100300001081060a2a000483060a2a00045d00250049000100660200020010005700090081000010927f0000025700090285000010927f000002dd9f22c6"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5]
ie.Protocols[0].address == '10.42.0.3'
= IE_PCO, basic instantiation
ie = IE_PCO(ietype='Protocol Configuration Options', length=8, Extension=1, PPP=3, Protocols=[
PCO_DNS_Server_IPv4(type='DNS Server IPv4 Address Request', length=4, address='10.42.0.3')])
ie.Extension == 1 and ie.PPP == 3 and ie.Protocols[0].address == '10.42.0.3'
= IE_PAA, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[9]
ie.PDN_type == 1 and ie.ipv4 == '127.0.0.3'
= IE_PAA, basic instantiation
ie = IE_PAA(ietype='PAA', length=5, PDN_type='IPv4', ipv4='127.0.0.3')
ie.ietype == 79 and ie.PDN_type == 1 and ie.ipv4 == '127.0.0.3'
= IE_Bearer_QoS, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[12].IE_list[2]
ie.MaxBitRateForUplink == 0 and ie.MaxBitRateForDownlink == 0 and ie.QCI == 7
= IE_Bearer_QoS, basic instantiation
ie = IE_Bearer_QoS(ietype='Bearer QoS', length=22, PCI=4, PriorityLevel=5, PVI=6, QCI=7,
MaxBitRateForUplink=1, MaxBitRateForDownlink=2, GuaranteedBitRateForUplink=3, GuaranteedBitRateForDownlink=4)
ie.ietype == 80 and ie.PCI == 4 and ie.PriorityLevel == 5 and ie.PVI == 6 and ie.QCI == 7 and ie.MaxBitRateForUplink == 1 and ie.MaxBitRateForDownlink == 2 and ie.GuaranteedBitRateForUplink == 3 and ie.GuaranteedBitRateForDownlink == 4
= IE_RAT, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[4]
ie.RAT_type == 6
= IE_RAT, basic instantiation
ie = IE_RAT(ietype='RAT', length=1, RAT_type='EUTRAN')
ie.ietype == 82 and ie.RAT_type == 6
= IE_ServingNetwork, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[3]
ie.MCC == b'234' and ie.MNC == b'02'
= IE_ServingNetwork, basic instantiation
ie = IE_ServingNetwork(
ietype='Serving Network', length=3, MCC='234', MNC='02')
ie.ietype == 83 and ie.MCC == b'234' and ie.MNC == b'02'
= IE_ULI, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[2]
ie.TAI_Present == 1 and ie.ECGI_Present == 1 and ie.TAI.MCC == b'234' and ie.TAI.MNC == b'02' and ie.TAI.TAC == 12345 and ie.ECGI.MCC == b'234' and ie.ECGI.MNC == b'02' and ie.ECGI.ECI == 123456
= IE_ULI, basic instantiation
ie = IE_ULI(ietype='ULI', length=13, LAI_Present=0, ECGI_Present=1, TAI_Present=1, RAI_Present=0, SAI_Present=0,
CGI_Present=0, TAI=ULI_TAI(MCC='234', MNC='02', TAC=12345), ECGI=ULI_ECGI(MCC='234', MNC='02', ECI=123456))
ie.ietype == 86 and ie.LAI_Present == 0 and ie.ECGI_Present == 1 and ie.TAI_Present == 1 and ie.RAI_Present == 0 and ie.SAI_Present == 0 and ie.CGI_Present == 0 and ie.TAI.MCC == b'234' and ie.TAI.MNC == b'02' and ie.TAI.TAC == 12345 and ie.ECGI.MCC == b'234' and ie.ECGI.MNC == b'02' and ie.ECGI.ECI == 123456
= IE_FTEID, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5]
ie.GRE_Key == 4242 and ie.ipv4 == '127.0.0.2'
= IE_FTEID, basic instantiation
ie = IE_FTEID(ietype='F-TEID', length=9, ipv4_present=1,
InterfaceType=10, GRE_Key=0x1092, ipv4='127.0.0.2')
ie.ietype == 87 and ie.ipv4_present == 1 and ie.InterfaceType == 10 and ie.GRE_Key == 0x1092 and ie.ipv4 == '127.0.0.2'
= IE_BearerContext, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[12]
len(ie.IE_list) == 3 and ie.IE_list[0].ietype == 73 and ie.IE_list[0].EBI == 229 and ie.IE_list[
1].ietype == 87 and ie.IE_list[1].ipv4 == '127.0.0.2' and ie.IE_list[2].ietype == 80 and ie.IE_list[2].QCI == 7
= IE_BearerContext, basic instantiation
ie = IE_BearerContext(ietype='Bearer Context', length=44, IE_list=[
IE_EPSBearerID(ietype='EPS Bearer ID', length=1, EBI=229)])
ie.ietype == 93 and len(ie.IE_list) == 1 and ie.IE_list[
0].ietype == 73 and ie.IE_list[0].EBI == 229
= IE_ChargingID, dissection
h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004da0316b4d96ac2c000200020010004c00060011111111111149000100c348000800000061a8000249f07f000100005d001300490001003f0200020010005e00040039004f454a0004007f00000436f73a63"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[5].IE_list[2]
ie.ChargingID == 956321605
= IE_ChargingID, basic instantiation
ie = IE_ChargingID(ietype='Charging ID', length=4, ChargingID=956321605)
ie.ietype == 94 and ie.ChargingID == 956321605
= IE_ChargingCharacteristics, dissection
h = "3333333333332222222222228100a384080045b8011800000000fc1193150a2a00010a2a00027be5084b010444c4482000f82fd783953790a2000100080002081132547600004c0006001111111111114b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000800007f00010000480008000000c3500002e6304e001a008080211001000010810600000000830600000000000d00000a005d001f00490001000750001600190700000000000000000000000000000000000000007200020014005f0002000a008e80b09f"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[18]
ie.ChargingCharacteristric == 0xa00
= IE_ChargingCharacteristics, basic instantiation
ie = IE_ChargingCharacteristics(
ietype='Charging Characteristics', length=2, ChargingCharacteristric=0xa00)
ie.ietype == 95 and ie.ChargingCharacteristric == 0xa00
= IE_PDN_type, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[8]
ie.PDN_type == 1
= IE_PDN_type, basic instantiation
ie = IE_PDN_type(ietype='PDN Type', length=1, PDN_type='IPv4')
ie.ietype == 99 and ie.PDN_type == 1
= IE_UE_Timezone, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[13]
ie.Timezone == 20 and ie.DST == 0
= IE_UE_Timezone, basic instantiation
ie = IE_UE_Timezone(ietype='UE Time zone', length=2, Timezone=20, DST=0)
ie.ietype == 114 and ie.Timezone == 20 and ie.DST == 0
= IE_UE_Timezone, basic instantiation
ie = IE_UE_Timezone(ietype='UE Time zone', length=2, Timezone=20, DST=1)
ie.ietype == 114 and ie.Timezone == 20 and ie.DST == 1
= IE_Port_Number, dissection
h = "00010203040800808e8f8ab608004500004100010000401169140b00019705000001ec45084b002da8524820001d00000000006e400001000700420061896453f44a0004005f1e1d737e0002004532"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[2]
ie.PortNumber == 17714
= IE_Port_Number, basic instantiation
ie = IE_Port_Number(
ietype='Port Number', length=2, PortNumber=17714)
ie.ietype == 126 and ie.PortNumber == 17714
= IE_APN_Restriction, dissection
h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[4]
ie.APN_Restriction == 0
= IE_APN_Restriction, basic instantiation
ie = IE_APN_Restriction(
ietype='APN Restriction', length=1, APN_Restriction=0)
ie.ietype == 127 and ie.APN_Restriction == 0
= IE_SelectionMode, dissection
h = "3333333333332222222222228100a384080045b8011800000000fc1193150a2a00010a2a00027be5084b010444c4482000f8093ca4cc47fa69000100080002081132547600004c0006001111111111114b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000800007f00010000480008000000c3500002e6304e001a008080211001000010810600000000830600000000000d00000a005d001f00490001004850001600190700000000000000000000000000000000000000007200020014005f0002000a008e80b09f"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[9]
ie.SelectionMode == 0
= IE_SelectionMode, basic instantiation
ie = IE_SelectionMode(
ietype='Selection Mode', length=1, SelectionMode=4)
ie.ietype == 128 and ie.SelectionMode == 4
= IE_MMBR, dissection
h = "3333333333332222222222228100838408004580014c97af0000f011830e0a2a00010a2a000282d5084b013876a74820012c29694a667f4a0b000100080002081132547600004c0006001111111111114b000800000000000001e24056000f000632f42030391a8532f42030391a855300030032f420520001000157001900c6000010927f0000020000000000000000000000000000fe8247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000000007f000100004800080000001640000052084e00200080c02306010000060000802110010000108106000000008306000000000005005d003c00490001006057001902c4000010927f0000020000000000000000000000000000fe825000160029080000000000000000000000000000000000000000720002006e005f0002000a00a10008000000164000005208e4701ad2"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[18]
ie.uplink_rate == 5696 and ie.downlink_rate == 21000
= IE_MMBR, basic instantiation
ie = IE_MMBR(ietype='Max MBR/APN-AMBR (MMBR)',
length=8, uplink_rate=5696, downlink_rate=21000)
ie.ietype == 161 and ie.uplink_rate == 5696 and ie.downlink_rate == 21000
= GTPHeader answers to not GTPHeader instance
GTPHeader(gtp_type=2).answers(Ether()) == False
= GTPHeader post_build
gtp = GTPHeader(gtp_type="create_session_req") / ("X"*32)
gtp.show2()
= GTPHeader hashret
req = GTPHeader(gtp_type="create_session_req") / ("X"*32)
res = GTPHeader(gtp_type="create_session_res") / ("Y"*32)
req.hashret() == res.hashret()
= IE_NotImplementedTLV
h = "333333333333222222222222810080c808004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e4001000900000100ff0001000daa000000003f1f382f"
gtp = Ether(hex_bytes(h))
isinstance(gtp.IE_list[0], IE_NotImplementedTLV)