2 * Copyright (c) 2015 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 java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import com.google.common.cache.CacheBuilder;
14 import com.google.common.cache.CacheLoader;
15 import com.google.common.cache.LoadingCache;
16 import java.util.Collection;
17 import java.util.Collections;
18 import java.util.Optional;
19 import javax.annotation.Nonnull;
20 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
21 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
22 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
23 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.Update;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.UpdateBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1Builder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2Builder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlri;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlriBuilder;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlri;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlriBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutes;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.BgpRib;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisherBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.CNextHop;
54 import org.opendaylight.yangtools.yang.binding.ChildOf;
55 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
56 import org.opendaylight.yangtools.yang.binding.DataObject;
57 import org.opendaylight.yangtools.yang.binding.Identifiable;
58 import org.opendaylight.yangtools.yang.binding.Identifier;
59 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
60 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
61 import org.opendaylight.yangtools.yang.common.QName;
62 import org.opendaylight.yangtools.yang.common.QNameModule;
63 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
64 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
65 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
66 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
67 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
68 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
69 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
70 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
71 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
72 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
73 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
74 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
75 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
76 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
77 import org.slf4j.Logger;
78 import org.slf4j.LoggerFactory;
81 public abstract class AbstractRIBSupport<
82 C extends Routes & DataObject & ChoiceIn<Tables>,
83 S extends ChildOf<? super C>,
84 R extends Route & ChildOf<? super S> & Identifiable<I>,
85 I extends Identifier<R>>
86 implements RIBSupport<C, S, R, I> {
87 public static final String ROUTE_KEY = "route-key";
88 private static final Logger LOG = LoggerFactory.getLogger(AbstractRIBSupport.class);
89 private static final NodeIdentifier ADVERTISED_ROUTES = new NodeIdentifier(AdvertizedRoutes.QNAME);
90 private static final NodeIdentifier WITHDRAWN_ROUTES = new NodeIdentifier(WithdrawnRoutes.QNAME);
91 private static final NodeIdentifier DESTINATION_TYPE = new NodeIdentifier(DestinationType.QNAME);
92 private static final InstanceIdentifier<Tables> TABLES_II = InstanceIdentifier.create(BgpRib.class)
93 .child(Rib.class).child(LocRib.class).child(Tables.class);
94 private static final NodeIdentifier ROUTES = new NodeIdentifier(Routes.QNAME);
95 private static final ApplyRoute DELETE_ROUTE = new DeleteRoute();
96 // Instance identifier to table/(choice routes)/(map of route)
97 private final LoadingCache<YangInstanceIdentifier, YangInstanceIdentifier> routesPath = CacheBuilder.newBuilder()
98 .weakValues().build(new CacheLoader<YangInstanceIdentifier, YangInstanceIdentifier>() {
100 public YangInstanceIdentifier load(@Nonnull final YangInstanceIdentifier routesTablePaths) {
101 return routesTablePaths.node(routesContainerIdentifier()).node(routeQName());
104 private final NodeIdentifier routesContainerIdentifier;
105 private final NodeIdentifier routesListIdentifier;
106 private final NodeIdentifier routeAttributesIdentifier;
107 private final Class<C> cazeClass;
108 private final Class<S> containerClass;
109 private final Class<R> listClass;
110 private final ApplyRoute putRoute = new PutRoute();
111 private final MapEntryNode emptyTable;
112 private final QName routeQname;
113 private final Class<? extends AddressFamily> afiClass;
114 private final Class<? extends SubsequentAddressFamily> safiClass;
115 private final NodeIdentifier destinationNid;
116 private final QName pathIdQname;
117 private final NodeIdentifier pathIdNid;
118 private final QName routeKeyQname;
119 private final NodeIdentifier prefixTypeNid;
120 private final NodeIdentifier rdNid;
121 protected final BindingNormalizedNodeSerializer mappingService;
122 protected final YangInstanceIdentifier routeDefaultYii;
123 private final TablesKey tk;
126 * Default constructor. Requires the QName of the container augmented under the routes choice
127 * node in instantiations of the rib grouping. It is assumed that this container is defined by
128 * the same model which populates it with route grouping instantiation, and by extension with
129 * the route attributes container.
131 * @param mappingService Serialization service
132 * @param cazeClass Binding class of the AFI/SAFI-specific case statement, must not be null
133 * @param containerClass Binding class of the container in routes choice, must not be null.
134 * @param listClass Binding class of the route list, nust not be null;
135 * @param afiClass address Family Class
136 * @param safiClass SubsequentAddressFamily
137 * @param destContainerQname destination Container Qname
139 protected AbstractRIBSupport(
140 final BindingNormalizedNodeSerializer mappingService,
141 final Class<C> cazeClass,
142 final Class<S> containerClass,
143 final Class<R> listClass,
144 final Class<? extends AddressFamily> afiClass,
145 final Class<? extends SubsequentAddressFamily> safiClass,
146 final QName destContainerQname) {
147 final QNameModule module = BindingReflections.getQNameModule(cazeClass);
148 this.routesContainerIdentifier
149 = new NodeIdentifier(BindingReflections.findQName(containerClass).withModule(module));
150 this.routeAttributesIdentifier = new NodeIdentifier(Attributes.QNAME.withModule(module));
151 this.cazeClass = requireNonNull(cazeClass);
152 this.mappingService = requireNonNull(mappingService);
153 this.containerClass = requireNonNull(containerClass);
154 this.listClass = requireNonNull(listClass);
155 this.routeQname = BindingReflections.findQName(listClass).withModule(module);
156 this.routesListIdentifier = new NodeIdentifier(this.routeQname);
157 this.tk = new TablesKey(afiClass, safiClass);
158 this.emptyTable = (MapEntryNode) this.mappingService
159 .toNormalizedNode(TABLES_II, new TablesBuilder().withKey(tk)
160 .setRoutes(emptyRoutesCase())
161 .setAttributes(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib
162 .rev180329.rib.tables.AttributesBuilder().build()).build()).getValue();
163 this.afiClass = afiClass;
164 this.safiClass = safiClass;
165 this.destinationNid = new NodeIdentifier(destContainerQname);
166 this.pathIdQname = QName.create(routeQName(), "path-id").intern();
167 this.pathIdNid = new NodeIdentifier(this.pathIdQname);
168 this.routeKeyQname = QName.create(routeQName(), ROUTE_KEY).intern();
169 this.prefixTypeNid = NodeIdentifier.create(QName.create(destContainerQname, "prefix").intern());
170 this.rdNid = NodeIdentifier.create(QName.create(destContainerQname, "route-distinguisher").intern());
171 this.routeDefaultYii =
172 YangInstanceIdentifier.builder()
180 .node(BindingReflections.findQName(containerClass).withModule(module))
181 .node(this.routeQname)
182 .node(this.routeQname).build();
186 public final TablesKey getTablesKey() {
191 public final Class<C> routesCaseClass() {
192 return this.cazeClass;
196 public final Class<S> routesContainerClass() {
197 return this.containerClass;
201 public final Class<R> routesListClass() {
202 return this.listClass;
206 public final MapEntryNode emptyTable() {
207 return this.emptyTable;
210 public final QName routeQName() {
211 return this.routeQname;
214 protected final NodeIdentifier prefixNid() {
215 return this.prefixTypeNid;
218 protected final NodeIdentifier routeNid() {
219 return this.routesListIdentifier;
223 public final Class<? extends AddressFamily> getAfi() {
224 return this.afiClass;
228 public final Class<? extends SubsequentAddressFamily> getSafi() {
229 return this.safiClass;
233 * Build MpReachNlri object from DOM representation.
235 * @param routes Collection of MapEntryNode DOM representation of routes
236 * @param hop CNextHop as it was parsed from Attributes, to be included in MpReach object
237 * @return MpReachNlri
239 private MpReachNlri buildReach(final Collection<MapEntryNode> routes, final CNextHop hop) {
240 final MpReachNlriBuilder mb = new MpReachNlriBuilder();
241 mb.setAfi(this.getAfi());
242 mb.setSafi(this.getSafi());
244 mb.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(buildDestination(routes)).build());
249 * Build MpUnReachNlri object from DOM representation.
251 * @param routes Collection of MapEntryNode DOM representation of routes
252 * @return MpUnreachNlri
254 private MpUnreachNlri buildUnreach(final Collection<MapEntryNode> routes) {
255 final MpUnreachNlriBuilder mb = new MpUnreachNlriBuilder();
256 mb.setAfi(this.getAfi());
257 mb.setSafi(this.getSafi());
258 mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder()
259 .setDestinationType(buildWithdrawnDestination(routes)).build());
263 protected abstract DestinationType buildDestination(Collection<MapEntryNode> routes);
265 protected abstract DestinationType buildWithdrawnDestination(Collection<MapEntryNode> routes);
268 * Return the {@link NodeIdentifier} of the AFI/SAFI-specific container under
271 * @return Container identifier, may not be null.
273 protected final NodeIdentifier routesContainerIdentifier() {
274 return this.routesContainerIdentifier;
278 * Return the {@link NodeIdentifier} of the AFI/SAFI-specific container under
279 * the NLRI destination.
281 * @return Container identifier, may not be null.
283 private NodeIdentifier destinationContainerIdentifier() {
284 return this.destinationNid;
288 * Given the destination as ContainerNode, implementation needs to parse the DOM model
289 * from this point onward:
291 * {@code /bgp-mp:mp-unreach-nlri/bgp-mp:withdrawn-routes/bgp-mp:destination-type}
292 * and delete the routes from its RIBs.
294 * @param tx DOMDataWriteTransaction to be passed into implementation
295 * @param tablePath YangInstanceIdentifier to be passed into implementation
296 * @param destination ContainerNode DOM representation of NLRI in Update message
297 * @param routesNodeId NodeIdentifier
299 private void deleteDestinationRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
300 final ContainerNode destination, final NodeIdentifier routesNodeId) {
301 processDestination(tx, tablePath.node(routesNodeId), destination, null, DELETE_ROUTE);
305 * Given the destination as ContainerNode, implementation needs to parse the DOM model
306 * from this point onward:
308 * {@code /bgp-mp:mp-reach-nlri/bgp-mp:advertized-routes/bgp-mp:destination-type}
309 * and put the routes to its RIBs.
311 * @param tx DOMDataWriteTransaction to be passed into implementation
312 * @param tablePath YangInstanceIdentifier to be passed into implementation
313 * @param destination ContainerNode DOM representation of NLRI in Update message
314 * @param attributes ContainerNode to be passed into implementation
315 * @param routesNodeId NodeIdentifier
317 private void putDestinationRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
318 final ContainerNode destination, final ContainerNode attributes, final NodeIdentifier routesNodeId) {
319 processDestination(tx, tablePath.node(routesNodeId), destination, attributes, this.putRoute);
322 protected abstract void processDestination(DOMDataWriteTransaction tx, YangInstanceIdentifier routesPath,
323 ContainerNode destination, ContainerNode attributes, ApplyRoute applyFunction);
325 private static ContainerNode getDestination(final DataContainerChild<? extends PathArgument, ?> routes,
326 final NodeIdentifier destinationId) {
327 if (routes instanceof ContainerNode) {
328 final java.util.Optional<DataContainerChild<? extends PathArgument, ?>> maybeDestination =
329 ((ContainerNode) routes).getChild(DESTINATION_TYPE);
330 if (maybeDestination.isPresent()) {
331 final DataContainerChild<? extends PathArgument, ?> destination = maybeDestination.get();
332 if (destination instanceof ChoiceNode) {
333 final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRet =
334 ((ChoiceNode) destination).getChild(destinationId);
335 if (maybeRet.isPresent()) {
336 final DataContainerChild<? extends PathArgument, ?> ret = maybeRet.get();
337 if (ret instanceof ContainerNode) {
338 return (ContainerNode) ret;
341 LOG.debug("Specified node {} is not a container, ignoring it", ret);
343 LOG.debug("Specified container {} is not present in destination {}",
344 destinationId, destination);
347 LOG.warn("Destination {} is not a choice, ignoring it", destination);
350 LOG.debug("Destination is not present in routes {}", routes);
353 LOG.warn("Advertized routes {} are not a container, ignoring it", routes);
360 public final NodeIdentifier routeAttributesIdentifier() {
361 return this.routeAttributesIdentifier;
365 public final Collection<DataTreeCandidateNode> changedRoutes(final DataTreeCandidateNode routes) {
366 final DataTreeCandidateNode myRoutes = routes.getModifiedChild(this.routesContainerIdentifier);
367 if (myRoutes == null) {
368 return Collections.emptySet();
370 final DataTreeCandidateNode routesMap = myRoutes.getModifiedChild(routeNid());
371 if (routesMap == null) {
372 return Collections.emptySet();
374 // Well, given the remote possibility of augmentation, we should perform a filter here,
375 // to make sure the type matches what routeType() reports.
376 return routesMap.getChildNodes();
380 public final YangInstanceIdentifier routePath(
381 final YangInstanceIdentifier routesTablePaths, final PathArgument routeId) {
382 return routesYangInstanceIdentifier(routesTablePaths).node(routeId);
386 public final InstanceIdentifier<R> createRouteIdentifier(
387 final KeyedInstanceIdentifier<Tables, TablesKey> tableIId, final I key) {
389 return tableIId.child(routesCaseClass(), routesContainerClass()).child(routesListClass(), key);
393 public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
394 final ContainerNode nlri) {
395 deleteRoutes(tx, tablePath, nlri, ROUTES);
399 public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
400 final ContainerNode nlri, final ContainerNode attributes) {
401 putRoutes(tx, tablePath, nlri, attributes, ROUTES);
405 public final Update buildUpdate(final Collection<MapEntryNode> advertised, final Collection<MapEntryNode> withdrawn,
406 final Attributes attr) {
407 final UpdateBuilder ub = new UpdateBuilder();
408 final AttributesBuilder ab = new AttributesBuilder(attr);
409 final CNextHop hop = ab.getCNextHop();
411 LOG.debug("cnextHop before={}", hop);
412 // do not preserve next hop in attributes if we are using MpReach
413 ab.setCNextHop(null);
415 if (!advertised.isEmpty()) {
416 final MpReachNlri mb = buildReach(advertised, hop);
417 ab.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mb).build());
418 LOG.debug("mpreach nexthop={}", mb);
420 if (!withdrawn.isEmpty()) {
421 final MpUnreachNlri mb = buildUnreach(withdrawn);
422 ab.addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mb).build());
423 LOG.debug("mpunrach mb={}", mb);
426 ub.setAttributes(ab.build());
427 LOG.debug("update {}", ub.build());
432 @SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
433 public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
434 final ContainerNode nlri, final NodeIdentifier routesNodeId) {
435 final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(WITHDRAWN_ROUTES);
436 if (maybeRoutes.isPresent()) {
437 final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
438 if (destination != null) {
439 deleteDestinationRoutes(tx, tablePath, destination, routesNodeId);
442 LOG.debug("Withdrawn routes are not present in NLRI {}", nlri);
447 public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
448 final ContainerNode nlri, final ContainerNode attributes, final NodeIdentifier routesNodeId) {
449 final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(ADVERTISED_ROUTES);
450 if (maybeRoutes.isPresent()) {
451 final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
452 if (destination != null) {
453 putDestinationRoutes(tx, tablePath, destination, attributes, routesNodeId);
456 LOG.debug("Advertized routes are not present in NLRI {}", nlri);
460 private static final class DeleteRoute implements ApplyRoute {
462 public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
463 final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route,
464 final ContainerNode attributes) {
465 tx.delete(LogicalDatastoreType.OPERATIONAL, base.node(routeKey));
469 private final class PutRoute implements ApplyRoute {
471 public void apply(final DOMDataWriteTransaction tx, final YangInstanceIdentifier base,
472 final NodeIdentifierWithPredicates routeKey, final DataContainerNode<?> route,
473 final ContainerNode attributes) {
474 // Build the DataContainer data
475 final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> b =
476 ImmutableNodes.mapEntryBuilder();
477 b.withNodeIdentifier(routeKey);
479 route.getValue().forEach(b::withChild);
481 final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cb =
482 Builders.containerBuilder(attributes);
483 cb.withNodeIdentifier(routeAttributesIdentifier());
484 b.withChild(cb.build());
485 tx.put(LogicalDatastoreType.OPERATIONAL, base.node(routeKey), b.build());
489 protected final NodeIdentifier routePathIdNid() {
490 return this.pathIdNid;
493 protected final QName pathIdQName() {
494 return this.pathIdQname;
497 protected final QName routeKeyQName() {
498 return this.routeKeyQname;
501 protected final String extractPrefix(final DataContainerNode<? extends PathArgument> route) {
502 return (String) route.getChild(prefixTypeNid).get().getValue();
505 protected final RouteDistinguisher extractRouteDistinguisher(
506 final DataContainerNode<? extends PathArgument> route) {
507 if (route.getChild(this.rdNid).isPresent()) {
508 return RouteDistinguisherBuilder.getDefaultInstance((String) route.getChild(this.rdNid).get().getValue());
513 protected final YangInstanceIdentifier routesYangInstanceIdentifier(final YangInstanceIdentifier routesTablePaths) {
514 return this.routesPath.getUnchecked(routesTablePaths);