Use NormalizedNode.name() instead.
Change-Id: I3f566b3a24b87234a0c8344a98432be24977d197
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
checkArgument(buffer.readableBytes() == CONTENT_LENGTH,
"Wrong length of array of bytes. Passed: %s;", buffer.readableBytes());
- final EsiParser parser = this.handlers.getParser(EsiType.forValue(buffer.readByte()).getIntValue());
+ final EsiParser parser = handlers.getParser(EsiType.forValue(buffer.readByte()).getIntValue());
return parser == null ? null : parser.parseEsi(buffer.readSlice(ESI_LENGTH));
}
final Collection<DataContainerChild> value = esiChoice.body();
checkArgument(!value.isEmpty(), "ESI may not be empty");
final ContainerNode cont = (ContainerNode) Iterables.getOnlyElement(value);
- final EsiSerializer serializer = this.modelHandlers.get(cont.getIdentifier());
+ final EsiSerializer serializer = modelHandlers.get(cont.name());
if (serializer != null) {
return serializer.serializeEsi(cont);
}
@Override
public void serializeEsi(final Esi esi, final ByteBuf buffer) {
- final EsiSerializer serializer = this.handlers.getSerializer(esi.implementedInterface());
+ final EsiSerializer serializer = handlers.getSerializer(esi.implementedInterface());
if (serializer != null) {
serializer.serializeEsi(esi, buffer);
}
@SuppressFBWarnings(value = "NP_NONNULL_RETURN_VIOLATION", justification = "SB does not grok TYPE_USE")
public EvpnChoice parseEvpn(final NlriType type, final ByteBuf buffer) {
checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
- final EvpnParser parser = this.handlers.getParser(type.getIntValue());
+ final EvpnParser parser = handlers.getParser(type.getIntValue());
return parser == null ? null : parser.parseEvpn(buffer);
}
@Override
public ByteBuf serializeEvpn(final EvpnChoice evpn, final ByteBuf common) {
- final EvpnSerializer serializer = this.handlers.getSerializer(evpn.implementedInterface());
+ final EvpnSerializer serializer = handlers.getSerializer(evpn.implementedInterface());
return serializer == null ? common : serializer.serializeEvpn(evpn, common);
}
final Collection<DataContainerChild> value = evpnChoice.body();
checkArgument(!value.isEmpty(), "Evpn case is mandatyr, cannot be empty");
final ContainerNode cont = (ContainerNode) Iterables.getOnlyElement(value);
- final EvpnSerializer serializer = this.modelHandlers.get(cont.getIdentifier());
+ final EvpnSerializer serializer = modelHandlers.get(cont.name());
return serializer == null ? null : serializerInterface.check(serializer, cont);
}
}
return;
}
- final NamespaceSpecificIds ids = PATH_CACHE.getUnchecked(attributes.getIdentifier().getNodeType().getModule());
+ final NamespaceSpecificIds ids = PATH_CACHE.getUnchecked(attributes.name().getNodeType().getModule());
localPref = (Uint32) NormalizedNodes.findNode(attributes, ids.locPref)
.map(NormalizedNode::body)
.orElse(null);
final Peer fromPeer = entryDep.getPeerTracker().getPeer(fromPeerId);
final RIBSupport<?, ?> ribSupport = entryDep.getRIBSupport();
final BGPRouteEntryExportParameters routeEntry = new BGPRouteEntryExportParametersImpl(fromPeer, this,
- ribSupport.extractRouteKey(route.getIdentifier()), rtCache);
+ ribSupport.extractRouteKey(route.name()), rtCache);
final Attributes bindingAttrs = ribSupport.attributeFromContainerNode(attrs);
final Optional<Attributes> optExportAttrs = entryDep.getRoutingPolicies().applyExportPolicies(routeEntry,
final Builder<TablesKey, TableContext> tb) {
// We will use table keys very often, make sure they are optimized
final InstanceIdentifierBuilder idb = YangInstanceIdentifier.builder(newPeerPath
- .node(EMPTY_ADJRIBIN.getIdentifier()).node(TABLES_NID)).node(rs.getRibSupport().tablesKey());
+ .node(EMPTY_ADJRIBIN.name()).node(TABLES_NID)).node(rs.getRibSupport().tablesKey());
final TableContext ctx = new TableContext(rs, idb.build());
ctx.createEmptyTableStructure(tx);
}
tx.put(LogicalDatastoreType.OPERATIONAL, newPeerPath.node(PEER_TABLES).node(supTablesKey), tt.build());
rs.createEmptyTableStructure(tx,
- newPeerPath.node(EMPTY_ADJRIBOUT.getIdentifier()).node(TABLES_NID).node(tableKey));
+ newPeerPath.node(EMPTY_ADJRIBOUT.name()).node(TABLES_NID).node(tableKey));
}
private void createEmptyPeerStructure(final PeerId newPeerId,
synchronized (staleRoutesRegistry) {
final MapNode routesNode = (MapNode) routesOptional.orElseThrow();
final List<NodeIdentifierWithPredicates> routes = routesNode.body().stream()
- .map(MapEntryNode::getIdentifier)
+ .map(MapEntryNode::name)
.collect(Collectors.toList());
if (!routes.isEmpty()) {
staleRoutesRegistry.put(tablesKey, routes);
final Update update;
switch (route.getModificationType()) {
case UNMODIFIED:
- LOG.debug("Skipping unmodified route {}", route.getIdentifier());
+ LOG.debug("Skipping unmodified route {}", route.name());
return;
case DELETE:
case DISAPPEARED:
@Holding("this")
private void changeDataTree(final DOMDataTreeWriteTransaction tx, final YangInstanceIdentifier rootPath,
final DataTreeCandidateNode root, final DataTreeCandidateNode table) {
- final PathArgument lastArg = table.getIdentifier();
+ final PathArgument lastArg = table.name();
verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(),
rootPath);
final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
if (maybeRoutesAfter.isPresent()) {
final YangInstanceIdentifier routesPath = routeMapPath(ribSupport, effectiveTablePath);
for (MapEntryNode routeAfter : extractMap(maybeRoutesAfter).body()) {
- writeRoute(tx, ribSupport, routesPath.node(routeAfter.getIdentifier()), null, routeAfter,
- longLivedStale);
+ writeRoute(tx, ribSupport, routesPath.node(routeAfter.name()), null, routeAfter, longLivedStale);
}
}
}
if (RouteTargetConstrainSubsequentAddressFamily.VALUE.equals(ribSupport.getTablesKey().getSafi())) {
final YangInstanceIdentifier routesPath = routeMapPath(ribSupport, effectiveTablePath);
for (final MapEntryNode routeBefore : deletedRoutes) {
- deleteRouteTarget(ribSupport, routesPath.node(routeBefore.getIdentifier()), routeBefore);
+ deleteRouteTarget(ribSupport, routesPath.node(routeBefore.name()), routeBefore);
}
rtMembershipsUpdated = true;
}
private void processRoute(final DOMDataTreeWriteTransaction tx, final RIBSupport<?, ?> ribSupport,
final YangInstanceIdentifier routesPath, final DataTreeCandidateNode route, final boolean longLivedStale) {
- LOG.debug("Process route {}", route.getIdentifier());
- final YangInstanceIdentifier routePath = ribSupport.routePath(routesPath, route.getIdentifier());
+ LOG.debug("Process route {}", route.name());
+ final YangInstanceIdentifier routePath = ribSupport.routePath(routesPath, route.name());
switch (route.getModificationType()) {
case DELETE:
case DISAPPEARED:
private void updateRoutesEntries(final Collection<DataTreeCandidateNode> collection,
final RouterId routerId, final Map<RouteUpdateKey, RouteEntry<C, S>> routes) {
for (final DataTreeCandidateNode route : collection) {
- final PathArgument routeArg = route.getIdentifier();
+ final PathArgument routeArg = route.name();
if (!(routeArg instanceof NodeIdentifierWithPredicates routeId)) {
LOG.debug("Route {} already deleted", routeArg);
return;
if (ribSupport != null) {
final MapEntryNode emptyTable = ribSupport.emptyTable();
final InstanceIdentifierBuilder tableId = YangInstanceIdentifier
- .builder(yangRibId.node(LOCRIB_NID).node(TABLES_NID)).node(emptyTable.getIdentifier());
+ .builder(yangRibId.node(LOCRIB_NID).node(TABLES_NID)).node(emptyTable.name());
tx.put(LogicalDatastoreType.OPERATIONAL, tableId.build(), emptyTable);
try {
doReturn(emptyTable).when(ribSupport).emptyTable();
final NodeIdentifierWithPredicates niie = NodeIdentifierWithPredicates.of(Rib.QNAME,
QName.create("", "test").intern(), "t");
- doReturn(niie).when(emptyTable).getIdentifier();
+ doReturn(niie).when(emptyTable).name();
doReturn(domTx).when(domDataBroker).createMergingTransactionChain(any());
final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
doReturn(ImmutableClassToInstanceMap.of(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
this.attributes = attributes;
this.depreferenced = depreferenced;
this.isFirstBestPath = isFirstBestPath;
- this.addPathRouteKeyIdentifier = ribSupport.toAddPathListArgument(route.getIdentifier());
- this.nonAddPathRouteKeyIdentifier = ribSupport.toNonPathListArgument(addPathRouteKeyIdentifier);
+ addPathRouteKeyIdentifier = ribSupport.toAddPathListArgument(route.name());
+ nonAddPathRouteKeyIdentifier = ribSupport.toNonPathListArgument(addPathRouteKeyIdentifier);
}
public final PeerId getFromPeerId() {
- return this.fromPeerId;
+ return fromPeerId;
}
public final MapEntryNode getRoute() {
@Override
public final NodeIdentifierWithPredicates getAddPathRouteKeyIdentifier() {
- return route.getIdentifier();
+ return route.name();
}
}
import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
-import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.DestinationIpv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder;
private static final LeafNode<Boolean> ATTRIBUTES_UPTODATE_FALSE =
ImmutableNodes.leafNode(QName.create(BMP_ATTRIBUTES_QNAME, "uptodate").intern(), Boolean.FALSE);
private static final LeafNode<Boolean> ATTRIBUTES_UPTODATE_TRUE =
- ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.getIdentifier(), Boolean.TRUE);
+ ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.name(), Boolean.TRUE);
private final DOMTransactionChain chain;
private final Map<TablesKey, TableContext> tables;
final ImmutableMap.Builder<TablesKey, TableContext> tb = ImmutableMap.builder();
for (final TablesKey tableType : tableTypes) {
- final RIBSupport rs = ribExtensions.getRIBSupport(tableType);
+ final var rs = ribExtensions.getRIBSupport(tableType);
if (rs == null) {
LOG.warn("No support for table type {}, skipping it", tableType);
continue;
ctx.createTable(tx);
tx.put(LogicalDatastoreType.OPERATIONAL, ctx.getTableId().node(BMP_ATTRIBUTES_QNAME)
- .node(ATTRIBUTES_UPTODATE_FALSE.getIdentifier()), ATTRIBUTES_UPTODATE_FALSE);
+ .node(ATTRIBUTES_UPTODATE_FALSE.name()), ATTRIBUTES_UPTODATE_FALSE);
LOG.debug("Created table instance {}", ctx.getTableId());
tb.put(tableType, ctx);
}
final DOMDataTreeWriteTransaction tx = chain.newWriteOnlyTransaction();
final TableContext ctxPre = tables.get(tableTypes);
tx.merge(LogicalDatastoreType.OPERATIONAL, ctxPre.getTableId().node(BMP_ATTRIBUTES_QNAME)
- .node(ATTRIBUTES_UPTODATE_TRUE.getIdentifier()), ATTRIBUTES_UPTODATE_TRUE);
+ .node(ATTRIBUTES_UPTODATE_TRUE.name()), ATTRIBUTES_UPTODATE_TRUE);
tx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
final DOMDataTreeWriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
wtx.merge(LogicalDatastoreType.CONFIGURATION,
- YangInstanceIdentifier.create(new NodeIdentifier(OdlBmpMonitors.QNAME), monitorsList.getIdentifier()),
+ YangInstanceIdentifier.create(new NodeIdentifier(OdlBmpMonitors.QNAME), monitorsList.name()),
monitorsList);
return wtx.commit();
}
.withChild(ImmutableNodes.leafNode(NAME, GLOBAL_BGP_NAME))
.build());
wtx.merge(LogicalDatastoreType.CONFIGURATION,
- GLOBAL_BGP_PATH.node(Protocols.QNAME).node(protocols.getIdentifier()), protocols);
+ GLOBAL_BGP_PATH.node(Protocols.QNAME).node(protocols.name()), protocols);
return wtx.commit();
}
}
final DOMDataTreeWriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
LOG.info("Storing Topologies {}", topologies.body().stream()
- .map(topo -> topo.getIdentifier().asMap()).collect(Collectors.toList()));
+ .map(topo -> topo.name().asMap()).collect(Collectors.toList()));
wtx.merge(LogicalDatastoreType.CONFIGURATION,
- YangInstanceIdentifier.create(new NodeIdentifier(NetworkTopology.QNAME), topologies.getIdentifier()),
+ YangInstanceIdentifier.create(new NodeIdentifier(NetworkTopology.QNAME), topologies.name()),
topologies);
return wtx.commit();