mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-10-30 18:27:53 +00:00
lf_json_autogen.py: updates flag computation:
- can use IntFlag refs and/or strings - can clear flags now - turns down debug messages Signed-off-by: Jed Reynolds <jed@candelatech.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||||
Generated by LANforge JsonApiPythonGenerator, Mon Aug 16 11:58:20 PDT 2021
|
Generated by LANforge JsonApiPythonGenerator, Mon Aug 16 13:08:07 PDT 2021
|
||||||
- - WORK IN PROGRESS - -
|
- - WORK IN PROGRESS - -
|
||||||
The API this library provides is actively being changed.
|
The API this library provides is actively being changed.
|
||||||
This file expects to live in py-json/LANforge directory.
|
This file expects to live in py-json/LANforge directory.
|
||||||
@@ -2283,7 +2283,10 @@ class LFJsonPost(LFCliBase):
|
|||||||
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
||||||
selected_flags.extend([member.value for member in flag_class if member == flag])
|
selected_flags.extend([member.value for member in flag_class if member == flag])
|
||||||
selected_flags.append(starting_value)
|
selected_flags.append(starting_value)
|
||||||
return sum(selected_flags)
|
result_flags = 0
|
||||||
|
for i in selected_flags:
|
||||||
|
result_flags |= i
|
||||||
|
return result_flags
|
||||||
f_name = None
|
f_name = None
|
||||||
if type(flag_names) is str:
|
if type(flag_names) is str:
|
||||||
f_name = flag_names
|
f_name = flag_names
|
||||||
@@ -2308,18 +2311,27 @@ class LFJsonPost(LFCliBase):
|
|||||||
if type(flag_names) is list:
|
if type(flag_names) is list:
|
||||||
unselected_val = starting_value
|
unselected_val = starting_value
|
||||||
for flag in flag_names:
|
for flag in flag_names:
|
||||||
if flag not in flag_class.__members__:
|
if isinstance(flag, str):
|
||||||
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
if flag not in flag_class.__members__:
|
||||||
print("unselected a[%s]" % (hex(unselected_val)))
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
||||||
unselected_val &= ~(flag_class[flag])
|
if isinstance(flag, IntFlag):
|
||||||
print("unselected b[%s]" % (hex(unselected_val)))
|
if flag not in flag_class:
|
||||||
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag))
|
||||||
|
unselected_val &= ~(flag.value)
|
||||||
|
# print("unselected b[%s]" % (hex(unselected_val)))
|
||||||
return unselected_val
|
return unselected_val
|
||||||
if flag_names not in flag_class.__members__:
|
if isinstance(flag_names, str):
|
||||||
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
if flag_names not in flag_class.__members__:
|
||||||
unselected_val = starting_value
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
||||||
print("unselected a[%s]" % (hex(unselected_val)))
|
unselected_val = starting_value
|
||||||
unselected_val &= ~flag_class
|
unselected_val &= ~flag_class.valueof(flag_names)
|
||||||
print("unselected b[%s]" % (hex(unselected_val)))
|
# print("281/ __line__: starting val[%s] ^flag_names[%s] unsel[%s]" % (starting_value, ~flag_class.valueof(flag_names), unselected_val))
|
||||||
|
if isinstance(flag_names, IntFlag):
|
||||||
|
if flag_names not in flag_class:
|
||||||
|
raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag_names))
|
||||||
|
unselected_val = starting_value
|
||||||
|
unselected_val &= ~flag_names.value
|
||||||
|
# print("287/ __line__: starting val[%s] ^flag_names[%s] unsel[%s]" % (starting_value, ~flag_names.value, unselected_val))
|
||||||
return unselected_val
|
return unselected_val
|
||||||
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
"""----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||||
Notes for <CLI-JSON/ADD_ARM_ENDP> type requests
|
Notes for <CLI-JSON/ADD_ARM_ENDP> type requests
|
||||||
|
|||||||
Reference in New Issue
Block a user