mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 10:48:02 +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 | ||||
| """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- | ||||
|     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 - - | ||||
|     The API this library provides is actively being changed. | ||||
|     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)) | ||||
|                     selected_flags.extend([member.value for member in flag_class if member == flag]) | ||||
|             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 | ||||
|         if type(flag_names) is str: | ||||
|             f_name = flag_names | ||||
| @@ -2308,18 +2311,27 @@ class LFJsonPost(LFCliBase): | ||||
|         if type(flag_names) is list: | ||||
|             unselected_val = starting_value | ||||
|             for flag in flag_names: | ||||
|                 if isinstance(flag, str): | ||||
|                     if flag not in flag_class.__members__: | ||||
|                         raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag)) | ||||
|                 print("unselected a[%s]" % (hex(unselected_val))) | ||||
|                 unselected_val &= ~(flag_class[flag]) | ||||
|                 print("unselected b[%s]" % (hex(unselected_val))) | ||||
|                 if isinstance(flag, IntFlag): | ||||
|                     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 | ||||
|         if isinstance(flag_names, str): | ||||
|             if flag_names not in flag_class.__members__: | ||||
|                 raise ValueError("%s has no member:[%s]" % (flag_class.__class__.__name__, flag_names)) | ||||
|             unselected_val = starting_value | ||||
|         print("unselected a[%s]" % (hex(unselected_val))) | ||||
|         unselected_val &= ~flag_class | ||||
|         print("unselected b[%s]" % (hex(unselected_val))) | ||||
|             unselected_val &= ~flag_class.valueof(flag_names) | ||||
|             # 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 | ||||
|     """----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- | ||||
|             Notes for <CLI-JSON/ADD_ARM_ENDP> type requests | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jed Reynolds
					Jed Reynolds