from infi.hbaapi import Port
import json
example = json.loads(""" [
    {
        "discovered_ports": [], 
        "driver_name": null, 
        "driver_version": "8.03.01.05.05.06-k", 
        "fabric_name": "20:01:00:05:73:dc:fa:81", 
        "firmware_version": null, 
        "hardware_version": "5.03.02 (d5)", 
        "manufacturer": null, 
        "model": "QLE2562", 
        "model_description": "PCI-Express Dual Channel 8Gb Fibre Channel HBA", 
        "node_wwn": "20:00:00:24:ff:2c:4e:53", 
        "option_rom_version": "4.04.00 128", 
        "os_device_name": null, 
        "port_fcid": "0x4d0300", 
        "port_max_frame_size": null, 
        "port_speed": 4, 
        "port_state": "online", 
        "port_supported_speeds": [
            1, 
            2, 
            4, 
            8
        ], 
        "port_symbolic_name": "QLE2562 FW:v5.03.02 DVR:v8.03.01.05.05.06-k", 
        "port_type": "nport (fabric via point-to-point)", 
        "port_wwn": "21:00:00:24:ff:2c:4e:53", 
        "serial_number": "", 
        "statistics": {
            "dumped_frames": 0, 
            "error_frames": -1, 
            "fcp_control_requests": -1, 
            "fcp_input_megabytes": 0, 
            "fcp_input_requests": -1, 
            "fcp_output_megabytes": 0, 
            "fcp_output_requests": -1, 
            "invalid_crc_count": 0, 
            "invalid_tx_word_count": 0, 
            "link_failure_count": 1, 
            "lip_count": 0, 
            "loss_of_signal_count": 0, 
            "loss_of_sync_count": 0, 
            "nos_count": 1, 
            "primitive_seq_protocol_err_count": -1, 
            "primitiveitive_seq_protocol_err_count": -1, 
            "rx_frames": 3475, 
            "rx_words": -1, 
            "seconds_since_last_reset": -1, 
            "tx_frames": 3473, 
            "tx_words": -1
        }
    }, 
    {
        "discovered_ports": [], 
        "driver_name": null, 
        "driver_version": "8.03.01.05.05.06-k", 
        "fabric_name": "10:00:00:05:33:68:30:15", 
        "firmware_version": null, 
        "hardware_version": "5.03.02 (d5)", 
        "manufacturer": null, 
        "model": "QLE2562", 
        "model_description": "PCI-Express Dual Channel 8Gb Fibre Channel HBA", 
        "node_wwn": "20:00:00:24:ff:2c:4e:52", 
        "option_rom_version": "4.04.00 128", 
        "os_device_name": null, 
        "port_fcid": "0x011300", 
        "port_max_frame_size": null, 
        "port_speed": 8, 
        "port_state": "online", 
        "port_supported_speeds": [
            1, 
            2, 
            4, 
            8
        ], 
        "port_symbolic_name": "QLE2562 FW:v5.03.02 DVR:v8.03.01.05.05.06-k", 
        "port_type": "nport (fabric via point-to-point)", 
        "port_wwn": "21:00:00:24:ff:2c:4e:52", 
        "serial_number": "", 
        "statistics": {
            "dumped_frames": 0, 
            "error_frames": -1, 
            "fcp_control_requests": -1, 
            "fcp_input_megabytes": 0, 
            "fcp_input_requests": -1, 
            "fcp_output_megabytes": 0, 
            "fcp_output_requests": -1, 
            "invalid_crc_count": 0, 
            "invalid_tx_word_count": 4, 
            "link_failure_count": 1, 
            "lip_count": 0, 
            "loss_of_signal_count": 0, 
            "loss_of_sync_count": 0, 
            "nos_count": 1, 
            "primitive_seq_protocol_err_count": -1, 
            "primitiveitive_seq_protocol_err_count": -1, 
            "rx_frames": 3474, 
            "rx_words": -1, 
            "seconds_since_last_reset": -1, 
            "tx_frames": 3474, 
            "tx_words": -1
        }
    }, 
    {
        "discovered_ports": [], 
        "driver_name": null, 
        "driver_version": "8.03.01.05.05.06-k", 
        "fabric_name": "20:00:00:24:ff:2c:4d:f3", 
        "firmware_version": null, 
        "hardware_version": "5.03.02 (d5)", 
        "manufacturer": null, 
        "model": "QLE2562", 
        "model_description": "PCI-Express Dual Channel 8Gb Fibre Channel HBA", 
        "node_wwn": "20:00:00:24:ff:2c:4d:f3", 
        "option_rom_version": "4.04.00 128", 
        "os_device_name": null, 
        "port_fcid": "0x000000", 
        "port_max_frame_size": null, 
        "port_speed": 0, 
        "port_state": "online", 
        "port_supported_speeds": [
            1, 
            2, 
            4, 
            8
        ], 
        "port_symbolic_name": "QLE2562 FW:v5.03.02 DVR:v8.03.01.05.05.06-k", 
        "port_type": null, 
        "port_wwn": "21:00:00:24:ff:2c:4d:f3", 
        "serial_number": "", 
        "statistics": {
            "dumped_frames": 0, 
            "error_frames": -1, 
            "fcp_control_requests": -1, 
            "fcp_input_megabytes": 0, 
            "fcp_input_requests": -1, 
            "fcp_output_megabytes": 0, 
            "fcp_output_requests": -1, 
            "invalid_crc_count": 0, 
            "invalid_tx_word_count": 0, 
            "link_failure_count": 0, 
            "lip_count": 0, 
            "loss_of_signal_count": 0, 
            "loss_of_sync_count": 0, 
            "nos_count": 0, 
            "primitive_seq_protocol_err_count": -1, 
            "primitiveitive_seq_protocol_err_count": -1, 
            "rx_frames": 0, 
            "rx_words": -1, 
            "seconds_since_last_reset": -1, 
            "tx_frames": 0, 
            "tx_words": -1
        }
    }, 
    {
        "discovered_ports": [], 
        "driver_name": null, 
        "driver_version": "8.03.01.05.05.06-k", 
        "fabric_name": "20:00:00:24:ff:2c:4d:f2", 
        "firmware_version": null, 
        "hardware_version": "5.03.02 (d5)", 
        "manufacturer": null, 
        "model": "QLE2562", 
        "model_description": "PCI-Express Dual Channel 8Gb Fibre Channel HBA", 
        "node_wwn": "20:00:00:24:ff:2c:4d:f2", 
        "option_rom_version": "4.04.00 128", 
        "os_device_name": null, 
        "port_fcid": "0x000000", 
        "port_max_frame_size": null, 
        "port_speed": 0, 
        "port_state": "online", 
        "port_supported_speeds": [
            1, 
            2, 
            4, 
            8
        ], 
        "port_symbolic_name": "QLE2562 FW:v5.03.02 DVR:v8.03.01.05.05.06-k", 
        "port_type": null, 
        "port_wwn": "21:00:00:24:ff:2c:4d:f2", 
        "serial_number": "", 
        "statistics": {
            "dumped_frames": 0, 
            "error_frames": -1, 
            "fcp_control_requests": -1, 
            "fcp_input_megabytes": 0, 
            "fcp_input_requests": -1, 
            "fcp_output_megabytes": 0, 
            "fcp_output_requests": -1, 
            "invalid_crc_count": 0, 
            "invalid_tx_word_count": 0, 
            "link_failure_count": 0, 
            "lip_count": 0, 
            "loss_of_signal_count": 0, 
            "loss_of_sync_count": 0, 
            "nos_count": 0, 
            "primitive_seq_protocol_err_count": -1, 
            "primitiveitive_seq_protocol_err_count": -1, 
            "rx_frames": 0, 
            "rx_words": -1, 
            "seconds_since_last_reset": -1, 
            "tx_frames": 0, 
            "tx_words": -1
        }
    }
]
""")
ports = [Port().update_not_none_values(item) for item in example]
