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.mode.impl.add.n.paths;
10 import com.google.common.primitives.UnsignedInteger;
11 import org.opendaylight.protocol.bgp.mode.api.BestPath;
12 import org.opendaylight.protocol.bgp.mode.impl.add.RouteKey;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
19 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
21 final class SimpleRouteEntry extends AbstractNPathsRouteEntry {
22 public SimpleRouteEntry(final Long nBestPaths) {
27 public boolean removeRoute(final UnsignedInteger routerId, final Long remotePathId) {
28 final RouteKey key = new RouteKey(routerId, remotePathId);
29 return removeRoute(key, getOffsets().offsetOf(key));
33 public MapEntryNode createValue(final PathArgument routeId, final BestPath path) {
34 final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> b = Builders.mapEntryBuilder();
35 b.withNodeIdentifier((NodeIdentifierWithPredicates) routeId);
36 b.addChild(path.getAttributes());
41 public int addRoute(final UnsignedInteger routerId, final Long remotePathId, final NodeIdentifier attributesIdentifier, final NormalizedNode<?, ?> data) {
42 return addRoute(new RouteKey(routerId, remotePathId), attributesIdentifier, data);