set_port.py: added environment check to utilize the LFJsonPost flag parameters

Signed-off-by: Jed Reynolds <jed@candelatech.com>
This commit is contained in:
Jed Reynolds
2021-08-17 15:17:01 -07:00
parent 6b6b14fc7a
commit 9b23578bf6

View File

@@ -1,3 +1,12 @@
import os
if os.environ.get("LF_USE_AUTOGEN") == 1:
import lf_json_autogen
from lf_json_autogen import LFJsonPost
set_port_current_flags = LFJsonPost.SetPortCurrentFlags.__members__
set_port_cmd_flags = LFJsonPost.SetPortCmdFlags.__members__
set_port_interest_flags = LFJsonPost.SetPortInterest.__members__
else:
set_port_current_flags = { set_port_current_flags = {
"if_down": 0x1, # Interface Down "if_down": 0x1, # Interface Down
"fixed_10bt_hd": 0x2, # Fixed-10bt-HD (half duplex) "fixed_10bt_hd": 0x2, # Fixed-10bt-HD (half duplex)
@@ -98,3 +107,4 @@ set_port_interest_flags = {
"no_apply_dhcp" : 0x80000000, # Enable/disable NO-APPLY-DHCP flag for a port "no_apply_dhcp" : 0x80000000, # Enable/disable NO-APPLY-DHCP flag for a port
"skip_ifup_roam" : 0x100000000, # Enable/disable SKIP-IFUP-ON-ROAM flag for a port "skip_ifup_roam" : 0x100000000, # Enable/disable SKIP-IFUP-ON-ROAM flag for a port
} }
#