diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2020-08-23 00:22:32 -0300 | 
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2020-08-26 20:16:19 -0300 | 
| commit | 7b36d36e0ed2a233c3a908c9e821e3f45c68d4e8 (patch) | |
| tree | a6c1a1da3e1a61a63a891f0d84d9ab06557b28e4 /isisd/isis_spf.h | |
| parent | 675269d48324ab42c63fc0ed79da0bbad06ecdb1 (diff) | |
isisd: make the SPF code more modular
The goal of modularizing the SPF code is to make it possible for
isisd to run SPF in the behalf of other nodes in the network, which
is going to be necessary later when implementing the R-LFA/TI-LFA
solutions. On top of that, a modularized SPF opens the door for
much needed unit testing.
Summary of the changes:
* Change the isis_spf_preload_tent() function to use the local LSP
  as an input (as per the ISO specification) instead of populating
  the TENT based on the list of local interfaces;
* Introduce the "isis_spf_adj" structure to represent an SPF
  adjacency.  SPF adjacencies are inferred from the LSPDB, different
  from normal adjacencies formed using IIH messages;
* Introduce the F_SPFTREE_NO_ROUTES flag to control whether the
  SPT should create routes or not;
* Introduce the F_SPFTREE_NO_ADJACENCIES flag to specify whether
  IS-IS adjacency information is available or not. When running SPF
  in the behalf of other nodes, or under the context of an unit test,
  no adjacency information will be present.
* On isis_area_create(), move some code around so that the area's isis
  backpointer is set as early as possible.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_spf.h')
| -rw-r--r-- | isisd/isis_spf.h | 20 | 
1 files changed, 19 insertions, 1 deletions
diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index a85e596bb0..e3c0fbc8b8 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -26,7 +26,24 @@  struct isis_spftree; -struct isis_spftree *isis_spftree_new(struct isis_area *area); +struct isis_spf_adj { +	uint8_t id[ISIS_SYS_ID_LEN + 1]; +	struct isis_adjacency *adj; +	uint32_t metric; +	struct isis_ext_subtlvs *subtlvs; +	struct { +		uint8_t desig_is_id[ISIS_SYS_ID_LEN + 1]; +		struct isis_lsp *lsp_pseudo; +	} lan; +	uint8_t flags; +#define F_ISIS_SPF_ADJ_BROADCAST 0x01 +#define F_ISIS_SPF_ADJ_OLDMETRIC 0x02 +}; + +struct isis_spftree *isis_spftree_new(struct isis_area *area, +				      struct lspdb_head *lspdb, +				      const uint8_t *sysid, int level, +				      enum spf_tree_id tree_id, uint8_t flags);  void isis_spf_invalidate_routes(struct isis_spftree *tree);  void isis_spf_verify_routes(struct isis_area *area,  			    struct isis_spftree **trees); @@ -40,6 +57,7 @@ int _isis_spf_schedule(struct isis_area *area, int level,  		       const char *func, const char *file, int line);  void isis_spf_init(void);  void isis_spf_print(struct isis_spftree *spftree, struct vty *vty); +void isis_run_spf(struct isis_spftree *spftree);  struct isis_spftree *isis_run_hopcount_spf(struct isis_area *area,  					   uint8_t *sysid,  					   struct isis_spftree *spftree);  | 
