diff options
| author | Hiroki Shirokura <hiroki.shirokura@linecorp.com> | 2022-01-04 01:31:45 +0000 |
|---|---|---|
| committer | Louis Scalbert <louis.scalbert@6wind.com> | 2023-04-18 11:33:15 +0200 |
| commit | 78774bbcd51b1cb461b2d8622545d4b8136f2344 (patch) | |
| tree | f750e0a072454063829ab09698487121a1a44021 /tests/isisd/test_common.c | |
| parent | 5749ac83a8adca45703e60ab56383e29ed732532 (diff) | |
isisd: add isis flex-algo lsp advertisement
Deal with the packing and unpacking of following Flex-Algo
Sub-Sub-TLVs:
- Router Capability (already defined TLV 242)
- List of the Flex-Algo Definitions (Sub-TLV 26)
- Exclude admin group (Sub-Sub-TLV 1)
- Include-any admin group (Sub-Sub-TLV 2)
- Include-all admin group (Sub-Sub-TLV 3)
- Flags (for prefix-metric) (Sub-Sub-TLV 4)
This commit splits data into multiple router capability TLVs if needed
because a TLV cannot contains more than 255 bytes.
Note that the list of SR Algorithm (Sub-TLV 19) within Router Capability
(TLV 242) is already set in a previous commit.
Signed-off-by: Hiroki Shirokura <hiroki.shirokura@linecorp.com>
Signed-off-by: Eric Kinzie <ekinzie@labn.net>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'tests/isisd/test_common.c')
| -rw-r--r-- | tests/isisd/test_common.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c index 5c1debca8d..e47456965e 100644 --- a/tests/isisd/test_common.c +++ b/tests/isisd/test_common.c @@ -163,31 +163,32 @@ static void lsp_add_reach(struct isis_lsp *lsp, static void lsp_add_router_capability(struct isis_lsp *lsp, const struct isis_test_node *tnode) { - struct isis_router_cap cap = {}; + struct isis_router_cap *cap; if (!tnode->router_id) return; - if (inet_pton(AF_INET, tnode->router_id, &cap.router_id) != 1) { + cap = isis_tlvs_init_router_capability(lsp->tlvs); + + if (inet_pton(AF_INET, tnode->router_id, &cap->router_id) != 1) { zlog_debug("%s: invalid router-id: %s", __func__, tnode->router_id); return; } if (CHECK_FLAG(tnode->flags, F_ISIS_TEST_NODE_SR)) { - cap.srgb.flags = + cap->srgb.flags = ISIS_SUBTLV_SRGB_FLAG_I | ISIS_SUBTLV_SRGB_FLAG_V; - cap.srgb.lower_bound = tnode->srgb.lower_bound - ? tnode->srgb.lower_bound - : SRGB_DFTL_LOWER_BOUND; - cap.srgb.range_size = tnode->srgb.range_size - ? tnode->srgb.range_size - : SRGB_DFTL_RANGE_SIZE; - cap.algo[0] = SR_ALGORITHM_SPF; - cap.algo[1] = SR_ALGORITHM_UNSET; + cap->srgb.lower_bound = tnode->srgb.lower_bound + ? tnode->srgb.lower_bound + : SRGB_DFTL_LOWER_BOUND; + cap->srgb.range_size = tnode->srgb.range_size + ? tnode->srgb.range_size + : SRGB_DFTL_RANGE_SIZE; + cap->algo[0] = SR_ALGORITHM_SPF; + cap->algo[1] = SR_ALGORITHM_UNSET; } - isis_tlvs_set_router_capability(lsp->tlvs, &cap); } static void lsp_add_mt_router_info(struct isis_lsp *lsp, |
