Merge "Switch IP prefix (de)serialization to binary"
[lispflowmapping.git] / mappingservice / lisp-proto / src / test / java / org / opendaylight / lispflowmapping / serializer / MapNotifySerializationTest.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.lispflowmapping.serializer;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertFalse;
13 import static org.junit.Assert.assertTrue;
14
15 import java.nio.ByteBuffer;
16 import java.util.ArrayList;
17
18 import junitx.framework.ArrayAssert;
19
20 import org.junit.Test;
21 import org.opendaylight.lispflowmapping.lisp.serializer.MapNotifySerializer;
22 import org.opendaylight.lispflowmapping.lisp.serializer.exception.LispSerializationException;
23 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
24 import org.opendaylight.lispflowmapping.lisp.util.MaskUtil;
25 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder;
34
35 public class MapNotifySerializationTest extends BaseTestCase {
36
37     @Test
38     public void serialize__Fields() throws Exception {
39         MapNotifyBuilder mnBuilder = new MapNotifyBuilder();
40         mnBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
41         mnBuilder.getMappingRecordItem().add(
42                 new MappingRecordItemBuilder().setMappingRecord(
43                         new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.1/32")).build())
44                         .build());
45         mnBuilder.getMappingRecordItem().add(
46                 new MappingRecordItemBuilder().setMappingRecord(
47                         new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.73/32")).build())
48                         .build());
49
50         mnBuilder.setNonce(6161616161L);
51         mnBuilder.setKeyId((short) 0x0001);
52         byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88,
53                 (byte) 0x2d, (byte) 0x4d, (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64,
54                 (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba, (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
55         mnBuilder.setAuthenticationData(authenticationData);
56
57         ByteBuffer bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
58         assertHexEquals((byte) 0x40, bb.get()); // Type + MSByte of reserved
59         assertEquals(0, bb.getShort()); // Rest of reserved
60         assertEquals(2, bb.get()); // Record Count
61         assertEquals(6161616161L, bb.getLong()); // Nonce
62         assertHexEquals((short) 0x0001, bb.getShort()); // Key ID
63         assertEquals(authenticationData.length, bb.getShort());
64
65         byte[] actualAuthenticationData = new byte[20];
66         bb.get(actualAuthenticationData);
67         ArrayAssert.assertEquals(authenticationData, actualAuthenticationData);
68
69         bb.position(bb.position() + 12); /* EID in first record */
70         assertEquals(0x1, bb.getInt());
71
72         bb.position(bb.position() + 12); /* EID in second record */
73         assertEquals(73, bb.getInt());
74
75         assertEquals(bb.position(), bb.capacity());
76     }
77
78     @Test
79     public void serialize__deserialize() throws Exception {
80         MapNotifyBuilder mnBuilder = new MapNotifyBuilder();
81         mnBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
82         mnBuilder.getMappingRecordItem().add(
83                 new MappingRecordItemBuilder().setMappingRecord(
84                         new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.1/32")).build())
85                         .build());
86         mnBuilder.getMappingRecordItem().add(
87                 new MappingRecordItemBuilder().setMappingRecord(
88                         new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.73/32")).build())
89                         .build());
90
91         mnBuilder.setNonce(6161616161L);
92         mnBuilder.setKeyId((short) 0x0001);
93         byte[] authenticationData = new byte[] { (byte) 0x16, (byte) 0x98, (byte) 0x96, (byte) 0xeb, (byte) 0x88,
94                 (byte) 0x2d, (byte) 0x4d, (byte) 0x22, (byte) 0xe5, (byte) 0x8f, (byte) 0xe6, (byte) 0x89, (byte) 0x64,
95                 (byte) 0xb9, (byte) 0x17, (byte) 0xa4, (byte) 0xba, (byte) 0x4e, (byte) 0x8c, (byte) 0x41 };
96         mnBuilder.setAuthenticationData(authenticationData);
97
98         MapNotify mn = mnBuilder.build();
99         ArrayAssert.assertEquals(MapNotifySerializer.getInstance().serialize(mn).array(),
100                 MapNotifySerializer.getInstance().serialize(MapNotifySerializer.getInstance()
101                         .deserialize(MapNotifySerializer.getInstance().serialize(mn))).array());
102
103     }
104
105     @Test
106     public void deserialize__AllFields() throws Exception {
107         // LISP(Type = 4 Map-Notify, I=1
108         // Record Counter: 1
109         // Nonce: (something)
110         // Key ID: 0x0000
111         // AuthDataLength: 00 Data:
112         // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
113         // No-Action
114         // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
115         // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
116         // xTR-ID 1
117         // Site-ID 1
118         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("48 00 00 01 FF BB "
119                 + "00 00 00 00 00 00 00 00 00 00 00 00 "
120                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
121                 + "ff 00 00 05 00 01 c0 a8 88 0a "
122                 + "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 " // xTR-ID
123                 + "00 00 00 00 00 00 00 01 " // Site-ID
124                 ));
125
126
127         assertTrue(mn.isXtrSiteIdPresent());
128
129         assertEquals(1, mn.getMappingRecordItem().size());
130         assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
131         assertEquals(0x0000, mn.getKeyId().shortValue());
132         byte[] expectedAuthenticationData = {};
133         ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
134     }
135
136     @Test
137     public void serialize__NoAuthenticationData() throws Exception {
138         MapNotifyBuilder mnBuilder = new MapNotifyBuilder();
139         mnBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
140         mnBuilder.getMappingRecordItem().add(
141                 new MappingRecordItemBuilder().setMappingRecord(
142                         new MappingRecordBuilder().setEid(LispAddressUtil.asIpv4PrefixEid("0.0.0.1/32"))
143                         .setRecordTtl(55).build()).build());
144
145         ByteBuffer bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
146         bb.position(bb.position() + 14); // jump to AuthenticationDataLength
147         assertEquals(0, bb.getShort());
148         assertEquals(55, bb.getInt());
149
150         mnBuilder.setAuthenticationData(null);
151
152         bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
153         bb.position(bb.position() + 14); // jump to AuthenticationDataLength
154         assertEquals(0, bb.getShort());
155         assertEquals(55, bb.getInt());
156
157         mnBuilder.setAuthenticationData(new byte[0]);
158
159         bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
160         bb.position(bb.position() + 14); // jump to AuthenticationDataLength
161         assertEquals(0, bb.getShort());
162         assertEquals(55, bb.getInt());
163     }
164
165     @Test
166     public void serialize__NoPrefixInEidToLocator() throws Exception {
167         MapNotifyBuilder mnBuilder = new MapNotifyBuilder();
168         mnBuilder.setMappingRecordItem(new ArrayList<MappingRecordItem>());
169         mnBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(
170                 new MappingRecordBuilder().build()).build());
171         mnBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord
172                 (new MappingRecordBuilder().setEid(null).build()).build());
173         mnBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(
174                 new MappingRecordBuilder().setEid(LispAddressUtil.getNoAddressEid()).build()).build());
175
176         ByteBuffer bb = MapNotifySerializer.getInstance().serialize(mnBuilder.build());
177         bb.position(bb.position() + 16); // jump to first record prefix AFI
178         assertEquals(0, bb.getShort());
179
180         bb.position(bb.position() + 10); // jump to second record prefix AFI
181         assertEquals(0, bb.getShort());
182
183         bb.position(bb.position() + 10); // jump to third record prefix AFI
184         assertEquals(0, bb.getShort());
185     }
186
187     @Test
188     public void deserialize__MultipleRecords() throws Exception {
189         // LISP(Type = 4 Map-Notify, I=1
190         // Record Counter: 4
191         // EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
192         // 150.16.254.1
193         // Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
194         // 192.168.136.13
195         //
196         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 "
197                 + "04 " // Record count
198                 + "FF BB 00 00 00 00 00 00 00 01 00 14 87 c1 33 cd "
199                 + "d1 1e bc 80 fd 3e 71 11 81 17 40 74 26 25 44 bd "
200                 + "00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " // Record
201                 // 1
202                 + "ff 00 00 05 00 01 c0 a8 88 0a " // contd
203                 + "00 00 00 0a 01 20 10 00 00 00 00 01 98 10 fe 01 01 64 " // Record
204                 // 2
205                 + "ff 00 00 05 00 01 c0 a8 88 0b " // contd
206                 + "00 00 00 0a 01 20 10 00 00 00 00 01 97 10 fe 01 01 64 " // Record
207                 // 3
208                 + "ff 00 00 05 00 01 c0 a8 88 0c " // contd
209                 + "00 00 00 0a 01 20 10 00 00 00 00 01 96 10 fe 01 01 64 " // Record
210                 // 4
211                 + "ff 00 00 05 00 01 c0 a8 88 0d " // contd
212         ));
213
214         assertEquals(4, mn.getMappingRecordItem().size());
215         assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("153.16.254.1/32"), mn.getMappingRecordItem().get(0)
216                 .getMappingRecord().getEid());
217         assertEquals(LispAddressUtil.asIpv4PrefixBinaryEid("151.16.254.1/32"), mn.getMappingRecordItem().get(2)
218                 .getMappingRecord().getEid());
219         assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.11"), mn.getMappingRecordItem().get(1)
220                 .getMappingRecord().getLocatorRecord().get(0).getRloc());
221         assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.13"), mn.getMappingRecordItem().get(3)
222                 .getMappingRecord().getLocatorRecord().get(0).getRloc());
223     }
224
225     @Test
226     public void deserialize__Locators() throws Exception {
227         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 01 01 "
228                 + "FF BB 00 00 00 00 00 00 00 01 00 14 f1 b8 ab f0 "
229                 + "66 bb 2e ef 12 70 74 46 6f 6b 8e ca bf 1e 68 40 "
230                 + "00 00 00 0a "
231                 + "03 " // Locator Count
232                 + "20 10 00 00 00 00 01 99 10 fe 01 "
233                 // Locator 1
234                 + "01 64 1f 00 " // priorities + weights
235                 + "00 05 " // Flags
236                 + "00 01 c0 a8 88 0a " // Locator
237                 // Locator 2
238                 + "67 00 30 34 " // priorities + weights
239                 + "00 02 " // Flags
240                 + "00 01 cc aa AA 11 " // Locator
241                 // Locator 3
242                 + "60 11 34 A4 " // priorities + weights
243                 + "00 03 " // Flags
244                 + "00 01 c0 a8 88 0a " // Locator
245         ));
246
247         assertEquals(1, mn.getMappingRecordItem().size());
248         MappingRecordItem eidToLocator = mn.getMappingRecordItem().get(0);
249         assertEquals(3, eidToLocator.getMappingRecord().getLocatorRecord().size());
250         LocatorRecord loc0 = eidToLocator.getMappingRecord().getLocatorRecord().get(0);
251         LocatorRecord loc1 = eidToLocator.getMappingRecord().getLocatorRecord().get(1);
252         LocatorRecord loc2 = eidToLocator.getMappingRecord().getLocatorRecord().get(2);
253         assertEquals((byte) 0x01, loc0.getPriority().byteValue());
254         assertEquals((byte) 0x67, loc1.getPriority().byteValue());
255         assertEquals((byte) 0x60, loc2.getPriority().byteValue());
256
257         assertEquals((byte) 0x64, loc0.getWeight().byteValue());
258         assertEquals((byte) 0x00, loc1.getWeight().byteValue());
259         assertEquals((byte) 0x11, loc2.getWeight().byteValue());
260
261         assertEquals((byte) 0x1F, loc0.getMulticastPriority().byteValue());
262         assertEquals((byte) 0x30, loc1.getMulticastPriority().byteValue());
263         assertEquals((byte) 0x34, loc2.getMulticastPriority().byteValue());
264
265         assertEquals((byte) 0x00, loc0.getMulticastWeight().byteValue());
266         assertEquals((byte) 0x34, loc1.getMulticastWeight().byteValue());
267         assertEquals((byte) 0xA4, loc2.getMulticastWeight().byteValue());
268
269         assertTrue(loc0.isLocalLocator());
270         assertFalse(loc1.isLocalLocator());
271         assertFalse(loc2.isLocalLocator());
272
273         assertFalse(loc0.isRlocProbed());
274         assertTrue(loc1.isRlocProbed());
275         assertTrue(loc2.isRlocProbed());
276
277         assertTrue(loc0.isRouted());
278         assertFalse(loc1.isRouted());
279         assertTrue(loc2.isRouted());
280
281         assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.10"), loc0.getRloc());
282         assertEquals(LispAddressUtil.asIpv4Rloc("204.170.170.17"), loc1.getRloc());
283     }
284
285     @Test
286     public void deserialize__SomeEidToLocatorFiels() throws Exception {
287         // LISP(Type = 4 Map-Notify, I=0
288         // Record Counter: 4
289         // EID prefixes: 153.16.254.1 -- 152.16.254.1 -- 151.16.254.1 --
290         // 150.16.254.1
291         // Local RLOCs: 192.168.136.10 -- 192.168.136.11 -- 192.168.136.12 --
292         // 192.168.136.13
293         //
294         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 "
295         //
296                 + "04 " // Record count
297                 + "FF BB 00 00 00 00 00 00 00 01 00 14 b9 cd 7b 89 " //
298                 + "65 c2 56 03 be dd 81 20 47 e5 c3 4f 56 02 e1 59 " //
299                 + "00 00 00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " // Record
300                 // 0
301                 + "ff 00 00 05 00 01 c0 a8 88 0a " // contd
302                 + "00 00 00 0b 01 17 50 00 01 11 00 01 98 10 fe 01 01 64 " // Record
303                 // 1
304                 + "ff 00 00 05 00 01 c0 a8 88 0b " // contd
305                 + "00 00 00 0c 01 20 00 00 02 22 00 01 97 10 fe 01 01 64 " // Record
306                 // 2
307                 + "ff 00 00 05 00 01 c0 a8 88 0c " // contd
308                 + "00 00 00 0d 01 20 20 00 03 33 00 01 96 10 fe 01 01 64 " // Record
309                 // 3
310                 + "ff 00 00 05 00 01 c0 a8 88 0d " // contd
311         ));
312
313         assertEquals(4, mn.getMappingRecordItem().size());
314
315         MappingRecord record0 = mn.getMappingRecordItem().get(0).getMappingRecord();
316         MappingRecord record1 = mn.getMappingRecordItem().get(1).getMappingRecord();
317         MappingRecord record2 = mn.getMappingRecordItem().get(2).getMappingRecord();
318         MappingRecord record3 = mn.getMappingRecordItem().get(3).getMappingRecord();
319
320         assertEquals(10, record0.getRecordTtl().intValue());
321         assertEquals(13, record3.getRecordTtl().intValue());
322
323         assertEquals(32, MaskUtil.getMaskForAddress(record0.getEid().getAddress()));
324         assertEquals(23, MaskUtil.getMaskForAddress(record1.getEid().getAddress()));
325
326         assertEquals(Action.NoAction, record0.getAction());
327         assertEquals(Action.SendMapRequest, record1.getAction());
328         assertEquals(Action.NoAction, record2.getAction());
329         assertEquals(Action.NativelyForward, record3.getAction());
330
331         assertTrue(record0.isAuthoritative());
332         assertTrue(record1.isAuthoritative());
333         assertFalse(record2.isAuthoritative());
334         assertFalse(record3.isAuthoritative());
335
336         assertEquals(0x000, record0.getMapVersion().shortValue());
337         assertEquals(0x111, record1.getMapVersion().shortValue());
338         assertEquals(0x222, record2.getMapVersion().shortValue());
339         assertEquals(0x333, record3.getMapVersion().shortValue());
340     }
341
342     @Test
343     public void deserialize__IllegalAction() throws Exception {
344         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 01 01 FF BB "
345                 + "00 00 00 00 00 00 00 01 00 14 ec 47 1e 53 25 91 "
346                 + "2f 68 10 75 13 dd 2c e8 6e 3c ac 94 ed e4 00 00 "
347                 + "00 0a 01 20 F0 00 00 00 00 01 99 10 fe 01 01 64 "
348                 + "ff 00 00 05 00 01 c0 a8 88 0a"));
349
350         assertEquals(1, mn.getMappingRecordItem().size());
351         assertEquals(Action.NoAction, mn.getMappingRecordItem().get(0).getMappingRecord().getAction());
352     }
353
354     @Test(expected = LispSerializationException.class)
355     public void deserialize_WrongAuthenticationLength() throws Exception {
356         // LISP(Type = 4 Map-Notify, I=0
357         // Record Counter: 1
358         // Nonce: (something)
359         // Key ID: 0x0000
360         // AuthDataLength: 20 Data:
361         // e8:f5:0b:c5:c5:f2:b0:21:27:a8:a5:68:89:ec
362         // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
363         // No-Action
364         // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
365         // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
366         //
367         MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("48 00 00 01 FF BB "
368                 + "00 00 00 00 00 00 00 00 00 14 e8 f5 0b c5 c5 f2 "
369                 + "b0 21 27 a8 21 a5 68 89 ec 00 00 "
370                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
371                 + "ff 00 00 05 00 01 c0 a8 88 0a"));
372     }
373
374     @Test
375     public void deserialize__SHA1() throws Exception {
376         // LISP(Type = 4 Map-Notify, I=0
377         // Record Counter: 1
378         // Nonce: (something)
379         // Key ID: 0x0001
380         // AuthDataLength: 20 Data:
381         // b2:dd:1a:25:c0:60:b1:46:e8:dc:6d:a6:ae:2e:92:92:a6:ca:b7:9d
382         // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
383         // No-Action
384         // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
385         // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
386         //
387         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 01 FF BB "
388                 + "00 00 00 00 00 00 00 01 00 14 2c 61 b9 c9 9a 20 "
389                 + "ba d8 f5 40 d3 55 6f 5f 6e 5a b2 0a bf b5 00 00 "
390                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
391                 + "ff 00 00 05 00 01 c0 a8 88 0a"));
392
393         assertFalse(mn.isXtrSiteIdPresent());
394
395         assertEquals(1, mn.getMappingRecordItem().size());
396         assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
397         assertEquals(0x0001, mn.getKeyId().shortValue());
398         byte[] expectedAuthenticationData = { (byte) 0x2c, (byte) 0x61, (byte) 0xb9, (byte) 0xc9, (byte) 0x9a,
399                 (byte) 0x20, (byte) 0xba, (byte) 0xd8, (byte) 0xf5, (byte) 0x40, (byte) 0xd3, (byte) 0x55, (byte) 0x6f,
400                 (byte) 0x5f, (byte) 0x6e, (byte) 0x5a, (byte) 0xb2, (byte) 0x0a, (byte) 0xbf, (byte) 0xb5 };
401         ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
402     }
403
404     @Test
405     public void deserialize__SHA256() throws Exception {
406         // LISP(Type = 4 Map-Notify, I=0
407         // Record Counter: 1
408         // Nonce: (something)
409         // Key ID: 0x0002
410         // AuthDataLength: 32 Data:
411         // 70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d 68 a5 bf 32 11 c9 7b
412         // 58 c4 b9 9f 06 11 23 b9 38
413         // EID prefix: 153.16.254.1/32 (EID=0x9910FE01), TTL: 10, Authoritative,
414         // No-Action
415         // Local RLOC: 192.168.136.10 (RLOC=0xC0A8880A), Reachable,
416         // Priority/Weight: 1/100, Multicast Priority/Weight: 255/0
417         //
418         MapNotify mn = MapNotifySerializer.getInstance().deserialize(hexToByteBuffer("40 00 00 01 FF BB "
419                 + "00 00 00 00 00 00 00 02 00 20 70 30 d4 c6 10 44 0d 83 be 4d bf fd a9 8c 57 6d 68 a5 bf 32 "
420                 + "11 c9 7b 58 c4 b9 9f 06 11 23 b9 38 00 00 "
421                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 "
422                 + "ff 00 00 05 00 01 c0 a8 88 0a"));
423
424         assertFalse(mn.isXtrSiteIdPresent());
425
426         assertEquals(1, mn.getMappingRecordItem().size());
427         assertEquals(0xFFBB000000000000L, mn.getNonce().longValue());
428         assertEquals(0x0002, mn.getKeyId().shortValue());
429         byte[] expectedAuthenticationData = { (byte) 0x70, (byte) 0x30, (byte) 0xd4, (byte) 0xc6, (byte) 0x10,
430                 (byte) 0x44, (byte) 0x0d, (byte) 0x83, (byte) 0xbe, (byte) 0x4d, (byte) 0xbf, (byte) 0xfd, (byte) 0xa9,
431                 (byte) 0x8c, (byte) 0x57, (byte) 0x6d, (byte) 0x68, (byte) 0xa5, (byte) 0xbf, (byte) 0x32, (byte) 0x11,
432                 (byte) 0xc9, (byte) 0x7b, (byte) 0x58, (byte) 0xc4, (byte) 0xb9, (byte) 0x9f, (byte) 0x06, (byte) 0x11,
433                 (byte) 0x23, (byte) 0xb9, (byte) 0x38 };
434         ArrayAssert.assertEquals(expectedAuthenticationData, mn.getAuthenticationData());
435     }
436 }