2 * Copyright (c) 2016 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
9 package org.opendaylight.protocol.bgp.rib.spi;
11 import static org.junit.Assert.assertEquals;
13 import com.google.common.primitives.UnsignedInteger;
14 import org.junit.Test;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId;
18 public class RouterIdsTest {
20 private UnsignedInteger unsignedRouterId = UnsignedInteger.valueOf(707406378);
21 private PeerId peerID = new PeerId("bgp://42.42.42.42");
24 public void testRouterIdForAddress() throws Exception {
25 assertEquals(this.unsignedRouterId, RouterIds.routerIdForAddress("42.42.42.42"));
29 public void testRouterIdForPeerId() throws Exception {
30 assertEquals(this.unsignedRouterId, RouterIds.routerIdForPeerId(this.peerID));
34 public void testCreatePeerId() throws Exception {
35 assertEquals(this.peerID, RouterIds.createPeerId(new Ipv4Address("42.42.42.42")));
39 public void testCreatePeerId1() throws Exception {
40 assertEquals(this.peerID, RouterIds.createPeerId(this.unsignedRouterId));