# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import sys
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files

if sys.version_info >= (3, 5):
    from typing import List, Any, Union


class RuCarrier(Base):
    """ORU Carrier configuration.
    The RuCarrier class encapsulates a required ruCarrier resource which will be retrieved from the server every time the property is accessed.
    """

    __slots__ = ()
    _SDM_NAME = "ruCarrier"
    _SDM_ATT_MAP = {
        "Active": "active",
        "BandSectorId": "bandSectorId",
        "CarrierBw": "carrierBw",
        "CcId": "ccId",
        "Count": "count",
        "DescriptiveName": "descriptiveName",
        "DuPortId": "duPortId",
        "IqBitwidth": "iqBitwidth",
        "IqCompMethod": "iqCompMethod",
        "Name": "name",
        "Numerology": "numerology",
        "PrbCount": "prbCount",
        "RuPortId": "ruPortId",
        "SlotFormat": "slotFormat",
        "Symbol0": "symbol0",
        "Symbol1": "symbol1",
        "Symbol10": "symbol10",
        "Symbol11": "symbol11",
        "Symbol12": "symbol12",
        "Symbol13": "symbol13",
        "Symbol2": "symbol2",
        "Symbol3": "symbol3",
        "Symbol4": "symbol4",
        "Symbol5": "symbol5",
        "Symbol6": "symbol6",
        "Symbol7": "symbol7",
        "Symbol8": "symbol8",
        "Symbol9": "symbol9",
        "UdCompHeaderInUPlane": "udCompHeaderInUPlane",
    }
    _SDM_ENUM_MAP = {}

    def __init__(self, parent, list_op=False):
        super(RuCarrier, self).__init__(parent, list_op)

    @property
    def Active(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Activate/Deactivate Configuration
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Active"]))

    @property
    def BandSectorId(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Aggregated Cell identifier which distinguishes bands and sectors supported by O-RU.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["BandSectorId"]))

    @property
    def CarrierBw(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Bandwidth of the carrier.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["CarrierBw"]))

    @property
    def CcId(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): CC(Component Carrier) identifier which distinguishes carrier components supported by O-RU.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["CcId"]))

    @property
    def Count(self):
        # type: () -> int
        """
        Returns
        -------
        - number: Number of elements inside associated multiplier-scaled container object, e.g. number of devices inside a Device Group.
        """
        return self._get_attribute(self._SDM_ATT_MAP["Count"])

    @property
    def DescriptiveName(self):
        # type: () -> str
        """
        Returns
        -------
        - str: Longer, more descriptive name for element. It's not guaranteed to be unique like -name-, but may offer more context.
        """
        return self._get_attribute(self._SDM_ATT_MAP["DescriptiveName"])

    @property
    def DuPortId(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): DU(Distributed Unit)identifier used to differentiate processing units at DU.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["DuPortId"]))

    @property
    def IqBitwidth(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Depends on the selected compression method. No compression: Represents the bitwidth of each uncompressed I and Q value. Block floating point: Represents the bitwidth of each I and Q mantissa value.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["IqBitwidth"]))

    @property
    def IqCompMethod(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Indicates the compression algorithm used for the IQ samples.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["IqCompMethod"]))

    @property
    def Name(self):
        # type: () -> str
        """
        Returns
        -------
        - str: Name of NGPF element, guaranteed to be unique in Scenario
        """
        return self._get_attribute(self._SDM_ATT_MAP["Name"])

    @Name.setter
    def Name(self, value):
        # type: (str) -> None
        self._set_attribute(self._SDM_ATT_MAP["Name"], value)

    @property
    def Numerology(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Numerology indicates the sub-carrier spacing.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Numerology"]))

    @property
    def PrbCount(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Number of PRBs(Physical Resource Blocks) for a symbol.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["PrbCount"]))

    @property
    def RuPortId(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): RU(Radio Unit) identifier which designates logical flows.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["RuPortId"]))

    @property
    def SlotFormat(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Configuration of the slot which has 14 symbols.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["SlotFormat"]))

    @property
    def Symbol0(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 0 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol0"]))

    @property
    def Symbol1(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 1 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol1"]))

    @property
    def Symbol10(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 10 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol10"]))

    @property
    def Symbol11(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 11 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol11"]))

    @property
    def Symbol12(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 12 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol12"]))

    @property
    def Symbol13(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 13 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol13"]))

    @property
    def Symbol2(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 2 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol2"]))

    @property
    def Symbol3(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 3 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol3"]))

    @property
    def Symbol4(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 4 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol4"]))

    @property
    def Symbol5(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 5 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol5"]))

    @property
    def Symbol6(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 6 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol6"]))

    @property
    def Symbol7(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 7 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol7"]))

    @property
    def Symbol8(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 8 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol8"]))

    @property
    def Symbol9(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Symbol 9 of slot.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP["Symbol9"]))

    @property
    def UdCompHeaderInUPlane(self):
        # type: () -> 'Multivalue'
        """
        Returns
        -------
        - obj(ixnetwork_restpy.multivalue.Multivalue): Include udCompHdr value in the U-plane message.
        """
        from ixnetwork_restpy.multivalue import Multivalue

        return Multivalue(
            self, self._get_attribute(self._SDM_ATT_MAP["UdCompHeaderInUPlane"])
        )

    def update(self, Name=None):
        # type: (str) -> RuCarrier
        """Updates ruCarrier resource on the server.

        This method has some named parameters with a type: obj (Multivalue).
        The Multivalue class has documentation that details the possible values for those named parameters.

        Args
        ----
        - Name (str): Name of NGPF element, guaranteed to be unique in Scenario

        Raises
        ------
        - ServerError: The server has encountered an uncategorized error condition
        """
        return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))

    def find(self, Count=None, DescriptiveName=None, Name=None):
        # type: (int, str, str) -> RuCarrier
        """Finds and retrieves ruCarrier resources from the server.

        All named parameters are evaluated on the server using regex. The named parameters can be used to selectively retrieve ruCarrier resources from the server.
        To retrieve an exact match ensure the parameter value starts with ^ and ends with $
        By default the find method takes no parameters and will retrieve all ruCarrier resources from the server.

        Args
        ----
        - Count (number): Number of elements inside associated multiplier-scaled container object, e.g. number of devices inside a Device Group.
        - DescriptiveName (str): Longer, more descriptive name for element. It's not guaranteed to be unique like -name-, but may offer more context.
        - Name (str): Name of NGPF element, guaranteed to be unique in Scenario

        Returns
        -------
        - self: This instance with matching ruCarrier resources retrieved from the server available through an iterator or index

        Raises
        ------
        - ServerError: The server has encountered an uncategorized error condition
        """
        return self._select(self._map_locals(self._SDM_ATT_MAP, locals()))

    def read(self, href):
        """Retrieves a single instance of ruCarrier data from the server.

        Args
        ----
        - href (str): An href to the instance to be retrieved

        Returns
        -------
        - self: This instance with the ruCarrier resources from the server available through an iterator or index

        Raises
        ------
        - NotFoundError: The requested resource does not exist on the server
        - ServerError: The server has encountered an uncategorized error condition
        """
        return self._read(href)

    def get_device_ids(
        self,
        PortNames=None,
        Active=None,
        BandSectorId=None,
        CarrierBw=None,
        CcId=None,
        DuPortId=None,
        IqBitwidth=None,
        IqCompMethod=None,
        Numerology=None,
        PrbCount=None,
        RuPortId=None,
        SlotFormat=None,
        Symbol0=None,
        Symbol1=None,
        Symbol10=None,
        Symbol11=None,
        Symbol12=None,
        Symbol13=None,
        Symbol2=None,
        Symbol3=None,
        Symbol4=None,
        Symbol5=None,
        Symbol6=None,
        Symbol7=None,
        Symbol8=None,
        Symbol9=None,
        UdCompHeaderInUPlane=None,
    ):
        """Base class infrastructure that gets a list of ruCarrier device ids encapsulated by this object.

        Use the optional regex parameters in the method to refine the list of device ids encapsulated by this object.

        Args
        ----
        - PortNames (str): optional regex of port names
        - Active (str): optional regex of active
        - BandSectorId (str): optional regex of bandSectorId
        - CarrierBw (str): optional regex of carrierBw
        - CcId (str): optional regex of ccId
        - DuPortId (str): optional regex of duPortId
        - IqBitwidth (str): optional regex of iqBitwidth
        - IqCompMethod (str): optional regex of iqCompMethod
        - Numerology (str): optional regex of numerology
        - PrbCount (str): optional regex of prbCount
        - RuPortId (str): optional regex of ruPortId
        - SlotFormat (str): optional regex of slotFormat
        - Symbol0 (str): optional regex of symbol0
        - Symbol1 (str): optional regex of symbol1
        - Symbol10 (str): optional regex of symbol10
        - Symbol11 (str): optional regex of symbol11
        - Symbol12 (str): optional regex of symbol12
        - Symbol13 (str): optional regex of symbol13
        - Symbol2 (str): optional regex of symbol2
        - Symbol3 (str): optional regex of symbol3
        - Symbol4 (str): optional regex of symbol4
        - Symbol5 (str): optional regex of symbol5
        - Symbol6 (str): optional regex of symbol6
        - Symbol7 (str): optional regex of symbol7
        - Symbol8 (str): optional regex of symbol8
        - Symbol9 (str): optional regex of symbol9
        - UdCompHeaderInUPlane (str): optional regex of udCompHeaderInUPlane

        Returns
        -------
        - list(int): A list of device ids that meets the regex criteria provided in the method parameters

        Raises
        ------
        - ServerError: The server has encountered an uncategorized error condition
        """
        return self._get_ngpf_device_ids(locals())
