2 * Copyright (c) 2013 Cisco Systems, 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.protocol.bgp.parser.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNull;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHop;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.c.next.hop.ipv6.next.hop._case.Ipv6NextHopBuilder;
20 public class IPv6NextHopTest {
21 private Ipv6NextHop nextHopA;
22 private Ipv6NextHop nextHopB;
26 this.nextHopA = new Ipv6NextHopBuilder().setGlobal(new Ipv6AddressNoZone("2001:db8:85a3:0:0:8a2e:370:7331"))
28 this.nextHopB = new Ipv6NextHopBuilder().setGlobal(new Ipv6AddressNoZone("2001:db8:85a3:0:0:8a2e:370:7331"))
29 .setLinkLocal(new Ipv6AddressNoZone("2001:db8:85a3:0:0:8a2e:370:0000")).build();
33 public void testGetGlobal() {
34 final Ipv6Address globalTestAddress = new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:7331");
36 assertEquals(this.nextHopA.getGlobal(), globalTestAddress);
37 assertEquals(this.nextHopB.getGlobal(), globalTestAddress);
41 public void testGetLinkLocal() {
42 final Ipv6Address localTestAddress = new Ipv6Address("2001:db8:85a3:0:0:8a2e:370:0000");
44 assertNull(this.nextHopA.getLinkLocal());
45 assertEquals(this.nextHopB.getLinkLocal(), localTestAddress);