Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
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; |
| 19 | |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 20 | /** |
| 21 | * Representation of an ISIS link state database. |
| 22 | */ |
| 23 | public interface IsisLsdb { |
| 24 | |
| 25 | /** |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 26 | * Returns the ISIS LSDB. |
Kiran Ramachandra | c92a122 | 2016-03-30 13:05:31 +0530 | [diff] [blame] | 27 | * |
| 28 | * @return ISIS LSDB |
| 29 | */ |
| 30 | IsisLsdb isisLsdb(); |
mohamed rahil | 8ea09d4 | 2016-04-19 20:47:21 +0530 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * Initializes LSDB. |
| 34 | */ |
| 35 | void initializeDb(); |
| 36 | |
| 37 | /** |
| 38 | * Returns the LSDB LSP key. |
| 39 | * |
| 40 | * @param systemId system ID |
| 41 | * @return LSP key |
| 42 | */ |
| 43 | String lspKey(String systemId); |
| 44 | |
| 45 | /** |
| 46 | * Returns the sequence number. |
| 47 | * |
| 48 | * @param lspType L1 or L2 LSP |
| 49 | * @return sequence number |
| 50 | */ |
| 51 | int lsSequenceNumber(IsisPduType lspType); |
| 52 | |
| 53 | /** |
| 54 | * Finds the LSP from LSDB. |
| 55 | * |
| 56 | * @param pduType L1 or L2 LSP |
| 57 | * @param lspId LSP ID |
| 58 | * @return LSP wrapper object |
| 59 | */ |
| 60 | LspWrapper findLsp(IsisPduType pduType, String lspId); |
| 61 | |
| 62 | /** |
| 63 | * Installs a new self-originated LSA in LSDB. |
| 64 | * Return true if installing was successful else false. |
| 65 | * |
| 66 | * @param lsPdu PDU instance |
| 67 | * @param isSelfOriginated true if self originated else false |
| 68 | * @param isisInterface ISIS interface instance |
| 69 | * @return true if successfully added |
| 70 | */ |
| 71 | boolean addLsp(IsisMessage lsPdu, boolean isSelfOriginated, IsisInterface isisInterface); |
| 72 | |
| 73 | /** |
| 74 | * Checks received LSP is latest, same or old. |
| 75 | * |
| 76 | * @param receivedLsp received LSP |
| 77 | * @param lspFromDb existing LSP |
| 78 | * @return "latest", "old" or "same" |
| 79 | */ |
| 80 | String isNewerOrSameLsp(IsisMessage receivedLsp, IsisMessage lspFromDb); |
| 81 | |
| 82 | /** |
| 83 | * Returns all LSPs (L1 and L2). |
| 84 | * |
| 85 | * @param excludeMaxAgeLsp exclude the max age LSPs |
| 86 | * @return List of LSPs |
| 87 | */ |
| 88 | List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp); |
| 89 | |
| 90 | /** |
| 91 | * Deletes the given LSP. |
| 92 | * |
| 93 | * @param lsp LSP instance |
| 94 | */ |
| 95 | void deleteLsp(IsisMessage lsp); |
| 96 | } |