예제 #1
0
    def _dict_to_obj(cls, json_dict):

        links = None
        if Links.RESOURCE_TYPE in json_dict:
            links = Links._list_to_obj(json_dict.get(Links.RESOURCE_TYPE))

        extra = None
        if Extra.METADATA_TYPE in json_dict:
            extra = Extra._dict_to_obj(json_dict.get(Extra.METADATA_TYPE))

        return Port(node_uuid=json_dict.get('node_uuid'),
                    uuid=json_dict.get('uuid'),
                    links=links,
                    extra=extra,
                    created_at=json_dict.get('created_at'),
                    updated_at=json_dict.get('updated_at'),
                    address=json_dict.get('address'))
예제 #2
0
    def _dict_to_obj(cls, json_dict):
        properties = None
        if 'properties' in json_dict:
            properties = Properties._dict_to_obj(
                json_dict.get(Properties.METADATA_TYPE))

        driver_info = None
        if DriverInfo.METADATA_TYPE in json_dict:
            driver_info = DriverInfo._dict_to_obj(
                json_dict.get(DriverInfo.METADATA_TYPE))

        links = None
        if Links.RESOURCE_TYPE in json_dict:
            links = Links._list_to_obj(json_dict.get(Links.RESOURCE_TYPE))

        ports = None
        if Ports.RESOURCE_TYPE in json_dict:
            ports = Ports._list_to_obj(json_dict.get(Ports.RESOURCE_TYPE))

        extra = None
        if Extra.METADATA_TYPE in json_dict:
            extra = Extra._dict_to_obj(json_dict.get(Extra.METADATA_TYPE))

        node = Node(
            instance_uuid=json_dict.get('instance_uuid'),
            target_power_state=json_dict.get('target_power_state'),
            properties=properties,
            maintenance=json_dict.get('maintenance'),
            links=links,
            driver_info=driver_info,
            extra=extra,
            last_error=json_dict.get('last_error'),
            console_enabled=json_dict.get('console_enabled'),
            target_provision_state=json_dict.get('target_provision_state'),
            driver=json_dict.get('driver'),
            updated_at=json_dict.get('updated_at'),
            ports=ports,
            provision_updated_at=json_dict.get('provision_updated_at'),
            chassis_uuid=json_dict.get('chassis_uuid'),
            provision_state=json_dict.get('provision_state'),
            reservation=json_dict.get('reservation'),
            power_state=json_dict.get('power_state'),
            created_at=json_dict.get('created_at'),
            uuid=json_dict.get('uuid'))
        return node
예제 #3
0
    def _dict_to_obj(cls, json_dict):
        properties = None
        if 'properties' in json_dict:
            properties = Properties._dict_to_obj(
                json_dict.get(Properties.METADATA_TYPE))

        driver_info = None
        if DriverInfo.METADATA_TYPE in json_dict:
            driver_info = DriverInfo._dict_to_obj(
                json_dict.get(DriverInfo.METADATA_TYPE))

        links = None
        if Links.RESOURCE_TYPE in json_dict:
            links = Links._list_to_obj(json_dict.get(Links.RESOURCE_TYPE))

        ports = None
        if Ports.RESOURCE_TYPE in json_dict:
            ports = Ports._list_to_obj(json_dict.get(Ports.RESOURCE_TYPE))

        extra = None
        if Extra.METADATA_TYPE in json_dict:
            extra = Extra._dict_to_obj(json_dict.get(Extra.METADATA_TYPE))

        node = Node(
            instance_uuid=json_dict.get('instance_uuid'),
            target_power_state=json_dict.get('target_power_state'),
            properties=properties,
            maintenance=json_dict.get('maintenance'),
            links=links,
            driver_info=driver_info,
            extra=extra,
            last_error=json_dict.get('last_error'),
            console_enabled=json_dict.get('console_enabled'),
            target_provision_state=json_dict.get('target_provision_state'),
            driver=json_dict.get('driver'),
            updated_at=json_dict.get('updated_at'),
            ports=ports,
            provision_updated_at=json_dict.get('provision_updated_at'),
            chassis_uuid=json_dict.get('chassis_uuid'),
            provision_state=json_dict.get('provision_state'),
            reservation=json_dict.get('reservation'),
            power_state=json_dict.get('power_state'),
            created_at=json_dict.get('created_at'),
            uuid=json_dict.get('uuid'))
        return node
예제 #4
0
    def _dict_to_obj(cls, json_dict):

        links = None
        if Links.RESOURCE_TYPE in json_dict:
            links = Links._list_to_obj(json_dict.get(Links.RESOURCE_TYPE))

        extra = None
        if Extra.METADATA_TYPE in json_dict:
            extra = Extra._dict_to_obj(json_dict.get(Extra.METADATA_TYPE))

        return Port(
            node_uuid=json_dict.get('node_uuid'),
            uuid=json_dict.get('uuid'),
            links=links,
            extra=extra,
            created_at=json_dict.get('created_at'),
            updated_at=json_dict.get('updated_at'),
            address=json_dict.get('address'))
예제 #5
0
    def _dict_to_obj(cls, json_dict):
        properties = None
        if "properties" in json_dict:
            properties = Properties._dict_to_obj(json_dict.get(Properties.METADATA_TYPE))

        driver_info = None
        if DriverInfo.METADATA_TYPE in json_dict:
            driver_info = DriverInfo._dict_to_obj(json_dict.get(DriverInfo.METADATA_TYPE))

        links = None
        if Links.RESOURCE_TYPE in json_dict:
            links = Links._list_to_obj(json_dict.get(Links.RESOURCE_TYPE))

        ports = None
        if Ports.RESOURCE_TYPE in json_dict:
            ports = Ports._list_to_obj(json_dict.get(Ports.RESOURCE_TYPE))

        extra = None
        if Extra.METADATA_TYPE in json_dict:
            extra = Extra._dict_to_obj(json_dict.get(Extra.METADATA_TYPE))

        node = Node(
            instance_uuid=json_dict.get("instance_uuid"),
            target_power_state=json_dict.get("target_power_state"),
            properties=properties,
            maintenance=json_dict.get("maintenance"),
            links=links,
            driver_info=driver_info,
            extra=extra,
            last_error=json_dict.get("last_error"),
            console_enabled=json_dict.get("console_enabled"),
            target_provision_state=json_dict.get("target_provision_state"),
            driver=json_dict.get("driver"),
            updated_at=json_dict.get("updated_at"),
            ports=ports,
            provision_updated_at=json_dict.get("provision_updated_at"),
            chassis_uuid=json_dict.get("chassis_uuid"),
            provision_state=json_dict.get("provision_state"),
            reservation=json_dict.get("reservation"),
            power_state=json_dict.get("power_state"),
            created_at=json_dict.get("created_at"),
            uuid=json_dict.get("uuid"),
        )
        return node