Add aaa-12 修改vlan_get_chk以及在webserver框架中新增vlan回调

SOL 修改vlan_get_chk以及在webserver框架中新增vlan回调
修改人:yinbin
检视人:yinbin

Signed-off-by: yinbin <yinbin@cmhi.chinamobile.com>
This commit is contained in:
yinbin 2019-08-27 04:08:10 -07:00
parent 437b5dbdb0
commit bb44ab5b15
2 changed files with 30 additions and 7 deletions

View File

@ -1824,6 +1824,7 @@ ret_code vid_value_chk(int vid)
ret_code vid_num_chk(char *if_name, operation_type op_type, int num) ret_code vid_num_chk(char *if_name, operation_type op_type, int num)
{ {
int ifnode = -1; int ifnode = -1;
int total = 0;
if(!if_name){ if(!if_name){
printf("[vlan]vid_num_chk: if_name is null.\n"); printf("[vlan]vid_num_chk: if_name is null.\n");
return RET_NULLP; return RET_NULLP;
@ -1831,13 +1832,15 @@ ret_code vid_num_chk(char *if_name, operation_type op_type, int num)
printf("[vlan]vid_num_chk: if_name=%s, op_type=%d, num=%d\n", if_name, op_type, num); printf("[vlan]vid_num_chk: if_name=%s, op_type=%d, num=%d\n", if_name, op_type, num);
ifnode = get_ifnode_from_global(if_name); ifnode = get_ifnode_from_global(if_name);
if(ifnode == -1){ if(ifnode == -1){
printf("[vlan]vid_num_chk: get ifnode empty, return\n"); total = num;
return RET_OK; printf("[vlan]vid_num_chk: get ifnode empty, total = %d\n", total);
} }
if(op_type == OP_ADD && else{
g_if_vlan_info[ifnode].vidcnt + num > EACH_PORT_MAX_VLAN_NUM){ total = g_if_vlan_info[ifnode].vidcnt + num;
printf("[vlan]vid_num_chk: ADD operation's vid num(%d+%d=%d) > EACH_PORT_MAX_VLAN_NUM\n", printf("[vlan]vid_num_chk: total = %d + %d = %d\n", g_if_vlan_info[ifnode].vidcnt, num, total);
g_if_vlan_info[ifnode].vidcnt, num, g_if_vlan_info[ifnode].vidcnt + num); }
if(op_type == OP_ADD && total > EACH_PORT_MAX_VLAN_NUM){
printf("[vlan]vid_num_chk: ADD operation's total vid num > EACH_PORT_MAX_VLAN_NUM\n");
return RET_INPUTERR; return RET_INPUTERR;
} }
@ -2105,12 +2108,16 @@ ret_code vlan_config_get_chk(uint source, pointer input)
printf("[vlan]vlan_config_get_chk: get json parse failed(%d).\n", ret); printf("[vlan]vlan_config_get_chk: get json parse failed(%d).\n", ret);
return ret; return ret;
} }
#if 0
for(i = 0; i < MAX_INTERFACES; i++){ for(i = 0; i < MAX_INTERFACES; i++){
if(interface[i] == 1){ if(interface[i] == 1){
printf("[vlan]find a node[%d]\n", i);
return RET_OK; return RET_OK;
} }
} }
return RET_INPUTERR; return RET_INPUTERR;
#endif
return RET_OK;
} }
/************************************************************ /************************************************************
@ -2148,7 +2155,7 @@ ret_code vlan_config_chk(uint source,uint *config_type,
if(ret != RET_OK){ if(ret != RET_OK){
goto out; goto out;
} }
*config_type = oper_type; //*config_type = oper_type;
printf("[vlan]vlan_config_chk: operate_type=%d\n", oper_type); printf("[vlan]vlan_config_chk: operate_type=%d\n", oper_type);
if(oper_type == CM_CONFIG_SET){ if(oper_type == CM_CONFIG_SET){
printf("[vlan]vlan_config_chk: SET chk\n"); printf("[vlan]vlan_config_chk: SET chk\n");

View File

@ -38,6 +38,8 @@ typedef enum { WEBM_HANDLE_INVALID_INDEX = -1,
WEBM_HANDLE_CONFIG_UUID_USER, WEBM_HANDLE_CONFIG_UUID_USER,
WEBM_HANDLE_CONFIG_DETAIL_USER, WEBM_HANDLE_CONFIG_DETAIL_USER,
WEBM_HANDLE_CONFIG_IPV4, WEBM_HANDLE_CONFIG_IPV4,
WEBM_HANDLE_CONFIG_VLAN_SET,
WEBM_HANDLE_CONFIG_VLAN_GET,
WEBM_HANDLE_MAX WEBM_HANDLE_MAX
} webm_handle_index; } webm_handle_index;
@ -169,6 +171,20 @@ extern int webm_config_send_proc(server *srv, uint32_t config_type, uint64 confg
CM_CONFIG_SET, \ CM_CONFIG_SET, \
IPCONFIG_V4, \ IPCONFIG_V4, \
webm_config_send_proc \ webm_config_send_proc \
}, \
{\
WEBM_HANDLE_CONFIG_VLAN_SET, \
"/FSG-CF/setvlan", \
CM_CONFIG_SET, \
VLAN_CONFIG, \
webm_config_send_proc \
}, \
{\
WEBM_HANDLE_CONFIG_VLAN_GET, \
"/FSG-GF/getvlan", \
CM_CONFIG_GET, \
VLAN_CONFIG, \
webm_config_send_proc \
} \ } \
\ \
} }