# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from collections import OrderedDict
from decimal import Decimal
from bitarray import bitarray
import six

# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
    import builtins as __builtin__

    long = int
elif six.PY2:
    import __builtin__


class config(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance - based on the path /network-instances/network-instance/policy-forwarding/policies/policy/rules/rule/transport/config. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Configuration data
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__source_port",
        "__destination_port",
        "__tcp_flags",
    )

    _yang_name = "config"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__source_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="source-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )
        self.__destination_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="destination-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )
        self.__tcp_flags = YANGDynClass(
            base=TypedListType(
                allowed_type=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                    },
                )
            ),
            is_leaf=False,
            yang_name="tcp-flags",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "policy-forwarding",
                "policies",
                "policy",
                "rules",
                "rule",
                "transport",
                "config",
            ]

    def _get_source_port(self):
        """
    Getter method for source_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/source_port (oc-pkt-match-types:port-num-range)

    YANG Description: Source port or range
    """
        return self.__source_port

    def _set_source_port(self, v, load=False):
        """
    Setter method for source_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/source_port (oc-pkt-match-types:port-num-range)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_source_port is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_source_port() directly.

    YANG Description: Source port or range
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                        },
                    ),
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..65535"]},
                            int_size=16,
                        ),
                        restriction_dict={"range": ["0..65535"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ANY": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="source-port",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-pkt-match-types:port-num-range",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""",
                    "defined-type": "oc-pkt-match-types:port-num-range",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""",
                }
            )

        self.__source_port = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_source_port(self):
        self.__source_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="source-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )

    def _get_destination_port(self):
        """
    Getter method for destination_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/destination_port (oc-pkt-match-types:port-num-range)

    YANG Description: Destination port or range
    """
        return self.__destination_port

    def _set_destination_port(self, v, load=False):
        """
    Setter method for destination_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/destination_port (oc-pkt-match-types:port-num-range)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_destination_port is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_destination_port() directly.

    YANG Description: Destination port or range
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                        },
                    ),
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..65535"]},
                            int_size=16,
                        ),
                        restriction_dict={"range": ["0..65535"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ANY": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="destination-port",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-pkt-match-types:port-num-range",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""",
                    "defined-type": "oc-pkt-match-types:port-num-range",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""",
                }
            )

        self.__destination_port = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_destination_port(self):
        self.__destination_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="destination-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )

    def _get_tcp_flags(self):
        """
    Getter method for tcp_flags, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/tcp_flags (identityref)

    YANG Description: List of TCP flags to match
    """
        return self.__tcp_flags

    def _set_tcp_flags(self, v, load=False):
        """
    Setter method for tcp_flags, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/tcp_flags (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_tcp_flags is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_tcp_flags() directly.

    YANG Description: List of TCP flags to match
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=TypedListType(
                    allowed_type=RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "TCP_SYN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_SYN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_FIN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_FIN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_RST": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_RST": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_PSH": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_PSH": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_ACK": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_ACK": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_URG": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_URG": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_ECE": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_ECE": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_CWR": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_CWR": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                        },
                    )
                ),
                is_leaf=False,
                yang_name="tcp-flags",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """tcp_flags must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'TCP_SYN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_FIN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_RST': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_PSH': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_ACK': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_URG': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_ECE': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_CWR': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__tcp_flags = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_tcp_flags(self):
        self.__tcp_flags = YANGDynClass(
            base=TypedListType(
                allowed_type=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                    },
                )
            ),
            is_leaf=False,
            yang_name="tcp-flags",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    source_port = __builtin__.property(_get_source_port, _set_source_port)
    destination_port = __builtin__.property(
        _get_destination_port, _set_destination_port
    )
    tcp_flags = __builtin__.property(_get_tcp_flags, _set_tcp_flags)

    _pyangbind_elements = OrderedDict(
        [
            ("source_port", source_port),
            ("destination_port", destination_port),
            ("tcp_flags", tcp_flags),
        ]
    )


class config(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance-l2 - based on the path /network-instances/network-instance/policy-forwarding/policies/policy/rules/rule/transport/config. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: Configuration data
  """
    __slots__ = (
        "_path_helper",
        "_extmethods",
        "__source_port",
        "__destination_port",
        "__tcp_flags",
    )

    _yang_name = "config"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__source_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="source-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )
        self.__destination_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="destination-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )
        self.__tcp_flags = YANGDynClass(
            base=TypedListType(
                allowed_type=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                    },
                )
            ),
            is_leaf=False,
            yang_name="tcp-flags",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "policy-forwarding",
                "policies",
                "policy",
                "rules",
                "rule",
                "transport",
                "config",
            ]

    def _get_source_port(self):
        """
    Getter method for source_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/source_port (oc-pkt-match-types:port-num-range)

    YANG Description: Source port or range
    """
        return self.__source_port

    def _set_source_port(self, v, load=False):
        """
    Setter method for source_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/source_port (oc-pkt-match-types:port-num-range)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_source_port is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_source_port() directly.

    YANG Description: Source port or range
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                        },
                    ),
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..65535"]},
                            int_size=16,
                        ),
                        restriction_dict={"range": ["0..65535"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ANY": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="source-port",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-pkt-match-types:port-num-range",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """source_port must be of a type compatible with oc-pkt-match-types:port-num-range""",
                    "defined-type": "oc-pkt-match-types:port-num-range",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="source-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""",
                }
            )

        self.__source_port = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_source_port(self):
        self.__source_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="source-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )

    def _get_destination_port(self):
        """
    Getter method for destination_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/destination_port (oc-pkt-match-types:port-num-range)

    YANG Description: Destination port or range
    """
        return self.__destination_port

    def _set_destination_port(self, v, load=False):
        """
    Setter method for destination_port, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/destination_port (oc-pkt-match-types:port-num-range)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_destination_port is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_destination_port() directly.

    YANG Description: Destination port or range
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=[
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_dict={
                            "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                        },
                    ),
                    RestrictedClassType(
                        base_type=RestrictedClassType(
                            base_type=int,
                            restriction_dict={"range": ["0..65535"]},
                            int_size=16,
                        ),
                        restriction_dict={"range": ["0..65535"]},
                    ),
                    RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={"ANY": {}},
                    ),
                ],
                is_leaf=True,
                yang_name="destination-port",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="oc-pkt-match-types:port-num-range",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """destination_port must be of a type compatible with oc-pkt-match-types:port-num-range""",
                    "defined-type": "oc-pkt-match-types:port-num-range",
                    "generated-type": """YANGDynClass(base=[RestrictedClassType(base_type=six.text_type, restriction_dict={'pattern': '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$'}),RestrictedClassType(base_type=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), restriction_dict={'range': ['0..65535']}),RestrictedClassType(base_type=six.text_type,                                     restriction_type="dict_key",                                     restriction_arg={'ANY': {}},),], is_leaf=True, yang_name="destination-port", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-pkt-match-types:port-num-range', is_config=True)""",
                }
            )

        self.__destination_port = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_destination_port(self):
        self.__destination_port = YANGDynClass(
            base=[
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_dict={
                        "pattern": "^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)\\.\\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?[0-9]?)$"
                    },
                ),
                RestrictedClassType(
                    base_type=RestrictedClassType(
                        base_type=int,
                        restriction_dict={"range": ["0..65535"]},
                        int_size=16,
                    ),
                    restriction_dict={"range": ["0..65535"]},
                ),
                RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={"ANY": {}},
                ),
            ],
            is_leaf=True,
            yang_name="destination-port",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="oc-pkt-match-types:port-num-range",
            is_config=True,
        )

    def _get_tcp_flags(self):
        """
    Getter method for tcp_flags, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/tcp_flags (identityref)

    YANG Description: List of TCP flags to match
    """
        return self.__tcp_flags

    def _set_tcp_flags(self, v, load=False):
        """
    Setter method for tcp_flags, mapped from YANG variable /network_instances/network_instance/policy_forwarding/policies/policy/rules/rule/transport/config/tcp_flags (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_tcp_flags is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_tcp_flags() directly.

    YANG Description: List of TCP flags to match
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=TypedListType(
                    allowed_type=RestrictedClassType(
                        base_type=six.text_type,
                        restriction_type="dict_key",
                        restriction_arg={
                            "TCP_SYN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_SYN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_FIN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_FIN": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_RST": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_RST": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_PSH": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_PSH": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_ACK": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_ACK": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_URG": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_URG": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_ECE": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_ECE": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "TCP_CWR": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                            "oc-pkt-match-types:TCP_CWR": {
                                "@module": "openconfig-packet-match-types",
                                "@namespace": "http://openconfig.net/yang/packet-match-types",
                            },
                        },
                    )
                ),
                is_leaf=False,
                yang_name="tcp-flags",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="identityref",
                is_config=True,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """tcp_flags must be of a type compatible with identityref""",
                    "defined-type": "openconfig-network-instance:identityref",
                    "generated-type": """YANGDynClass(base=TypedListType(allowed_type=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={'TCP_SYN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_SYN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_FIN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_FIN': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_RST': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_RST': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_PSH': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_PSH': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_ACK': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_ACK': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_URG': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_URG': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_ECE': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_ECE': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'TCP_CWR': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}, 'oc-pkt-match-types:TCP_CWR': {'@module': 'openconfig-packet-match-types', '@namespace': 'http://openconfig.net/yang/packet-match-types'}},)), is_leaf=False, yang_name="tcp-flags", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='identityref', is_config=True)""",
                }
            )

        self.__tcp_flags = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_tcp_flags(self):
        self.__tcp_flags = YANGDynClass(
            base=TypedListType(
                allowed_type=RestrictedClassType(
                    base_type=six.text_type,
                    restriction_type="dict_key",
                    restriction_arg={
                        "TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_SYN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_FIN": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_RST": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_PSH": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ACK": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_URG": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_ECE": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                        "oc-pkt-match-types:TCP_CWR": {
                            "@module": "openconfig-packet-match-types",
                            "@namespace": "http://openconfig.net/yang/packet-match-types",
                        },
                    },
                )
            ),
            is_leaf=False,
            yang_name="tcp-flags",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="identityref",
            is_config=True,
        )

    source_port = __builtin__.property(_get_source_port, _set_source_port)
    destination_port = __builtin__.property(
        _get_destination_port, _set_destination_port
    )
    tcp_flags = __builtin__.property(_get_tcp_flags, _set_tcp_flags)

    _pyangbind_elements = OrderedDict(
        [
            ("source_port", source_port),
            ("destination_port", destination_port),
            ("tcp_flags", tcp_flags),
        ]
    )
