blob: 2fdac6cde2eec36bb4fc7c2737846baae786f396 [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;
Dhruv Dhodye64b93e2016-04-20 19:26:55 +053019import java.util.Map;
mohamed rahil8ea09d42016-04-19 20:47:21 +053020
Kiran Ramachandrac92a1222016-03-30 13:05:31 +053021/**
22 * Representation of an ISIS link state database.
23 */
24public interface IsisLsdb {
25
26 /**
mohamed rahil8ea09d42016-04-19 20:47:21 +053027 * Returns the ISIS LSDB.
Kiran Ramachandrac92a1222016-03-30 13:05:31 +053028 *
29 * @return ISIS LSDB
30 */
31 IsisLsdb isisLsdb();
mohamed rahil8ea09d42016-04-19 20:47:21 +053032
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 Dhodye64b93e2016-04-20 19:26:55 +053097
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 vk4b5ce002016-05-09 20:18:35 +0530111
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 vk7bdf4d42016-06-24 12:29:43 +0530125 /**
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 Dhodye64b93e2016-04-20 19:26:55 +0530132}