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