blob: 7ceb9f15c2fae1c0fbf6a88ac5ede42a20a06fe5 [file] [log] [blame]
Kiran Ramachandrac92a1222016-03-30 13:05:31 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Kiran Ramachandrac92a1222016-03-30 13:05:31 +05303 *
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 Ramachandrac92a1222016-03-30 13:05:31 +053016package org.onosproject.isis.controller;
17
mohamed rahil8ea09d42016-04-19 20:47:21 +053018import java.util.List;
19
Kiran Ramachandrac92a1222016-03-30 13:05:31 +053020/**
21 * Representation of an ISIS link state database.
22 */
23public interface IsisLsdb {
24
25 /**
mohamed rahil8ea09d42016-04-19 20:47:21 +053026 * Returns the ISIS LSDB.
Kiran Ramachandrac92a1222016-03-30 13:05:31 +053027 *
28 * @return ISIS LSDB
29 */
30 IsisLsdb isisLsdb();
mohamed rahil8ea09d42016-04-19 20:47:21 +053031
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}