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,4 +1,13 @@
set_port_current_flags = {
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 = {
"if_down": 0x1, # Interface Down
"fixed_10bt_hd": 0x2, # Fixed-10bt-HD (half duplex)
"fixed_10bt_fd": 0x4, # Fixed-10bt-FD
@@ -44,8 +53,8 @@ set_port_current_flags = {
"ipsec_client": 0x40000000000000, # Enable client IPSEC xfrm on this port.
"ipsec_concentrator": 0x80000000000000, # Enable concentrator (upstream) IPSEC xfrm on this port.
"service_dns": 0x100000000000000, # Enable DNS (dnsmasq) service on this port.
}
set_port_cmd_flags = {
}
set_port_cmd_flags = {
"reset_transceiver": 0x1, # Reset transciever
"restart_link_neg": 0x2, # Restart link negotiation
"force_MII_probe": 0x4, # Force MII probe
@@ -60,8 +69,8 @@ set_port_cmd_flags = {
"from_dhcp": 0x200, # Settings come from DHCP client.
"abort_if_scripts": 0x400, # Forceably abort all ifup/down scripts on this Port.
"use_pre_ifdown": 0x800, # Call pre-ifdown script before bringing interface down.
}
set_port_interest_flags = {
}
set_port_interest_flags = {
"command_flags" : 0x1, # apply command flags
"current_flags" : 0x2, # apply current flags
"ip_address" : 0x4, # IP address
@@ -97,4 +106,5 @@ set_port_interest_flags = {
"no_dhcp_conn" : 0x40000000, # Enable/disable NO-DHCP-ON-CONNECT 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
}
}
#