This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgHello Harald Welte, Jenkins Builder, Holger Freyther, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/1576 to look at the new patch set (#3). CTRL: remove boilerplate Use CTRL_CMD_DEFINE_WO() and CTRL_CMD_DEFINE_WO_NOVRF() where appropriate to get rid of boilerplate code. Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b --- M openbsc/src/libbsc/bsc_ctrl_commands.c M openbsc/src/libmsc/ctrl_commands.c M openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c M openbsc/tests/ctrl_test_runner.py 4 files changed, 9 insertions(+), 75 deletions(-) git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/76/1576/3 diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c index 7e84797..d1348e0 100644 --- a/openbsc/src/libbsc/bsc_ctrl_commands.c +++ b/openbsc/src/libbsc/bsc_ctrl_commands.c @@ -70,17 +70,6 @@ CTRL_CMD_VTY_STRING(net_short_name, "short-name", struct gsm_network, name_short); CTRL_CMD_VTY_STRING(net_long_name, "long-name", struct gsm_network, name_long); -static int verify_net_apply_config(struct ctrl_cmd *cmd, const char *v, void *d) -{ - return 0; -} - -static int get_net_apply_config(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; -} - static int set_net_apply_config(struct ctrl_cmd *cmd, void *data) { struct gsm_network *net = cmd->node; @@ -107,7 +96,7 @@ return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(net_apply_config, "apply-configuration"); +CTRL_CMD_DEFINE_WO_NOVRF(net_apply_config, "apply-configuration"); static int verify_net_mcc_mnc_apply(struct ctrl_cmd *cmd, const char *value, void *d) { @@ -124,12 +113,6 @@ if (!mcc || !mnc) return 1; return 0; -} - -static int get_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } static int set_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data) @@ -165,22 +148,11 @@ cmd->reply = "OOM"; return CTRL_CMD_ERROR; } -CTRL_CMD_DEFINE(net_mcc_mnc_apply, "mcc-mnc-apply"); +CTRL_CMD_DEFINE_WO(net_mcc_mnc_apply, "mcc-mnc-apply"); /* BTS related commands below */ CTRL_CMD_DEFINE_RANGE(bts_lac, "location-area-code", struct gsm_bts, location_area_code, 0, 65535); CTRL_CMD_DEFINE_RANGE(bts_ci, "cell-identity", struct gsm_bts, cell_identity, 0, 65535); - -static int verify_bts_apply_config(struct ctrl_cmd *cmd, const char *v, void *d) -{ - return 0; -} - -static int get_bts_apply_config(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; -} static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data) { @@ -196,18 +168,7 @@ return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(bts_apply_config, "apply-configuration"); - -static int verify_bts_si(struct ctrl_cmd *cmd, const char *v, void *d) -{ - return 0; -} - -static int get_bts_si(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; -} +CTRL_CMD_DEFINE_WO_NOVRF(bts_apply_config, "apply-configuration"); static int set_bts_si(struct ctrl_cmd *cmd, void *data) { @@ -223,7 +184,7 @@ cmd->reply = "Generated new System Information"; return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(bts_si, "send-new-system-informations"); +CTRL_CMD_DEFINE_WO_NOVRF(bts_si, "send-new-system-informations"); static int verify_bts_chan_load(struct ctrl_cmd *cmd, const char *v, void *d) { diff --git a/openbsc/src/libmsc/ctrl_commands.c b/openbsc/src/libmsc/ctrl_commands.c index 79e136d..24b68fa 100644 --- a/openbsc/src/libmsc/ctrl_commands.c +++ b/openbsc/src/libmsc/ctrl_commands.c @@ -74,12 +74,6 @@ return rc; } -static int get_subscriber_modify(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Set only attribute"; - return CTRL_CMD_ERROR; -} - static int set_subscriber_modify(struct ctrl_cmd *cmd, void *data) { struct gsm_network *net = cmd->node; @@ -157,18 +151,7 @@ return CTRL_CMD_ERROR; } -CTRL_CMD_DEFINE(subscriber_modify, "subscriber-modify-v1"); - -static int verify_subscriber_delete(struct ctrl_cmd *cmd, const char *v, void *d) -{ - return 0; -} - -static int get_subscriber_delete(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Set only attribute"; - return CTRL_CMD_ERROR; -} +CTRL_CMD_DEFINE_WO(subscriber_modify, "subscriber-modify-v1"); static int set_subscriber_delete(struct ctrl_cmd *cmd, void *data) { @@ -199,7 +182,7 @@ cmd->reply = was_used ? "Removed active subscriber" : "Removed"; return CTRL_CMD_REPLY; } -CTRL_CMD_DEFINE(subscriber_delete, "subscriber-delete-v1"); +CTRL_CMD_DEFINE_WO_NOVRF(subscriber_delete, "subscriber-delete-v1"); static int verify_subscriber_list(struct ctrl_cmd *cmd, const char *value, void *d) { diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c index ec4243e..057a583 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c @@ -446,11 +446,7 @@ return 0; } -CTRL_CMD_DEFINE(net_save_cmd, "net 0 save-configuration"); -static int verify_net_save_cmd(struct ctrl_cmd *cmd, const char *v, void *d) -{ - return 0; -} +CTRL_CMD_DEFINE_WO_NOVRF(net_save_cmd, "net 0 save-configuration"); static int set_net_save_cmd(struct ctrl_cmd *cmd, void *data) { @@ -462,12 +458,6 @@ } return CTRL_CMD_REPLY; -} - -static int get_net_save_cmd(struct ctrl_cmd *cmd, void *data) -{ - cmd->reply = "Write only attribute"; - return CTRL_CMD_ERROR; } struct ctrl_handle *bsc_nat_controlif_setup(struct bsc_nat *nat, diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py index 4fd831f..40de782 100644 --- a/openbsc/tests/ctrl_test_runner.py +++ b/openbsc/tests/ctrl_test_runner.py @@ -219,7 +219,7 @@ def testBtsGenerateSystemInformation(self): r = self.do_get('bts.0.send-new-system-informations') self.assertEquals(r['mtype'], 'ERROR') - self.assertEquals(r['error'], 'Write only attribute') + self.assertEquals(r['error'], 'Write Only attribute') # No RSL links so it will fail r = self.do_set('bts.0.send-new-system-informations', '1') @@ -531,7 +531,7 @@ def testApplyConfiguration(self): r = self.do_get('bts.0.apply-configuration') self.assertEquals(r['mtype'], 'ERROR') - self.assertEquals(r['error'], 'Write only attribute') + self.assertEquals(r['error'], 'Write Only attribute') r = self.do_set('bts.0.apply-configuration', '1') self.assertEquals(r['mtype'], 'SET_REPLY') -- To view, visit https://gerrit.osmocom.org/1576 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b Gerrit-PatchSet: 3 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Holger Freyther <holger at freyther.de> Gerrit-Reviewer: Jenkins Builder