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
8 package org.opendaylight.protocol.bgp.rib.spi;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNull;
12 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
14 import com.google.common.collect.ImmutableMap;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route;
20 public class AddPathRibSupportTest {
22 private static final String PREFIX = "1.2.3.4/32";
23 private static final String ROUTE_KEY = "prefix";
24 private static final NodeIdentifierWithPredicates QNAME
25 = new NodeIdentifierWithPredicates(Ipv4Route.QNAME,
26 ImmutableMap.of(QName.create(Ipv4Route.QNAME, ROUTE_KEY).intern(), PREFIX));
29 public void defaultAddPathRibSupport() {
30 final AddPathRibSupportLocalTest test = new AddPathRibSupportLocalTest();
31 assertEquals((Long) NON_PATH_ID, test.extractPathId(null));
32 assertNull(test.getRouteIdAddPath(NON_PATH_ID, null));
33 assertEquals(QNAME, test.createRouteKeyPathArgument(QNAME));
36 private static class AddPathRibSupportLocalTest implements AddPathRibSupport {