# coding: utf-8

"""
SocPortDiagnosticData.py

 The Clear BSD License

 Copyright (c) – 2016, NetApp, Inc. All rights reserved.

 Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

 * Neither the name of NetApp, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

 NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

from pprint import pformat
from six import iteritems


class SocPortDiagnosticData(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self):
        """
        SocPortDiagnosticData - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'port_state': 'str',  # (required parameter)
            'port_insertion_count': 'int',  # (required parameter)
            'loop_state': 'str',  # (required parameter)
            'loop_up_count': 'int',  # (required parameter)
            'crc_error_count': 'int',  # (required parameter)
            'relative_frequency_drift_error_average': 'int',  # (required parameter)
            'loop_cycle_count': 'int',  # (required parameter)
            'os_error_count': 'int',  # (required parameter)
            'port_connections_attempted_count': 'int',  # (required parameter)
            'port_connections_held_off_count': 'int',  # (required parameter)
            'port_utilization': 'int'
        }

        self.attribute_map = {
            'port_state': 'portState',  # (required parameter)
            'port_insertion_count': 'portInsertionCount',  # (required parameter)
            'loop_state': 'loopState',  # (required parameter)
            'loop_up_count': 'loopUpCount',  # (required parameter)
            'crc_error_count': 'crcErrorCount',  # (required parameter)
            'relative_frequency_drift_error_average': 'relativeFrequencyDriftErrorAverage',  # (required parameter)
            'loop_cycle_count': 'loopCycleCount',  # (required parameter)
            'os_error_count': 'osErrorCount',  # (required parameter)
            'port_connections_attempted_count': 'portConnectionsAttemptedCount',  # (required parameter)
            'port_connections_held_off_count': 'portConnectionsHeldOffCount',  # (required parameter)
            'port_utilization': 'portUtilization'
        }

        self._port_state = None
        self._port_insertion_count = None
        self._loop_state = None
        self._loop_up_count = None
        self._crc_error_count = None
        self._relative_frequency_drift_error_average = None
        self._loop_cycle_count = None
        self._os_error_count = None
        self._port_connections_attempted_count = None
        self._port_connections_held_off_count = None
        self._port_utilization = None

    @property
    def port_state(self):
        """
        Gets the port_state of this SocPortDiagnosticData.
        The current state of the port.

        :return: The port_state of this SocPortDiagnosticData.
        :rtype: str
        :required/optional: required
        """
        return self._port_state

    @port_state.setter
    def port_state(self, port_state):
        """
        Sets the port_state of this SocPortDiagnosticData.
        The current state of the port.

        :param port_state: The port_state of this SocPortDiagnosticData.
        :type: str
        """
        allowed_values = ["unknown", "inserted", "insertedManual", "loopback", "diagXmit", "bypassed", "bypNoFru", "bypTxFault", "bypLipF8", "bypDataTimeout", "bypRxLos", "bypSyncLoss", "bypLipIsol", "bypPtbi", "bypManual", "bypRedundant", "bypSnoop", "bypCrcThresh", "bypInvalidOsThresh", "__UNDEFINED"]
        if port_state not in allowed_values:
            raise ValueError(
                "Invalid value for `port_state`, must be one of {0}"
                .format(allowed_values)
            )
        self._port_state = port_state

    @property
    def port_insertion_count(self):
        """
        Gets the port_insertion_count of this SocPortDiagnosticData.
        The number of times the port has been inserted.

        :return: The port_insertion_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._port_insertion_count

    @port_insertion_count.setter
    def port_insertion_count(self, port_insertion_count):
        """
        Sets the port_insertion_count of this SocPortDiagnosticData.
        The number of times the port has been inserted.

        :param port_insertion_count: The port_insertion_count of this SocPortDiagnosticData.
        :type: int
        """
        self._port_insertion_count = port_insertion_count

    @property
    def loop_state(self):
        """
        Gets the loop_state of this SocPortDiagnosticData.
        The state of the loop

        :return: The loop_state of this SocPortDiagnosticData.
        :rtype: str
        :required/optional: required
        """
        return self._loop_state

    @loop_state.setter
    def loop_state(self, loop_state):
        """
        Sets the loop_state of this SocPortDiagnosticData.
        The state of the loop

        :param loop_state: The loop_state of this SocPortDiagnosticData.
        :type: str
        """
        allowed_values = ["down", "init", "openInit", "up", "active", "__UNDEFINED"]
        if loop_state not in allowed_values:
            raise ValueError(
                "Invalid value for `loop_state`, must be one of {0}"
                .format(allowed_values)
            )
        self._loop_state = loop_state

    @property
    def loop_up_count(self):
        """
        Gets the loop_up_count of this SocPortDiagnosticData.
        The number of times the referenced port has seen a loop-up event.

        :return: The loop_up_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._loop_up_count

    @loop_up_count.setter
    def loop_up_count(self, loop_up_count):
        """
        Sets the loop_up_count of this SocPortDiagnosticData.
        The number of times the referenced port has seen a loop-up event.

        :param loop_up_count: The loop_up_count of this SocPortDiagnosticData.
        :type: int
        """
        self._loop_up_count = loop_up_count

    @property
    def crc_error_count(self):
        """
        Gets the crc_error_count of this SocPortDiagnosticData.
        The count of CRC errors.

        :return: The crc_error_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._crc_error_count

    @crc_error_count.setter
    def crc_error_count(self, crc_error_count):
        """
        Sets the crc_error_count of this SocPortDiagnosticData.
        The count of CRC errors.

        :param crc_error_count: The crc_error_count of this SocPortDiagnosticData.
        :type: int
        """
        self._crc_error_count = crc_error_count

    @property
    def relative_frequency_drift_error_average(self):
        """
        Gets the relative_frequency_drift_error_average of this SocPortDiagnosticData.
        The difference, in PPM, between the port received data rate and the internal clock of the SOC.

        :return: The relative_frequency_drift_error_average of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._relative_frequency_drift_error_average

    @relative_frequency_drift_error_average.setter
    def relative_frequency_drift_error_average(self, relative_frequency_drift_error_average):
        """
        Sets the relative_frequency_drift_error_average of this SocPortDiagnosticData.
        The difference, in PPM, between the port received data rate and the internal clock of the SOC.

        :param relative_frequency_drift_error_average: The relative_frequency_drift_error_average of this SocPortDiagnosticData.
        :type: int
        """
        self._relative_frequency_drift_error_average = relative_frequency_drift_error_average

    @property
    def loop_cycle_count(self):
        """
        Gets the loop_cycle_count of this SocPortDiagnosticData.
        The number of LIPs seen by the referenced port. (valid in segmenting mode only)

        :return: The loop_cycle_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._loop_cycle_count

    @loop_cycle_count.setter
    def loop_cycle_count(self, loop_cycle_count):
        """
        Sets the loop_cycle_count of this SocPortDiagnosticData.
        The number of LIPs seen by the referenced port. (valid in segmenting mode only)

        :param loop_cycle_count: The loop_cycle_count of this SocPortDiagnosticData.
        :type: int
        """
        self._loop_cycle_count = loop_cycle_count

    @property
    def os_error_count(self):
        """
        Gets the os_error_count of this SocPortDiagnosticData.
        The count of invalid FC transmit words seen at the receiver of the referenced port.

        :return: The os_error_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._os_error_count

    @os_error_count.setter
    def os_error_count(self, os_error_count):
        """
        Sets the os_error_count of this SocPortDiagnosticData.
        The count of invalid FC transmit words seen at the receiver of the referenced port.

        :param os_error_count: The os_error_count of this SocPortDiagnosticData.
        :type: int
        """
        self._os_error_count = os_error_count

    @property
    def port_connections_attempted_count(self):
        """
        Gets the port_connections_attempted_count of this SocPortDiagnosticData.
        The number of times a port has attempted make a connection due to ARB connection requests. (valid in segmenting mode only)

        :return: The port_connections_attempted_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._port_connections_attempted_count

    @port_connections_attempted_count.setter
    def port_connections_attempted_count(self, port_connections_attempted_count):
        """
        Sets the port_connections_attempted_count of this SocPortDiagnosticData.
        The number of times a port has attempted make a connection due to ARB connection requests. (valid in segmenting mode only)

        :param port_connections_attempted_count: The port_connections_attempted_count of this SocPortDiagnosticData.
        :type: int
        """
        self._port_connections_attempted_count = port_connections_attempted_count

    @property
    def port_connections_held_off_count(self):
        """
        Gets the port_connections_held_off_count of this SocPortDiagnosticData.
        The count of times this port has attempted to make a connection and was held off by a busy port. (valid in segmenting mode only)

        :return: The port_connections_held_off_count of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._port_connections_held_off_count

    @port_connections_held_off_count.setter
    def port_connections_held_off_count(self, port_connections_held_off_count):
        """
        Sets the port_connections_held_off_count of this SocPortDiagnosticData.
        The count of times this port has attempted to make a connection and was held off by a busy port. (valid in segmenting mode only)

        :param port_connections_held_off_count: The port_connections_held_off_count of this SocPortDiagnosticData.
        :type: int
        """
        self._port_connections_held_off_count = port_connections_held_off_count

    @property
    def port_utilization(self):
        """
        Gets the port_utilization of this SocPortDiagnosticData.
        The port utilization seen on the referenced port. The value returned is either the percent of time that frames are seen on the port, or the percent of time that a port is used during switching mode operation when the SOC is operating in the switching mode. Range 0 to 200, 0.5% per bit scale. (valid in segmenting mode only)

        :return: The port_utilization of this SocPortDiagnosticData.
        :rtype: int
        :required/optional: required
        """
        return self._port_utilization

    @port_utilization.setter
    def port_utilization(self, port_utilization):
        """
        Sets the port_utilization of this SocPortDiagnosticData.
        The port utilization seen on the referenced port. The value returned is either the percent of time that frames are seen on the port, or the percent of time that a port is used during switching mode operation when the SOC is operating in the switching mode. Range 0 to 200, 0.5% per bit scale. (valid in segmenting mode only)

        :param port_utilization: The port_utilization of this SocPortDiagnosticData.
        :type: int
        """
        self._port_utilization = port_utilization

    def to_dict(self):
        """
        Returns the model properties as a dict
        """
        result = {}

        for attr, _ in iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return pformat(self.to_dict())

    def __repr__(self):
        """
        For `print` and `pprint`
        """
        if self is None:
           return None
        return self.to_str()

    def __eq__(self, other):
        """
        Returns true if both objects are equal
        """
        if self is None or other is None:
            return None
        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """
        Returns true if both objects are not equal
        """
        return not self == other

