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.impl;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertFalse;
13 import static org.junit.Assert.assertNotEquals;
15 import com.google.common.primitives.UnsignedInteger;
16 import org.junit.Test;
17 import org.opendaylight.protocol.bgp.rib.spi.RouterIds;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId;
20 public class RouteUpdateKeyTest {
21 private static final UnsignedInteger PEER_ID = RouterIds.routerIdForPeerId(new PeerId("bgp://127.0.0.1"));
22 private static final UnsignedInteger PEER_ID_2 = RouterIds.routerIdForPeerId(new PeerId("bgp://127.0.0.2"));
23 private static final String PREFIX = "0.0.0.0/0";
24 private static final String PREFIX_2 = "1.1.1.1/24";
27 public void testRouteUpdateKey() {
28 final RouteUpdateKey rk = new RouteUpdateKey(PEER_ID, PREFIX);
29 assertEquals(PEER_ID, rk.getPeerId());
30 assertEquals(PREFIX, rk.getRouteId());
31 assertEquals(rk, new RouteUpdateKey(PEER_ID, PREFIX));
33 assertFalse(rk.equals(null));
34 assertNotEquals(rk, new RouteUpdateKey(PEER_ID_2, PREFIX));
35 assertNotEquals(rk, new RouteUpdateKey(PEER_ID_2, PREFIX_2));