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
9 package org.opendaylight.protocol.bgp.rib.spi;
11 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
17 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20 * Interface implemented to be extended by RibSupport.
21 * This interface exposes methods to access to Add Path information
22 * By default we implement non supported Multiple Path therefore
23 * 0 Path Id is returned and null PathArgument
25 interface AddPathRibSupport {
27 * Extract PathId from route change received.
29 * @param normalizedNode Path Id Container
30 * @return pathId The path identifier value
32 default long extractPathId(@Nonnull NormalizedNode<?, ?> normalizedNode) {
37 * Construct a PathArgument to an AddPathRoute.
39 * @param pathId The path identifier
40 * @param routeId PathArgument leaf path
41 * @return routeId PathArgument + pathId or Null in case Add-path is not supported
44 default NodeIdentifierWithPredicates getRouteIdAddPath(long pathId, @Nonnull PathArgument routeId) {
49 * Create a new Path Argument for route Key removing remove Path Id from key.
50 * For extension which do not support Multiple Path this step is not required.
52 * @param routeKeyPathArgument routeKey Path Argument
53 * @return new route Key
56 NodeIdentifierWithPredicates createRouteKeyPathArgument(
57 @Nonnull NodeIdentifierWithPredicates routeKeyPathArgument) {
58 return routeKeyPathArgument;