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