mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-01-28 01:27:16 +01:00
Ticket refs #5611: icwmp notifications unit test module
This commit is contained in:
parent
49c0641b31
commit
1fadaffefb
10 changed files with 530 additions and 85 deletions
|
|
@ -40,6 +40,13 @@ echo "Installing libicwmp"
|
|||
make install -C test/cmocka
|
||||
ldconfig
|
||||
|
||||
mkdir -p /etc/icwmpd
|
||||
mkdir -p /etc/config
|
||||
cp test/files/etc/config/* /etc/config/
|
||||
|
||||
echo "Display cwmp config: "
|
||||
cat /etc/config/cwmp
|
||||
|
||||
echo "Running the unit test cases"
|
||||
make unit-test -C test/cmocka/
|
||||
check_ret $?
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ CFLAGS = -g -Wall -I./inc
|
|||
LDFLAGS = -lmicroxml -luci -lblobmsg_json -lubox -ljson-c -lubus -lpthread -lcurl -lssl -lcrypto
|
||||
LIBCFLAGS = -g -Wall -fPIC -c -I../../inc
|
||||
LIBOBJ = libobj
|
||||
UNIT_TESTS = icwmp_datamodel_interface_unit_testd icwmp_soap_msg_unit_testd icwmp_backup_session_unit_testd icwmp_download_unit_testd icwmp_custom_inform_parameters_unit_testd
|
||||
UNIT_TESTS = icwmp_datamodel_interface_unit_testd icwmp_soap_msg_unit_testd icwmp_backup_session_unit_testd icwmp_download_unit_testd icwmp_notifications_unit_testd
|
||||
VALGRIND = valgrind --xml=yes --xml-file=/builds/iopsys/icwmp/memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all
|
||||
|
||||
libobj:
|
||||
|
|
@ -38,16 +38,19 @@ icwmp_soap_msg_unit_testd: icwmp_soap_msg_unit_test.o
|
|||
|
||||
icwmp_backup_session_unit_testd: icwmp_backup_session_unit_test.o
|
||||
$(CC) -o $@ $^ -lcmocka -licwmp $(LDFLAGS) $(CFLAGS)
|
||||
|
||||
|
||||
icwmp_download_unit_testd: icwmp_download_unit_test.o
|
||||
$(CC) -o $@ $^ -lcmocka -licwmp $(LDFLAGS) $(CFLAGS)
|
||||
|
||||
icwmp_custom_inform_parameters_unit_testd: icwmp_custom_inform_parameters_unit_test.o
|
||||
icwmp_notifications_unit_testd: icwmp_notifications_unit_test.o
|
||||
$(CC) -o $@ $^ -lcmocka -licwmp $(LDFLAGS) $(CFLAGS)
|
||||
|
||||
unit-test: $(UNIT_TESTS)
|
||||
$(foreach testprog, $(UNIT_TESTS), sudo $(VALGRIND) ./$(testprog);)
|
||||
for testprog in $(UNIT_TESTS); do \
|
||||
sudo $(VALGRIND) ./$$testprog; \
|
||||
cp ../files/etc/config/* /etc/config; \
|
||||
done
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -fv *.o libicwmp.so.1.0 $(UNIT_TESTS)
|
||||
rm -fv *.o libicwmp.so.1.0 $(UNIT_TESTS)
|
||||
|
|
|
|||
|
|
@ -311,84 +311,6 @@ static void dm_get_parameter_names_test(void **state)
|
|||
assert_string_equal(fault, "9005");
|
||||
}
|
||||
|
||||
void dm_set_parameter_attributes_test(void **state)
|
||||
{
|
||||
char *fault = NULL;
|
||||
|
||||
/*
|
||||
* Valid parameter path
|
||||
*/
|
||||
cwmp_transaction_start("cwmp");
|
||||
fault = cwmp_set_parameter_attributes("Device.DeviceInfo.UpTime", "1");
|
||||
assert_null(fault);
|
||||
cwmp_transaction_commit();
|
||||
|
||||
/*
|
||||
* Not valid parameter path
|
||||
*/
|
||||
cwmp_transaction_start("cwmp");
|
||||
fault = cwmp_set_parameter_attributes("Device.DeviceInfo.pTime", "1");
|
||||
assert_non_null(fault);
|
||||
cwmp_transaction_commit();
|
||||
|
||||
/*
|
||||
* Valid object path
|
||||
*/
|
||||
cwmp_transaction_start("cwmp");
|
||||
fault = cwmp_set_parameter_attributes("Device.WiFi.SSID.", "1");
|
||||
assert_null(fault);
|
||||
cwmp_transaction_commit();
|
||||
}
|
||||
|
||||
static void dm_get_parameter_attributes_test(void **state)
|
||||
{
|
||||
char *fault = NULL;
|
||||
LIST_HEAD(parameters_list);
|
||||
|
||||
/*
|
||||
* Test of valid parameter path
|
||||
*/
|
||||
fault = cwmp_get_parameter_attributes("Device.DeviceInfo.ProvisioningCode", ¶meters_list);
|
||||
assert_null(fault);
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
list_for_each_entry (param_value, ¶meters_list, list) {
|
||||
assert_non_null(param_value->name);
|
||||
assert_string_equal(param_value->name, "Device.DeviceInfo.ProvisioningCode");
|
||||
break;
|
||||
}
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
/*
|
||||
* Test of non valid parameter path
|
||||
*/
|
||||
fault = cwmp_get_parameter_attributes("Device.Deviceno.UpTime", ¶meters_list);
|
||||
assert_non_null(fault);
|
||||
assert_string_equal(fault, "9005");
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
/*
|
||||
* Test of valid multi-instance_object_path
|
||||
*/
|
||||
fault = cwmp_get_parameter_attributes("Device.WiFi.SSID.", ¶meters_list);
|
||||
assert_null(fault);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
/*
|
||||
* Test of valid not multi-instance_object_path
|
||||
*/
|
||||
fault = cwmp_get_parameter_attributes("Device.DeviceInfo.", ¶meters_list);
|
||||
assert_null(fault);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
/*
|
||||
* Test of non valid object path
|
||||
*/
|
||||
fault = cwmp_get_parameter_attributes("Device.Deviceno.", ¶meters_list);
|
||||
assert_non_null(fault);
|
||||
assert_string_equal(fault, "9005");
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
|
|
@ -397,8 +319,6 @@ int main(void)
|
|||
cmocka_unit_test(dm_add_object_test),
|
||||
cmocka_unit_test(dm_delete_object_test),
|
||||
cmocka_unit_test(dm_get_parameter_names_test),
|
||||
cmocka_unit_test(dm_set_parameter_attributes_test),
|
||||
cmocka_unit_test(dm_get_parameter_attributes_test),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, dm_iface_unit_tests_clean);
|
||||
|
|
|
|||
252
test/cmocka/icwmp_notifications_unit_test.c
Normal file
252
test/cmocka/icwmp_notifications_unit_test.c
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Copyright (C) 2013-2020 iopsys Software Solutions AB
|
||||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <libicwmp/common.h>
|
||||
#include <libicwmp/notifications.h>
|
||||
#include <libicwmp/cwmp_uci.h>
|
||||
/*
|
||||
* Common functions
|
||||
*/
|
||||
char *notifications_test[7] = {"disabled" , "passive", "active", "passive_lw", "passive_passive_lw", "active_lw", "passive_active_lw"};
|
||||
|
||||
int check_notify_file(char *param, int *ret_notification)
|
||||
{
|
||||
FILE *fp;
|
||||
int nbre_iterations = 0;
|
||||
char buf[1280];
|
||||
fp = fopen(DM_ENABLED_NOTIFY, "r");
|
||||
if (fp == NULL)
|
||||
return nbre_iterations;
|
||||
while (fgets(buf, 1280, fp) != NULL) {
|
||||
int len = strlen(buf);
|
||||
if (len) {
|
||||
nbre_iterations++;
|
||||
buf[len - 1] = '\0';
|
||||
}
|
||||
char parameter[256] = { 0 }, notification[2] = { 0 }, value[1024] = { 0 }, type[32] = { 0 };
|
||||
sscanf(buf, "parameter:%256s notifcation:%2s type:%32s value:%1024s\n", parameter, notification, type, value);
|
||||
if (strcmp(param, parameter) == 0) {
|
||||
*ret_notification = atoi(notification);
|
||||
}
|
||||
}
|
||||
return nbre_iterations;
|
||||
}
|
||||
|
||||
int get_parameter_notification_from_list_head(struct list_head *params_list, char *parameter_name)
|
||||
{
|
||||
struct cwmp_dm_parameter *param_iter = NULL;
|
||||
list_for_each_entry (param_iter, params_list, list) {
|
||||
if (strcmp(parameter_name, param_iter->name) == 0)
|
||||
return param_iter->notification;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_parameter_notification_from_notifications_uci_list(char *parameter_name)
|
||||
{
|
||||
int i, option_type, notification = 0;
|
||||
struct uci_list *list_notif;
|
||||
struct uci_element *e;
|
||||
cwmp_uci_init(UCI_STANDARD_CONFIG);
|
||||
for (i = 0; i < 7; i++) {
|
||||
option_type = cwmp_uci_get_option_value_list("cwmp", "@notifications[0]", notifications_test[i], &list_notif);
|
||||
if (list_notif) {
|
||||
uci_foreach_element(list_notif, e) {
|
||||
if (strcmp(e->name, parameter_name) == 0) {
|
||||
notification = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (option_type == UCI_TYPE_STRING)
|
||||
cwmp_free_uci_list(list_notif);
|
||||
if(notification > 0)
|
||||
break;
|
||||
}
|
||||
cwmp_uci_exit();
|
||||
return notification;
|
||||
}
|
||||
|
||||
int get_parameter_in_list_value_change(char *parameter_name)
|
||||
{
|
||||
struct cwmp_dm_parameter *param_iter = NULL;
|
||||
list_for_each_entry (param_iter, &list_value_change, list) {
|
||||
if (strcmp(parameter_name, param_iter->name) == 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
////////////////////////////////////////////
|
||||
|
||||
static void cwmp_init_list_param_notify_unit_test_default(void **state)
|
||||
{
|
||||
init_list_param_notify();
|
||||
assert_int_equal((int)list_empty(&list_param_obj_notify), 1);
|
||||
}
|
||||
|
||||
static void cwmp_update_notify_file_unit_test_default(void **state)
|
||||
{
|
||||
cwmp_update_enabled_notify_file();
|
||||
int notification = 0, nbre_iter = 0;
|
||||
nbre_iter = check_notify_file("Device.DeviceInfo.ProvisioningCode", ¬ification);
|
||||
assert_int_equal(nbre_iter, 2);
|
||||
assert_int_equal(notification, 2);
|
||||
}
|
||||
|
||||
static void cwmp_get_parameter_attribute_unit_test_default(void **state)
|
||||
{
|
||||
|
||||
LIST_HEAD(parameters_list);
|
||||
char *err = NULL;
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.SoftwareVersion", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.SoftwareVersion"), 2);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.ProvisioningCode", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.ProvisioningCode"), 2);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.UpTime", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.UpTime"), 0);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.Upime", ¶meters_list);
|
||||
assert_non_null(err);
|
||||
assert_string_equal(err, "9005");
|
||||
assert_int_equal((int)list_empty(¶meters_list), 1);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
}
|
||||
|
||||
static void cwmp_check_value_change_unit_test_default(void **state)
|
||||
{
|
||||
int is_notify = check_value_change();
|
||||
assert_int_equal(is_notify, NOTIF_NONE);
|
||||
assert_int_equal((int)list_empty(&list_value_change), 1);
|
||||
assert_int_equal((int)list_empty(&list_lw_value_change), 1);
|
||||
}
|
||||
|
||||
static void cwmp_set_parameter_attributes_parameter_sub_parameter_1_unit_test(void **state)
|
||||
{
|
||||
char *err = NULL;
|
||||
//char *list_notif = NULL;
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.UpTime", 1);
|
||||
assert_null(err);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.UpTime"), 1);
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.", 1);
|
||||
assert_null(err);
|
||||
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo."), 1);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.UpTime"), 0);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.ProvisioningCode"), 0);
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.UpTime", 1);
|
||||
assert_null(err);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.UpTime"), 0);
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.Processor.1.", 2);
|
||||
assert_null(err);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.Processor.1."), 2);
|
||||
assert_int_equal(get_parameter_notification_from_notifications_uci_list("Device.DeviceInfo.Processor.1.Alias"), 0);
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.Upime", 2);
|
||||
assert_non_null(err);
|
||||
assert_string_equal(err, "9005");
|
||||
|
||||
err = cwmp_set_parameter_attributes("Device.DeviceInfo.ProvisioningCode", 0);
|
||||
assert_non_null(err);
|
||||
assert_string_equal(err, "9009");
|
||||
reinit_list_param_notify();
|
||||
}
|
||||
|
||||
static void cwmp_get_parameter_attributes_parameter_sub_parameter_1_unit_test(void **state)
|
||||
{
|
||||
LIST_HEAD(parameters_list);
|
||||
char *err = NULL;
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.UpTime", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.UpTime"), 1);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.Processor.", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.Processor.1.Alias"), 2);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.Processor.1.Architecture"), 2);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.Processor.2.Alias"), 1);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.Processor.2.Architecture"), 1);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
|
||||
err = cwmp_get_parameter_attributes("Device.DeviceInfo.ProvisioningCode", ¶meters_list);
|
||||
assert_null(err);
|
||||
assert_int_equal((int)list_empty(¶meters_list), 0);
|
||||
assert_int_equal(get_parameter_notification_from_list_head(¶meters_list, "Device.DeviceInfo.ProvisioningCode"), 2);
|
||||
cwmp_free_all_dm_parameter_list(¶meters_list);
|
||||
}
|
||||
|
||||
static void cwmp_update_notify_file_1_unit_test(void **state)
|
||||
{
|
||||
cwmp_update_enabled_notify_file();
|
||||
int notification = 0, nbre_iter = 0;
|
||||
|
||||
nbre_iter = check_notify_file("Device.DeviceInfo.ProvisioningCode", ¬ification);
|
||||
assert_int_equal(nbre_iter > 2, 1);
|
||||
assert_int_equal(notification, 2);
|
||||
notification = 0;
|
||||
nbre_iter = 0;
|
||||
|
||||
nbre_iter = check_notify_file("Device.DeviceInfo.UpTime", ¬ification);
|
||||
assert_int_equal(nbre_iter > 2, 1);
|
||||
assert_int_equal(notification, 1);
|
||||
notification = 0;
|
||||
nbre_iter = 0;
|
||||
}
|
||||
|
||||
static void cwmp_check_value_change_1_unit_test(void **state)
|
||||
{
|
||||
sleep(2);
|
||||
int is_notify = check_value_change();
|
||||
assert_int_equal(is_notify, NOTIF_PASSIVE);
|
||||
assert_int_equal((int)list_empty(&list_value_change), 0);
|
||||
assert_int_equal((int)list_empty(&list_lw_value_change), 1);
|
||||
assert_int_equal(get_parameter_in_list_value_change("Device.DeviceInfo.UpTime"), 1);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = { //
|
||||
cmocka_unit_test(cwmp_init_list_param_notify_unit_test_default),
|
||||
cmocka_unit_test(cwmp_update_notify_file_unit_test_default),
|
||||
cmocka_unit_test(cwmp_get_parameter_attribute_unit_test_default),
|
||||
cmocka_unit_test(cwmp_check_value_change_unit_test_default),
|
||||
cmocka_unit_test(cwmp_set_parameter_attributes_parameter_sub_parameter_1_unit_test),
|
||||
cmocka_unit_test(cwmp_get_parameter_attributes_parameter_sub_parameter_1_unit_test),
|
||||
cmocka_unit_test(cwmp_update_notify_file_1_unit_test),
|
||||
cmocka_unit_test(cwmp_check_value_change_1_unit_test),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
45
test/files/etc/config/dsl
Normal file
45
test/files/etc/config/dsl
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
config dsl-line 'line'
|
||||
list mode 'gdmt'
|
||||
list mode 'glite'
|
||||
list mode 't1413'
|
||||
list mode 'adsl2'
|
||||
list mode 'adsl2p'
|
||||
list mode 'annexl'
|
||||
list mode 'annexm'
|
||||
list mode 'vdsl2'
|
||||
list profile '8a'
|
||||
list profile '8b'
|
||||
list profile '8c'
|
||||
list profile '8d'
|
||||
list profile '12a'
|
||||
list profile '12b'
|
||||
list profile '17a'
|
||||
list profile '30a'
|
||||
list profile '35b'
|
||||
list profile '35b'
|
||||
list profile '35b'
|
||||
list profile '35b'
|
||||
list profile '35b'
|
||||
list profile '35b'
|
||||
option bitswap '1'
|
||||
option sra '1'
|
||||
option us0 '1'
|
||||
option sesdrop '0'
|
||||
option sos '0'
|
||||
option phyReXmtUs '0'
|
||||
option phyReXmtDs '1'
|
||||
|
||||
config atm-device 'atm0'
|
||||
option name 'ATM'
|
||||
option vpi '8'
|
||||
option vci '35'
|
||||
option device 'atm0'
|
||||
option link_type 'eoa'
|
||||
option encapsulation 'llc'
|
||||
option qos_class 'ubr'
|
||||
|
||||
config ptm-device 'ptm0'
|
||||
option name 'PTM'
|
||||
option device 'ptm0'
|
||||
option priority '1'
|
||||
option portid '1'
|
||||
164
test/files/etc/config/firewall
Normal file
164
test/files/etc/config/firewall
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
config globals 'globals'
|
||||
option enabled '1'
|
||||
|
||||
config defaults
|
||||
option syn_flood '1'
|
||||
option input 'ACCEPT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'REJECT'
|
||||
|
||||
config zone
|
||||
option name 'lan'
|
||||
list network 'lan'
|
||||
option input 'ACCEPT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'ACCEPT'
|
||||
|
||||
config zone
|
||||
option name 'wan'
|
||||
list network 'wan'
|
||||
list network 'wan6'
|
||||
option input 'REJECT'
|
||||
option output 'ACCEPT'
|
||||
option forward 'REJECT'
|
||||
option masq '1'
|
||||
option mtu_fix '1'
|
||||
|
||||
config forwarding
|
||||
option src 'lan'
|
||||
option dest 'wan'
|
||||
|
||||
config rule
|
||||
option name 'Allow-DHCP-Renew'
|
||||
option src 'wan'
|
||||
option proto 'udp'
|
||||
option dest_port '68'
|
||||
option target 'ACCEPT'
|
||||
option family 'ipv4'
|
||||
option dest 'lan'
|
||||
|
||||
config rule
|
||||
option name 'Allow-Ping'
|
||||
option src 'wan'
|
||||
option proto 'icmp'
|
||||
option icmp_type 'echo-request'
|
||||
option family 'ipv4'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-IGMP'
|
||||
option src 'wan'
|
||||
option proto 'igmp'
|
||||
option family 'ipv4'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-DHCPv6'
|
||||
option src 'wan'
|
||||
option proto 'udp'
|
||||
option src_ip 'fc00::/6'
|
||||
option dest_ip 'fc00::/6'
|
||||
option dest_port '546'
|
||||
option family 'ipv6'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-MLD'
|
||||
option src 'wan'
|
||||
option proto 'icmp'
|
||||
option src_ip 'fe80::/10'
|
||||
list icmp_type '130/0'
|
||||
list icmp_type '131/0'
|
||||
list icmp_type '132/0'
|
||||
list icmp_type '143/0'
|
||||
option family 'ipv6'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-ICMPv6-Input'
|
||||
option src 'wan'
|
||||
option proto 'icmp'
|
||||
list icmp_type 'echo-request'
|
||||
list icmp_type 'echo-reply'
|
||||
list icmp_type 'destination-unreachable'
|
||||
list icmp_type 'packet-too-big'
|
||||
list icmp_type 'time-exceeded'
|
||||
list icmp_type 'bad-header'
|
||||
list icmp_type 'unknown-header-type'
|
||||
list icmp_type 'router-solicitation'
|
||||
list icmp_type 'neighbour-solicitation'
|
||||
list icmp_type 'router-advertisement'
|
||||
list icmp_type 'neighbour-advertisement'
|
||||
option limit '1000/sec'
|
||||
option family 'ipv6'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-ICMPv6-Forward'
|
||||
option src 'wan'
|
||||
option dest '*'
|
||||
option proto 'icmp'
|
||||
list icmp_type 'echo-request'
|
||||
list icmp_type 'echo-reply'
|
||||
list icmp_type 'destination-unreachable'
|
||||
list icmp_type 'packet-too-big'
|
||||
list icmp_type 'time-exceeded'
|
||||
list icmp_type 'bad-header'
|
||||
list icmp_type 'unknown-header-type'
|
||||
option limit '1000/sec'
|
||||
option family 'ipv6'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-IPSec-ESP'
|
||||
option src 'wan'
|
||||
option dest 'lan'
|
||||
option proto 'esp'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config rule
|
||||
option name 'Allow-ISAKMP'
|
||||
option src 'wan'
|
||||
option dest 'lan'
|
||||
option dest_port '500'
|
||||
option proto 'udp'
|
||||
option target 'ACCEPT'
|
||||
|
||||
config dmz 'dmz'
|
||||
option enabled '0'
|
||||
option exclude_ports '5060 7547'
|
||||
|
||||
config include
|
||||
option path '/etc/firewall.user'
|
||||
option reload '1'
|
||||
|
||||
config include 'ddos'
|
||||
option path '/etc/firewall.ddos'
|
||||
option reload '1'
|
||||
|
||||
config include 'parental'
|
||||
option path '/etc/firewall.parental'
|
||||
option reload '1'
|
||||
|
||||
config include 'qos'
|
||||
option path '/etc/firewall.qos'
|
||||
option reload '1'
|
||||
|
||||
config include 'cwmp'
|
||||
option path '/etc/firewall.cwmp'
|
||||
option reload '1'
|
||||
|
||||
config include 'miniupnpd'
|
||||
option type 'script'
|
||||
option path '/usr/share/miniupnpd/firewall.include'
|
||||
option family 'any'
|
||||
option reload '1'
|
||||
|
||||
config include 'sip'
|
||||
option path '/etc/firewall.sip'
|
||||
option reload '1'
|
||||
|
||||
config include 'dmzhost'
|
||||
option path '/etc/firewall.dmz'
|
||||
option reload '1'
|
||||
|
||||
17
test/files/etc/config/network
Normal file
17
test/files/etc/config/network
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option proto 'dhcp'
|
||||
option hostname 'iopsysWrt-00220775DC6C'
|
||||
option vendorid 'eg400'
|
||||
option ifname 'eth0'
|
||||
option reqopts '43'
|
||||
|
||||
config interface 'wan6'
|
||||
option proto 'dhcpv6'
|
||||
option ifname '@wan'
|
||||
|
||||
8
test/files/etc/config/users
Normal file
8
test/files/etc/config/users
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
config user 'user'
|
||||
option enabled '1'
|
||||
option remote_access '1'
|
||||
list _access_w 'admin'
|
||||
list _access_w 'support'
|
||||
list _access_w 'user'
|
||||
|
||||
4
test/files/etc/config/uspd
Normal file
4
test/files/etc/config/uspd
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
config uspd 'usp'
|
||||
option granularitylevel '0'
|
||||
option debug '1'
|
||||
option loglevel '2'
|
||||
25
test/files/etc/config/wireless
Normal file
25
test/files/etc/config/wireless
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
config wifi-device 'test2'
|
||||
option channel 'auto'
|
||||
option hwmode 'auto'
|
||||
option country 'DE'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
|
||||
config wifi-iface
|
||||
option device 'test2'
|
||||
option ifname 'test2'
|
||||
option mode 'ap'
|
||||
option encryption 'psk2'
|
||||
|
||||
config wifi-device 'test5'
|
||||
option channel 'auto'
|
||||
option hwmode 'auto'
|
||||
option country 'DE'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
|
||||
config wifi-iface
|
||||
option device 'test5'
|
||||
option ifname 'test5'
|
||||
option mode 'ap'
|
||||
option encryption 'psk2'
|
||||
Loading…
Add table
Reference in a new issue