2 * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
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
8 package org.opendaylight.lispflowmapping.serializer.address;
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.lispflowmapping.lisp.serializer.address.LispAddressSerializer;
15 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.Ipv6BinaryAfi;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv6Binary;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
20 public class Ipv6SerializerTest {
23 public void constructor__Name() throws Exception {
24 Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:0");
26 assertEquals(Ipv6BinaryAfi.VALUE, rloc.getAddressType());
27 assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
28 assertArrayEquals(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
29 ((Ipv6Binary) rloc.getAddress()).getIpv6Binary().getValue());
33 public void constructor__Buffer() throws Exception {
34 Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1");
36 assertEquals(Ipv6BinaryAfi.VALUE, rloc.getAddressType());
37 assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
38 assertArrayEquals(new byte[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
39 ((Ipv6Binary) rloc.getAddress()).getIpv6Binary().getValue());