diff --git a/recipes-devtools/wifi-test-tool/files/src/Makefile.am b/recipes-devtools/wifi-test-tool/files/src/Makefile.am
new file mode 100644
index 0000000..59dee99
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/Makefile.am
@@ -0,0 +1,13 @@
+AM_CFLAGS = -D_ANSC_LINUX
+AM_CFLAGS += -D_ANSC_USER
+AM_CFLAGS += -D_ANSC_LITTLE_ENDIAN_
+
+AM_CPPFLAGS = -Wall -Werror
+ACLOCAL_AMFLAGS = -I m4
+hardware_platform = armv7ahf-neon-rdk-linux-musleabi
+
+bin_PROGRAMS = wifi_test_tool
+wifi_test_tool_CPPFLAGS = -I$(top_srcdir)/include $(CPPFLAGS) -D_WIFI_HAL_TEST_
+wifi_test_tool_SOURCES = wifi-test-tool.c
+wifi_test_tool_LDFLAGS = -lhal_wifi
+
diff --git a/recipes-devtools/wifi-test-tool/files/src/configure.ac b/recipes-devtools/wifi-test-tool/files/src/configure.ac
new file mode 100644
index 0000000..8783d84
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/configure.ac
@@ -0,0 +1,33 @@
+AC_PREREQ([2.65])
+AC_INIT([hal], [1.0], [BUG-REPORT-ADDRESS])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT
+
+AC_PREFIX_DEFAULT(`pwd`)
+AC_ENABLE_SHARED
+AC_DISABLE_STATIC
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_CC_C_O
+AM_PROG_LIBTOOL(libtool)
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_INLINE
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+
+AC_CONFIG_FILES(Makefile)
+
+
+AC_OUTPUT
+
diff --git a/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c
new file mode 100644
index 0000000..94fde80
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.c
@@ -0,0 +1,336 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <uci.h>
+#include "wifi-test-tool.h"
+
+void set_channel(wifi_radio_param *radio_param, char *channel)
+{
+    if (strcmp(channel, "auto") != 0) {
+        radio_param->auto_channel = FALSE;
+        radio_param->channel = atoi(channel);
+    }
+}
+
+void set_band(wifi_radio_param *radio_param, char *country)
+{
+    strcpy(radio_param->country, country);
+}
+
+void set_country(wifi_radio_param *radio_param, char *band)
+{
+    strcpy(radio_param->band, band);
+}
+
+void set_hwmode(wifi_radio_param *radio_param, char *hwmode)
+{
+    if (strncmp(hwmode, "11a", 3) == 0)
+        strcpy(radio_param->hwmode, "a");
+    if (strncmp(hwmode, "11b", 3) == 0)
+        strcpy(radio_param->hwmode, "b");
+    if (strncmp(hwmode, "11g", 3) == 0)
+        strcpy(radio_param->hwmode, "g");
+}
+
+void set_htmode(wifi_radio_param *radio_param, char *htmode)
+{
+    char tmp[16] = {0};
+    char *ptr = htmode;
+    ULONG bandwidth = 0;
+    radio_param->bandwidth = 20;
+    while (*ptr) {
+        if (isdigit(*ptr)) {
+            bandwidth = strtoul(ptr, NULL, 10);
+            radio_param->bandwidth = bandwidth;
+            break;
+        }
+        ptr++;
+    }
+
+    // HT40     -> 11NGHT40PLUS
+    // VHT40+   -> 11ACVHT40PLUS
+    // HE80     -> 11AXHE80
+    if (strstr(htmode, "+") != NULL) {
+        strncpy(tmp, htmode, strlen(htmode) - 1);
+        strcat(tmp, "PLUS");
+    } else if (strstr(htmode, "-") != NULL) {
+        strncpy(tmp, htmode, strlen(htmode) - 1);
+        strcat(tmp, "MINUS");
+    } else 
+        strcpy(tmp, htmode);
+
+
+    if (strstr(htmode, "VHT") != NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11AC%s", tmp);
+    } else if (strstr(htmode, "HT") != NULL && strstr(htmode, "NO") == NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11NG%s", tmp);
+    } else if (strstr(htmode, "HE") != NULL) {
+        snprintf(radio_param->htmode, sizeof(radio_param->htmode), "11AX%s", tmp);
+    } else {        // NOHT or NONE should be parsed with the band, so just fill the original string.
+        strcpy(radio_param->htmode, tmp);
+    }
+
+}
+
+void set_disable(wifi_radio_param *radio_param, char *disable)
+{
+    if (strcmp(disable, "1") == 0)
+        radio_param->disabled = TRUE;
+    else
+        radio_param->disabled = FALSE;
+}
+
+void set_radionum(wifi_ap_param *ap_param, char *radio_name)
+{
+    int radio_num;
+    char *ptr = radio_name;
+
+    while (*ptr) {
+        if (isdigit(*ptr)) {
+            radio_num = strtoul(ptr, NULL, 10);
+            ap_param->radio_index = radio_num;
+            break;
+        }
+        ptr++;
+    }
+}
+
+void set_ssid(wifi_ap_param *ap_param, char *ssid)
+{
+    strncpy(ap_param->ssid, ssid, 32);
+}
+
+void set_encryption(wifi_ap_param *ap_param, char *encryption_mode)
+{
+    if (strstr(encryption_mode, "3") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA3-");
+    } else if (strstr(encryption_mode, "2") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA2-");
+    } else if (strstr(encryption_mode, "1") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA-");
+    } else if (strstr(encryption_mode, "mix") != NULL) {
+        strcpy(ap_param->enctyption_mode, "WPA-WPA2-");
+    }
+
+    if (strstr(encryption_mode, "psk") != NULL) {
+        strcat(ap_param->enctyption_mode, "Personal");
+    } else if (strstr(encryption_mode, "wpa") != NULL) {
+        strcat(ap_param->enctyption_mode, "Enterprise");
+    }
+    
+    if (strcmp(encryption_mode, "none") == 0) {
+        strcpy(ap_param->enctyption_mode, "None");
+    }
+}
+
+void set_key(wifi_ap_param *ap_param, char *key)
+{
+    strncpy(ap_param->password, key, 64);
+}
+
+void set_radio_param(wifi_radio_param radio_parameter)
+{
+    BOOL enable;
+    BOOL current;
+    char config_file[64] = {0};
+    int ret = 0;
+    struct params param;
+
+    fprintf(stderr, "Start setting radio\n");
+    sprintf(config_file, "/nvram/hostapd%d.conf", radio_parameter.radio_index);
+
+    // Call hal to set in this function
+    // Channel
+    fprintf(stderr, "Set channel: %d, bandwidth: %d\n", radio_parameter.channel, radio_parameter.bandwidth);
+    if (radio_parameter.auto_channel == TRUE) {
+        ret = wifi_setRadioAutoChannelEnable(radio_parameter.radio_index, TRUE);
+    } else {
+        // wifi_setRadioChannel(radio_parameter.radio_index, radio_parameter.channel);
+        ret = wifi_pushRadioChannel2(radio_parameter.radio_index, radio_parameter.channel, radio_parameter.bandwidth, 30);
+    }
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set channel failed!!!]\n");
+    ret = 0;
+
+    // Country
+    fprintf(stderr, "Set Country: %s\n", radio_parameter.country);
+    ret = wifi_setRadioCountryCode(radio_parameter.radio_index, radio_parameter.country);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set Country failed!!!]\n");
+    ret = 0;
+
+    // hwmode
+    fprintf(stderr, "Set hwmode: %s\n", radio_parameter.hwmode);
+    ret = wifi_setRadioHwMode(radio_parameter.radio_index, radio_parameter.hwmode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set hwmode failed!!!]\n");
+    ret = 0;
+
+    // htmode
+    wifi_ieee80211_Mode pure_mode;
+    if (strcmp(radio_parameter.band, "2g") == 0) {
+
+        pure_mode |= WIFI_MODE_B | WIFI_MODE_G;
+        if (strcmp(radio_parameter.htmode, "NOHT") == 0 || strcmp(radio_parameter.htmode, "NONE") == 0)
+            strcpy(radio_parameter.htmode, "11G");
+
+    } else if (strcmp(radio_parameter.band, "5g") == 0) {
+
+        pure_mode |= WIFI_MODE_A;
+        if (strcmp(radio_parameter.htmode, "NOHT") == 0 || strcmp(radio_parameter.htmode, "NONE") == 0) 
+            strcpy(radio_parameter.htmode, "11A");
+    }
+
+    if (strstr(radio_parameter.htmode, "VHT") != NULL)
+        pure_mode |= WIFI_MODE_N | WIFI_MODE_AC;
+    else if (strstr(radio_parameter.htmode, "HT") != NULL && strstr(radio_parameter.htmode, "NO") == NULL)
+        pure_mode |= WIFI_MODE_N;
+    else if (strstr(radio_parameter.htmode, "HE") != NULL)
+        pure_mode |= WIFI_MODE_N | WIFI_MODE_AC | WIFI_MODE_AX;
+
+    radio_parameter.pure_mode = (int)pure_mode;
+    fprintf(stderr, "Set htmode: %s, puremode: %d\n", radio_parameter.htmode, radio_parameter.pure_mode);
+    ret = wifi_setRadioMode(radio_parameter.radio_index, radio_parameter.htmode, radio_parameter.pure_mode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set htmode failed!!!]\n");
+    ret = 0;
+
+    // disabled
+    if (radio_parameter.disabled == FALSE)
+        enable = TRUE;
+    ret = wifi_getRadioEnable(radio_parameter.radio_index, &current);
+    fprintf(stderr, "radio %d, current: %s, set: %s, getstatus return: %s\n", radio_parameter.radio_index, current ? "enable":"disable", radio_parameter.disabled ? "disable":"enable",  (ret==RETURN_OK)? "success": "failed");
+    // fprintf(stderr, "In if closure. enable: %d, current: %d.\n", enable, current);
+    if (enable != current) {
+        ret = wifi_setRadioEnable(radio_parameter.radio_index, enable);
+    }
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set radio %s failed!!!]\n", enable?"enble":"disable");
+    ret = 0;
+
+}
+
+void set_ap_param(wifi_ap_param ap_param)
+{
+    int ret = 0;
+
+    fprintf(stderr, "Start setting ap\n");
+    // Call hal to set in this function
+    // SSID
+    fprintf(stderr, "Set SSID: %s\n", ap_param.ssid);
+    ret = wifi_setSSIDName(ap_param.ap_index, ap_param.ssid);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set SSID failed!!!]\n");
+
+    // wpa and security mode
+    fprintf(stderr, "Set encryption mode: %s\n", ap_param.enctyption_mode);
+    ret = wifi_setApSecurityModeEnabled(ap_param.ap_index, ap_param.enctyption_mode);
+    if (ret != RETURN_OK)
+        fprintf(stderr, "[Set encryption mode failed!!!]\n");
+
+    // key
+    if (strlen(ap_param.password) > 0) {
+        fprintf(stderr, "Set password: %s\n", ap_param.password);
+        ret = wifi_setApSecurityKeyPassphrase(ap_param.ap_index, ap_param.password);
+        if (ret != RETURN_OK)
+            fprintf(stderr, "[Set password failed!!!]\n");
+    }
+
+    // restart ap
+    wifi_setApEnable(ap_param.ap_index, FALSE);
+    wifi_setApEnable(ap_param.ap_index, TRUE);
+}
+
+int apply_uci_config ()
+{
+    struct uci_context *uci_ctx = uci_alloc_context();
+    struct uci_package *uci_pkg = NULL;
+    struct uci_element *e;
+    // struct uci_section *s;
+    const char cfg_name[] = "wireless";
+    int max_radio_num = 0;
+    BOOL parsing_radio = FALSE;
+
+    wifi_getMaxRadioNumber(&max_radio_num);
+    fprintf(stderr, "max radio number: %d\n", max_radio_num);
+    if (uci_load(uci_ctx, cfg_name, &uci_pkg) != UCI_OK) {
+        uci_free_context(uci_ctx);
+        fprintf(stderr, "%s: load uci failed.\n", __func__);
+        return RETURN_ERR;
+    }
+
+    uci_foreach_element(&uci_pkg->sections, e) {
+
+        struct uci_section *s = uci_to_section(e);
+        struct uci_element *option = NULL;
+        wifi_radio_param radio_param = {0};
+        wifi_ap_param ap_param = {0};
+        radio_param.radio_index = -1;
+        ap_param.ap_index = -1;
+
+        if (strcmp(s->type, "wifi-device") == 0) {
+            sscanf(s->e.name, "radio%d", &radio_param.radio_index);
+            parsing_radio = TRUE;
+            fprintf(stderr, "\n----- Start parsing radio %d config. -----\n", radio_param.radio_index);
+        } else if (strcmp(s->type, "wifi-iface") == 0) {
+            sscanf(s->e.name, "default_radio%d", &ap_param.ap_index);
+            parsing_radio = FALSE;
+            fprintf(stderr, "\n----- Start parsing ap %d config. -----\n", ap_param.ap_index);
+        }
+
+        uci_foreach_element(&s->options, option) {
+
+            struct uci_option *op = uci_to_option(option);
+            if (parsing_radio == TRUE) {
+                // transform the type from input string and store the value in radio_param.
+                if (strcmp(op->e.name, "channel") == 0)
+                    set_channel(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "hwmode") == 0)
+                    set_hwmode(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "htmode") == 0)
+                    set_htmode(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "disabled") == 0)
+                    set_disable(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "band") == 0)
+                    set_band(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "country") == 0)
+                    set_country(&radio_param, op->v.string);
+                else if (strcmp(op->e.name, "noscan") == 0)
+                    set_band(&radio_param, op->v.string);
+                else
+                    fprintf(stderr, "[%s %s not set!]\n", op->e.name, op->v.string);
+            } else {        
+                // parsing iface
+                if (strcmp(op->e.name, "device") == 0)
+                    set_radionum(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "ssid") == 0)
+                    set_ssid(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "encryption") == 0)
+                    set_encryption(&ap_param, op->v.string);
+                else if (strcmp(op->e.name, "key") == 0)
+                    set_key(&ap_param, op->v.string);
+                else
+                    fprintf(stderr, "[%s %s not set!]\n", op->e.name, op->v.string);
+            }
+        }
+        if (parsing_radio == TRUE)
+            set_radio_param(radio_param);
+        else
+            set_ap_param(ap_param);
+    }
+
+    uci_unload(uci_ctx, uci_pkg);
+    uci_free_context(uci_ctx);
+    return RETURN_OK;
+}
+
+int main(int argc, char **argv)
+{
+    if (argc != 2 || strcmp(argv[1], "reload") != 0) {
+        fprintf(stderr, "Usage: wifi reload.\nThis tool is only for RDKB MSP/SQC test.\n");
+        return -1;
+    }
+    apply_uci_config();
+    return 0;
+}
diff --git a/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h
new file mode 100644
index 0000000..a8cc11c
--- /dev/null
+++ b/recipes-devtools/wifi-test-tool/files/src/wifi-test-tool.h
@@ -0,0 +1,62 @@
+#include "uci_config.h"
+#include "wifi_hal.h"
+
+typedef enum {
+    WIFI_MODE_A = 0x01,
+    WIFI_MODE_B = 0x02,
+    WIFI_MODE_G = 0x04,
+    WIFI_MODE_N = 0x08,
+    WIFI_MODE_AC = 0x10,
+    WIFI_MODE_AX = 0x20,
+} wifi_ieee80211_Mode;
+
+typedef struct {
+    int radio_index;
+    char type[16];
+    char phy[16];
+    char macaddr[18];
+    BOOL disabled;
+    int channel;
+    BOOL auto_channel;
+    char channels[64];      // list type
+    char hwmode[2];
+    char band[8];
+    char htmode[16];
+    int bandwidth;
+    int pure_mode;
+    int chanbw;
+    char ht_capab[8];
+    int txpower;
+    BOOL diversity;
+    int rxantenna;
+    int txantenna;
+    char country[3];
+    BOOL country_ie;
+    int distance;
+    int beacon_int;
+    BOOL legacy_rates;
+    char require_mode[2];
+    int cell_density;
+    char basic_rate[64];
+    char supported_rates[64];
+    int log_level;
+    char hostapd_options[64];
+} wifi_radio_param;
+
+typedef struct {
+    wifi_radio_param *radio_info;   // for multiple vap
+    int radio_index;
+    int ap_index;
+    char ssid[33];
+    int wpa;
+    char password[64];
+    char enctyption_mode[64];
+} wifi_ap_param;
+
+struct params
+{
+    char * name;
+    char * value;
+};
+
+INT wifi_getMaxRadioNumber(INT *max_radio_num);
