TWSD-1442 - WebUI: SNMP Trap Host port is not getting updated with configured value in version V1/V2 and also accepting invalid value "-0"
Review Request #1263 — Created Dec. 24, 2025 and submitted — Latest diff uploaded
| Information | |
|---|---|
| shuinvy | |
| APV10 | |
| rel_apv_10_7 | |
| TWSD-1442 | |
| Reviewers | |
| austin, lucille, mingji, peteryeh | |
Let V1 or V2 can update Host Port and restrict Host Port only 161 or 162
The ticket is:
https://arraynetworks.atlassian.net/browse/TWSD-1442For C code:
1. I added error message if the port is not 161 or 162.
2. Based on the ticket: https://arraynetworks.atlassian.net/browse/TWSD-1142
We should show warning only when user change the Engine ID.
For Python code:
1. Because both V1 or V2, V3 can edit port, I added port attribute in class Server, and removed the port attribute in the individual class.
2. There is typo, cause the CLI string is wrong.
Before changing, the CLI calling is:
snmp auth 192.168.85.142 "" "" "" 161
After changing, the CLI calling is:
snmp auth 192.168.85.142 "" "" "" "" 161
The original will cause V1 or V2 cannot update the Host Port because the collumn is in wrong order,
so it will just set 'level' column to 161, not "".
3. I added new ignore message in BlankParser.
4. I added update function for V1/V2 class.For HTML code:
The URL of the popup window for adding SNMP Trap Host is:
/api/apv/admintools/snmp/Server/_box_model_add_wizard?context={"asso":[[{"_asso_idx":0}],"SNMP Trap Host"]}
The URL of the popup window for adding SNMP Trap Host with V1 or V2 is:
/api/apv/admintools/snmp/SNMPV1V2Servers/_box_instance_config/ip/{"ipv4": "192.168.85.142"}/type/"v1v2"?context={"asso":[[{"_asso_idx":0}],"SNMP Trap Host"]}
The URL of the popup window for adding SNMP Trap Host with V3 is:
/api/apv/admintools/snmp/SNMPV3Servers/_box_instance_config/ip/{"ipv4": "192.168.85.146"}/type/"v3"?context={"asso":[[{"_asso_idx":0}],"SNMP Trap Host"]}However, the original template is under common folder(hive/templates).
I don't want to change the common html in the hive/templates,
so I create directory path as the URL:
mkdir /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/Server
mkdir /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/SNMPV1V2Servers
and
mkdir /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/SNMPV3Servers
and put related html to the directory:
cp /ca/webui/htdocs/new/src/hive/templates/box_model_add_wizard.html /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/Server/box_model_add_wizard.html
cp /ca/webui/htdocs/new/src/hive/templates/box_instance_config.html /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/SNMPV1V2Servers/box_instance_config.html
cp /ca/webui/htdocs/new/src/hive/templates/box_instance_config.html /ca/webui/htdocs/new/src/apv/templates/admintools/snmp/SNMPV3Servers/box_instance_config.html
That is,
thebox_model_add_wizard.htmlandbox_instance_configis copy from hive/templates, so it won't impact common files(templates).
What I customized is these code:
Inbox_model_add_wizard.html
(function(){ // Special handling for SNMP Trap Host 'port' field var isEditPage = false; {% include 'snmp_trap_host.html' %} })();
and inbox_instance_config.html(the code for V1V2 and V3 is same)
(function(){ // Special handling for SNMP Trap Host 'port' field var isEditPage = true; {% include 'snmp_trap_host.html' %} })();
Besides,
I create a html partial:snmp_trap_host.htmlunder the/ca/webui/htdocs/new/src/apv/templates/,
so other new html can import it ({% include 'snmp_trap_host.html' %})
The main logic for HTML part is insnmp_trap_host.html:
1. Getidof the port field (such astextinput_port)
2. I addedshowSaveChangesfunction to show "Save Changes" button as the logic inmedia/js/coffee/hive.coffee
3. The input part is also takemedia/js/coffee/hive.coffeefor reference.
You can check how the error icon and error message show and see the related DOM in attachment.
Both "input"(keypress) and "focus click"(focus and click) event will trigger showing the "Save Changes" button (for Edit page).
4. Because "submit" operation will cal bothvalidateandvalidate_on_blurfunction, preventvalidate_on_blurshow message again.
5. Invalidate, it will show popup window for error message, please see attachment for reference.I also handle the language text.
