66import sys
77from typing import Any
88
9- current_script_dir = os .path .dirname (os .path .abspath (__file__ ))
10- project_root_dir = os .path .abspath (os .path .join (current_script_dir , os .pardir ))
9+ _current_script_dir = os .path .dirname (os .path .abspath (__file__ ))
10+ _project_root_dir = os .path .abspath (os .path .join (_current_script_dir , os .pardir ))
1111
12- if project_root_dir not in sys .path :
13- sys .path .append (project_root_dir )
12+ if _project_root_dir not in sys .path :
13+ sys .path .append (_project_root_dir )
1414
15- from airos .data import AirOS8Data , Remote , Station , Wireless # noqa: E402
15+ from airos .data import AirOS8Data , Interface , Remote , Station , Wireless # noqa: E402
1616
1717logging .basicConfig (level = logging .DEBUG , stream = sys .stdout )
1818_LOGGER = logging .getLogger (__name__ )
@@ -31,7 +31,7 @@ def main() -> None:
3131 sys .path .append (project_root_dir )
3232
3333 # Load the JSON data
34- with open (sys .argv [1 ]) as f :
34+ with open (sys .argv [1 ], encoding = "utf-8" ) as f :
3535 data = json .loads (f .read ())
3636
3737 try :
@@ -63,6 +63,14 @@ def main() -> None:
6363 wireless_obj = Wireless .from_dict (wireless_data ) # noqa: F841
6464 _LOGGER .info (" -> Success! The Wireless object is valid." )
6565
66+ _LOGGER .info (" -> Checking list of Interface objects..." )
67+ interfaces = data ["interfaces" ]
68+ for i , interface_data in enumerate (interfaces ):
69+ _LOGGER .info (" -> Checking Interface object at index %s..." , i )
70+ _LOGGER .info (" Interface should be %s." , interface_data ["ifname" ])
71+ interface_obj = Interface .from_dict (interface_data ) # noqa: F841
72+ _LOGGER .info (" Success! Interface is valid." )
73+
6674 _LOGGER .info ("Attempting to deserialize full AirOS8Data object..." )
6775 airos_data_obj = AirOS8Data .from_dict (data ) # noqa: F841
6876 _LOGGER .info ("Success! Full AirOS8Data object is valid." )
0 commit comments