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