diff options
| author | Carmine Scarpitta <cscarpit@cisco.com> | 2025-02-26 15:34:19 +0100 |
|---|---|---|
| committer | Carmine Scarpitta <cscarpit@cisco.com> | 2025-02-27 12:17:26 +0100 |
| commit | ab7a7541a669ebe586d8de8015e7eb68c0365c2b (patch) | |
| tree | cd8c34f5440cec0b5ebed7c5a4b6274aaa80939e /staticd | |
| parent | e7640f388538cba10bf954460315c7c9fac22d04 (diff) | |
staticd: Add `no` form for `static-sids` command
Currently, when the user tries to delete all static SIDs with the
`no static-sids` command, staticd returns an error.
```
router# config
router(config)# segment-routing
router(sr)# srv6
router(srv6)# no static-sids
% Unknown command: no static-sids
```
The problem is the `static-sids` command does not support the `no` form.
This PR enables the `no` form for the `static-sids` command.
```
router# config
router(config)# segment-routing
router(sr)# srv6
router(srv6)# no static-sids
```
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
Diffstat (limited to 'staticd')
| -rw-r--r-- | staticd/static_nb.h | 4 | ||||
| -rw-r--r-- | staticd/static_vty.c | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/staticd/static_nb.h b/staticd/static_nb.h index 282c9dcf11..6106f90018 100644 --- a/staticd/static_nb.h +++ b/staticd/static_nb.h @@ -184,6 +184,10 @@ int routing_control_plane_protocols_name_validate( "frr-staticd:staticd/segment-routing/srv6" /* srv6/static-sids */ +#define FRR_STATIC_SRV6_STATIC_SIDS_XPATH \ + FRR_STATIC_SRV6_INFO_KEY_XPATH \ + "/static-sids" + #define FRR_STATIC_SRV6_SID_KEY_XPATH \ FRR_STATIC_SRV6_INFO_KEY_XPATH \ "/static-sids/" \ diff --git a/staticd/static_vty.c b/staticd/static_vty.c index dd57bfa173..92965681e3 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -1190,10 +1190,22 @@ DEFUN_YANG_NOSH (no_static_srv6, no_static_srv6_cmd, return nb_cli_apply_changes(vty, "%s", xpath); } -DEFPY_NOSH (static_srv6_sids, static_srv6_sids_cmd, - "static-sids", +DEFPY_YANG_NOSH (static_srv6_sids, static_srv6_sids_cmd, + "[no] static-sids", + NO_STR "Segment Routing SRv6 SIDs\n") { + char xpath[XPATH_MAXLEN]; + + if (no) { + snprintf(xpath, sizeof(xpath), FRR_STATIC_SRV6_STATIC_SIDS_XPATH, + "frr-staticd:staticd", "staticd", VRF_DEFAULT_NAME); + + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes(vty, "%s", xpath); + } + VTY_PUSH_CONTEXT_NULL(SRV6_SIDS_NODE); return CMD_SUCCESS; } |
