Provide Add Path support for all AFI/SAFI
[bgpcep.git] / bgp / rib-spi / src / test / java / org / opendaylight / protocol / bgp / rib / spi / RouterIdsTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, 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.protocol.bgp.rib.spi;
10
11 import static org.junit.Assert.assertEquals;
12
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;
17
18 public class RouterIdsTest {
19
20     private UnsignedInteger unsignedRouterId = UnsignedInteger.valueOf(707406378);
21     private PeerId peerID = new PeerId("bgp://42.42.42.42");
22
23     @Test
24     public void testRouterIdForAddress() throws Exception {
25         assertEquals(this.unsignedRouterId, RouterIds.routerIdForAddress("42.42.42.42"));
26     }
27
28     @Test
29     public void testRouterIdForPeerId() throws Exception {
30         assertEquals(this.unsignedRouterId, RouterIds.routerIdForPeerId(this.peerID));
31     }
32
33     @Test
34     public void testCreatePeerId() throws Exception {
35         assertEquals(this.peerID, RouterIds.createPeerId(new Ipv4Address("42.42.42.42")));
36     }
37
38     @Test
39     public void testCreatePeerId1() throws Exception {
40         assertEquals(this.peerID, RouterIds.createPeerId(this.unsignedRouterId));
41     }
42 }