<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-spec-util</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-common-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>util</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-api</artifactId>
public synchronized void instantiateServiceInstance(final DOMDataTreeChangeService dataTreeChangeService,
final DOMDataTreeIdentifier appPeerDOMId) {
setActive(true);
- final Set<TablesKey> localTables = rib.getLocalTablesKeys();
- localTables.forEach(tablesKey -> supportedTables.add(RibSupportUtils.toYangTablesKey(tablesKey)));
+ final var localTables = rib.getLocalTablesKeys();
+ for (var localTable : localTables) {
+ final var tableSupport = rib.getRibSupportContext().getRIBSupport(localTable);
+ if (tableSupport != null) {
+ supportedTables.add(tableSupport.tablesKey());
+ } else {
+ LOG.warn("Ignoring unsupported table {}", localTable);
+ }
+ }
setAdvertizedGracefulRestartTableTypes(List.of());
createDomChain();
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.rib.impl;
-
-import com.google.common.collect.ImmutableList;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
-import org.opendaylight.protocol.bgp.rib.spi.RIBQNames;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
-import org.opendaylight.yangtools.util.ImmutableOffsetMapTemplate;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-
-final class RibSupportUtils {
- private static final ImmutableOffsetMapTemplate<QName> AFI_SAFI_TEMPLATE =
- ImmutableOffsetMapTemplate.ordered(ImmutableList.of(RIBQNames.AFI_QNAME, RIBQNames.SAFI_QNAME));
-
- private RibSupportUtils() {
- // Hidden on purpose
- }
-
- /**
- * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}.
- *
- * @param tablesKey Tables key representing table.
- * @return NodeIdentifierWithPredicates of {@link Tables} for specified AFI, SAFI combination.
- */
- static NodeIdentifierWithPredicates toYangTablesKey(final TablesKey tablesKey) {
- return NodeIdentifierWithPredicates.of(Tables.QNAME, AFI_SAFI_TEMPLATE.instantiateWithValues(
- BindingReflections.getQName(tablesKey.getAfi()), BindingReflections.getQName(tablesKey.getSafi())));
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-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 java.util.Map;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.UnicastSubsequentAddressFamily;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-
-public class RibSupportUtilsTest {
- @Test
- public void testYangTablesKey() {
- final NodeIdentifierWithPredicates p = RibSupportUtils.toYangTablesKey(new TablesKey(Ipv4AddressFamily.VALUE,
- UnicastSubsequentAddressFamily.VALUE));
- final Map<QName, Object> m = p.asMap();
- assertFalse(m.isEmpty());
- assertEquals(Tables.QNAME, p.getNodeType());
- assertTrue(m.containsValue(Ipv4AddressFamily.QNAME));
- assertTrue(m.containsValue(UnicastSubsequentAddressFamily.QNAME));
- }
-}