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.PathArgument;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 * Interface implemented to be extended by RibSupport.
20 * This interface exposes methods to access to Add Path information
21 * By default we implement non supported Multiple Path therefore
22 * 0 Path Id is returned and null PathArgument
24 interface AddPathRibSupport {
26 * Extract PathId from route change received.
28 * @param normalizedNode Path Id Container
29 * @return pathId The path identifier value
31 default Long extractPathId(@Nonnull NormalizedNode<?, ?> normalizedNode) {
36 * Construct a PathArgument to an AddPathRoute.
38 * @param pathId The path identifier
39 * @param routeId PathArgument leaf path
40 * @return routeId PathArgument + pathId or Null in case Add-path is not supported
43 default PathArgument getRouteIdAddPath(long pathId, @Nonnull PathArgument routeId) {
48 * Create a new Path Argument for route Key removing remove Path Id from key.
49 * For non extension which doesnt support Multiple Path this step is not required.
51 * @param routeKeyPathArgument routeKey Path Argument
52 * @return new route Key
54 default @Nonnull PathArgument createRouteKeyPathArgument(@Nonnull PathArgument routeKeyPathArgument) {
55 return routeKeyPathArgument;