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
9 package org.opendaylight.lispflowmapping.serializer.address;
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.lispflowmapping.tools.junit.BaseTestCase;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.Ipv6Afi;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
21 public class Ipv6SerializerTest extends BaseTestCase {
24 public void constructor__Name() throws Exception {
25 Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:0");
27 assertEquals(Ipv6Afi.class, rloc.getAddressType());
28 assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
29 assertEquals("0:0:0:0:0:0:0:0", ((Ipv6) rloc.getAddress()).getIpv6().getValue());
33 public void constructor__Buffer() throws Exception {
34 Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1");
36 assertEquals(Ipv6Afi.class, rloc.getAddressType());
37 assertEquals(18, LispAddressSerializer.getInstance().getAddressSize(rloc));
38 assertEquals("0:0:0:0:0:0:0:1", ((Ipv6) rloc.getAddress()).getIpv6().getValue());