File: pim.uts

package info (click to toggle)
scapy 2.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,956 kB
  • sloc: python: 163,618; sh: 90; makefile: 11
file content (275 lines) | stat: -rw-r--r-- 17,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# PIM Related regression tests
# 
# Type the following command to launch start the tests:
# $ test/run_tests -P "load_contrib('pim')" -t test/contrib/pim.uts

+ pim

= PIMv2 Hello - instantiation

hello_data = b'\x01\x00^\x00\x00\r\x00\xd0\xcb\x00\xba\xe4\x08\x00E\xc0\x00BY\xf9\x00\x00\x01gTe\x15\x15\x15\x15\xe0\x00\x00\r \x00\xa55\x00\x01\x00\x02\x00i\x00\x13\x00\x04\x00\x00\x00\x00\x00\x02\x00\x04\x01\xf4\t\xc4\x00\x14\x00\x04\x00\x00\x00\x00'

hello_pkt = Ether(hello_data)

assert (hello_pkt[PIMv2Hdr].version == 2)
assert (hello_pkt[PIMv2Hdr].type == 0)
assert (len(hello_pkt[PIMv2Hello].option) == 4)
assert (hello_pkt[PIMv2Hello].option[0][PIMv2HelloHoldtime].type == 1)
assert (hello_pkt[PIMv2Hello].option[0][PIMv2HelloHoldtime].holdtime == 105)
assert (hello_pkt[PIMv2Hello].option[1][PIMv2HelloDRPriority].type == 19)
assert (hello_pkt[PIMv2Hello].option[1][PIMv2HelloDRPriority].dr_priority == 0)
assert (hello_pkt[PIMv2Hello].option[2][PIMv2HelloLANPruneDelay].type == 2)
assert (hello_pkt[PIMv2Hello].option[2][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].t == 0)
assert (hello_pkt[PIMv2Hello].option[2][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].propagation_delay == 500)
assert (hello_pkt[PIMv2Hello].option[2][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].override_interval == 2500)
assert (hello_pkt[PIMv2Hello].option[3][PIMv2HelloGenerationID].type == 20)

repr(PIMv2HelloLANPruneDelayValue(t=1))

= PIMv2 Join/Prune - instantiation

jp_data = b'\x01\x00^\x00\x00\r\x00\xd0\xcb\x00\xba\xe4\x08\x00E\xc0\x00rY\xfb\x00\x00\x01gT3\x15\x15\x15\x15\xe0\x00\x00\r#\x00\x1b\x18\x01\x00\x15\x15\x15\x16\x00\x04\x00\xd2\x01\x00\x00 \xef\x01\x01\x0b\x00\x01\x00\x00\x01\x00\x07 \x16\x16\x16\x15\x01\x00\x00 \xef\x01\x01\x0c\x00\x01\x00\x00\x01\x00\x07 \x16\x16\x16\x15\x01\x00\x00 \xef\x01\x01\x0b\x00\x00\x00\x01\x01\x00\x07 \x16\x16\x16\x15\x01\x00\x00 \xef\x01\x01\x0c\x00\x00\x00\x01\x01\x00\x07 \x16\x16\x16\x15'

jp_pkt = Ether(jp_data)

assert (jp_pkt[PIMv2Hdr].version == 2)
assert (jp_pkt[PIMv2Hdr].type == 3)
assert (jp_pkt[PIMv2JoinPrune].up_addr_family == 1)
assert (jp_pkt[PIMv2JoinPrune].up_encoding_type == 0)
assert (jp_pkt[PIMv2JoinPrune].up_neighbor_ip == "21.21.21.22")
assert (jp_pkt[PIMv2JoinPrune].reserved == 0)
assert (jp_pkt[PIMv2JoinPrune].num_group == 4)
assert (jp_pkt[PIMv2JoinPrune].holdtime == 210)
assert (jp_pkt[PIMv2JoinPrune].num_group == len(jp_pkt[PIMv2JoinPrune].jp_ips))
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].addr_family == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].encoding_type == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].bidirection == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].reserved == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].admin_scope_zone == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].mask_len == 32)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].gaddr == "239.1.1.11")
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].num_joins == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].num_joins == len(jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips))
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].addr_family == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].encoding_type == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].rsrvd == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].sparse == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].wildcard == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].rpt == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].mask_len == 32)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].src_ip == "22.22.22.21")
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].num_prunes == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[0].num_prunes == len(jp_pkt[PIMv2JoinPrune].jp_ips[0].prune_ips))
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].addr_family == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].encoding_type == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].bidirection == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].reserved == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].admin_scope_zone == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].mask_len == 32)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].gaddr == "239.1.1.11")
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].num_joins == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].num_joins == len(jp_pkt[PIMv2JoinPrune].jp_ips[2].join_ips))
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].num_prunes == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].num_prunes == len(jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips))
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].addr_family == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].encoding_type == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].rsrvd == 0)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].sparse == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].wildcard == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].rpt == 1)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].mask_len == 32)
assert (jp_pkt[PIMv2JoinPrune].jp_ips[2].prune_ips[0][PIMv2PruneAddrs].src_ip == "22.22.22.21")

= PIMv2 Hello - build

hello_delay_pkt = Ether(dst="01:00:5e:00:00:0d", src="00:d0:cb:00:ba:e4")/IP(version=4, ihl=5, tos=0xc0, id=23037, ttl=1, proto=103, src="21.21.21.21", dst="224.0.0.13")/\
                  PIMv2Hdr(version=2, type=0, reserved=0)/\
                  PIMv2Hello(option=[PIMv2HelloHoldtime(type=1, holdtime=105), PIMv2HelloDRPriority(type=19, dr_priority=0), 
                  PIMv2HelloLANPruneDelay(type=2, value=[PIMv2HelloLANPruneDelayValue(t=0, propagation_delay=500, override_interval=2500)]),
                  PIMv2HelloGenerationID(type=20, generation_id=459007194)])

assert raw(hello_delay_pkt) == b'\x01\x00^\x00\x00\r\x00\xd0\xcb\x00\xba\xe4\x08\x00E\xc0\x006Y\xfd\x00\x00\x01gTm\x15\x15\x15\x15\xe0\x00\x00\r \x00\xd3p\x00\x01\x00\x02\x00i\x00\x13\x00\x04\x00\x00\x00\x00\x00\x02\x00\x04\x01\xf4\t\xc4\x00\x14\x00\x04\x1b[\xe4\xda'

hello_refresh_pkt = Ether(dst="01:00:5e:00:00:0d", src="c2:01:52:72:00:00")/IP(version=4, ihl=5, tos=0xc0, id=121, ttl=1, proto=103, src="10.0.0.1", dst="224.0.0.13")/\
                    PIMv2Hdr(version=2, type=0, reserved=0)/\
                    PIMv2Hello(option=[PIMv2HelloHoldtime(type=1, holdtime=105), PIMv2HelloGenerationID(type=20, generation_id=3613938422),
                    PIMv2HelloDRPriority(type=19, dr_priority=1), 
                    PIMv2HelloStateRefresh(type=21, value=[PIMv2HelloStateRefreshValue(version=1, interval=0, reserved=0)])])

assert raw(hello_refresh_pkt) == b'\x01\x00^\x00\x00\r\xc2\x01Rr\x00\x00\x08\x00E\xc0\x006\x00y\x00\x00\x01g\xce\x1a\n\x00\x00\x01\xe0\x00\x00\r \x00\xb3\xeb\x00\x01\x00\x02\x00i\x00\x14\x00\x04\xd7hR\xf6\x00\x13\x00\x04\x00\x00\x00\x01\x00\x15\x00\x04\x01\x00\x00\x00'

= PIMv2 Join/Prune - build

join_pkt = Ether(dst="01:00:5e:00:00:0d", src="c2:02:3d:80:00:01")/IP(version=4, ihl=5, tos=0xc0, id=139, ttl=1, proto=103, src="10.0.0.14", dst="224.0.0.13")/\
           PIMv2Hdr(version=2, type=3, reserved=0)/\
           PIMv2JoinPrune(up_addr_family=1, up_encoding_type=0, up_neighbor_ip="10.0.0.13", reserved=0, num_group=1, holdtime=210,
           jp_ips=[PIMv2GroupAddrs(addr_family=1, encoding_type=0, bidirection=0, reserved=0, admin_scope_zone=0,
           mask_len=32, gaddr="239.123.123.123", 
           join_ips=[PIMv2JoinAddrs(addr_family=1, encoding_type=0, rsrvd=0, sparse=1, wildcard=1,
             rpt=1, mask_len=32, src_ip="1.1.1.1")], 
           prune_ips=[])
           ] )
     

assert raw(join_pkt) == b'\x01\x00^\x00\x00\r\xc2\x02=\x80\x00\x01\x08\x00E\xc0\x006\x00\x8b\x00\x00\x01g\xcd\xfb\n\x00\x00\x0e\xe0\x00\x00\r#\x00Z\xe5\x01\x00\n\x00\x00\r\x00\x01\x00\xd2\x01\x00\x00 \xef{{{\x00\x01\x00\x00\x01\x00\x07 \x01\x01\x01\x01'



prune_pkt = Ether(dst="01:00:5e:00:00:0d", src="c2:02:3d:80:00:01")/IP(version=4, ihl=5, tos=0xc0, id=139, ttl=1, proto=103, src="10.0.0.2", dst="224.0.0.13")/\
            PIMv2Hdr(version=2, type=3, reserved=0)/\
            PIMv2JoinPrune(up_addr_family=1, up_encoding_type=0, up_neighbor_ip="10.0.0.1", reserved=0, num_group=1, holdtime=210,
            jp_ips=[PIMv2GroupAddrs(addr_family=1, encoding_type=0, bidirection=0, reserved=0, admin_scope_zone=0,
             mask_len=32, gaddr="239.123.123.123",
             prune_ips=[PIMv2PruneAddrs(addr_family=1, encoding_type=0, rsrvd=0, sparse=0, wildcard=0, rpt=0,
             mask_len=32, src_ip="172.16.40.10")])
                                              ]
                                    )

assert raw(prune_pkt) == b'\x01\x00^\x00\x00\r\xc2\x02=\x80\x00\x01\x08\x00E\xc0\x006\x00\x8b\x00\x00\x01g\xce\x07\n\x00\x00\x02\xe0\x00\x00\r#\x00\x8f\xd8\x01\x00\n\x00\x00\x01\x00\x01\x00\xd2\x01\x00\x00 \xef{{{\x00\x00\x00\x01\x01\x00\x00 \xac\x10(\n'





####################################################################################
# IPv6 added
####################################################################################


= IPv6 PIMv2 Hello - instantiation

hello_data6 = b'33\x00\x00\x00\r\x02\x00\x00\x00\x00\x01\x86\xddk\x80\x00\x00\x008g\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xfe\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r \x00\xe4G\x00\x01\x00\x02\x00i\x00\x02\x00\x04\x01\xf4\t\xc4\x00\x13\x00\x04\x00\x00\x00\x01\x00\x14\x00\x04:I\x8b\xa3\x00\x18\x00\x12\x02\x00 \x01\xa7\xff@\n"\t\x00\x00\x00\x00\x00\x00\x00\x02'

hello_pkt6 = Ether(hello_data6)

assert (hello_pkt6[PIMv2Hdr].version == 2)
assert (hello_pkt6[PIMv2Hdr].type == 0)
assert (len(hello_pkt6[PIMv2Hello].option) == 5)
assert (hello_pkt6[PIMv2Hello].option[0][PIMv2HelloHoldtime].type == 1)
assert (hello_pkt6[PIMv2Hello].option[0][PIMv2HelloHoldtime].holdtime == 105)
assert (hello_pkt6[PIMv2Hello].option[1][PIMv2HelloLANPruneDelay].type == 2)
assert (hello_pkt6[PIMv2Hello].option[1][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].t == 0)
assert (hello_pkt6[PIMv2Hello].option[1][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].propagation_delay == 500)
assert (hello_pkt6[PIMv2Hello].option[1][PIMv2HelloLANPruneDelay].value[0][PIMv2HelloLANPruneDelayValue].override_interval == 2500)
assert (hello_pkt6[PIMv2Hello].option[2][PIMv2HelloDRPriority].type == 19)
assert (hello_pkt6[PIMv2Hello].option[2][PIMv2HelloDRPriority].dr_priority == 1)
assert (hello_pkt6[PIMv2Hello].option[3][PIMv2HelloGenerationID].type == 20)

repr(PIMv2HelloLANPruneDelayValue(t=1))

= IPv6 PIMv2 Join/Prune - instantiation

jp_data6join = b'33\x00\x00\x00\r\x02\x00\x00\x00\x00\x01\x86\xddk\x80\x00\x00\x00Fg\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xfe\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r#\x00\xc6X\x02\x00\xfe\x80\x00\x00\x00\x00\x00\x00\xfc\x87\xff\xff\xfe\x00\x01A\x00\x01\x00\xd2\x02\x00\x00\x80\xff>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x01\x00\x01\x00\x00\x02\x00\x04\x80$\x04\x80\x00\x00\x01\xf0\x01\x00\x00\x00\x00\x00\x00\x00\x01'

jp_pkt6 = Ether(jp_data6join)

assert (jp_pkt6[PIMv2Hdr].version == 2)
assert (jp_pkt6[PIMv2Hdr].type == 3)
assert (jp_pkt6[PIMv2JoinPrune].up_addr_family == 2)
assert (jp_pkt6[PIMv2JoinPrune].up_encoding_type == 0)
assert (jp_pkt6[PIMv2JoinPrune].up_neighbor_ip == 'fe80::fc87:ffff:fe00:141')
assert (jp_pkt6[PIMv2JoinPrune].reserved == 0)
assert (jp_pkt6[PIMv2JoinPrune].num_group == 1)
assert (jp_pkt6[PIMv2JoinPrune].holdtime == 210)
assert (jp_pkt6[PIMv2JoinPrune].num_group == len(jp_pkt6[PIMv2JoinPrune].jp_ips))
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].addr_family == 2)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].encoding_type == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].bidirection == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].reserved == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].admin_scope_zone == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].mask_len == 128)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].gaddr == 'ff3e::8000:1')
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_joins == 1)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_joins == len(jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips))
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].addr_family == 2)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].encoding_type == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].rsrvd == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].sparse == 1)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].wildcard == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].rpt == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].mask_len == 128)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips[0][PIMv2JoinAddrs].src_ip == '2404:8000:1:f001::1')
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_prunes == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_prunes == len(jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips))



jp_data6prune = b'33\x00\x00\x00\r\x02\x00\x00\x00\x00\x01\x86\xddk\x80\x00\x00\x00Fg\x01\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xfe\x00\x00\x01\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\r#\x00\xc6X\x02\x00\xfe\x80\x00\x00\x00\x00\x00\x00\xfc\x87\xff\xff\xfe\x00\x01A\x00\x01\x00\xd2\x02\x00\x00\x80\xff>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x01\x00\x00\x00\x01\x02\x00\x04\x80$\x04\x80\x00\x00\x01\xf0\x01\x00\x00\x00\x00\x00\x00\x00\x01'

jp_pkt6 = Ether(jp_data6prune)

assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].addr_family == 2)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].encoding_type == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].bidirection == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].reserved == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].admin_scope_zone == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].mask_len == 128)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].gaddr == 'ff3e::8000:1')
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_joins == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_joins == len(jp_pkt6[PIMv2JoinPrune].jp_ips[0].join_ips))
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_prunes == 1)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].num_prunes == len(jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips))
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].addr_family == 2)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].encoding_type == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].rsrvd == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].sparse == 1)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].wildcard == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].rpt == 0)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].mask_len == 128)
assert (jp_pkt6[PIMv2JoinPrune].jp_ips[0].prune_ips[0][PIMv2PruneAddrs].src_ip == '2404:8000:1:f001::1')




= IPv6 PIMv2 Hello - build

hello_delay_pkt6 = Ether(dst='33:33:00:00:00:0d', src='02:00:00:00:00:01')/ \
                   IPv6(tc=0xb8, nh=103, hlim=1, src='fe80::ff:fe00:1', dst='ff02::d')/ \
                   PIMv2Hdr()/ \
                   PIMv2Hello(option=[ \
                    PIMv2HelloHoldtime(holdtime=105),
                    PIMv2HelloLANPruneDelay(value=[PIMv2HelloLANPruneDelayValue(propagation_delay=500, override_interval=2500)]),
                    PIMv2HelloDRPriority(dr_priority=1),
                    PIMv2HelloGenerationID(generation_id=977898403),
                    PIMv2HelloAddrList(value=[PIMv2HelloAddrListValue(addr_family=2,prefix='2001:a7ff:400a:2209::2')]),
                  ])


assert raw(hello_delay_pkt6) == hello_data6 





= IPv6 PIMv2 Join/Prune - build

     
join_pkt6 = Ether(dst='33:33:00:00:00:0d', src='02:00:00:00:00:01')/\
           IPv6(tc=184, nh=103, hlim=1, src='fe80::ff:fe00:1', dst='ff02::d')/ \
           PIMv2Hdr(version=2, type=3, reserved=0)/ \
           PIMv2JoinPrune(jp_ips=[ \
             PIMv2GroupAddrs(join_ips=[
               PIMv2JoinAddrs(addr_family=2, sparse=1, wildcard=0, rpt=0, mask_len=128, src_ip='2404:8000:1:f001::1')],
               addr_family=2, admin_scope_zone=0, mask_len=128, gaddr='ff3e::8000:1',
               num_joins=1, num_prunes=0)],
             up_addr_family=2, up_neighbor_ip='fe80::fc87:ffff:fe00:141', num_group=1, holdtime=210)


assert raw(join_pkt6) == jp_data6join



prune_pkt6 = Ether(dst='33:33:00:00:00:0d', src='02:00:00:00:00:01')/ \
             IPv6(tc=184, nh=103, hlim=1, src='fe80::ff:fe00:1', dst='ff02::d')/ \
             PIMv2Hdr()/ \
             PIMv2JoinPrune(jp_ips=[ \
               PIMv2GroupAddrs(prune_ips=[ \
                 PIMv2PruneAddrs(addr_family=2, sparse=1, wildcard=0, rpt=0, mask_len=128, src_ip='2404:8000:1:f001::1')],
               addr_family=2, mask_len=128, gaddr='ff3e::8000:1',
               num_joins=0, num_prunes=1)],
               up_addr_family=2, up_neighbor_ip='fe80::fc87:ffff:fe00:141', num_group=1, holdtime=210)


assert raw(prune_pkt6) == jp_data6prune