[S] Change in libosmo-sigtran[master]: vty: Forbig deleting ASP currently configured in an AS
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41634?usp=email ) Change subject: vty: Forbig deleting ASP currently configured in an AS ...................................................................... vty: Forbig deleting ASP currently configured in an AS Make the user first remove the ASP from the AS manually. Change-Id: I3eed65b4a33b786e7dde6e86774c56655523aea2 --- M src/ss7_asp_vty.c M tests/vty/osmo_stp_test.vty 2 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/34/41634/1 diff --git a/src/ss7_asp_vty.c b/src/ss7_asp_vty.c index 49177a1..d54eb01 100644 --- a/src/ss7_asp_vty.c +++ b/src/ss7_asp_vty.c @@ -232,12 +232,23 @@ struct osmo_ss7_instance *inst = vty->index; const char *name = argv[0]; struct osmo_ss7_asp *asp; + struct osmo_ss7_as *as; asp = osmo_ss7_asp_find_by_name(inst, name); if (!asp) { vty_out(vty, "No ASP named '%s' found%s", name, VTY_NEWLINE); return CMD_WARNING; } + + llist_for_each_entry(as, &inst->as_list, list) { + if (osmo_ss7_as_has_asp(as, asp)) { + vty_out(vty, "%% ASP '%s' currently configured in AS '%s'. " + "You must first remove the ASP from the AS configuration%s", + name, as->cfg.name, VTY_NEWLINE); + return CMD_WARNING; + } + } + osmo_ss7_asp_destroy(asp); return CMD_SUCCESS; } diff --git a/tests/vty/osmo_stp_test.vty b/tests/vty/osmo_stp_test.vty index bf2db65..1114a2c 100644 --- a/tests/vty/osmo_stp_test.vty +++ b/tests/vty/osmo_stp_test.vty @@ -657,6 +657,11 @@ No ASP named 'unknown-asp' found OsmoSTP(config-cs7)# no asp my-asp +% ASP 'my-asp' currently configured in AS 'my-ass'. You must first remove the ASP from the AS configuration +OsmoSTP(config-cs7)# as my-ass m3ua +OsmoSTP(config-cs7-as)# no asp my-asp +OsmoSTP(config-cs7-as)# exit +OsmoSTP(config-cs7)# no asp my-asp OsmoSTP(config-cs7)# do show cs7 instance 0 asp ASP Name AS Name State Type Role SCTP Role Local Addresses Remote Addresses -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41634?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: libosmo-sigtran Gerrit-Branch: master Gerrit-Change-Id: I3eed65b4a33b786e7dde6e86774c56655523aea2 Gerrit-Change-Number: 41634 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin@sysmocom.de>
participants (1)
-
pespin