Home | History | Annotate | Download | only in contrib
      1 # GTPv2 unit tests
      2 #
      3 # Type the following command to launch start the tests:
      4 # $ test/run_tests -P "load_contrib('gtp_v2')" -t scapy/contrib/gtp_v2.uts
      5 
      6 + GTPv2
      7 
      8 = GTPHeader v2, basic instanciation
      9 gtp = IP()/UDP(dport=2123)/GTPHeader(gtp_type=1)
     10 gtp.dport == 2123 and gtp.gtp_type == 1
     11 
     12 = GTPV2EchoRequest, basic instantiation
     13 gtp = IP()/UDP(dport=2123) / GTPHeader(seq=12345) / GTPV2EchoRequest()
     14 gtp.dport == 2123 and gtp.seq == 12345 and gtp.gtp_type == 1 and gtp.T == 0
     15 
     16 = GTPV2CreateSessionRequest, basic instantiation
     17 gtp = IP() / UDP(dport=2123) / \
     18     GTPHeader(gtp_type="create_session_req", teid=2807, seq=12345) / \
     19     GTPV2CreateSessionRequest()
     20 gtp.dport == 2123 and gtp.teid == 2807 and gtp.seq == 12345
     21 
     22 = GTPV2EchoRequest, dissection
     23 h = "333333333333222222222222810080c808004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e4001000900000100030001000daa000000003f1f382f"
     24 gtp = Ether(hex_bytes(h))
     25 gtp.gtp_type == 1
     26 
     27 = GTPV2EchoResponse, dissection
     28 h = "3333333333332222222222228100e384080045fc002fd6d70000f21180d40a2a00010a2a0002084b084b001b00004002000f000001000300010001020002001000731cd7c5"
     29 gtp = Ether(hex_bytes(h))
     30 gtp.gtp_type == 2
     31 
     32 = GTPV2ModifyBearerRequest, dissection
     33 h = "3333333333332222222222228100a384080045b8004300000000fc1185350a2a00010a2a00027a76084b002f6c344822002392e9e1143652540052000100065d00120049000100055700090080000010927f000002ac79a28e"
     34 gtp = Ether(hex_bytes(h))
     35 gtp.gtp_type == 34
     36 
     37 = IE_IMSI, dissection
     38 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd00000000661759000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100235700090385000010927f00000250001600580700000000000000000000000000000000000000007200020040005311004c"
     39 gtp = Ether(hex_bytes(h))
     40 ie = gtp.IE_list[0]
     41 ie.IMSI == b"2080112345670000"
     42 
     43 = IE_IMSI, basic instantiation
     44 ie = IE_IMSI(ietype='IMSI', length=8, IMSI='2080112345670000')
     45 ie.ietype == 1 and ie.IMSI == b'2080112345670000'
     46 
     47 = IE_Cause, dissection
     48 h = "3333333333332222222222228100838408004588004a00000000fd1193160a2a00010a2a0002084b824600366a744823002a45e679235ea151000200020010005d001800490001006c0200020010005700090081000010927f000002558d3b69"
     49 gtp = Ether(hex_bytes(h))
     50 ie = gtp.IE_list[0]
     51 ie.Cause == 16
     52 
     53 = IE_Cause, basic instantiation
     54 ie = IE_Cause(
     55     ietype='Cause', length=2, Cause='Request Accepted', PCE=1, BCE=0, CS=0)
     56 ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 1 and ie.BCE == 0 and ie.CS == 0
     57 
     58 = IE_Cause, basic instantiation 2
     59 ie = IE_Cause(
     60     ietype='Cause', length=2, Cause='Request Accepted', PCE=0, BCE=1, CS=0)
     61 ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 0 and ie.BCE == 1 and ie.CS == 0
     62 
     63 = IE_Cause, basic instantiation 3
     64 ie = IE_Cause(
     65     ietype='Cause', length=2, Cause='Request Accepted', PCE=0, BCE=0, CS=1)
     66 ie.ietype == 2 and ie.Cause == 16 and ie.PCE == 0 and ie.BCE == 0 and ie.CS == 1
     67 
     68 = IE_RecoveryRestart, dissection
     69 h = "3333333333332222222222228100838408004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e400100095e4b1f00030001000daa000000003f1f382f"
     70 gtp = Ether(hex_bytes(h))
     71 ie = gtp.IE_list[0]
     72 ie.ietype == 3 and ie.restart_counter == 13
     73 
     74 = IE_RecoveryRestart, basic instantiation
     75 ie = IE_RecoveryRestart(
     76     ietype='Recovery Restart', length=1, restart_counter=17)
     77 ie.ietype == 3 and ie.restart_counter == 17
     78 
     79 = IE_APN, dissection
     80 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
     81 gtp = Ether(hex_bytes(h))
     82 ie = gtp.IE_list[7]
     83 ie.APN == b'aaaaaaaaaaaaaaaaaaaaaaaaa'
     84 
     85 = IE_APN, basic instantiation
     86 ie = IE_APN(ietype='APN', length=26, APN='aaaaaaaaaaaaaaaaaaaaaaaaa')
     87 ie.ietype == 71 and ie.APN == b'aaaaaaaaaaaaaaaaaaaaaaaaa'
     88 
     89 = IE_AMBR, dissection
     90 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
     91 gtp = Ether(hex_bytes(h))
     92 ie = gtp.IE_list[11]
     93 ie.AMBR_Uplink == 5888 and ie.AMBR_Downlink == 42000
     94 
     95 = IE_AMBR, basic instantiation
     96 ie = IE_AMBR(
     97     ietype='AMBR', length=8, AMBR_Uplink=5888, AMBR_Downlink=42000)
     98 ie.ietype == 72 and ie.AMBR_Uplink == 5888 and ie.AMBR_Downlink == 42000
     99 
    100 = IE_EPSBearerID, dissection
    101 h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
    102 gtp = Ether(hex_bytes(h))
    103 ie = gtp.IE_list[2]
    104 ie.EBI == 50
    105 
    106 = IE_EPSBearerID, basic instantiation
    107 ie = IE_EPSBearerID(ietype='EPS Bearer ID', length=1, EBI=50)
    108 ie.ietype == 73 and ie.EBI == 50
    109 
    110 = IE_IPv4, dissection
    111 h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d84530d5a4cdee2000200020010004c00060011111111111149000100b248000800000061a8000249f07f000100005d00130049000100da0200020010005e00040039004f454a0004007f00000436f73a63"
    112 gtp = Ether(hex_bytes(h))
    113 ie = gtp.IE_list[6]
    114 ie.address == '127.0.0.4'
    115 
    116 = IE_IPv4, basic instantiation
    117 ie = IE_IPv4(ietype='IPv4', length=4, address='127.0.0.4')
    118 ie.ietype == 74 and ie.address == '127.0.0.4'
    119 
    120 = IE_MEI, dissection
    121 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    122 gtp = Ether(hex_bytes(h))
    123 ie = gtp.IE_list[1]
    124 ie.MEI == 123456
    125 
    126 = IE_MEI, basic instantiation
    127 ie = IE_MEI(ietype='MEI', length=1, MEI=123456)
    128 ie.ietype == 75 and ie.MEI == 123456
    129 
    130 = IE_MSISDN, dissection
    131 h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
    132 gtp = Ether(hex_bytes(h))
    133 ie = gtp.IE_list[1]
    134 ie.digits == b'111111111111'
    135 
    136 = IE_MSISDN, basic instantiation
    137 ie = IE_MSISDN(ietype='MSISDN', length=6, digits='111111111111')
    138 ie.ietype == 76 and ie.digits == b'111111111111'
    139 
    140 = IE_Indication, dissection
    141 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    142 gtp = Ether(hex_bytes(h))
    143 ie = gtp.IE_list[10]
    144 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
    145 
    146 = IE_Indication, basic instantiation
    147 ie = IE_Indication(ietype='Indication', length=8, PS=1, CPRAI=1)
    148 ie.ietype == 77 and ie.PS == 1 and ie.CPRAI == 1
    149 
    150 = IE_Indication, basic instantiation 2
    151 ie = IE_Indication(ietype='Indication', length=8, DTF=1, PPSI=1)
    152 ie.ietype == 77 and ie.DTF == 1 and ie.PPSI == 1
    153 
    154 = IE_PCO, dissection
    155 h = "333333333333222222222222810083840800458800a500000000fd1183bb0a2a00010a2a0002084b76a00091cf0b48210085bd574af24c68e300020002001000570009008b000010927f0000025700090187000010927f0000024f000500017f0000037f000100004e00220080000d040a2a0003000d040a2a00038021100300001081060a2a000483060a2a00045d00250049000100660200020010005700090081000010927f0000025700090285000010927f000002dd9f22c6"
    156 gtp = Ether(hex_bytes(h))
    157 ie = gtp.IE_list[5]
    158 ie.Protocols[0].address == '10.42.0.3'
    159 
    160 = IE_PCO, basic instantiation
    161 ie = IE_PCO(ietype='Protocol Configuration Options', length=8, Extension=1, PPP=3, Protocols=[
    162                    PCO_DNS_Server_IPv4(type='DNS Server IPv4 Address Request', length=4, address='10.42.0.3')])
    163 ie.Extension == 1 and ie.PPP == 3 and ie.Protocols[0].address == '10.42.0.3'
    164 
    165 = IE_PAA, dissection
    166 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    167 gtp = Ether(hex_bytes(h))
    168 ie = gtp.IE_list[9]
    169 ie.PDN_type == 1 and ie.ipv4 == '127.0.0.3'
    170 
    171 = IE_PAA, basic instantiation
    172 ie = IE_PAA(ietype='PAA', length=5, PDN_type='IPv4', ipv4='127.0.0.3')
    173 ie.ietype == 79 and ie.PDN_type == 1 and ie.ipv4 == '127.0.0.3'
    174 
    175 = IE_Bearer_QoS, dissection
    176 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    177 gtp = Ether(hex_bytes(h))
    178 ie = gtp.IE_list[12].IE_list[2]
    179 ie.MaxBitRateForUplink == 0 and ie.MaxBitRateForDownlink == 0 and ie.QCI == 7
    180 
    181 = IE_Bearer_QoS, basic instantiation
    182 ie = IE_Bearer_QoS(ietype='Bearer QoS', length=22, PCI=4, PriorityLevel=5, PVI=6, QCI=7,
    183                           MaxBitRateForUplink=1, MaxBitRateForDownlink=2, GuaranteedBitRateForUplink=3, GuaranteedBitRateForDownlink=4)
    184 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
    185 
    186 = IE_RAT, dissection
    187 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    188 gtp = Ether(hex_bytes(h))
    189 ie = gtp.IE_list[4]
    190 ie.RAT_type == 6
    191 
    192 = IE_RAT, basic instantiation
    193 ie = IE_RAT(ietype='RAT', length=1, RAT_type='EUTRAN')
    194 ie.ietype == 82 and ie.RAT_type == 6
    195 
    196 = IE_ServingNetwork, dissection
    197 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    198 gtp = Ether(hex_bytes(h))
    199 ie = gtp.IE_list[3]
    200 ie.MCC == b'234' and ie.MNC == b'02'
    201 
    202 = IE_ServingNetwork, basic instantiation
    203 ie = IE_ServingNetwork(
    204     ietype='Serving Network', length=3, MCC='234', MNC='02')
    205 ie.ietype == 83 and ie.MCC == b'234' and ie.MNC == b'02'
    206 
    207 = IE_ULI, dissection
    208 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    209 gtp = Ether(hex_bytes(h))
    210 ie = gtp.IE_list[2]
    211 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
    212 
    213 = IE_ULI, basic instantiation
    214 ie = IE_ULI(ietype='ULI', length=13, LAI_Present=0, ECGI_Present=1, TAI_Present=1, RAI_Present=0, SAI_Present=0,
    215                    CGI_Present=0, TAI=ULI_TAI(MCC='234', MNC='02', TAC=12345), ECGI=ULI_ECGI(MCC='234', MNC='02', ECI=123456))
    216 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
    217 
    218 = IE_FTEID, dissection
    219 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    220 gtp = Ether(hex_bytes(h))
    221 ie = gtp.IE_list[5]
    222 ie.GRE_Key == 4242 and ie.ipv4 == '127.0.0.2'
    223 
    224 = IE_FTEID, basic instantiation
    225 ie = IE_FTEID(ietype='F-TEID', length=9, ipv4_present=1,
    226                      InterfaceType=10, GRE_Key=0x1092, ipv4='127.0.0.2')
    227 ie.ietype == 87 and ie.ipv4_present == 1 and ie.InterfaceType == 10 and ie.GRE_Key == 0x1092 and ie.ipv4 == '127.0.0.2'
    228 
    229 = IE_BearerContext, dissection
    230 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    231 gtp = Ether(hex_bytes(h))
    232 ie = gtp.IE_list[12]
    233 len(ie.IE_list) == 3 and ie.IE_list[0].ietype == 73 and ie.IE_list[0].EBI == 229 and ie.IE_list[
    234     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
    235 
    236 = IE_BearerContext, basic instantiation
    237 ie = IE_BearerContext(ietype='Bearer Context', length=44, IE_list=[
    238                              IE_EPSBearerID(ietype='EPS Bearer ID', length=1, EBI=229)])
    239 ie.ietype == 93 and len(ie.IE_list) == 1 and ie.IE_list[
    240     0].ietype == 73 and ie.IE_list[0].EBI == 229
    241 
    242 = IE_ChargingID, dissection
    243 h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004da0316b4d96ac2c000200020010004c00060011111111111149000100c348000800000061a8000249f07f000100005d001300490001003f0200020010005e00040039004f454a0004007f00000436f73a63"
    244 gtp = Ether(hex_bytes(h))
    245 ie = gtp.IE_list[5].IE_list[2]
    246 ie.ChargingID == 956321605
    247 
    248 = IE_ChargingID, basic instantiation
    249 ie = IE_ChargingID(ietype='Charging ID', length=4, ChargingID=956321605)
    250 ie.ietype == 94 and ie.ChargingID == 956321605
    251 
    252 = IE_ChargingCharacteristics, dissection
    253 h = "3333333333332222222222228100a384080045b8011800000000fc1193150a2a00010a2a00027be5084b010444c4482000f82fd783953790a2000100080002081132547600004c0006001111111111114b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000800007f00010000480008000000c3500002e6304e001a008080211001000010810600000000830600000000000d00000a005d001f00490001000750001600190700000000000000000000000000000000000000007200020014005f0002000a008e80b09f"
    254 gtp = Ether(hex_bytes(h))
    255 ie = gtp.IE_list[18]
    256 ie.ChargingCharacteristric == 0xa00
    257 
    258 = IE_ChargingCharacteristics, basic instantiation
    259 ie = IE_ChargingCharacteristics(
    260     ietype='Charging Characteristics', length=2, ChargingCharacteristric=0xa00)
    261 ie.ietype == 95 and ie.ChargingCharacteristric == 0xa00
    262 
    263 = IE_PDN_type, dissection
    264 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    265 gtp = Ether(hex_bytes(h))
    266 ie = gtp.IE_list[8]
    267 ie.PDN_type == 1
    268 
    269 = IE_PDN_type, basic instantiation
    270 ie = IE_PDN_type(ietype='PDN Type', length=1, PDN_type='IPv4')
    271 ie.ietype == 99 and ie.PDN_type == 1
    272 
    273 = IE_UE_Timezone, dissection
    274 h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
    275 gtp = Ether(hex_bytes(h))
    276 ie = gtp.IE_list[13]
    277 ie.Timezone == 20 and ie.DST == 0
    278 
    279 = IE_UE_Timezone, basic instantiation
    280 ie = IE_UE_Timezone(ietype='UE Time zone', length=2, Timezone=20, DST=0)
    281 ie.ietype == 114 and ie.Timezone == 20 and ie.DST == 0
    282 
    283 = IE_UE_Timezone, basic instantiation
    284 ie = IE_UE_Timezone(ietype='UE Time zone', length=2, Timezone=20, DST=1)
    285 ie.ietype == 114 and ie.Timezone == 20 and ie.DST == 1
    286 
    287 = IE_Port_Number, dissection
    288 h = "00010203040800808e8f8ab608004500004100010000401169140b00019705000001ec45084b002da8524820001d00000000006e400001000700420061896453f44a0004005f1e1d737e0002004532"
    289 gtp = Ether(hex_bytes(h))
    290 ie = gtp.IE_list[2]
    291 ie.PortNumber == 17714
    292 
    293 = IE_Port_Number, basic instantiation
    294 ie = IE_Port_Number(
    295     ietype='Port Number', length=2, PortNumber=17714)
    296 ie.ietype == 126 and ie.PortNumber == 17714
    297 
    298 = IE_APN_Restriction, dissection
    299 h = "3333333333332222222222228100838408004580006d00000000f31180d20a2a00010a2a0002084b85930059e49a4823004d55819f6500ede7000200020010004c000600111111111111490001003248000800000061a8000249f07f000100005d001300490001000b0200020010005e00040039004f454a0004007f00000436f73a63"
    300 gtp = Ether(hex_bytes(h))
    301 ie = gtp.IE_list[4]
    302 ie.APN_Restriction == 0
    303 
    304 = IE_APN_Restriction, basic instantiation
    305 ie = IE_APN_Restriction(
    306     ietype='APN Restriction', length=1, APN_Restriction=0)
    307 ie.ietype == 127 and ie.APN_Restriction == 0
    308 
    309 = IE_SelectionMode, dissection
    310 h = "3333333333332222222222228100a384080045b8011800000000fc1193150a2a00010a2a00027be5084b010444c4482000f8093ca4cc47fa69000100080002081132547600004c0006001111111111114b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000800007f00010000480008000000c3500002e6304e001a008080211001000010810600000000830600000000000d00000a005d001f00490001004850001600190700000000000000000000000000000000000000007200020014005f0002000a008e80b09f"
    311 gtp = Ether(hex_bytes(h))
    312 ie = gtp.IE_list[9]
    313 ie.SelectionMode == 0
    314 
    315 = IE_SelectionMode, basic instantiation
    316 ie = IE_SelectionMode(
    317     ietype='Selection Mode', length=1, SelectionMode=4)
    318 ie.ietype == 128 and ie.SelectionMode == 4
    319 
    320 = IE_MMBR, dissection
    321 h = "3333333333332222222222228100838408004580014c97af0000f011830e0a2a00010a2a000282d5084b013876a74820012c29694a667f4a0b000100080002081132547600004c0006001111111111114b000800000000000001e24056000f000632f42030391a8532f42030391a855300030032f420520001000157001900c6000010927f0000020000000000000000000000000000fe8247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000000007f000100004800080000001640000052084e00200080c02306010000060000802110010000108106000000008306000000000005005d003c00490001006057001902c4000010927f0000020000000000000000000000000000fe825000160029080000000000000000000000000000000000000000720002006e005f0002000a00a10008000000164000005208e4701ad2"
    322 gtp = Ether(hex_bytes(h))
    323 ie = gtp.IE_list[18]
    324 ie.uplink_rate == 5696 and ie.downlink_rate == 21000
    325 
    326 = IE_MMBR, basic instantiation
    327 ie = IE_MMBR(ietype='Max MBR/APN-AMBR (MMBR)',
    328                     length=8, uplink_rate=5696, downlink_rate=21000)
    329 ie.ietype == 161 and ie.uplink_rate == 5696 and ie.downlink_rate == 21000
    330 
    331 = GTPHeader answers to not GTPHeader instance
    332 GTPHeader(gtp_type=2).answers(Ether()) == False
    333 
    334 = GTPHeader post_build
    335 gtp = GTPHeader(gtp_type="create_session_req") / ("X"*32)
    336 gtp.show2()
    337 
    338 = GTPHeader hashret
    339 req = GTPHeader(gtp_type="create_session_req") / ("X"*32)
    340 res = GTPHeader(gtp_type="create_session_res") / ("Y"*32)
    341 req.hashret() == res.hashret()
    342 
    343 = IE_NotImplementedTLV
    344 h = "333333333333222222222222810080c808004588002937dd0000fd1115490a2a00010a2a0002084b084b00152d0e4001000900000100ff0001000daa000000003f1f382f"
    345 gtp = Ether(hex_bytes(h))
    346 isinstance(gtp.IE_list[0], IE_NotImplementedTLV)
    347 
    348