python类property()的实例源码

__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 59 收藏 0 点赞 0 评论 0
def _set_name(self, v, load=False):
    """
    Setter method for name, mapped from YANG variable /components/component/properties/property/state/name (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_name() directly.

    YANG Description: System-supplied name of the property -- this is typically
non-configurable
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='string', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """name must be of a type compatible with string""",
          'defined-type': "string",
          'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='string', is_config=False)""",
        })

    self.__name = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _set_configurable(self, v, load=False):
    """
    Setter method for configurable, mapped from YANG variable /components/component/properties/property/state/configurable (boolean)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_configurable is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_configurable() directly.

    YANG Description: Indication whether the property is user-configurable
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="configurable", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='boolean', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """configurable must be of a type compatible with boolean""",
          'defined-type': "boolean",
          'generated-type': """YANGDynClass(base=YANGBool, is_leaf=True, yang_name="configurable", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='boolean', is_config=False)""",
        })

    self.__configurable = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _set_config(self, v, load=False):
    """
    Setter method for config, mapped from YANG variable /components/component/properties/property/config (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_config is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_config() directly.

    YANG Description: Configuration data for each property
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='container', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """config must be of a type compatible with container""",
          'defined-type': "container",
          'generated-type': """YANGDynClass(base=config.config, is_container='container', yang_name="config", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='container', is_config=True)""",
        })

    self.__config = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _set_name(self, v, load=False):
    """
    Setter method for name, mapped from YANG variable /components/component/properties/property/config/name (string)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_name() directly.

    YANG Description: System-supplied name of the property -- this is typically
non-configurable
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='string', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """name must be of a type compatible with string""",
          'defined-type': "string",
          'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='string', is_config=True)""",
        })

    self.__name = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _set_property_(self, v, load=False):
    """
    Setter method for property_, mapped from YANG variable /components/component/properties/property (list)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_property_ is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_property_() directly.

    YANG Description: List of system properties for the component
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=YANGListType("name",property_.property_, yang_name="property", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="property", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='list', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """property_ must be of a type compatible with list""",
          'defined-type': "list",
          'generated-type': """YANGDynClass(base=YANGListType("name",property_.property_, yang_name="property", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='name', extensions=None), is_container='list', yang_name="property", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='list', is_config=True)""",
        })

    self.__property_ = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def string(self, ID):
        size = ffi.new('size_t *')
        buffer = lib.graph_string(self._txn, ID, size)
        return ffi.buffer(buffer, size[0])

    # fetch graph/node/edge/property property object by key
    # yes, the graph itself as well as properties may have child properties
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def property(self, key):
        if key in self.reserved:
            return NativeProperty(self, key)
        _prop = self._get_property(self.txn.serialize_property_key.encode(key))
        return None if _prop == ffi.NULL else Property(self.txn, _prop)
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get(self, key, default=None):
        prop = self.property(key)
        if prop is None:
            return default
        return prop.value
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __getitem__(self, key):
        prop = self.property(key)
        if prop is None:
            raise KeyError(key)
        return prop.value
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __delitem__(self, key):
        if key in self.reserved:
            raise KeyError
        prop = self.property(key)
        if prop is None:
            raise KeyError(key)
        prop.delete()
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def edge(self, **kwargs):
        return self._node_edge_property(Edge, **kwargs)

    # fetch property by ID, applying beforeID filter
    # heads up! we are inspecting supplied parameters to decide whether or not to override!
    # if overridden, this will fetch a property object by ID, applying optional beforeID filter
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def property(self, *args, **kwargs):
        # if positional args were passed, we punt to the parent function
        if args:
            return super(Transaction, self).property(*args, **kwargs)
        return self._node_edge_property(Property, **kwargs)

    # return nodes iterator, optionally for a specific type
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def updates(self, **kwargs):
        """returns iterator for tuples of: node/edge before modification, node/edge after modification, the set of key names that changed, first and last txn ID to contribute to the delta, and the last logID processed"""
        changed = {}
        batch=kwargs.pop('batch', 500)
        for target in self.scan(**kwargs):
            ID = target.ID
            updated = []
            if isinstance(target, Property):
                # it is a property
                updated.append((target.parent, set([target.key])))
            else:
                updated.append((target, set(target)))
                # new edges cause changes in referenced nodes' properties
                if isinstance(target,Edge):
                    updated.append((target.src, Node.reserved_src_updates))
                    updated.append((target.tgt, Node.reserved_tgt_updates))

            for (obj, keys) in updated:
                if obj.ID in changed:
                    # updated record w/ latest revision of node/edge, and merge in affected key names
                    changed[obj.ID][1] = obj
                    changed[obj.ID][2].update(keys)
                    changed[obj.ID][4] = ID
                else:
                    # collect changes for up to $batch node/edges before yielding change sets
                    if len(changed) == batch:
                        for before_after_keys in changed.itervalues():
                            before_after_keys.append(ID)
                            yield tuple(before_after_keys)
                        changed.clear()
                    # snag copy of the object just before this update (might not exist yet), this object, and affected keys
                    changed[obj.ID] = [obj.clone(beforeID=ID), obj, set(keys), ID, ID]
        for before_after_keys in changed.itervalues():
            before_after_keys.append(ID)
            yield tuple(before_after_keys)
__init__.py 文件源码 项目:lemongraph 作者: NationalSecurityAgency 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _prop_iter(self, keys, handler=None):
        for key in keys:
            if key in self.reserved:
                obj = NativeProperty(self, key)
                yield obj if handler is None else handler(obj)

    # return iterator over node/edge/property properties
compile.py 文件源码 项目:netscaler-ansible-modules 作者: citrix 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def produce_module_arguments_from_json_schema(json_doc, skip_attrs):
    module_arguments = list()
    for property in json_doc:
        # Skip readonly attributes
        if property['readonly'] is True:
            continue

        # Skip attributes in skip_attrs
        if property['name'] in skip_attrs:
            continue

        key = property['name']
        entry = {}
        entry['key'] = key
        entry['transforms'] = []

        # Convert json type to ansible module argument type declaration

        entry['type'] = property['type']

        # Add choices if applicable
        if 'choices' in property:
            choice_set = frozenset([choice.lower() for choice in property['choices']])
            if choice_set == frozenset(['yes', 'no']):
                # Overwrite type to bool
                entry['type'] = 'bool'
                entry['transforms'] = ['bool_yes_no']
            elif choice_set == frozenset(['on', 'off']):
                # Overwrite type to bool
                entry['type'] = 'bool'
                entry['transforms'] = ['bool_on_off']
            elif choice_set == frozenset(['enabled', 'disabled']):
                entry['choices'] = ['enabled', 'disabled']
            else:
                entry['choices'] = property['choices']

        # Add to ansible modules argument
        module_arguments.append(entry)

    return module_arguments
compile.py 文件源码 项目:netscaler-ansible-modules 作者: citrix 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def produce_readwrite_attrs_list(json_doc):
    readonly_list = list()
    for property in json_doc:
        # Add only readonly attributes
        if property['readonly'] is False:
            readonly_list.append(property['name'])
    return readonly_list
compile.py 文件源码 项目:netscaler-ansible-modules 作者: citrix 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def produce_readonly_attrs_list(json_doc):
    readonly_list = list()
    for property in json_doc:
        # Add only readonly attributes
        if property['readonly'] is True:
            readonly_list.append(property['name'])
    return readonly_list
compile.py 文件源码 项目:netscaler-ansible-modules 作者: citrix 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def produce_immutables_list(json_doc):
    immutables_list = []
    for property in json_doc:
        # Add only readonly attributes
        if 'mutable' in property and not property['mutable'] and not property['readonly']:
            immutables_list.append(property['name'])
    return immutables_list
Hoster.py 文件源码 项目:download-manager 作者: thispc 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def setter(self, method):
            return property(self.fget, method, self.fdel)
Hoster.py 文件源码 项目:download-manager 作者: thispc 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def deleter(self, method):
            return property(self.fget, self.fset, method)
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _get_ethernet_pmd_preconf(self):
    """
    Getter method for ethernet_pmd_preconf, mapped from YANG variable /components/component/transceiver/state/ethernet_pmd_preconf (identityref)

    YANG Description: The Ethernet PMD is a property of the optical transceiver
used on the port, indicating the type of physical connection.
It is included in configuration data to allow pre-configuring
a port/transceiver with the expected PMD.  The actual PMD is
indicated by the ethernet-pmd state leaf.
    """
    return self.__ethernet_pmd_preconf
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _set_ethernet_pmd_preconf(self, v, load=False):
    """
    Setter method for ethernet_pmd_preconf, mapped from YANG variable /components/component/transceiver/state/ethernet_pmd_preconf (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ethernet_pmd_preconf is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ethernet_pmd_preconf() directly.

    YANG Description: The Ethernet PMD is a property of the optical transceiver
used on the port, indicating the type of physical connection.
It is included in configuration data to allow pre-configuring
a port/transceiver with the expected PMD.  The actual PMD is
indicated by the ethernet-pmd state leaf.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}},), is_leaf=True, yang_name="ethernet-pmd-preconf", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform/transceiver', defining_module='openconfig-platform-transceiver', yang_type='identityref', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ethernet_pmd_preconf must be of a type compatible with identityref""",
          'defined-type': "openconfig-platform-transceiver:identityref",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}},), is_leaf=True, yang_name="ethernet-pmd-preconf", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform/transceiver', defining_module='openconfig-platform-transceiver', yang_type='identityref', is_config=False)""",
        })

    self.__ethernet_pmd_preconf = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _get_ethernet_pmd_preconf(self):
    """
    Getter method for ethernet_pmd_preconf, mapped from YANG variable /components/component/transceiver/config/ethernet_pmd_preconf (identityref)

    YANG Description: The Ethernet PMD is a property of the optical transceiver
used on the port, indicating the type of physical connection.
It is included in configuration data to allow pre-configuring
a port/transceiver with the expected PMD.  The actual PMD is
indicated by the ethernet-pmd state leaf.
    """
    return self.__ethernet_pmd_preconf
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _set_ethernet_pmd_preconf(self, v, load=False):
    """
    Setter method for ethernet_pmd_preconf, mapped from YANG variable /components/component/transceiver/config/ethernet_pmd_preconf (identityref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_ethernet_pmd_preconf is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_ethernet_pmd_preconf() directly.

    YANG Description: The Ethernet PMD is a property of the optical transceiver
used on the port, indicating the type of physical connection.
It is included in configuration data to allow pre-configuring
a port/transceiver with the expected PMD.  The actual PMD is
indicated by the ethernet-pmd state leaf.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}},), is_leaf=True, yang_name="ethernet-pmd-preconf", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform/transceiver', defining_module='openconfig-platform-transceiver', yang_type='identityref', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """ethernet_pmd_preconf must be of a type compatible with identityref""",
          'defined-type': "openconfig-platform-transceiver:identityref",
          'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_UNDEFINED': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_AOC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100G_ACC': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ZR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_SR10': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_SR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_ER': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_SR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_10GBASE_LRM': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_40GBASE_LR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_CWDM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_100GBASE_PSM4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'ETH_40GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_4X10GBASE_LR': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_ER4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CLR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}, u'oc-opt-types:ETH_100GBASE_CR4': {'@namespace': u'http://openconfig.net/yang/transport-types', '@module': u'openconfig-transport-types'}},), is_leaf=True, yang_name="ethernet-pmd-preconf", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform/transceiver', defining_module='openconfig-platform-transceiver', yang_type='identityref', is_config=True)""",
        })

    self.__ethernet_pmd_preconf = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _path(self):
    if hasattr(self, "_parent"):
      return self._parent._path()+[self._yang_name]
    else:
      return [u'components', u'component', u'properties', u'property', u'state']
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _get_value(self):
    """
    Getter method for value, mapped from YANG variable /components/component/properties/property/state/value (union)

    YANG Description: Property values can take on a variety of types.  Signed and
unsigned integer types may be provided in smaller sizes,
e.g., int8, uint16, etc.
    """
    return self.__value
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _set_value(self, v, load=False):
    """
    Setter method for value, mapped from YANG variable /components/component/properties/property/state/value (union)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_value is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_value() directly.

    YANG Description: Property values can take on a variety of types.  Signed and
unsigned integer types may be provided in smaller sizes,
e.g., int8, uint16, etc.
    """
    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=[unicode,YANGBool,RestrictedClassType(base_type=long, restriction_dict={'range': ['-9223372036854775808..9223372036854775807']}, int_size=64),RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64),RestrictedPrecisionDecimalType(precision=2),], is_leaf=True, yang_name="value", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='union', is_config=False)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """value must be of a type compatible with union""",
          'defined-type': "openconfig-platform:union",
          'generated-type': """YANGDynClass(base=[unicode,YANGBool,RestrictedClassType(base_type=long, restriction_dict={'range': ['-9223372036854775808..9223372036854775807']}, int_size=64),RestrictedClassType(base_type=long, restriction_dict={'range':  ['0..18446744073709551615']}, int_size=64),RestrictedPrecisionDecimalType(precision=2),], is_leaf=True, yang_name="value", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='union', is_config=False)""",
        })

    self.__value = t
    if hasattr(self, '_set'):
      self._set()
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _get_configurable(self):
    """
    Getter method for configurable, mapped from YANG variable /components/component/properties/property/state/configurable (boolean)

    YANG Description: Indication whether the property is user-configurable
    """
    return self.__configurable
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _get_name(self):
    """
    Getter method for name, mapped from YANG variable /components/component/properties/property/name (leafref)

    YANG Description: Reference to the property name.
    """
    return self.__name
__init__.py 文件源码 项目:napalm-yang 作者: napalm-automation 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _set_name(self, v, load=False):
    """
    Setter method for name, mapped from YANG variable /components/component/properties/property/name (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_name is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_name() directly.

    YANG Description: Reference to the property name.
    """
    parent = getattr(self, "_parent", None)
    if parent is not None and load is False:
      raise AttributeError("Cannot set keys directly when" +
                             " within an instantiated list")

    if hasattr(v, "_utype"):
      v = v._utype(v)
    try:
      t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='leafref', is_config=True)
    except (TypeError, ValueError):
      raise ValueError({
          'error-string': """name must be of a type compatible with leafref""",
          'defined-type': "leafref",
          'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/platform', defining_module='openconfig-platform', yang_type='leafref', is_config=True)""",
        })

    self.__name = t
    if hasattr(self, '_set'):
      self._set()


问题


面经


文章

微信
公众号

扫码关注公众号