blob: f30a2dc6b8a844433c05243647d392aedd08a13b [file] [log] [blame]
Shashikanth VHeca7cec2015-11-18 16:19:58 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Shashikanth VHeca7cec2015-11-18 16:19:58 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 * specific language governing permissions and limitations under the License.
12 */
13
14package org.onosproject.bgp.controller;
15
Priyanka Bfc51c952016-03-26 14:30:33 +053016import org.onosproject.bgpio.exceptions.BgpParseException;
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053017import org.onosproject.bgpio.protocol.BgpLSNlri;
Shashikanth VHeca7cec2015-11-18 16:19:58 +053018import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
mohamedrahil00f6f262016-11-24 20:20:41 +053019import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib;
20import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier;
21import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier;
22import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier;
Shashikanth VHeca7cec2015-11-18 16:19:58 +053023import org.onosproject.bgpio.types.RouteDistinguisher;
24
mohamedrahil00f6f262016-11-24 20:20:41 +053025import java.util.Map;
26
Shashikanth VHeca7cec2015-11-18 16:19:58 +053027/**
28 * Abstraction of BGP local RIB.
29 */
30public interface BgpLocalRib {
31
32 /**
33 * Add NLRI to local RIB.
34 *
35 * @param sessionInfo session info
36 * @param nlri network layer reach info
Priyanka Bfc51c952016-03-26 14:30:33 +053037 * @param details path attributes and NLRI information
38 * @throws BgpParseException while adding NLRI to local rib
Shashikanth VHeca7cec2015-11-18 16:19:58 +053039 */
Priyanka Bfc51c952016-03-26 14:30:33 +053040 void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) throws BgpParseException;
Shashikanth VHeca7cec2015-11-18 16:19:58 +053041
42 /**
43 * Removes NLRI identifier if it exists.
44 *
45 * @param nlri info
Priyanka Bfc51c952016-03-26 14:30:33 +053046 * @throws BgpParseException while deleting NLRI from local rib
Shashikanth VHeca7cec2015-11-18 16:19:58 +053047 */
Priyanka Bfc51c952016-03-26 14:30:33 +053048 void delete(BgpLSNlri nlri) throws BgpParseException;
Shashikanth VHeca7cec2015-11-18 16:19:58 +053049
50 /**
Ray Milkeyc108a6b2017-08-23 15:23:50 -070051 * Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI information mapped
Shashikanth VHeca7cec2015-11-18 16:19:58 +053052 * to respective route distinguisher.
53 *
54 * @param sessionInfo BGP session info
55 * @param nlri info
56 * @param details has pathattribute, protocol id and identifier
57 * @param routeDistinguisher unique for each VPN
Priyanka Bfc51c952016-03-26 14:30:33 +053058 * @throws BgpParseException while adding NLRI updation
Shashikanth VHeca7cec2015-11-18 16:19:58 +053059 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053060 void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details,
Priyanka Bfc51c952016-03-26 14:30:33 +053061 RouteDistinguisher routeDistinguisher) throws BgpParseException;
Shashikanth VHeca7cec2015-11-18 16:19:58 +053062
63 /**
64 * Removes VPN NLRI identifier mapped to route distinguisher if it exists.
65 *
66 * @param nlri info
67 * @param routeDistinguisher unique for each VPN
Priyanka Bfc51c952016-03-26 14:30:33 +053068 * @throws BgpParseException while deleting NLRI from local rib
Shashikanth VHeca7cec2015-11-18 16:19:58 +053069 */
Priyanka Bfc51c952016-03-26 14:30:33 +053070 void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException;
mohamedrahil00f6f262016-11-24 20:20:41 +053071
72 /**
73 * Returns node NLRI tree.
74 *
75 * @return node tree
76 */
77 Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib> nodeTree();
78
79 /**
80 * Returns link NLRI tree.
81 *
82 * @return link tree
83 */
84 Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib> linkTree();
85
86 /**
87 * Returns prefix NLRI tree.
88 *
89 * @return prefix tree
90 */
91 Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixTree();
92
93 /**
94 * Returns VPN node NLRI tree.
95 *
96 * @return vpn node NLRI tree
97 */
98 Map<RouteDistinguisher, Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnNodeTree();
99
100 /**
101 * Returns VPN link NLRI tree.
102 *
103 * @return vpn link NLRI Tree
104 */
105 Map<RouteDistinguisher, Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnLinkTree();
106
107 /**
108 * Returns VPN prefix NLRI tree.
109 *
110 * @return vpn prefix NLRI Tree
111 */
112 Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefixTree();
Shashikanth VHeca7cec2015-11-18 16:19:58 +0530113}