Migrate lisp-proto implementation to IETF YANG model
[lispflowmapping.git] / mappingservice / lisp-proto / src / test / java / org / opendaylight / lispflowmapping / serializer / address / Ipv6SerializerTest.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.address;
10
11 import static org.junit.Assert.assertEquals;
12
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;
20
21 public class Ipv6SerializerTest extends BaseTestCase {
22
23     @Test
24     public void constructor__Name() throws Exception {
25         Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:0");
26
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());
30     }
31
32     @Test
33     public void constructor__Buffer() throws Exception {
34         Rloc rloc = LispAddressUtil.asIpv6Rloc("0:0:0:0:0:0:0:1");
35
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());
39     }
40 }