blob: 7ada0a757fb0d90933db1c6437115eb3590ff35e [file] [log] [blame]
Nick Gordonf3a9ecb2017-01-24 13:55:14 -06001\section{Link-State Database}
2\label{sec:lsdb}
3
Nick Gordon221531c2017-06-08 11:44:45 -05004The Link-State Database (LSDB) holds LSA information distributed by
5other routers in the network. The LSDB stores all types of LSAs and
6will trigger events when a new LSA is added, updated, or expires. The
7LSDB also handles LSA retrieval, performs LSA builds, and triggers
8routing table calculations.
Nick Gordonf3a9ecb2017-01-24 13:55:14 -06009
10\subsection{Retrieving an LSA}
11
Nick Gordon221531c2017-06-08 11:44:45 -050012The LSDB provides the \texttt{Lsdb::expressInterest()} method as a
13public interface to retrieve an LSA from the network. If LSA Data is
14returned, the LSDB will validate the Data using the Validator
15module. Then, it will perform the necessary LSDB modifications. If
16the LSA Interest times out, the LSDB will retry until it reaches a
17configurable maximum number of tries, or a configurable deadline
18passes.
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060019
Nick Gordon221531c2017-06-08 11:44:45 -050020The LSDB uses the SegmentFetcher system to retrieve LSAs. LSAs very
21often will exceed the maximum NDN packet size. In these cases, the LSA
22needs to be split into segments to be sent, so the LSDB uses the
23SegmentFetcher to send all LSAs. The SegmentFetcher can decide if the
24data actually needs to be split.
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060025
Nick Gordon221531c2017-06-08 11:44:45 -050026\subsection{General Procedure}
27
28The LSDB is responsible for building, installing, and publishing
29NLSR's LSAs, as well as for installing and processing LSAs from other
30NSLRs. Generally, the functions of the LSDB are:
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060031\begin{itemize}
Nick Gordon221531c2017-06-08 11:44:45 -050032\item Schedule the building of an LSA.
33\item Building the LSA.
34\item Installing the LSA into the LSDB.
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060035\end{itemize}
36
Nick Gordon221531c2017-06-08 11:44:45 -050037\subsection{Scheduling LSA Builds}
38LSAs need to be rebuilt whenever the routing information NLSR has
39changes. This includes events like neighbors becoming active, or when
40a prefix for advertisement is inserted by the Prefix Update Processor,
41which would cause an adjacency LSA or a name LSA rebuild,
42respectively. To improve performance, instead of directly building
43adjacency LSAs the first request schedules the build, and build requests
44that occur after the scheduling but before the actual event are
45aggregated (in other words, ignored), because they will be satisfied
46by the already-scheduled build. Some specifics are shown below.
47below.
48\begin{itemize}
49\item \textbf{Adjacency LSAs} -- will only be scheduled if link-state
50 routing is enabled. In particular, this means Adjacency LSA builds
51 will \emph{not} occur if hyperbolic routing is enabled. Note that
52 adjacency LSAs will be built if dry-run hyperbolic routing is
53 enabled, as the network is still using link-state routing to
54 calculate paths.
55\end{itemize}
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060056
Nick Gordon221531c2017-06-08 11:44:45 -050057\subsection{Building LSAs}
58Building LSAs has a part common to all LSAs and a part specific to
59each LSA type. For example, all LSA types increment sequence number
60and have the same expiration length, and of course come from the same
61router. Additionally, all LSA builds cause a sync update
62publishing. However, each type of LSA includes different data, to
63represent different kinds of information that NLSR
64has. (Section~\ref{sec:lsas}) In particular:
65\begin{itemize}
66 \item \textbf{Adjacency LSAs} -- the number and a list of active
67 neighbors is included.
68 \item \textbf{Coordinate LSAs} -- the hyperbolic radius and all
69 hyperbolic angles are included.
70 \item \textbf{Name LSAs} -- the list of name prefixes that are
71 accessible at this router is included.
72\end{itemize}
73
74\subsection{Installing and Processing LSAs}
75LSA installation procedure is mostly the same across any type of LSA,
76but each type also has installation behavior specific to that type,
77too. For any LSA type, we need to schedule an expiration event, and we
78need to update several fields in the LSA. However, installing an
79adjacency or coordinate LSA causes a Routing Table calculation, but a
80name LSA does not, for example.
81%%| Not yet true, but it should be true!
82Additionally, the name of the origin router is added as a ``routable prefix'' in the NPT. (Section~\ref{sec:npt}).
83\begin{itemize}
84 \item \textbf{Adjacency LSAs} -- each adjacency in the LSA will be
85 added as a ``routable prefix'' to the NPT. If the adjacencies have
86 changed since the last version of this LSA, a Routing Table
87 calculation needs to be scheduled, because the state of the
88 network has changed. Of course, this is necessarily true if the
89 LSA is new to us. Important to note is that we will also install
90 and process \emph{our own} adjacency LSA in this way.
91 \item \textbf{Coordinate LSAs} -- the router that the LSA is from
92 will be added as a ``routable prefix'' to the NPT. If the radius
93 and coordinates have changed since the last version of this LSA, a
94 Routing Table calculation needs to be scheduled, because the state
95 of the network has changed. As above, this is true for a new
96 LSA. This is only done if the LSA is from a foreign router.
97 \item \textbf{Name LSAs} -- each name prefix in the LSA will be
98 added to our NPT. This is only done if the LSA is from a foreign
99 router.
100\end{itemize}
101
102\subsection{LSA Expiration}
103LSAs expire so that the network can clean up when a router
104crashes. The amount of time an LSA lasts is configurable. When an LSA
105expires, we refresh it if it's our LSA, and remove it from the LSDB if
106not. There is a ``grace period'' window that is appended to the end of
107the expiration period of all LSAs, to provide time for the originating
108router to refresh the LSA and for it to propagate back to us. In all
109expiration cases, the name of the origin router will be removed from
110the NPT. What happens when an LSA is removed from the LSDB differs
111based on the type of LSA:
112\begin{itemize}
113 \item \textbf{Adjacency LSAs} -- a Routing Table calculation needs to occur,
114 since the state of the network has changed, at least from our
115 perspective.
116 \item \textbf{Coordinate LSAs} -- a Routing Table calculation needs to occur,
117 since the state of the network has changed, at least from our
118 perspective.
119 \item \textbf{Name LSAs} -- the name prefixes in the LSA are removed from the
120 NPT.
121\end{itemize}
122
123\subsection{LSA Refreshment}
124NLSR will only refresh its own LSAs. Additionally, the procedure for refreshing an LSA is the same for all types:
125\begin{itemize}
126\item Increment the LSA sequence number
127\item Schedule another expiration event. The length of time to wait
128 until refreshing is configurable, but it should probably be lower
129 than the expiration time that was set when building the LSA
130 initially. This prevents other routers from deleting our LSAs
131 because the network is slow, for instance. The length of time is set
132 by \texttt{lsa-refresh-time} in the configuration file.
133\item Publish an update to sync
134\end{itemize}
Nick Gordonf3a9ecb2017-01-24 13:55:14 -0600135
Nick Gordoneafb2a22017-01-24 14:55:56 -0600136\begin{figure}[h]
Nick Gordonf3a9ecb2017-01-24 13:55:14 -0600137\center
138\includegraphics[width=0.5\linewidth]{figures/generic-lsdb-flow}
139\label{fig:generic-lsdb-flow}
140\caption{The general LSDB logic for each LSA type}
141\end{figure}