Fixing port security checkbox for instance port

This fix ensures the "Port security" checkbox in port settings accurately reflects
the is_port_security_enabled status.
It resolves a logic mismatch between backend data and UI,
ensuring the checkbox displays as checked when security groups are applied to the port.

Change-Id: If1bc6f2efe6af38c2c5dd5c82a2864a3f1881214
Closes-Bug: #2093367
This commit is contained in:
Ivan Anfimov 2025-01-22 15:55:34 +00:00 committed by Dmitriy Chubinidze
parent cbea7e9e88
commit 3cee2a1e34

View File

@ -87,6 +87,11 @@ class NeutronAPIDictWrapper(base.APIDictWrapper):
else:
apidict['admin_state'] = 'DOWN'
# https://bugs.launchpad.net/horizon/+bug/2093367
if 'is_port_security_enabled' in apidict:
if apidict['is_port_security_enabled']:
apidict['port_security_enabled'] = 'UP'
# Django cannot handle a key name with ':', so use '__'.
apidict.update({
key.replace(':', '__'): value