Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 3 | * |
| 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 | |
| 14 | package org.onosproject.bgp.controller; |
| 15 | |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 16 | import org.onosproject.bgpio.exceptions.BgpParseException; |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 17 | import org.onosproject.bgpio.protocol.BgpLSNlri; |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 18 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 19 | import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib; |
| 20 | import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier; |
| 21 | import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier; |
| 22 | import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier; |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 23 | import org.onosproject.bgpio.types.RouteDistinguisher; |
| 24 | |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 25 | import java.util.Map; |
| 26 | |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 27 | /** |
| 28 | * Abstraction of BGP local RIB. |
| 29 | */ |
| 30 | public interface BgpLocalRib { |
| 31 | |
| 32 | /** |
| 33 | * Add NLRI to local RIB. |
| 34 | * |
| 35 | * @param sessionInfo session info |
| 36 | * @param nlri network layer reach info |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 37 | * @param details path attributes and NLRI information |
| 38 | * @throws BgpParseException while adding NLRI to local rib |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 39 | */ |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 40 | void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details) throws BgpParseException; |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Removes NLRI identifier if it exists. |
| 44 | * |
| 45 | * @param nlri info |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 46 | * @throws BgpParseException while deleting NLRI from local rib |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 47 | */ |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 48 | void delete(BgpLSNlri nlri) throws BgpParseException; |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 49 | |
| 50 | /** |
Ray Milkey | bd52a05 | 2017-08-23 15:23:50 -0700 | [diff] [blame] | 51 | * Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI information mapped |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 52 | * 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 B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 58 | * @throws BgpParseException while adding NLRI updation |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 59 | */ |
Shashikanth VH | 5dd8dbe | 2015-11-26 13:22:18 +0530 | [diff] [blame] | 60 | void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 61 | RouteDistinguisher routeDistinguisher) throws BgpParseException; |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 62 | |
| 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 B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 68 | * @throws BgpParseException while deleting NLRI from local rib |
Shashikanth VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 69 | */ |
Priyanka B | fc51c95 | 2016-03-26 14:30:33 +0530 | [diff] [blame] | 70 | void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException; |
mohamedrahil | 00f6f26 | 2016-11-24 20:20:41 +0530 | [diff] [blame] | 71 | |
| 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 VH | eca7cec | 2015-11-18 16:19:58 +0530 | [diff] [blame] | 113 | } |