diff --git a/test/cmocka/functional_test_bbfd.c b/test/cmocka/functional_test_bbfd.c index 8d763696..ef00e31e 100644 --- a/test/cmocka/functional_test_bbfd.c +++ b/test/cmocka/functional_test_bbfd.c @@ -383,40 +383,40 @@ static void test_api_bbfdm_get_set_json_v1_parameter(void **state) assert_int_equal(fault, FAULT_9008); // get value ==> expected "0" error - ctx->in_param = "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name"; + ctx->in_param = "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name", "homeoffice", "xsd:string"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name", "kids", "xsd:string"); // set value ==> expected "0" error - ctx->in_param = "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name"; + ctx->in_param = "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name"; ctx->in_value = "home+office test"; fault = bbf_entry_method(ctx, BBF_SET_VALUE); assert_int_equal(fault, 0); // get value ==> expected "0" error - ctx->in_param = "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name"; + ctx->in_param = "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name", "home+office test", "xsd:string"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name", "home+office test", "xsd:string"); // set value ==> expected "0" error - ctx->in_param = "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name"; + ctx->in_param = "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name"; ctx->in_value = "office_test"; fault = bbf_entry_method(ctx, BBF_SET_VALUE); assert_int_equal(fault, 0); // get value ==> expected "0" error - ctx->in_param = "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name"; + ctx->in_param = "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name"; fault = bbf_entry_method(ctx, BBF_GET_VALUE); assert_int_equal(fault, 0); // validate parameter : name, type, value - validate_parameter(ctx, "Device.X_IOPSYS_EU_URLFilter.Profile.1.Name", "office_test", "xsd:string"); + validate_parameter(ctx, "Device.X_IOPSYS_EU_ParentalControl.Profile.1.Name", "office_test", "xsd:string"); } static void test_api_bbfdm_get_set_library_parameter(void **state) diff --git a/test/files/etc/config/parentalcontrol b/test/files/etc/config/parentalcontrol new file mode 100644 index 00000000..82d31c7a --- /dev/null +++ b/test/files/etc/config/parentalcontrol @@ -0,0 +1,29 @@ +config globals 'globals' + option enable '1' + +config profile 'profile_1' + option name 'kids' + list host 'aa:00:aa:35:01:01' + list host 'D_wan_53_1' + option bedtime_enable '1' + list internet_access_schedule 'schedule_1' + option internet_access_policy 'Allow' + option internet_access_enable '1' + +config profile_urlfilter 'profile_1_profile_urlfilter_1' + option dm_parent 'profile_1' + list filter_text 'facebook.com' + list profile_urlfilter_schedule 'schedule_1' + option profile_urlbundle 'b_kids' + option enable '1' + +config urlbundle 'urlbundle_1' + option name 'b_kids' + list custom_url 'youtube.com' + +config profile_bedtime_schedule 'profile_1_profile_bedtime_schedule_1' + option dm_parent 'profile_1' + option start_time '21:00' + option end_time '08:00' + list day 'Saturday' + list day 'Sunday' diff --git a/test/files/etc/config/urlfilter b/test/files/etc/config/urlfilter deleted file mode 100644 index 5045946b..00000000 --- a/test/files/etc/config/urlfilter +++ /dev/null @@ -1,36 +0,0 @@ -config globals 'globals' - option enable '1' - option global_blacklist '1' - list blacklist_url 'abc.com' - list blacklist_url 'def.com' - list blacklist_url 'facebook.com' - list blacklist_url 'instagram.com' - -config profile 'profile_1' - option name 'homeoffice' - list whitelist_url 'facebook.com' - list whitelist_url 'instagram.com' - -config profile 'profile_2' - option name 'kids' - list blacklist_url 'youtube.com' - list blacklist_url 'game.com' - -config filter 'filter_1' - option enable '1' - option profile 'profile_2' - list macaddr '00:11:22:33:44:55' - list macaddr 'AA:BB:CC:33:44:55' - list day 'Monday' - list day 'Tuesday' - list day 'Wednesday' - list day 'Thursday' - list day 'Friday' - option start_time '20:00' - option duration '64800' - -config filter 'filter_2' - option enable '1' - option profile 'profile_1' - list macaddr 'CC:DD:EE:33:44:55' - list macaddr 'EE:AA:BB:11:22:33' diff --git a/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_ParentalControl.json b/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_ParentalControl.json deleted file mode 100644 index e8da4e8d..00000000 --- a/test/files/usr/share/bbfdm/plugins/X_IOPSYS_EU_ParentalControl.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "json_plugin_version": 2, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "description": "This object contains the information about all parental control features.", - "array": false, - "ProfileNumberOfEntries": { - "type": "unsignedInt", - "read": true, - "write": false, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "unsignedInt", - "description": "<>", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile" - }, - "option": { - "name": "@Count" - } - } - } - ] - }, - "URLBundleNumberOfEntries": { - "type": "unsignedInt", - "read": true, - "write": false, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "unsignedInt", - "description": "<>", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "urlbundle" - }, - "option": { - "name": "@Count" - } - } - } - ] - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.URLBundle.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": true, - "array": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "urlbundle" - }, - "dmmapfile": "dmmap_parentalcontrol" - } - } - ], - "Name": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "description": "Uniquely identifiable name of the URL bundle instance.", - "datatype": "string", - "range": [ - { - "max": 32 - } - ], - "flags": [ - "Unique", - "Linker" - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "name" - } - ] - }, - "DownloadURL": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "download_url" - } - ] - }, - "CustomURL": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "list": { - "datatype": "string" - }, - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "custom_url" - } - ] - } - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "description": "Table contain details of the access profiles.", - "uniqueKeys": [ - "Name" - ], - "access": true, - "array": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile" - }, - "dmmapfile": "dmmap_parentalcontrol" - } - } - ], - "Alias": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "Alias", - "range": [ - { - "max": 64 - } - ], - "flags": [ - "unique" - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "alias" - } - ] - }, - "Name": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "range": [ - { - "max": 64 - } - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "name" - } - ] - }, - "HostList": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "description": "Comma separated list of hostnames or MAC addresses.", - "list": { - "datatype": "string" - }, - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "list": "host" - } - ] - }, - "URLFilterNumberOfEntries": { - "type": "unsignedInt", - "read": true, - "write": false, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "unsignedInt", - "description": "<>", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile_urlfilter" - }, - "option": { - "name": "@Count" - } - } - } - ] - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.URLFilter.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": true, - "array": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile_urlfilter" - }, - "dmmapfile": "dmmap_parentalcontrol" - } - } - ], - "Enable": { - "type": "boolean", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "boolean", - "description": "Enable or disable this filter instance on the CPE.", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "enable" - } - ] - }, - "AccessPolicy": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "default": "Allow", - "enumerations": [ - "Allow", - "Deny" - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "access" - } - ] - }, - "Order": { - "type": "unsignedInt", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "description": "Priority order of applying the policy", - "datatype": "unsignedInt", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "order" - } - ] - }, - "FilterText": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "range": [ - { - "max": 256 - } - ], - "description": "Comma separated list of URL or sub-part of the URL used for filter", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "filtertext" - } - ] - }, - "URLBundleRef": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "flags": [ - "Reference" - ], - "description": "Reference to URLBundle which has list of URLs defined based on Category", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "profile_urlbundle", - "linker_obj": "Device.{BBF_VENDOR_PREFIX}ParentalControl.URLBundle.*.Name" - } - ] - }, - "ScheduleRef": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "flags": [ - "Reference" - ], - "description": "Reference to the schedule attached to this url filter instance", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "profile_bedtime_schedule", - "linker_obj": "Device.Schedules.Schedule.[Alias==@key]" - } - ] - } - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.BedTime.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "array": false, - "Enable": { - "type": "boolean", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "boolean", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "bedtime_enable" - } - ] - }, - "ScheduleNumberOfEntries": { - "type": "unsignedInt", - "read": true, - "write": false, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "unsignedInt", - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile_bedtime_schedule" - }, - "option": { - "name": "@Count" - } - } - } - ] - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.BedTime.Schedule.{i}.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": true, - "array": true, - "mapping": [ - { - "type": "uci", - "uci": { - "file": "parentalcontrol", - "section": { - "type": "profile_bedtime_schedule" - }, - "dmmapfile": "dmmap_parentalcontrol" - } - } - ], - "Alias": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "Alias", - "range": [ - { - "max": 64 - } - ], - "flags": [ - "unique" - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "alias" - } - ] - }, - "Name": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "description": "Name of this schedule instance.", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "name" - } - ] - }, - "Days": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "list": { - "datatype": "string", - "enumerations": [ - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday" - ] - }, - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "days" - } - ] - }, - "StartTime": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "range": [ - { - "max": 5 - } - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "start_time" - } - ] - }, - "EndTime": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "string", - "range": [ - { - "max": 5 - } - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "end_time" - } - ] - } - } - }, - "Device.{BBF_VENDOR_PREFIX}ParentalControl.Profile.{i}.InternetAccess.": { - "type": "object", - "protocols": [ - "cwmp", - "usp" - ], - "access": false, - "array": false, - "Enable": { - "type": "boolean", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "datatype": "boolean", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "internet_access_enable" - } - ] - }, - "AccessPolicy": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "description": "Set Deny to stop internet access, set Allow to allow access based on Schedule", - "datatype": "string", - "default": "Allow", - "enumerations": [ - "Allow", - "Deny" - ], - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "key": "internet_access_policy" - } - ] - }, - "ScheduleRef": { - "type": "string", - "read": true, - "write": true, - "protocols": [ - "cwmp", - "usp" - ], - "flags": [ - "Reference" - ], - "description": "Comma separated list of references to the Schedules object", - "mapping": [ - { - "data": "@Parent", - "type": "uci_sec", - "list": "internet_access_schedule", - "linker_obj": "Device.Schedules.Schedule.[Alias==@list]" - } - ] - } - } - } - } -} - diff --git a/tools/tools_input.json b/tools/tools_input.json index 9f475287..f80774fb 100644 --- a/tools/tools_input.json +++ b/tools/tools_input.json @@ -72,7 +72,7 @@ "proto": "git", "version": "devel", "dm_files": [ - "urlfilter/files/etc/urlfilter/urlfilter.json", + "urlfilter/files/etc/urlfilter/X_IOPSYS_EU_ParentalControl.json", "icwmp/files/etc/bbfdm/json/CWMPManagementServer.json", "ponmngr/files/etc/ponmngr/xpon.json" ]