ManagementServer: moved to icwmp package as dynamic object

This commit is contained in:
Omar Kallel 2023-01-17 13:01:38 +00:00 committed by Amin Ben Romdhane
parent 4e82190d88
commit 735526f3e1
5 changed files with 16 additions and 1425 deletions

View file

@ -12,7 +12,6 @@
#include "device.h"
#include "deviceinfo.h"
#include "managementserver.h"
#include "times.h"
#include "upnp.h"
#include "ip.h"
@ -89,7 +88,6 @@ DMOBJ tEntry181Obj[] = {
DMOBJ tDeviceObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH, NULL, "2.0"},
{"ManagementServer", &DMREAD, NULL, NULL, "file:/etc/config/cwmp", NULL, NULL, NULL, tManagementServerObj, tManagementServerParams, NULL, BBFDM_CWMP, NULL, "2.1"},
{"Time", &DMREAD, NULL, NULL, "file:/etc/config/system", NULL, NULL, NULL, NULL, tTimeParams, NULL, BBFDM_BOTH, NULL, "2.0"},
{"UPnP", &DMREAD, NULL, NULL, "file:/etc/init.d/ssdpd", NULL, NULL, NULL, tUPnPObj, NULL, NULL, BBFDM_BOTH, NULL, "2.0"},
{"WiFi", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH, NULL, "2.0"},

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
/*
* Copyright (C) 2019 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Imen Bhiri <imen.bhiri@pivasoftware.com>
* Author: Feten Besbes <feten.besbes@pivasoftware.com>
*/
#ifndef __MANAGEMENT_SERVER_H
#define __MANAGEMENT_SERVER_H
#include "libbbf_api/dmcommon.h"
extern DMLEAF tManagementServerParams[];
extern DMLEAF tHeartbeatPolicyParams[];
extern DMLEAF tInformParameterParams[];
extern DMLEAF tManageableDeviceParams[];
extern DMLEAF tTransferComplPolicyParams[];
extern DMLEAF tDUStateChangeComplPolicyParams[];
extern DMOBJ tManagementServerObj[];
#endif

View file

@ -366,18 +366,18 @@ static void test_api_bbfdm_get_set_library_parameter(void **state)
int fault = 0;
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.ManagementServer.EnableCWMP", NULL, NULL);
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.WiFi.SSID.1.Enable", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.ManagementServer.EnableCWMP", "1", "xsd:boolean");
validate_parameter(ctx, "Device.WiFi.SSID.1.Enable", "1", "xsd:boolean");
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.ManagementServer.EnableCWMP", "truee", NULL);
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.WiFi.SSID.1.Enable", "truee", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.ManagementServer.EnableCWMP", "0", NULL);
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.WiFi.SSID.1.Enable", "0", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
@ -385,11 +385,11 @@ static void test_api_bbfdm_get_set_library_parameter(void **state)
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.ManagementServer.EnableCWMP", NULL, NULL);
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.WiFi.SSID.1.Enable", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to 0: name, type, value
validate_parameter(ctx, "Device.ManagementServer.EnableCWMP", "0", "xsd:boolean");
validate_parameter(ctx, "Device.WiFi.SSID.1.Enable", "0", "xsd:boolean");
}
static void test_api_bbfdm_get_set_standard_parameter_alias(void **state)
@ -1137,11 +1137,11 @@ static void test_api_bbfdm_add_del_library_object(void **state)
int fault = 0;
// Get name object ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_NAME, "Device.ManagementServer.InformParameter.", "1", NULL);
fault = dm_entry_param_method(ctx, CMD_GET_NAME, "Device.WiFi.SSID.", "1", NULL);
assert_int_equal(fault, 0);
// add object ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_ADD_OBJECT, "Device.ManagementServer.InformParameter.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_ADD_OBJECT, "Device.WiFi.SSID.", "test_key", NULL);
assert_int_equal(fault, 0);
// check the new instance
@ -1149,7 +1149,7 @@ static void test_api_bbfdm_add_del_library_object(void **state)
assert_string_equal(ctx->addobj_instance, "3");
// delete object ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.ManagementServer.InformParameter.2.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.WiFi.SSID.2.", "test_key", NULL);
assert_int_equal(fault, 0);
// Get name object after deleting instance 2 ==> expected "9005" error
@ -1157,11 +1157,11 @@ static void test_api_bbfdm_add_del_library_object(void **state)
assert_int_equal(fault, FAULT_9005);
// delete all object ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.ManagementServer.InformParameter.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.WiFi.SSID.", "test_key", NULL);
assert_int_equal(fault, 0);
// Get name object after deleting all instances ==> expected "9005" error
fault = dm_entry_param_method(ctx, CMD_GET_NAME, "Device.ManagementServer.InformParameter.1.", "1", NULL);
fault = dm_entry_param_method(ctx, CMD_GET_NAME, "Device.WiFi.SSID.1.", "1", NULL);
assert_int_equal(fault, FAULT_9005);
}

View file

@ -664,7 +664,7 @@ static void test_api_bbfdm_library_get_value(void **state)
dm_ctx_clean_sub(ctx);
dm_ctx_init_sub(ctx, INSTANCE_MODE_NUMBER);
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.ManagementServer.EnableCWMP", NULL, NULL);
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.WiFi.SSID.1.Enable", NULL, NULL);
assert_int_equal(fault, 0);
first_entry = list_first_entry(&ctx->list_parameter, struct dm_parameter, list);
@ -690,7 +690,7 @@ static void test_api_bbfdm_library_set_value(void **state)
dmcmd("/bin/cp", 2, LIBBBF_TEST_PATH, LIBBBF_TEST_BBFDM_PATH);
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.ManagementServer.EnableCWMP", "true", NULL);
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.WiFi.SSID.1.Enable", "true", NULL);
assert_int_equal(fault, 0);
first_fault = list_first_entry(&ctx->list_fault_param, struct param_fault, list);
@ -714,7 +714,7 @@ static void test_api_bbfdm_library_add_object(void **state)
struct dmctx *ctx = (struct dmctx *) *state;
int fault = 0;
fault = dm_entry_param_method(ctx, CMD_ADD_OBJECT, "Device.ManagementServer.InformParameter.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_ADD_OBJECT, "Device.WiFi.SSID.", "test_key", NULL);
assert_int_equal(fault, 0);
assert_non_null(ctx->addobj_instance);
@ -726,10 +726,10 @@ static void test_api_bbfdm_library_delete_object(void **state)
struct dmctx *ctx = (struct dmctx *) *state;
int fault = 0;
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.ManagementServer.InformParameter.1.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.WiFi.SSID.1.", "test_key", NULL);
assert_int_equal(fault, 0);
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.ManagementServer.InformParameter.", "test_key", NULL);
fault = dm_entry_param_method(ctx, CMD_DEL_OBJECT, "Device.WiFi.SSID.", "test_key", NULL);
assert_int_equal(fault, 0);
}