Provide Add Path support for all AFI/SAFI
[bgpcep.git] / bgp / rib-impl / src / test / java / org / opendaylight / protocol / bgp / rib / impl / RouteUpdateKeyTest.java
index 2746507dcb43f6430f3148365c7cc4abe6ae1d4c..94b987f6875b08bc6b28db0f33b708df60e1aa9a 100644 (file)
@@ -11,31 +11,27 @@ package org.opendaylight.protocol.bgp.rib.impl;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.PEER_ID_QNAME;
 
-import com.google.common.collect.ImmutableMap;
+import com.google.common.primitives.UnsignedInteger;
 import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.protocol.bgp.rib.spi.RouterIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId;
 
 public class RouteUpdateKeyTest {
-    private static final PeerId PEER_ID = new PeerId("127.0.0.1");
-    private static final PeerId PEER_ID_2 = new PeerId("127.0.0.2");
-    private static final NodeIdentifierWithPredicates NIWP_PEER = new NodeIdentifierWithPredicates(Peer.QNAME,
-        ImmutableMap.of(PEER_ID_QNAME, PEER_ID.getValue()));
+    private static final UnsignedInteger PEER_ID = RouterIds.routerIdForPeerId(new PeerId("bgp://127.0.0.1"));
+    private static final UnsignedInteger PEER_ID_2 = RouterIds.routerIdForPeerId(new PeerId("bgp://127.0.0.2"));
+    private static final String PREFIX = "0.0.0.0/0";
+    private static final String PREFIX_2 = "1.1.1.1/24";
 
     @Test
     public void testRouteUpdateKey() {
-        final RouteUpdateKey rk = new RouteUpdateKey(PEER_ID, NIWP_PEER);
+        final RouteUpdateKey rk = new RouteUpdateKey(PEER_ID, PREFIX);
         assertEquals(PEER_ID, rk.getPeerId());
-        assertEquals(NIWP_PEER, rk.getRouteId());
-        assertTrue(rk.equals(new RouteUpdateKey(PEER_ID, NIWP_PEER)));
+        assertEquals(PREFIX, rk.getRouteId());
+        assertTrue(rk.equals(new RouteUpdateKey(PEER_ID, PREFIX)));
         assertTrue(rk.equals(rk));
         assertFalse(rk.equals(null));
-        assertFalse(rk.equals(new RouteUpdateKey(PEER_ID_2, NIWP_PEER)));
-        assertFalse(rk.equals(new RouteUpdateKey(PEER_ID, new NodeIdentifierWithPredicates(Peer.QNAME,
-            ImmutableMap.of(PEER_ID_QNAME, PEER_ID_2.getValue())))));
+        assertFalse(rk.equals(new RouteUpdateKey(PEER_ID_2, PREFIX)));
+        assertFalse(rk.equals(new RouteUpdateKey(PEER_ID_2, PREFIX_2)));
     }
-
 }
\ No newline at end of file