diff options
| author | Christian Franke <chris@opensourcerouting.org> | 2018-05-10 19:05:40 +0200 |
|---|---|---|
| committer | Christian Franke <chris@opensourcerouting.org> | 2018-09-05 11:38:13 +0200 |
| commit | 92ed0cdef522c148250186cd3fbdf61cc9789d77 (patch) | |
| tree | ecdf6679ab3a6f167c53a573ef41babca6a3d01f /isisd/fabricd.c | |
| parent | 41a145f18d621e24a1c4b8ab17683d14d9190fd3 (diff) | |
fabricd: allow to configure tier-level advertisement
While OpenFabric calculates most tier numbers automatically by the
fabric locality calculation algorithm, that algorithm requires two
systems to be manually configured as tier 0, so it has reference points.
Also, completely manual configuration is possible.
To support this, introduce appropriate CLI commands and flood the
configured information.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'isisd/fabricd.c')
| -rw-r--r-- | isisd/fabricd.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 853b672075..11d1ff695e 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -27,6 +27,8 @@ #include "isisd/isis_misc.h" #include "isisd/isis_adjacency.h" #include "isisd/isis_spf.h" +#include "isisd/isis_tlvs.h" +#include "isisd/isis_lsp.h" DEFINE_MTYPE_STATIC(ISISD, FABRICD_STATE, "ISIS OpenFabric") @@ -42,20 +44,27 @@ enum fabricd_sync_state { }; struct fabricd { + struct isis_area *area; + enum fabricd_sync_state initial_sync_state; time_t initial_sync_start; struct isis_circuit *initial_sync_circuit; struct thread *initial_sync_timeout; struct isis_spftree *spftree; + + uint8_t tier; + uint8_t tier_config; }; struct fabricd *fabricd_new(struct isis_area *area) { struct fabricd *rv = XCALLOC(MTYPE_FABRICD_STATE, sizeof(*rv)); + rv->area = area; rv->initial_sync_state = FABRICD_SYNC_PENDING; rv->spftree = isis_spftree_new(area); + rv->tier = rv->tier_config = ISIS_TIER_UNDEFINED; return rv; }; @@ -147,6 +156,16 @@ void fabricd_initial_sync_finish(struct isis_area *area) f->initial_sync_timeout = NULL; } +static void fabricd_set_tier(struct fabricd *f, uint8_t tier) +{ + if (f->tier == tier) + return; + + f->tier = tier; + + lsp_regenerate_schedule(f->area, ISIS_LEVEL2, 0); +} + void fabricd_run_spf(struct isis_area *area) { struct fabricd *f = area->fabricd; @@ -166,3 +185,40 @@ struct isis_spftree *fabricd_spftree(struct isis_area *area) return f->spftree; } + +void fabricd_configure_tier(struct isis_area *area, uint8_t tier) +{ + struct fabricd *f = area->fabricd; + + if (!f || f->tier_config == tier) + return; + + f->tier_config = tier; + fabricd_set_tier(f, tier); +} + +uint8_t fabricd_tier(struct isis_area *area) +{ + struct fabricd *f = area->fabricd; + + if (!f) + return ISIS_TIER_UNDEFINED; + + return f->tier; +} + +int fabricd_write_settings(struct isis_area *area, struct vty *vty) +{ + struct fabricd *f = area->fabricd; + int written = 0; + + if (!f) + return written; + + if (f->tier_config != ISIS_TIER_UNDEFINED) { + vty_out(vty, " fabric-tier %" PRIu8 "\n", f->tier_config); + written++; + } + + return written; +} |
