blob: b5a3e1357405d2fa0f80fa0e75d71298f66bb1ee [file] [log] [blame]
Nick Gordonf3a9ecb2017-01-24 13:55:14 -06001\section{Link-State Database}
2\label{sec:lsdb}
3
4The Link-State Database (LSDB) holds LSA information distributed by other routers in the network.
5The LSDB stores all three types of LSAs and will trigger necessary events when a new LSA is added, when an LSA is updated, and when an LSA expires.
6The LSDB also handles LSA retrieval and validation, performs LSA builds, and triggers routing table calculations.
7
8\subsection{Retrieving an LSA}
9
10The LSDB provides \texttt{Lsdb::expressInterest()} as a public interface to retrieve an LSA from the network.
11If LSA Data is returned, the LSDB will handle the Data validation and perform the necessary LSDB modifications.
12If the LSA Interest times out, the LSDB will continue to re-attempt to fetch the LSA Data.
13The LSDB will stop trying these fetch re-attempts once it has tried for as long as the maximum configurable LSA refresh time.
14
15\subsection{Building LSAs}
16
17The LSDB provides three interfaces to build and install a router's own various LSAs.
18\begin{itemize}
19\item \texttt{Lsdb::scheduleAdjLsaBuild()} schedules an Adjacency LSA calculation if one is not already scheduled and if hyperbolic routing is not turned on, i.e. if link-state routing or dry run is on.
20\item \texttt{Lsdb::buildAndInstallOwnAdjLsa()} instantiates a new Adjacency LSA with the router's current adjacency list, incremented sequence number, and number of active neighbors. It also notifies the Sync Logic Handler to publish the routing update(Section~\ref{sssec:routing-update}) if link-state routing or dry-run is enabled to let other node in the network know the newly instlled Adjacency LSA.
21\item \texttt{Lsdb::buildAndInstallOwnCoordinateLsa()} instantiates a new Coordinate LSA with the router's hyperbolic coordinates and an incremented sequence number. The newly constructed Coordinate LSA is then installed in the LSDB. It also notifies the Sync Logic Handler to publish the routing update(Section~\ref{sssec:routing-update}) if hyperbolic routing or dry run is turned on to let other nodes in the network know the newly installed Coordinate LSA.
22\item \texttt{Lsdb::buildAndInstallOwnNameLsa()} instantiates a new Name LSA with the router's current name prefix list and an incremented sequence number. The newly constructed Name LSA is then installed in the LSDB.
23\end{itemize}
24
25\subsection{LSA Installation and Updates}
26
27The LSDB provides three internal interfaces for each of the three types of LSAs to add or update LSAs in the LSDB.
28The general logic for each type of LSA installation is similar (Figure~\ref{fig:generic-lsdb-flow}), but there are slight differences in the events that are triggered by an installation or update.
29
Nick Gordoneafb2a22017-01-24 14:55:56 -060030\begin{figure}[h]
Nick Gordonf3a9ecb2017-01-24 13:55:14 -060031\center
32\includegraphics[width=0.5\linewidth]{figures/generic-lsdb-flow}
33\label{fig:generic-lsdb-flow}
34\caption{The general LSDB logic for each LSA type}
35\end{figure}
36
37\subsubsection{Lsdb::installAdjLsa()}
38
39When an Adjacency LSA is passed to \texttt{Lsdb::installAdjLsa()}, the LSDB first attempts to find the LSA in its current database.
40
41If the Adjacency LSA is not installed in the database, the LSA will first be added to the database.
42If the installed LSA is advertised by a remote router, the remote router's name will be added to the NPT and the LSA will be scheduled to expire after the expiration time point included in the LSA.
43Since a new Adjacency LSA introduces a new node and new links in the network, a routing table calculation is scheduled.
44
45If the Adjacency LSA is already installed in the database, the existing LSA will only be updated if the newly received LSA has a higher sequence number.
46If an Adjacency LSA with a higher sequence number is being installed, the existing LSA's sequence number and expiration time will be updated.
47If the newly received LSA contains an adjacency list that is different from the existing LSA, the existing LSA's adjacencies are updated and a routing table calculation is scheduled to account for the network change.
48Finally, if the updated LSA is advertised by a remote router, the LSA will be scheduled to expire after the expiration time point included in the LSA.
49
50\subsubsection{Lsdb::installCoordinateLsa()}
51
52When a Coordinate LSA is passed to \texttt{Lsdb::installCoordinateLsa()}, the LSDB first attempts to find the LSA in its current database.
53
54If the Coordinate LSA is not installed in the database, the LSA will first be added to the database.
55If the installed LSA is advertised by a remote router, the remote router's name will be added to the NPT, and the LSA will be scheduled to expire after the expiration time point included in the LSA.
56If hyperbolic routing is enabled, a new Coordinate LSA means that the routing table should be re-calculated to include the new destination router.
57
58If the Coordinate LSA is already installed in the database, the existing LSA will only be updated if the newly received LSA has a higher sequence number.
59If a Coordinate LSA with a higher sequence number is being installed, the existing LSA's sequence number and expiration time will be updated.
60If the newly received LSA contains hyperbolic coordinate different from the existing LSA, the existing LSA's coordinates are updated.
61If hyperbolic routing is enabled, an LSA with new coordinates means the routing table should be re-calculated to account for the different coordinates.
62Finally, If the updated LSA is advertised by a remote router, the LSA will be scheduled to expire after the expiration time point included in the LSA.
63
64\subsubsection{Lsdb::installNameLsa()}
65
66When a Name LSA is passed to \texttt{Lsdb::installNameLsa()}, the LSDB first attempts to find the LSA in its current database.
67
68If the Name LSA is not installed in the database, the LSA will first be added to the database.
69If the installed LSA is advertised by a remote router, the remote router's name and each advertised name in the LSA will be added to the NPT, and the LSA will be scheduled to expire after the expiration time point included in the LSA.
70
71If the Name LSA is already installed in the database, the existing LSA will only be updated if the newly received LSA has a higher sequence number.
72If a Name LSA with a higher sequence number is being installed, the existing LSA's sequence number and expiration time will be updated.
73A set difference is performed between the new LSA's advertised name prefix list and the existing LSA's advertised name prefix list to determine name prefixes that have been added.
74If there are added name prefixes, the name prefixes are added to the NPT and to the existing LSA.
75A set difference is then performed between the new LSA's advertised name prefix list and the existing LSA's advertised name prefix list to determine name prefixes that have been removed.
76If there are removed name prefixes, the name prefixes are removed from the NPT and from the existing LSA.
77Finally, If the updated LSA is advertised by a remote router, the LSA will be scheduled to expire after the expiration time point included in the LSA.
78
79\subsection{LSA Expiration}
80
81LSAs are scheduled to expire after a configurable amount of time in order to allow for LSDB cleanup when a router crashes.
82After the expiration period, if the LSA belongs to the current router, the LSA is refreshed with an incremented sequence number (Section~\ref{sec:lsa-refresh}).
83Otherwise, if the LSA belongs to a remote router, the LSA is removed from the LSDB.
84Removing an LSA from the LSDB triggers different events depending on the type of the LSA.
85\begin{itemize}
86\item \textbf{Adjacency LSA} - When an Adjacency LSA is removed, a routing table calculation is scheduled to determine new paths that don't include the associated router.
87\item \textbf{Coordinate LSA} - When a Coordinate LSA is removed and hyperbolic routing is enabled, a routing table calculation is scheduled.
88\item \textbf{Name LSA} - When a Name LSA is removed, the name prefixes advertised by the LSA are removed from the NPT.
89\end{itemize}
90
91In all three cases, the LSA's origin router's name will also be removed from the NPT.
92
93\subsection{LSA Refresh}
94\label{sec:lsa-refresh}
95
96When a router refreshes its own LSA, all three LSA types trigger the same events:
97\begin{itemize}
98\item Increment the LSA's sequence number by one
99\item Schedule the LSA to expire after the configured \texttt{lsa-refresh-time}.
100\item Publish a routing update in NSync to notify other routers of the change in the LSDB.
101\end{itemize}
102
103