<s> """<STR_LIT>""" <EOL> import json <EOL> from cafe . engine . models . base import AutoMarshallingModel , AutoMarshallingListModel <EOL> from cloudcafe . bare_metal . common . models . links import Link , Links <EOL> from cloudcafe . bare_metal . common . models . metadata import MetadataBase , Extra <EOL> class Node ( AutoMarshallingModel ) : <EOL> def __init__ ( <EOL> self , instance_uuid = None , target_power_state = None , <EOL> properties = None , maintenance = None , links = None , driver_info = None , <EOL> extra = None , last_error = None , console_enabled = None , <EOL> target_provision_state = None , driver = None , updated_at = None , <EOL> ports = None , provision_updated_at = None , chassis_uuid = None , <EOL> provision_state = None , reservation = None , power_state = None , <EOL> created_at = None , uuid = None ) : <EOL> super ( Node , self ) . __init__ ( ) <EOL> self . instance_uuid = instance_uuid <EOL> self . target_power_state = target_power_state <EOL> self . properties = properties <EOL> self . maintenance = maintenance <EOL> self . links = links <EOL> self . driver_info = driver_info <EOL> self . extra = extra <EOL> self . last_error = last_error <EOL> self . console_enabled = console_enabled <EOL> self . target_provision_state = target_provision_state <EOL> self . driver = driver <EOL> self . updated_at = updated_at <EOL> self . ports = ports <EOL> self . provision_updated_at = provision_updated_at <EOL> self . chassis_uuid = chassis_uuid <EOL> self . provision_state = provision_state <EOL> self . reservation = reservation <EOL> self . power_state = power_state <EOL> self . created_at = created_at <EOL> self . uuid = uuid <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> json_dict = json . loads ( serialized_str ) <EOL> return cls . _dict_to_obj ( json_dict ) <EOL> @ classmethod <EOL> def _dict_to_obj ( cls , json_dict ) : <EOL> properties = None <EOL> if '<STR_LIT>' in json_dict : <EOL> properties = Properties . _dict_to_obj ( <EOL> json_dict . get ( Properties . METADATA_TYPE ) ) <EOL> driver_info = None <EOL> if DriverInfo . METADATA_TYPE in json_dict : <EOL> driver_info = DriverInfo . _dict_to_obj ( <EOL> json_dict . get ( DriverInfo . METADATA_TYPE ) ) <EOL> links = None <EOL> if Links . RESOURCE_TYPE in json_dict : <EOL> links = Links . _list_to_obj ( json_dict . get ( Links . RESOURCE_TYPE ) ) <EOL> ports = None <EOL> if Ports . RESOURCE_TYPE in json_dict : <EOL> ports = Ports . _list_to_obj ( json_dict . get ( Ports . RESOURCE_TYPE ) ) <EOL> extra = None <EOL> if Extra . METADATA_TYPE in json_dict : <EOL> extra = Extra . _dict_to_obj ( json_dict . get ( Extra . METADATA_TYPE ) ) <EOL> node = Node ( <EOL> instance_uuid = json_dict . get ( '<STR_LIT>' ) , <EOL> target_power_state = json_dict . get ( '<STR_LIT>' ) , <EOL> properties = properties , <EOL> maintenance = json_dict . get ( '<STR_LIT>' ) , <EOL> links = links , <EOL> driver_info = driver_info , <EOL> extra = extra , <EOL> last_error = json_dict . get ( '<STR_LIT>' ) , <EOL> console_enabled = json_dict . get ( '<STR_LIT>' ) , <EOL> target_provision_state = json_dict . get ( '<STR_LIT>' ) , <EOL> driver = json_dict . get ( '<STR_LIT>' ) , <EOL> updated_at = json_dict . get ( '<STR_LIT>' ) , <EOL> ports = ports , <EOL> provision_updated_at = json_dict . get ( '<STR_LIT>' ) , <EOL> chassis_uuid = json_dict . get ( '<STR_LIT>' ) , <EOL> provision_state = json_dict . get ( '<STR_LIT>' ) , <EOL> reservation = json_dict . get ( '<STR_LIT>' ) , <EOL> power_state = json_dict . get ( '<STR_LIT>' ) , <EOL> created_at = json_dict . get ( '<STR_LIT>' ) , <EOL> uuid = json_dict . get ( '<STR_LIT>' ) ) <EOL> return node <EOL> class Nodes ( AutoMarshallingListModel ) : <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> json_dict = json . loads ( serialized_str ) <EOL> return cls . _list_to_obj ( json_dict . get ( '<STR_LIT>' ) ) <EOL> @ classmethod <EOL> def _list_to_obj ( cls , node_dict_list ) : <EOL> nodes = Nodes ( ) <EOL> for node_dict in node_dict_list : <EOL> node = Node . _dict_to_obj ( node_dict ) <EOL> nodes . append ( node ) <EOL> return nodes <EOL> class Port ( Link ) : <EOL> RESOURCE_TYPE = '<STR_LIT:port>' <EOL> class Ports ( Links ) : <EOL> RESOURCE_TYPE = '<STR_LIT>' <EOL> class Properties ( MetadataBase ) : <EOL> METADATA_TYPE = '<STR_LIT>' <EOL> class DriverInfo ( MetadataBase ) : <EOL> METADATA_TYPE = '<STR_LIT>' <EOL> class DriverInterfaceResult ( AutoMarshallingModel ) : <EOL> def __init__ ( self , result = None , reason = None ) : <EOL> self . result = result <EOL> self . reason = reason <EOL> @ classmethod <EOL> def _dict_to_obj ( cls , json_dict ) : <EOL> return DriverInterfaceResult ( <EOL> result = json_dict . get ( '<STR_LIT:result>' ) , <EOL> reason = json_dict . get ( '<STR_LIT>' ) ) <EOL> class DriverInterfaces ( AutoMarshallingModel ) : <EOL> def __init__ ( self , console = None , power = None , deploy = None ) : <EOL> self . console = console <EOL> self . power = power <EOL> self . deploy = deploy <EOL> @ classmethod <EOL> def _json_to_obj ( cls , serialized_str ) : <EOL> json_dict = json . loads ( serialized_str ) <EOL> console = DriverInterfaceResult . _dict_to_obj ( json_dict . get ( '<STR_LIT>' ) ) <EOL> power = DriverInterfaceResult . _dict_to_obj ( json_dict . get ( '<STR_LIT>' ) ) <EOL> deploy = DriverInterfaceResult . _dict_to_obj ( json_dict . get ( '<STR_LIT>' ) ) <EOL> return DriverInterfaces ( console = console , power = power , deploy = deploy ) </s>
