Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 16 | package org.onosproject.isis.controller; |
| 17 | |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 18 | import java.util.List; |
Dhruv Dhody | e64b93e | 2016-04-20 19:26:55 +0530 | [diff] [blame] | 19 | import java.util.Map; |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 20 | |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 21 | /** |
| 22 | * Representation of an ISIS link state database. |
| 23 | */ |
| 24 | public interface IsisLsdb { |
| 25 | |
| 26 | /** |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 27 | * Returns the ISIS LSDB. |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 28 | * |
| 29 | * @return ISIS LSDB |
| 30 | */ |
| 31 | IsisLsdb isisLsdb(); |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Initializes LSDB. |
| 35 | */ |
| 36 | void initializeDb(); |
| 37 | |
| 38 | /** |
| 39 | * Returns the LSDB LSP key. |
| 40 | * |
| 41 | * @param systemId system ID |
| 42 | * @return LSP key |
| 43 | */ |
| 44 | String lspKey(String systemId); |
| 45 | |
| 46 | /** |
| 47 | * Returns the sequence number. |
| 48 | * |
| 49 | * @param lspType L1 or L2 LSP |
| 50 | * @return sequence number |
| 51 | */ |
| 52 | int lsSequenceNumber(IsisPduType lspType); |
| 53 | |
| 54 | /** |
| 55 | * Finds the LSP from LSDB. |
| 56 | * |
| 57 | * @param pduType L1 or L2 LSP |
| 58 | * @param lspId LSP ID |
| 59 | * @return LSP wrapper object |
| 60 | */ |
| 61 | LspWrapper findLsp(IsisPduType pduType, String lspId); |
| 62 | |
| 63 | /** |
| 64 | * Installs a new self-originated LSA in LSDB. |
| 65 | * Return true if installing was successful else false. |
| 66 | * |
| 67 | * @param lsPdu PDU instance |
| 68 | * @param isSelfOriginated true if self originated else false |
| 69 | * @param isisInterface ISIS interface instance |
| 70 | * @return true if successfully added |
| 71 | */ |
| 72 | boolean addLsp(IsisMessage lsPdu, boolean isSelfOriginated, IsisInterface isisInterface); |
| 73 | |
| 74 | /** |
| 75 | * Checks received LSP is latest, same or old. |
| 76 | * |
| 77 | * @param receivedLsp received LSP |
| 78 | * @param lspFromDb existing LSP |
| 79 | * @return "latest", "old" or "same" |
| 80 | */ |
| 81 | String isNewerOrSameLsp(IsisMessage receivedLsp, IsisMessage lspFromDb); |
| 82 | |
| 83 | /** |
| 84 | * Returns all LSPs (L1 and L2). |
| 85 | * |
| 86 | * @param excludeMaxAgeLsp exclude the max age LSPs |
| 87 | * @return List of LSPs |
| 88 | */ |
| 89 | List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp); |
| 90 | |
| 91 | /** |
| 92 | * Deletes the given LSP. |
| 93 | * |
| 94 | * @param lsp LSP instance |
| 95 | */ |
| 96 | void deleteLsp(IsisMessage lsp); |
Dhruv Dhody | e64b93e | 2016-04-20 19:26:55 +0530 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * Gets the neighbor database information. |
| 100 | * |
| 101 | * @return neighbor database information |
| 102 | */ |
| 103 | Map<String, LspWrapper> getL1Db(); |
| 104 | |
| 105 | /** |
| 106 | * Gets the neighbor database information. |
| 107 | * |
| 108 | * @return neighbor database information |
| 109 | */ |
| 110 | Map<String, LspWrapper> getL2Db(); |
sunish vk | 4b5ce00 | 2016-05-09 20:18:35 +0530 | [diff] [blame] | 111 | |
| 112 | /** |
| 113 | * Sets the level 1 link state sequence number. |
| 114 | * |
| 115 | * @param l1LspSeqNo link state sequence number |
| 116 | */ |
| 117 | void setL1LspSeqNo(int l1LspSeqNo); |
| 118 | |
| 119 | /** |
| 120 | * Sets the level 2 link state sequence number. |
| 121 | * |
| 122 | * @param l2LspSeqNo link state sequence number |
| 123 | */ |
| 124 | void setL2LspSeqNo(int l2LspSeqNo); |
sunish vk | 7bdf4d4 | 2016-06-24 12:29:43 +0530 | [diff] [blame] | 125 | /** |
| 126 | * Removes topology information when neighbor down. |
| 127 | * |
| 128 | * @param neighbor ISIS neighbor instance |
| 129 | * @param isisInterface ISIS interface instance |
| 130 | */ |
| 131 | void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface); |
Dhruv Dhody | e64b93e | 2016-04-20 19:26:55 +0530 | [diff] [blame] | 132 | } |