class MplsLsd(Entity): """ MPLS LSD configuration data .. attribute:: app_reg_delay_disable Disable LSD application reg delay **type**\: :py:class:`Empty<ydk.types.Empty>` .. attribute:: ipv4 Configure IPv4 parameters **type**\: :py:class:`Ipv4 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsLsd.Ipv4>` .. attribute:: ipv6 Configure IPv6 parameters **type**\: :py:class:`Ipv6 <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsLsd.Ipv6>` .. attribute:: label_databases Table of label databases **type**\: :py:class:`LabelDatabases <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsLsd.LabelDatabases>` .. attribute:: mpls_entropy_label Enable MPLS Entropy Label **type**\: :py:class:`Empty<ydk.types.Empty>` .. attribute:: mpls_ip_ttl_propagate_disable Disable Propagation of IP TTL onto the label stack **type**\: :py:class:`MplsIpTtlPropagateDisable <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsIpTtlPropagateDisable>` """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd, self).__init__() self._top_entity = None self.yang_name = "mpls-lsd" self.yang_parent_name = "Cisco-IOS-XR-mpls-lsd-cfg" self.app_reg_delay_disable = YLeaf(YType.empty, "app-reg-delay-disable") self.mpls_entropy_label = YLeaf(YType.empty, "mpls-entropy-label") self.mpls_ip_ttl_propagate_disable = YLeaf(YType.enumeration, "mpls-ip-ttl-propagate-disable") self.ipv4 = MplsLsd.Ipv4() self.ipv4.parent = self self._children_name_map["ipv4"] = "ipv4" self._children_yang_names.add("ipv4") self.ipv6 = MplsLsd.Ipv6() self.ipv6.parent = self self._children_name_map["ipv6"] = "ipv6" self._children_yang_names.add("ipv6") self.label_databases = MplsLsd.LabelDatabases() self.label_databases.parent = self self._children_name_map["label_databases"] = "label-databases" self._children_yang_names.add("label-databases") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("app_reg_delay_disable", "mpls_entropy_label", "mpls_ip_ttl_propagate_disable") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd, self).__setattr__(name, value) class Ipv6(Entity): """ Configure IPv6 parameters .. attribute:: ttl_expiration_pop Number of labels to pop upon MPLS IP TTL expiry **type**\: int **range:** 1..10 """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.Ipv6, self).__init__() self.yang_name = "ipv6" self.yang_parent_name = "mpls-lsd" self.ttl_expiration_pop = YLeaf(YType.uint32, "ttl-expiration-pop") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("ttl_expiration_pop") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.Ipv6, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.Ipv6, self).__setattr__(name, value) def has_data(self): return self.ttl_expiration_pop.is_set def has_operation(self): return ( self.yfilter != YFilter.not_set or self.ttl_expiration_pop.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "ipv6" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.ttl_expiration_pop.is_set or self.ttl_expiration_pop.yfilter != YFilter.not_set): leaf_name_data.append(self.ttl_expiration_pop.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "ttl-expiration-pop"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "ttl-expiration-pop"): self.ttl_expiration_pop = value self.ttl_expiration_pop.value_namespace = name_space self.ttl_expiration_pop.value_namespace_prefix = name_space_prefix class Ipv4(Entity): """ Configure IPv4 parameters .. attribute:: ttl_expiration_pop Number of labels to pop upon MPLS IP TTL expiry **type**\: int **range:** 1..10 """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.Ipv4, self).__init__() self.yang_name = "ipv4" self.yang_parent_name = "mpls-lsd" self.ttl_expiration_pop = YLeaf(YType.uint32, "ttl-expiration-pop") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("ttl_expiration_pop") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.Ipv4, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.Ipv4, self).__setattr__(name, value) def has_data(self): return self.ttl_expiration_pop.is_set def has_operation(self): return ( self.yfilter != YFilter.not_set or self.ttl_expiration_pop.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "ipv4" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.ttl_expiration_pop.is_set or self.ttl_expiration_pop.yfilter != YFilter.not_set): leaf_name_data.append(self.ttl_expiration_pop.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "ttl-expiration-pop"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "ttl-expiration-pop"): self.ttl_expiration_pop = value self.ttl_expiration_pop.value_namespace = name_space self.ttl_expiration_pop.value_namespace_prefix = name_space_prefix class LabelDatabases(Entity): """ Table of label databases .. attribute:: label_database A label database **type**\: list of :py:class:`LabelDatabase <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsLsd.LabelDatabases.LabelDatabase>` """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.LabelDatabases, self).__init__() self.yang_name = "label-databases" self.yang_parent_name = "mpls-lsd" self.label_database = YList(self) def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in () and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.LabelDatabases, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.LabelDatabases, self).__setattr__(name, value) class LabelDatabase(Entity): """ A label database .. attribute:: label_database_id <key> Label database identifier **type**\: int **range:** 0..4294967295 .. attribute:: label_range Label range **type**\: :py:class:`LabelRange <ydk.models.cisco_ios_xr.Cisco_IOS_XR_mpls_lsd_cfg.MplsLsd.LabelDatabases.LabelDatabase.LabelRange>` """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.LabelDatabases.LabelDatabase, self).__init__() self.yang_name = "label-database" self.yang_parent_name = "label-databases" self.label_database_id = YLeaf(YType.uint32, "label-database-id") self.label_range = MplsLsd.LabelDatabases.LabelDatabase.LabelRange() self.label_range.parent = self self._children_name_map["label_range"] = "label-range" self._children_yang_names.add("label-range") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("label_database_id") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.LabelDatabases.LabelDatabase, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.LabelDatabases.LabelDatabase, self).__setattr__(name, value) class LabelRange(Entity): """ Label range .. attribute:: max_static_value Maximum static label value **type**\: int **range:** 0..1048575 .. attribute:: max_value Maximum label value **type**\: int **range:** 16000..1048575 .. attribute:: min_static_value Minimum static label value **type**\: int **range:** 0..1048575 .. attribute:: minvalue Minimum label value **type**\: int **range:** 16000..1048575 """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__init__() self.yang_name = "label-range" self.yang_parent_name = "label-database" self.max_static_value = YLeaf(YType.uint32, "max-static-value") self.max_value = YLeaf(YType.uint32, "max-value") self.min_static_value = YLeaf(YType.uint32, "min-static-value") self.minvalue = YLeaf(YType.uint32, "minvalue") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("max_static_value", "max_value", "min_static_value", "minvalue") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__setattr__(name, value) def has_data(self): return ( self.max_static_value.is_set or self.max_value.is_set or self.min_static_value.is_set or self.minvalue.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.max_static_value.yfilter != YFilter.not_set or self.max_value.yfilter != YFilter.not_set or self.min_static_value.yfilter != YFilter.not_set or self.minvalue.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "label-range" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.max_static_value.is_set or self.max_static_value.yfilter != YFilter.not_set): leaf_name_data.append(self.max_static_value.get_name_leafdata()) if (self.max_value.is_set or self.max_value.yfilter != YFilter.not_set): leaf_name_data.append(self.max_value.get_name_leafdata()) if (self.min_static_value.is_set or self.min_static_value.yfilter != YFilter.not_set): leaf_name_data.append(self.min_static_value.get_name_leafdata()) if (self.minvalue.is_set or self.minvalue.yfilter != YFilter.not_set): leaf_name_data.append(self.minvalue.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "max-static-value" or name == "max-value" or name == "min-static-value" or name == "minvalue"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "max-static-value"): self.max_static_value = value self.max_static_value.value_namespace = name_space self.max_static_value.value_namespace_prefix = name_space_prefix if(value_path == "max-value"): self.max_value = value self.max_value.value_namespace = name_space self.max_value.value_namespace_prefix = name_space_prefix if(value_path == "min-static-value"): self.min_static_value = value self.min_static_value.value_namespace = name_space self.min_static_value.value_namespace_prefix = name_space_prefix if(value_path == "minvalue"): self.minvalue = value self.minvalue.value_namespace = name_space self.minvalue.value_namespace_prefix = name_space_prefix def has_data(self): return ( self.label_database_id.is_set or (self.label_range is not None and self.label_range.has_data())) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.label_database_id.yfilter != YFilter.not_set or (self.label_range is not None and self.label_range.has_operation())) def get_segment_path(self): path_buffer = "" path_buffer = "label-database" + "[label-database-id='" + self.label_database_id.get() + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd/label-databases/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.label_database_id.is_set or self.label_database_id.yfilter != YFilter.not_set): leaf_name_data.append(self.label_database_id.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "label-range"): if (self.label_range is None): self.label_range = MplsLsd.LabelDatabases.LabelDatabase.LabelRange() self.label_range.parent = self self._children_name_map["label_range"] = "label-range" return self.label_range return None def has_leaf_or_child_of_name(self, name): if(name == "label-range" or name == "label-database-id"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "label-database-id"): self.label_database_id = value self.label_database_id.value_namespace = name_space self.label_database_id.value_namespace_prefix = name_space_prefix def has_data(self): for c in self.label_database: if (c.has_data()): return True return False def has_operation(self): for c in self.label_database: if (c.has_operation()): return True return self.yfilter != YFilter.not_set def get_segment_path(self): path_buffer = "" path_buffer = "label-databases" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "label-database"): for c in self.label_database: segment = c.get_segment_path() if (segment_path == segment): return c c = MplsLsd.LabelDatabases.LabelDatabase() c.parent = self local_reference_key = "ydk::seg::%s" % segment_path self._local_refs[local_reference_key] = c self.label_database.append(c) return c return None def has_leaf_or_child_of_name(self, name): if(name == "label-database"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): pass def has_data(self): return ( self.app_reg_delay_disable.is_set or self.mpls_entropy_label.is_set or self.mpls_ip_ttl_propagate_disable.is_set or (self.ipv4 is not None and self.ipv4.has_data()) or (self.ipv6 is not None and self.ipv6.has_data()) or (self.label_databases is not None and self.label_databases.has_data())) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.app_reg_delay_disable.yfilter != YFilter.not_set or self.mpls_entropy_label.yfilter != YFilter.not_set or self.mpls_ip_ttl_propagate_disable.yfilter != YFilter.not_set or (self.ipv4 is not None and self.ipv4.has_operation()) or (self.ipv6 is not None and self.ipv6.has_operation()) or (self.label_databases is not None and self.label_databases.has_operation())) def get_segment_path(self): path_buffer = "" path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (not ancestor is None): raise YPYModelError("ancestor has to be None for top-level node") path_buffer = self.get_segment_path() leaf_name_data = LeafDataList() if (self.app_reg_delay_disable.is_set or self.app_reg_delay_disable.yfilter != YFilter.not_set): leaf_name_data.append(self.app_reg_delay_disable.get_name_leafdata()) if (self.mpls_entropy_label.is_set or self.mpls_entropy_label.yfilter != YFilter.not_set): leaf_name_data.append(self.mpls_entropy_label.get_name_leafdata()) if (self.mpls_ip_ttl_propagate_disable.is_set or self.mpls_ip_ttl_propagate_disable.yfilter != YFilter.not_set): leaf_name_data.append(self.mpls_ip_ttl_propagate_disable.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "ipv4"): if (self.ipv4 is None): self.ipv4 = MplsLsd.Ipv4() self.ipv4.parent = self self._children_name_map["ipv4"] = "ipv4" return self.ipv4 if (child_yang_name == "ipv6"): if (self.ipv6 is None): self.ipv6 = MplsLsd.Ipv6() self.ipv6.parent = self self._children_name_map["ipv6"] = "ipv6" return self.ipv6 if (child_yang_name == "label-databases"): if (self.label_databases is None): self.label_databases = MplsLsd.LabelDatabases() self.label_databases.parent = self self._children_name_map["label_databases"] = "label-databases" return self.label_databases return None def has_leaf_or_child_of_name(self, name): if(name == "ipv4" or name == "ipv6" or name == "label-databases" or name == "app-reg-delay-disable" or name == "mpls-entropy-label" or name == "mpls-ip-ttl-propagate-disable"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "app-reg-delay-disable"): self.app_reg_delay_disable = value self.app_reg_delay_disable.value_namespace = name_space self.app_reg_delay_disable.value_namespace_prefix = name_space_prefix if(value_path == "mpls-entropy-label"): self.mpls_entropy_label = value self.mpls_entropy_label.value_namespace = name_space self.mpls_entropy_label.value_namespace_prefix = name_space_prefix if(value_path == "mpls-ip-ttl-propagate-disable"): self.mpls_ip_ttl_propagate_disable = value self.mpls_ip_ttl_propagate_disable.value_namespace = name_space self.mpls_ip_ttl_propagate_disable.value_namespace_prefix = name_space_prefix def clone_ptr(self): self._top_entity = MplsLsd() return self._top_entity
class Ipv4(Entity): """ Configure IPv4 parameters .. attribute:: ttl_expiration_pop Number of labels to pop upon MPLS IP TTL expiry **type**\: int **range:** 1..10 """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.Ipv4, self).__init__() self.yang_name = "ipv4" self.yang_parent_name = "mpls-lsd" self.ttl_expiration_pop = YLeaf(YType.uint32, "ttl-expiration-pop") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("ttl_expiration_pop") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.Ipv4, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.Ipv4, self).__setattr__(name, value) def has_data(self): return self.ttl_expiration_pop.is_set def has_operation(self): return ( self.yfilter != YFilter.not_set or self.ttl_expiration_pop.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "ipv4" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-mpls-lsd-cfg:mpls-lsd/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.ttl_expiration_pop.is_set or self.ttl_expiration_pop.yfilter != YFilter.not_set): leaf_name_data.append(self.ttl_expiration_pop.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "ttl-expiration-pop"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "ttl-expiration-pop"): self.ttl_expiration_pop = value self.ttl_expiration_pop.value_namespace = name_space self.ttl_expiration_pop.value_namespace_prefix = name_space_prefix
class LabelRange(Entity): """ Label range .. attribute:: max_static_value Maximum static label value **type**\: int **range:** 0..1048575 .. attribute:: max_value Maximum label value **type**\: int **range:** 16000..1048575 .. attribute:: min_static_value Minimum static label value **type**\: int **range:** 0..1048575 .. attribute:: minvalue Minimum label value **type**\: int **range:** 16000..1048575 """ _prefix = 'mpls-lsd-cfg' _revision = '2015-11-09' def __init__(self): super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__init__() self.yang_name = "label-range" self.yang_parent_name = "label-database" self.max_static_value = YLeaf(YType.uint32, "max-static-value") self.max_value = YLeaf(YType.uint32, "max-value") self.min_static_value = YLeaf(YType.uint32, "min-static-value") self.minvalue = YLeaf(YType.uint32, "minvalue") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("max_static_value", "max_value", "min_static_value", "minvalue") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MplsLsd.LabelDatabases.LabelDatabase.LabelRange, self).__setattr__(name, value) def has_data(self): return ( self.max_static_value.is_set or self.max_value.is_set or self.min_static_value.is_set or self.minvalue.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.max_static_value.yfilter != YFilter.not_set or self.max_value.yfilter != YFilter.not_set or self.min_static_value.yfilter != YFilter.not_set or self.minvalue.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "label-range" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.max_static_value.is_set or self.max_static_value.yfilter != YFilter.not_set): leaf_name_data.append(self.max_static_value.get_name_leafdata()) if (self.max_value.is_set or self.max_value.yfilter != YFilter.not_set): leaf_name_data.append(self.max_value.get_name_leafdata()) if (self.min_static_value.is_set or self.min_static_value.yfilter != YFilter.not_set): leaf_name_data.append(self.min_static_value.get_name_leafdata()) if (self.minvalue.is_set or self.minvalue.yfilter != YFilter.not_set): leaf_name_data.append(self.minvalue.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "max-static-value" or name == "max-value" or name == "min-static-value" or name == "minvalue"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "max-static-value"): self.max_static_value = value self.max_static_value.value_namespace = name_space self.max_static_value.value_namespace_prefix = name_space_prefix if(value_path == "max-value"): self.max_value = value self.max_value.value_namespace = name_space self.max_value.value_namespace_prefix = name_space_prefix if(value_path == "min-static-value"): self.min_static_value = value self.min_static_value.value_namespace = name_space self.min_static_value.value_namespace_prefix = name_space_prefix if(value_path == "minvalue"): self.minvalue = value self.minvalue.value_namespace = name_space self.minvalue.value_namespace_prefix = name_space_prefix
class Ceedot3Pauseextentry(Entity): """ An entry in the table, containing additional information about the MAC Control PAUSE function on a single ethernet\-like interface, in extension to dot3PauseEntry in Etherlike\-MIB. .. attribute:: dot3statsindex <key> **type**\: int **range:** 1..2147483647 **refers to**\: :py:class:`dot3statsindex <ydk.models.cisco_ios_xe.EtherLike_MIB.EtherlikeMib.Dot3Statstable.Dot3Statsentry>` .. attribute:: ceedot3pauseextadminmode Indicates preference to send or process pause frames on this interface. txDesired(0) \- indicates preference to send pause frames, but autonegotiates flow control. This bit can only be turned on when the corresponding instance of dot3PauseAdminMode has the value of 'enabledXmit' or 'enabledXmitAndRcv'. rxDesired(1) \- indicates preference to process pause frames, but autonegotiates flow control. This bit can only be turned on when the corresponding instance of dot3PauseAdminMode has the value of 'enabledRcv' or 'enabledXmitAndRcv' **type**\: :py:class:`Ceedot3Pauseextadminmode <ydk.models.cisco_ios_xe.CISCO_ETHERLIKE_EXT_MIB.CiscoEtherlikeExtMib.Ceedot3Pauseexttable.Ceedot3Pauseextentry.Ceedot3Pauseextadminmode>` .. attribute:: ceedot3pauseextopermode Provides additional information about the flow control operational status on this interface. txDisagree(0) \- the transmit pause function on this interface is disabled due to disagreement from the far end on negotiation. rxDisagree(1) \- the receive pause function on this interface is disabled due to disagreement from the far end on negotiation. txDesired(2) \- the transmit pause function on this interface is desired. rxDesired(3) \- the receive pause function on this interface is desired **type**\: :py:class:`Ceedot3Pauseextopermode <ydk.models.cisco_ios_xe.CISCO_ETHERLIKE_EXT_MIB.CiscoEtherlikeExtMib.Ceedot3Pauseexttable.Ceedot3Pauseextentry.Ceedot3Pauseextopermode>` """ _prefix = 'CISCO-ETHERLIKE-EXT-MIB' _revision = '2010-06-04' def __init__(self): super( CiscoEtherlikeExtMib.Ceedot3Pauseexttable. Ceedot3Pauseextentry, self).__init__() self.yang_name = "ceeDot3PauseExtEntry" self.yang_parent_name = "ceeDot3PauseExtTable" self.dot3statsindex = YLeaf(YType.str, "dot3StatsIndex") self.ceedot3pauseextadminmode = YLeaf( YType.bits, "ceeDot3PauseExtAdminMode") self.ceedot3pauseextopermode = YLeaf( YType.bits, "ceeDot3PauseExtOperMode") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance( self.__dict__[name], YList): raise YPYModelError( "Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method.".format( value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("dot3statsindex", "ceedot3pauseextadminmode", "ceedot3pauseextopermode" ) and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super( CiscoEtherlikeExtMib.Ceedot3Pauseexttable. Ceedot3Pauseextentry, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container" ) and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super( CiscoEtherlikeExtMib.Ceedot3Pauseexttable. Ceedot3Pauseextentry, self).__setattr__(name, value) def has_data(self): return (self.dot3statsindex.is_set or self.ceedot3pauseextadminmode.is_set or self.ceedot3pauseextopermode.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.dot3statsindex.yfilter != YFilter.not_set or self.ceedot3pauseextadminmode.yfilter != YFilter.not_set or self.ceedot3pauseextopermode.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "ceeDot3PauseExtEntry" + "[dot3StatsIndex='" + self.dot3statsindex.get( ) + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "CISCO-ETHERLIKE-EXT-MIB:CISCO-ETHERLIKE-EXT-MIB/ceeDot3PauseExtTable/%s" % self.get_segment_path( ) else: path_buffer = _get_relative_entity_path( self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.dot3statsindex.is_set or self.dot3statsindex.yfilter != YFilter.not_set): leaf_name_data.append( self.dot3statsindex.get_name_leafdata()) if (self.ceedot3pauseextadminmode.is_set or self.ceedot3pauseextadminmode.yfilter != YFilter.not_set): leaf_name_data.append( self.ceedot3pauseextadminmode.get_name_leafdata()) if (self.ceedot3pauseextopermode.is_set or self.ceedot3pauseextopermode.yfilter != YFilter.not_set): leaf_name_data.append( self.ceedot3pauseextopermode.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name( [child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if (name == "dot3StatsIndex" or name == "ceeDot3PauseExtAdminMode" or name == "ceeDot3PauseExtOperMode"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if (value_path == "dot3StatsIndex"): self.dot3statsindex = value self.dot3statsindex.value_namespace = name_space self.dot3statsindex.value_namespace_prefix = name_space_prefix if (value_path == "ceeDot3PauseExtAdminMode"): self.ceedot3pauseextadminmode[value] = True if (value_path == "ceeDot3PauseExtOperMode"): self.ceedot3pauseextopermode[value] = True
class Ceesubinterfaceentry(Entity): """ This table contains a row for each Ethernet\-like interface by it's ifTable ifIndex in the system, which supports the sub\-interface. An entry is created by an agent, when it detects a Ethernet\-like interface is created in ifTable and it can support sub\-interface. An entry is deleted by an agent, when the ifTable entry associated to the Ethernet\-like interface is deleted. Typically, when the card is removed from the device. .. attribute:: ifindex <key> **type**\: int **range:** 1..2147483647 **refers to**\: :py:class:`ifindex <ydk.models.cisco_ios_xe.IF_MIB.IfMib.Iftable.Ifentry>` .. attribute:: ceesubinterfacecount This object represents the number of subinterfaces created on a Ethernet\-like interface **type**\: int **range:** 0..4294967295 **units**\: subifs """ _prefix = 'CISCO-ETHERLIKE-EXT-MIB' _revision = '2010-06-04' def __init__(self): super( CiscoEtherlikeExtMib.Ceesubinterfacetable. Ceesubinterfaceentry, self).__init__() self.yang_name = "ceeSubInterfaceEntry" self.yang_parent_name = "ceeSubInterfaceTable" self.ifindex = YLeaf(YType.str, "ifIndex") self.ceesubinterfacecount = YLeaf(YType.uint32, "ceeSubInterfaceCount") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance( self.__dict__[name], YList): raise YPYModelError( "Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method.".format( value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("ifindex", "ceesubinterfacecount" ) and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super( CiscoEtherlikeExtMib.Ceesubinterfacetable. Ceesubinterfaceentry, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container" ) and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super( CiscoEtherlikeExtMib.Ceesubinterfacetable. Ceesubinterfaceentry, self).__setattr__(name, value) def has_data(self): return (self.ifindex.is_set or self.ceesubinterfacecount.is_set) def has_operation(self): return (self.yfilter != YFilter.not_set or self.ifindex.yfilter != YFilter.not_set or self.ceesubinterfacecount.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "ceeSubInterfaceEntry" + "[ifIndex='" + self.ifindex.get( ) + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "CISCO-ETHERLIKE-EXT-MIB:CISCO-ETHERLIKE-EXT-MIB/ceeSubInterfaceTable/%s" % self.get_segment_path( ) else: path_buffer = _get_relative_entity_path( self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.ifindex.is_set or self.ifindex.yfilter != YFilter.not_set): leaf_name_data.append(self.ifindex.get_name_leafdata()) if (self.ceesubinterfacecount.is_set or self.ceesubinterfacecount.yfilter != YFilter.not_set): leaf_name_data.append( self.ceesubinterfacecount.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name( [child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if (name == "ifIndex" or name == "ceeSubInterfaceCount"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if (value_path == "ifIndex"): self.ifindex = value self.ifindex.value_namespace = name_space self.ifindex.value_namespace_prefix = name_space_prefix if (value_path == "ceeSubInterfaceCount"): self.ceesubinterfacecount = value self.ceesubinterfacecount.value_namespace = name_space self.ceesubinterfacecount.value_namespace_prefix = name_space_prefix
class Cdp(Entity): """ Global CDP configuration data .. attribute:: advertise_v1_only Enable CDPv1 only advertisements **type**\: :py:class:`Empty<ydk.types.Empty>` .. attribute:: enable Enable or disable CDP globally **type**\: bool **default value**\: true .. attribute:: hold_time Length of time (in sec) that the receiver must keep a CDP packet **type**\: int **range:** 10..255 **default value**\: 180 .. attribute:: log_adjacency Enable logging of adjacency changes **type**\: :py:class:`Empty<ydk.types.Empty>` .. attribute:: timer Specify the rate at which CDP packets are sent **type**\: int **range:** 5..255 **default value**\: 60 """ _prefix = 'cdp-cfg' _revision = '2015-07-30' def __init__(self): super(Cdp, self).__init__() self._top_entity = None self.yang_name = "cdp" self.yang_parent_name = "Cisco-IOS-XR-cdp-cfg" self.advertise_v1_only = YLeaf(YType.empty, "advertise-v1-only") self.enable = YLeaf(YType.boolean, "enable") self.hold_time = YLeaf(YType.uint32, "hold-time") self.log_adjacency = YLeaf(YType.empty, "log-adjacency") self.timer = YLeaf(YType.uint32, "timer") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("advertise_v1_only", "enable", "hold_time", "log_adjacency", "timer") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Cdp, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Cdp, self).__setattr__(name, value) def has_data(self): return ( self.advertise_v1_only.is_set or self.enable.is_set or self.hold_time.is_set or self.log_adjacency.is_set or self.timer.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.advertise_v1_only.yfilter != YFilter.not_set or self.enable.yfilter != YFilter.not_set or self.hold_time.yfilter != YFilter.not_set or self.log_adjacency.yfilter != YFilter.not_set or self.timer.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "Cisco-IOS-XR-cdp-cfg:cdp" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (not ancestor is None): raise YPYModelError("ancestor has to be None for top-level node") path_buffer = self.get_segment_path() leaf_name_data = LeafDataList() if (self.advertise_v1_only.is_set or self.advertise_v1_only.yfilter != YFilter.not_set): leaf_name_data.append(self.advertise_v1_only.get_name_leafdata()) if (self.enable.is_set or self.enable.yfilter != YFilter.not_set): leaf_name_data.append(self.enable.get_name_leafdata()) if (self.hold_time.is_set or self.hold_time.yfilter != YFilter.not_set): leaf_name_data.append(self.hold_time.get_name_leafdata()) if (self.log_adjacency.is_set or self.log_adjacency.yfilter != YFilter.not_set): leaf_name_data.append(self.log_adjacency.get_name_leafdata()) if (self.timer.is_set or self.timer.yfilter != YFilter.not_set): leaf_name_data.append(self.timer.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "advertise-v1-only" or name == "enable" or name == "hold-time" or name == "log-adjacency" or name == "timer"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "advertise-v1-only"): self.advertise_v1_only = value self.advertise_v1_only.value_namespace = name_space self.advertise_v1_only.value_namespace_prefix = name_space_prefix if(value_path == "enable"): self.enable = value self.enable.value_namespace = name_space self.enable.value_namespace_prefix = name_space_prefix if(value_path == "hold-time"): self.hold_time = value self.hold_time.value_namespace = name_space self.hold_time.value_namespace_prefix = name_space_prefix if(value_path == "log-adjacency"): self.log_adjacency = value self.log_adjacency.value_namespace = name_space self.log_adjacency.value_namespace_prefix = name_space_prefix if(value_path == "timer"): self.timer = value self.timer.value_namespace = name_space self.timer.value_namespace_prefix = name_space_prefix def clone_ptr(self): self._top_entity = Cdp() return self._top_entity
class Policy(Entity): """ MACSec Policy .. attribute:: name <key> Name of the Policy of maximum length 16 **type**\: str **length:** 1..16 .. attribute:: cipher_suite Cipher\-suite of Policy **type**\: :py:class:`MacsecMkaCipherSuite <ydk.models.cisco_ios_xr.Cisco_IOS_XR_crypto_macsec_mka_cfg.MacsecMkaCipherSuite>` .. attribute:: conf_offset Conf\-Offset of Policy **type**\: :py:class:`MacsecMkaConfOffset <ydk.models.cisco_ios_xr.Cisco_IOS_XR_crypto_macsec_mka_cfg.MacsecMkaConfOffset>` .. attribute:: delay_protection TRUE enables data delay protection **type**\: bool .. attribute:: include_icv_indicator TRUE enables Include ICV Indicator paramset in MKPDU **type**\: bool .. attribute:: key_server_priority Key\-Server\-Priority of Policy **type**\: int **range:** 0..255 .. attribute:: policy_exception Macsec policy exception for packets to be in clear **type**\: :py:class:`MacsecMkaPolicyException <ydk.models.cisco_ios_xr.Cisco_IOS_XR_crypto_macsec_mka_cfg.MacsecMkaPolicyException>` .. attribute:: sak_rekey_interval Interval after which key\-server generates new SAK for a Secured Session **type**\: int **range:** 0..43200 **units**\: minute .. attribute:: security_policy Security\-Policy of Policy **type**\: :py:class:`MacsecMkaSecurityPolicy <ydk.models.cisco_ios_xr.Cisco_IOS_XR_crypto_macsec_mka_cfg.MacsecMkaSecurityPolicy>` .. attribute:: vlan_tags_in_clear VLAN\-Tags\-In\-Clear of Policy **type**\: int **range:** 1..2 .. attribute:: window_size Window\-Size of Policy **type**\: int **range:** 0..1024 """ _prefix = 'crypto-macsec-mka-cfg' _revision = '2015-11-09' def __init__(self): super(Macsec.Policy, self).__init__() self.yang_name = "policy" self.yang_parent_name = "macsec" self.name = YLeaf(YType.str, "name") self.cipher_suite = YLeaf(YType.enumeration, "cipher-suite") self.conf_offset = YLeaf(YType.enumeration, "conf-offset") self.delay_protection = YLeaf(YType.boolean, "delay-protection") self.include_icv_indicator = YLeaf(YType.boolean, "include-icv-indicator") self.key_server_priority = YLeaf(YType.uint32, "key-server-priority") self.policy_exception = YLeaf(YType.enumeration, "policy-exception") self.sak_rekey_interval = YLeaf(YType.uint32, "sak-rekey-interval") self.security_policy = YLeaf(YType.enumeration, "security-policy") self.vlan_tags_in_clear = YLeaf(YType.uint32, "vlan-tags-in-clear") self.window_size = YLeaf(YType.uint32, "window-size") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance( self.__dict__[name], YList): raise YPYModelError( "Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method.".format( value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("name", "cipher_suite", "conf_offset", "delay_protection", "include_icv_indicator", "key_server_priority", "policy_exception", "sak_rekey_interval", "security_policy", "vlan_tags_in_clear", "window_size") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Macsec.Policy, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container" ) and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Macsec.Policy, self).__setattr__(name, value) def has_data(self): return (self.name.is_set or self.cipher_suite.is_set or self.conf_offset.is_set or self.delay_protection.is_set or self.include_icv_indicator.is_set or self.key_server_priority.is_set or self.policy_exception.is_set or self.sak_rekey_interval.is_set or self.security_policy.is_set or self.vlan_tags_in_clear.is_set or self.window_size.is_set) def has_operation(self): return (self.yfilter != YFilter.not_set or self.name.yfilter != YFilter.not_set or self.cipher_suite.yfilter != YFilter.not_set or self.conf_offset.yfilter != YFilter.not_set or self.delay_protection.yfilter != YFilter.not_set or self.include_icv_indicator.yfilter != YFilter.not_set or self.key_server_priority.yfilter != YFilter.not_set or self.policy_exception.yfilter != YFilter.not_set or self.sak_rekey_interval.yfilter != YFilter.not_set or self.security_policy.yfilter != YFilter.not_set or self.vlan_tags_in_clear.yfilter != YFilter.not_set or self.window_size.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "policy" + "[name='" + self.name.get( ) + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-crypto-macsec-mka-cfg:macsec/%s" % self.get_segment_path( ) else: path_buffer = _get_relative_entity_path( self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.name.is_set or self.name.yfilter != YFilter.not_set): leaf_name_data.append(self.name.get_name_leafdata()) if (self.cipher_suite.is_set or self.cipher_suite.yfilter != YFilter.not_set): leaf_name_data.append(self.cipher_suite.get_name_leafdata()) if (self.conf_offset.is_set or self.conf_offset.yfilter != YFilter.not_set): leaf_name_data.append(self.conf_offset.get_name_leafdata()) if (self.delay_protection.is_set or self.delay_protection.yfilter != YFilter.not_set): leaf_name_data.append( self.delay_protection.get_name_leafdata()) if (self.include_icv_indicator.is_set or self.include_icv_indicator.yfilter != YFilter.not_set): leaf_name_data.append( self.include_icv_indicator.get_name_leafdata()) if (self.key_server_priority.is_set or self.key_server_priority.yfilter != YFilter.not_set): leaf_name_data.append( self.key_server_priority.get_name_leafdata()) if (self.policy_exception.is_set or self.policy_exception.yfilter != YFilter.not_set): leaf_name_data.append( self.policy_exception.get_name_leafdata()) if (self.sak_rekey_interval.is_set or self.sak_rekey_interval.yfilter != YFilter.not_set): leaf_name_data.append( self.sak_rekey_interval.get_name_leafdata()) if (self.security_policy.is_set or self.security_policy.yfilter != YFilter.not_set): leaf_name_data.append(self.security_policy.get_name_leafdata()) if (self.vlan_tags_in_clear.is_set or self.vlan_tags_in_clear.yfilter != YFilter.not_set): leaf_name_data.append( self.vlan_tags_in_clear.get_name_leafdata()) if (self.window_size.is_set or self.window_size.yfilter != YFilter.not_set): leaf_name_data.append(self.window_size.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name( [child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if (name == "name" or name == "cipher-suite" or name == "conf-offset" or name == "delay-protection" or name == "include-icv-indicator" or name == "key-server-priority" or name == "policy-exception" or name == "sak-rekey-interval" or name == "security-policy" or name == "vlan-tags-in-clear" or name == "window-size"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if (value_path == "name"): self.name = value self.name.value_namespace = name_space self.name.value_namespace_prefix = name_space_prefix if (value_path == "cipher-suite"): self.cipher_suite = value self.cipher_suite.value_namespace = name_space self.cipher_suite.value_namespace_prefix = name_space_prefix if (value_path == "conf-offset"): self.conf_offset = value self.conf_offset.value_namespace = name_space self.conf_offset.value_namespace_prefix = name_space_prefix if (value_path == "delay-protection"): self.delay_protection = value self.delay_protection.value_namespace = name_space self.delay_protection.value_namespace_prefix = name_space_prefix if (value_path == "include-icv-indicator"): self.include_icv_indicator = value self.include_icv_indicator.value_namespace = name_space self.include_icv_indicator.value_namespace_prefix = name_space_prefix if (value_path == "key-server-priority"): self.key_server_priority = value self.key_server_priority.value_namespace = name_space self.key_server_priority.value_namespace_prefix = name_space_prefix if (value_path == "policy-exception"): self.policy_exception = value self.policy_exception.value_namespace = name_space self.policy_exception.value_namespace_prefix = name_space_prefix if (value_path == "sak-rekey-interval"): self.sak_rekey_interval = value self.sak_rekey_interval.value_namespace = name_space self.sak_rekey_interval.value_namespace_prefix = name_space_prefix if (value_path == "security-policy"): self.security_policy = value self.security_policy.value_namespace = name_space self.security_policy.value_namespace_prefix = name_space_prefix if (value_path == "vlan-tags-in-clear"): self.vlan_tags_in_clear = value self.vlan_tags_in_clear.value_namespace = name_space self.vlan_tags_in_clear.value_namespace_prefix = name_space_prefix if (value_path == "window-size"): self.window_size = value self.window_size.value_namespace = name_space self.window_size.value_namespace_prefix = name_space_prefix
class ProcessCpu(Entity): """ Per process CPU utilization .. attribute:: process_cpu_fifteen_minute Process CPU utilization in percent for past 15 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_cpu_five_minute Process CPU utilization in percent for past 5 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_cpu_one_minute Process CPU utilization in percent for past 1 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_id Process ID **type**\: int **range:** 0..4294967295 .. attribute:: process_name Process name **type**\: str """ _prefix = 'wdsysmon-fd-oper' _revision = '2015-11-09' def __init__(self): super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__init__() self.yang_name = "process-cpu" self.yang_parent_name = "cpu-utilization" self.process_cpu_fifteen_minute = YLeaf(YType.uint32, "process-cpu-fifteen-minute") self.process_cpu_five_minute = YLeaf(YType.uint32, "process-cpu-five-minute") self.process_cpu_one_minute = YLeaf(YType.uint32, "process-cpu-one-minute") self.process_id = YLeaf(YType.uint32, "process-id") self.process_name = YLeaf(YType.str, "process-name") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("process_cpu_fifteen_minute", "process_cpu_five_minute", "process_cpu_one_minute", "process_id", "process_name") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__setattr__(name, value) def has_data(self): return ( self.process_cpu_fifteen_minute.is_set or self.process_cpu_five_minute.is_set or self.process_cpu_one_minute.is_set or self.process_id.is_set or self.process_name.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.process_cpu_fifteen_minute.yfilter != YFilter.not_set or self.process_cpu_five_minute.yfilter != YFilter.not_set or self.process_cpu_one_minute.yfilter != YFilter.not_set or self.process_id.yfilter != YFilter.not_set or self.process_name.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "process-cpu" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.process_cpu_fifteen_minute.is_set or self.process_cpu_fifteen_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_fifteen_minute.get_name_leafdata()) if (self.process_cpu_five_minute.is_set or self.process_cpu_five_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_five_minute.get_name_leafdata()) if (self.process_cpu_one_minute.is_set or self.process_cpu_one_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_one_minute.get_name_leafdata()) if (self.process_id.is_set or self.process_id.yfilter != YFilter.not_set): leaf_name_data.append(self.process_id.get_name_leafdata()) if (self.process_name.is_set or self.process_name.yfilter != YFilter.not_set): leaf_name_data.append(self.process_name.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "process-cpu-fifteen-minute" or name == "process-cpu-five-minute" or name == "process-cpu-one-minute" or name == "process-id" or name == "process-name"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "process-cpu-fifteen-minute"): self.process_cpu_fifteen_minute = value self.process_cpu_fifteen_minute.value_namespace = name_space self.process_cpu_fifteen_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-cpu-five-minute"): self.process_cpu_five_minute = value self.process_cpu_five_minute.value_namespace = name_space self.process_cpu_five_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-cpu-one-minute"): self.process_cpu_one_minute = value self.process_cpu_one_minute.value_namespace = name_space self.process_cpu_one_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-id"): self.process_id = value self.process_id.value_namespace = name_space self.process_id.value_namespace_prefix = name_space_prefix if(value_path == "process-name"): self.process_name = value self.process_name.value_namespace = name_space self.process_name.value_namespace_prefix = name_space_prefix
class CpuUtilization(Entity): """ Processes CPU utilization information .. attribute:: node_name <key> Node name **type**\: str **pattern:** ([a\-zA\-Z0\-9\_]\*\\d+/){1,2}([a\-zA\-Z0\-9\_]\*\\d+) .. attribute:: process_cpu Per process CPU utilization **type**\: list of :py:class:`ProcessCpu <ydk.models.cisco_ios_xr.Cisco_IOS_XR_wdsysmon_fd_oper.SystemMonitoring.CpuUtilization.ProcessCpu>` .. attribute:: total_cpu_fifteen_minute Total CPU utilization in past 15 minute **type**\: int **range:** 0..4294967295 .. attribute:: total_cpu_five_minute Total CPU utilization in past 5 minute **type**\: int **range:** 0..4294967295 .. attribute:: total_cpu_one_minute Total CPU utilization in past 1 minute **type**\: int **range:** 0..4294967295 """ _prefix = 'wdsysmon-fd-oper' _revision = '2015-11-09' def __init__(self): super(SystemMonitoring.CpuUtilization, self).__init__() self.yang_name = "cpu-utilization" self.yang_parent_name = "system-monitoring" self.node_name = YLeaf(YType.str, "node-name") self.total_cpu_fifteen_minute = YLeaf(YType.uint32, "total-cpu-fifteen-minute") self.total_cpu_five_minute = YLeaf(YType.uint32, "total-cpu-five-minute") self.total_cpu_one_minute = YLeaf(YType.uint32, "total-cpu-one-minute") self.process_cpu = YList(self) def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("node_name", "total_cpu_fifteen_minute", "total_cpu_five_minute", "total_cpu_one_minute") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(SystemMonitoring.CpuUtilization, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(SystemMonitoring.CpuUtilization, self).__setattr__(name, value) class ProcessCpu(Entity): """ Per process CPU utilization .. attribute:: process_cpu_fifteen_minute Process CPU utilization in percent for past 15 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_cpu_five_minute Process CPU utilization in percent for past 5 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_cpu_one_minute Process CPU utilization in percent for past 1 minute **type**\: int **range:** 0..4294967295 **units**\: percentage .. attribute:: process_id Process ID **type**\: int **range:** 0..4294967295 .. attribute:: process_name Process name **type**\: str """ _prefix = 'wdsysmon-fd-oper' _revision = '2015-11-09' def __init__(self): super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__init__() self.yang_name = "process-cpu" self.yang_parent_name = "cpu-utilization" self.process_cpu_fifteen_minute = YLeaf(YType.uint32, "process-cpu-fifteen-minute") self.process_cpu_five_minute = YLeaf(YType.uint32, "process-cpu-five-minute") self.process_cpu_one_minute = YLeaf(YType.uint32, "process-cpu-one-minute") self.process_id = YLeaf(YType.uint32, "process-id") self.process_name = YLeaf(YType.str, "process-name") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("process_cpu_fifteen_minute", "process_cpu_five_minute", "process_cpu_one_minute", "process_id", "process_name") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(SystemMonitoring.CpuUtilization.ProcessCpu, self).__setattr__(name, value) def has_data(self): return ( self.process_cpu_fifteen_minute.is_set or self.process_cpu_five_minute.is_set or self.process_cpu_one_minute.is_set or self.process_id.is_set or self.process_name.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.process_cpu_fifteen_minute.yfilter != YFilter.not_set or self.process_cpu_five_minute.yfilter != YFilter.not_set or self.process_cpu_one_minute.yfilter != YFilter.not_set or self.process_id.yfilter != YFilter.not_set or self.process_name.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "process-cpu" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.process_cpu_fifteen_minute.is_set or self.process_cpu_fifteen_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_fifteen_minute.get_name_leafdata()) if (self.process_cpu_five_minute.is_set or self.process_cpu_five_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_five_minute.get_name_leafdata()) if (self.process_cpu_one_minute.is_set or self.process_cpu_one_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.process_cpu_one_minute.get_name_leafdata()) if (self.process_id.is_set or self.process_id.yfilter != YFilter.not_set): leaf_name_data.append(self.process_id.get_name_leafdata()) if (self.process_name.is_set or self.process_name.yfilter != YFilter.not_set): leaf_name_data.append(self.process_name.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "process-cpu-fifteen-minute" or name == "process-cpu-five-minute" or name == "process-cpu-one-minute" or name == "process-id" or name == "process-name"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "process-cpu-fifteen-minute"): self.process_cpu_fifteen_minute = value self.process_cpu_fifteen_minute.value_namespace = name_space self.process_cpu_fifteen_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-cpu-five-minute"): self.process_cpu_five_minute = value self.process_cpu_five_minute.value_namespace = name_space self.process_cpu_five_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-cpu-one-minute"): self.process_cpu_one_minute = value self.process_cpu_one_minute.value_namespace = name_space self.process_cpu_one_minute.value_namespace_prefix = name_space_prefix if(value_path == "process-id"): self.process_id = value self.process_id.value_namespace = name_space self.process_id.value_namespace_prefix = name_space_prefix if(value_path == "process-name"): self.process_name = value self.process_name.value_namespace = name_space self.process_name.value_namespace_prefix = name_space_prefix def has_data(self): for c in self.process_cpu: if (c.has_data()): return True return ( self.node_name.is_set or self.total_cpu_fifteen_minute.is_set or self.total_cpu_five_minute.is_set or self.total_cpu_one_minute.is_set) def has_operation(self): for c in self.process_cpu: if (c.has_operation()): return True return ( self.yfilter != YFilter.not_set or self.node_name.yfilter != YFilter.not_set or self.total_cpu_fifteen_minute.yfilter != YFilter.not_set or self.total_cpu_five_minute.yfilter != YFilter.not_set or self.total_cpu_one_minute.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "cpu-utilization" + "[node-name='" + self.node_name.get() + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.node_name.is_set or self.node_name.yfilter != YFilter.not_set): leaf_name_data.append(self.node_name.get_name_leafdata()) if (self.total_cpu_fifteen_minute.is_set or self.total_cpu_fifteen_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.total_cpu_fifteen_minute.get_name_leafdata()) if (self.total_cpu_five_minute.is_set or self.total_cpu_five_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.total_cpu_five_minute.get_name_leafdata()) if (self.total_cpu_one_minute.is_set or self.total_cpu_one_minute.yfilter != YFilter.not_set): leaf_name_data.append(self.total_cpu_one_minute.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "process-cpu"): for c in self.process_cpu: segment = c.get_segment_path() if (segment_path == segment): return c c = SystemMonitoring.CpuUtilization.ProcessCpu() c.parent = self local_reference_key = "ydk::seg::%s" % segment_path self._local_refs[local_reference_key] = c self.process_cpu.append(c) return c return None def has_leaf_or_child_of_name(self, name): if(name == "process-cpu" or name == "node-name" or name == "total-cpu-fifteen-minute" or name == "total-cpu-five-minute" or name == "total-cpu-one-minute"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "node-name"): self.node_name = value self.node_name.value_namespace = name_space self.node_name.value_namespace_prefix = name_space_prefix if(value_path == "total-cpu-fifteen-minute"): self.total_cpu_fifteen_minute = value self.total_cpu_fifteen_minute.value_namespace = name_space self.total_cpu_fifteen_minute.value_namespace_prefix = name_space_prefix if(value_path == "total-cpu-five-minute"): self.total_cpu_five_minute = value self.total_cpu_five_minute.value_namespace = name_space self.total_cpu_five_minute.value_namespace_prefix = name_space_prefix if(value_path == "total-cpu-one-minute"): self.total_cpu_one_minute = value self.total_cpu_one_minute.value_namespace = name_space self.total_cpu_one_minute.value_namespace_prefix = name_space_prefix
class Mapping(Entity): """ IP prefix to SID mapping .. attribute:: af <key> Address Family **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: ip <key> IP prefix **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: mask <key> Mask **type**\: int **range:** \-2147483648..2147483647 .. attribute:: flag_attached Enable/Disable Attached flag **type**\: :py:class:`SrmsMiFlag <ydk.models.cisco_ios_xr.Cisco_IOS_XR_segment_routing_ms_cfg.SrmsMiFlag>` .. attribute:: sid_range Range (number of SIDs) **type**\: int **range:** \-2147483648..2147483647 .. attribute:: sid_start Start of SID index range **type**\: int **range:** 0..1048575 """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr.Mappings.Mapping, self).__init__() self.yang_name = "mapping" self.yang_parent_name = "mappings" self.af = YLeaf(YType.str, "af") self.ip = YLeaf(YType.str, "ip") self.mask = YLeaf(YType.int32, "mask") self.flag_attached = YLeaf(YType.enumeration, "flag-attached") self.sid_range = YLeaf(YType.int32, "sid-range") self.sid_start = YLeaf(YType.uint32, "sid-start") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("af", "ip", "mask", "flag_attached", "sid_range", "sid_start") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr.Mappings.Mapping, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr.Mappings.Mapping, self).__setattr__(name, value) def has_data(self): return ( self.af.is_set or self.ip.is_set or self.mask.is_set or self.flag_attached.is_set or self.sid_range.is_set or self.sid_start.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.af.yfilter != YFilter.not_set or self.ip.yfilter != YFilter.not_set or self.mask.yfilter != YFilter.not_set or self.flag_attached.yfilter != YFilter.not_set or self.sid_range.yfilter != YFilter.not_set or self.sid_start.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "mapping" + "[af='" + self.af.get() + "']" + "[ip='" + self.ip.get() + "']" + "[mask='" + self.mask.get() + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr/mappings/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.af.is_set or self.af.yfilter != YFilter.not_set): leaf_name_data.append(self.af.get_name_leafdata()) if (self.ip.is_set or self.ip.yfilter != YFilter.not_set): leaf_name_data.append(self.ip.get_name_leafdata()) if (self.mask.is_set or self.mask.yfilter != YFilter.not_set): leaf_name_data.append(self.mask.get_name_leafdata()) if (self.flag_attached.is_set or self.flag_attached.yfilter != YFilter.not_set): leaf_name_data.append(self.flag_attached.get_name_leafdata()) if (self.sid_range.is_set or self.sid_range.yfilter != YFilter.not_set): leaf_name_data.append(self.sid_range.get_name_leafdata()) if (self.sid_start.is_set or self.sid_start.yfilter != YFilter.not_set): leaf_name_data.append(self.sid_start.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "af" or name == "ip" or name == "mask" or name == "flag-attached" or name == "sid-range" or name == "sid-start"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "af"): self.af = value self.af.value_namespace = name_space self.af.value_namespace_prefix = name_space_prefix if(value_path == "ip"): self.ip = value self.ip.value_namespace = name_space self.ip.value_namespace_prefix = name_space_prefix if(value_path == "mask"): self.mask = value self.mask.value_namespace = name_space self.mask.value_namespace_prefix = name_space_prefix if(value_path == "flag-attached"): self.flag_attached = value self.flag_attached.value_namespace = name_space self.flag_attached.value_namespace_prefix = name_space_prefix if(value_path == "sid-range"): self.sid_range = value self.sid_range.value_namespace = name_space self.sid_range.value_namespace_prefix = name_space_prefix if(value_path == "sid-start"): self.sid_start = value self.sid_start.value_namespace = name_space self.sid_start.value_namespace_prefix = name_space_prefix
class Sr(Entity): """ Segment Routing .. attribute:: enable enable SR **type**\: :py:class:`Empty<ydk.types.Empty>` .. attribute:: global_block Global Block Segment Routing **type**\: :py:class:`GlobalBlock <ydk.models.cisco_ios_xr.Cisco_IOS_XR_segment_routing_ms_cfg.Sr.GlobalBlock>` **presence node**\: True .. attribute:: mappings Mapping Server **type**\: :py:class:`Mappings <ydk.models.cisco_ios_xr.Cisco_IOS_XR_segment_routing_ms_cfg.Sr.Mappings>` """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr, self).__init__() self._top_entity = None self.yang_name = "sr" self.yang_parent_name = "Cisco-IOS-XR-segment-routing-ms-cfg" self.enable = YLeaf(YType.empty, "enable") self.global_block = None self._children_name_map["global_block"] = "global-block" self._children_yang_names.add("global-block") self.mappings = Sr.Mappings() self.mappings.parent = self self._children_name_map["mappings"] = "mappings" self._children_yang_names.add("mappings") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("enable") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr, self).__setattr__(name, value) class GlobalBlock(Entity): """ Global Block Segment Routing .. attribute:: lower_bound SRGB Lower Bound **type**\: int **range:** 16000..1048574 **mandatory**\: True .. attribute:: upper_bound SRGB Upper Bound **type**\: int **range:** 16001..1048575 **mandatory**\: True This class is a :ref:`presence class<presence-class>` """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr.GlobalBlock, self).__init__() self.yang_name = "global-block" self.yang_parent_name = "sr" self.is_presence_container = True self.lower_bound = YLeaf(YType.uint32, "lower-bound") self.upper_bound = YLeaf(YType.uint32, "upper-bound") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("lower_bound", "upper_bound") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr.GlobalBlock, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr.GlobalBlock, self).__setattr__(name, value) def has_data(self): return ( self.lower_bound.is_set or self.upper_bound.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.lower_bound.yfilter != YFilter.not_set or self.upper_bound.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "global-block" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.lower_bound.is_set or self.lower_bound.yfilter != YFilter.not_set): leaf_name_data.append(self.lower_bound.get_name_leafdata()) if (self.upper_bound.is_set or self.upper_bound.yfilter != YFilter.not_set): leaf_name_data.append(self.upper_bound.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "lower-bound" or name == "upper-bound"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "lower-bound"): self.lower_bound = value self.lower_bound.value_namespace = name_space self.lower_bound.value_namespace_prefix = name_space_prefix if(value_path == "upper-bound"): self.upper_bound = value self.upper_bound.value_namespace = name_space self.upper_bound.value_namespace_prefix = name_space_prefix class Mappings(Entity): """ Mapping Server .. attribute:: mapping IP prefix to SID mapping **type**\: list of :py:class:`Mapping <ydk.models.cisco_ios_xr.Cisco_IOS_XR_segment_routing_ms_cfg.Sr.Mappings.Mapping>` """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr.Mappings, self).__init__() self.yang_name = "mappings" self.yang_parent_name = "sr" self.mapping = YList(self) def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in () and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr.Mappings, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr.Mappings, self).__setattr__(name, value) class Mapping(Entity): """ IP prefix to SID mapping .. attribute:: af <key> Address Family **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: ip <key> IP prefix **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: mask <key> Mask **type**\: int **range:** \-2147483648..2147483647 .. attribute:: flag_attached Enable/Disable Attached flag **type**\: :py:class:`SrmsMiFlag <ydk.models.cisco_ios_xr.Cisco_IOS_XR_segment_routing_ms_cfg.SrmsMiFlag>` .. attribute:: sid_range Range (number of SIDs) **type**\: int **range:** \-2147483648..2147483647 .. attribute:: sid_start Start of SID index range **type**\: int **range:** 0..1048575 """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr.Mappings.Mapping, self).__init__() self.yang_name = "mapping" self.yang_parent_name = "mappings" self.af = YLeaf(YType.str, "af") self.ip = YLeaf(YType.str, "ip") self.mask = YLeaf(YType.int32, "mask") self.flag_attached = YLeaf(YType.enumeration, "flag-attached") self.sid_range = YLeaf(YType.int32, "sid-range") self.sid_start = YLeaf(YType.uint32, "sid-start") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("af", "ip", "mask", "flag_attached", "sid_range", "sid_start") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr.Mappings.Mapping, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr.Mappings.Mapping, self).__setattr__(name, value) def has_data(self): return ( self.af.is_set or self.ip.is_set or self.mask.is_set or self.flag_attached.is_set or self.sid_range.is_set or self.sid_start.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.af.yfilter != YFilter.not_set or self.ip.yfilter != YFilter.not_set or self.mask.yfilter != YFilter.not_set or self.flag_attached.yfilter != YFilter.not_set or self.sid_range.yfilter != YFilter.not_set or self.sid_start.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "mapping" + "[af='" + self.af.get() + "']" + "[ip='" + self.ip.get() + "']" + "[mask='" + self.mask.get() + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr/mappings/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.af.is_set or self.af.yfilter != YFilter.not_set): leaf_name_data.append(self.af.get_name_leafdata()) if (self.ip.is_set or self.ip.yfilter != YFilter.not_set): leaf_name_data.append(self.ip.get_name_leafdata()) if (self.mask.is_set or self.mask.yfilter != YFilter.not_set): leaf_name_data.append(self.mask.get_name_leafdata()) if (self.flag_attached.is_set or self.flag_attached.yfilter != YFilter.not_set): leaf_name_data.append(self.flag_attached.get_name_leafdata()) if (self.sid_range.is_set or self.sid_range.yfilter != YFilter.not_set): leaf_name_data.append(self.sid_range.get_name_leafdata()) if (self.sid_start.is_set or self.sid_start.yfilter != YFilter.not_set): leaf_name_data.append(self.sid_start.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "af" or name == "ip" or name == "mask" or name == "flag-attached" or name == "sid-range" or name == "sid-start"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "af"): self.af = value self.af.value_namespace = name_space self.af.value_namespace_prefix = name_space_prefix if(value_path == "ip"): self.ip = value self.ip.value_namespace = name_space self.ip.value_namespace_prefix = name_space_prefix if(value_path == "mask"): self.mask = value self.mask.value_namespace = name_space self.mask.value_namespace_prefix = name_space_prefix if(value_path == "flag-attached"): self.flag_attached = value self.flag_attached.value_namespace = name_space self.flag_attached.value_namespace_prefix = name_space_prefix if(value_path == "sid-range"): self.sid_range = value self.sid_range.value_namespace = name_space self.sid_range.value_namespace_prefix = name_space_prefix if(value_path == "sid-start"): self.sid_start = value self.sid_start.value_namespace = name_space self.sid_start.value_namespace_prefix = name_space_prefix def has_data(self): for c in self.mapping: if (c.has_data()): return True return False def has_operation(self): for c in self.mapping: if (c.has_operation()): return True return self.yfilter != YFilter.not_set def get_segment_path(self): path_buffer = "" path_buffer = "mappings" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "mapping"): for c in self.mapping: segment = c.get_segment_path() if (segment_path == segment): return c c = Sr.Mappings.Mapping() c.parent = self local_reference_key = "ydk::seg::%s" % segment_path self._local_refs[local_reference_key] = c self.mapping.append(c) return c return None def has_leaf_or_child_of_name(self, name): if(name == "mapping"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): pass def has_data(self): return ( self.enable.is_set or (self.mappings is not None and self.mappings.has_data()) or (self.global_block is not None)) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.enable.yfilter != YFilter.not_set or (self.global_block is not None and self.global_block.has_operation()) or (self.mappings is not None and self.mappings.has_operation())) def get_segment_path(self): path_buffer = "" path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (not ancestor is None): raise YPYModelError("ancestor has to be None for top-level node") path_buffer = self.get_segment_path() leaf_name_data = LeafDataList() if (self.enable.is_set or self.enable.yfilter != YFilter.not_set): leaf_name_data.append(self.enable.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "global-block"): if (self.global_block is None): self.global_block = Sr.GlobalBlock() self.global_block.parent = self self._children_name_map["global_block"] = "global-block" return self.global_block if (child_yang_name == "mappings"): if (self.mappings is None): self.mappings = Sr.Mappings() self.mappings.parent = self self._children_name_map["mappings"] = "mappings" return self.mappings return None def has_leaf_or_child_of_name(self, name): if(name == "global-block" or name == "mappings" or name == "enable"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "enable"): self.enable = value self.enable.value_namespace = name_space self.enable.value_namespace_prefix = name_space_prefix def clone_ptr(self): self._top_entity = Sr() return self._top_entity
class GlobalBlock(Entity): """ Global Block Segment Routing .. attribute:: lower_bound SRGB Lower Bound **type**\: int **range:** 16000..1048574 **mandatory**\: True .. attribute:: upper_bound SRGB Upper Bound **type**\: int **range:** 16001..1048575 **mandatory**\: True This class is a :ref:`presence class<presence-class>` """ _prefix = 'segment-routing-ms-cfg' _revision = '2015-11-09' def __init__(self): super(Sr.GlobalBlock, self).__init__() self.yang_name = "global-block" self.yang_parent_name = "sr" self.is_presence_container = True self.lower_bound = YLeaf(YType.uint32, "lower-bound") self.upper_bound = YLeaf(YType.uint32, "upper-bound") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("lower_bound", "upper_bound") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(Sr.GlobalBlock, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(Sr.GlobalBlock, self).__setattr__(name, value) def has_data(self): return ( self.lower_bound.is_set or self.upper_bound.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.lower_bound.yfilter != YFilter.not_set or self.upper_bound.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "global-block" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-segment-routing-ms-cfg:sr/%s" % self.get_segment_path() else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.lower_bound.is_set or self.lower_bound.yfilter != YFilter.not_set): leaf_name_data.append(self.lower_bound.get_name_leafdata()) if (self.upper_bound.is_set or self.upper_bound.yfilter != YFilter.not_set): leaf_name_data.append(self.upper_bound.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "lower-bound" or name == "upper-bound"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "lower-bound"): self.lower_bound = value self.lower_bound.value_namespace = name_space self.lower_bound.value_namespace_prefix = name_space_prefix if(value_path == "upper-bound"): self.upper_bound = value self.upper_bound.value_namespace = name_space self.upper_bound.value_namespace_prefix = name_space_prefix
class KeyString(Entity): """ Configure a clear text/encrypted Key string along with cryptographic algorithm .. attribute:: cryptographic_algorithm Cryptographic Algorithm **type**\: :py:class:`MacSecCryptoAlg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecCryptoAlg>` **mandatory**\: True .. attribute:: encryption_type encryption type used to store key **type**\: int **range:** \-2147483648..2147483647 **default value**\: 0 .. attribute:: string Key String **type**\: str **pattern:** (!.+)\|([^!].+) **mandatory**\: True This class is a :ref:`presence class<presence-class>` """ _prefix = 'lib-keychain-macsec-cfg' _revision = '2015-11-09' def __init__(self): super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__init__() self.yang_name = "key-string" self.yang_parent_name = "key" self.is_presence_container = True self.cryptographic_algorithm = YLeaf(YType.enumeration, "cryptographic-algorithm") self.encryption_type = YLeaf(YType.int32, "encryption-type") self.string = YLeaf(YType.str, "string") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("cryptographic_algorithm", "encryption_type", "string") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__setattr__(name, value) def has_data(self): return ( self.cryptographic_algorithm.is_set or self.encryption_type.is_set or self.string.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.cryptographic_algorithm.yfilter != YFilter.not_set or self.encryption_type.yfilter != YFilter.not_set or self.string.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "key-string" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.cryptographic_algorithm.is_set or self.cryptographic_algorithm.yfilter != YFilter.not_set): leaf_name_data.append(self.cryptographic_algorithm.get_name_leafdata()) if (self.encryption_type.is_set or self.encryption_type.yfilter != YFilter.not_set): leaf_name_data.append(self.encryption_type.get_name_leafdata()) if (self.string.is_set or self.string.yfilter != YFilter.not_set): leaf_name_data.append(self.string.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "cryptographic-algorithm" or name == "encryption-type" or name == "string"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "cryptographic-algorithm"): self.cryptographic_algorithm = value self.cryptographic_algorithm.value_namespace = name_space self.cryptographic_algorithm.value_namespace_prefix = name_space_prefix if(value_path == "encryption-type"): self.encryption_type = value self.encryption_type.value_namespace = name_space self.encryption_type.value_namespace_prefix = name_space_prefix if(value_path == "string"): self.string = value self.string.value_namespace = name_space self.string.value_namespace_prefix = name_space_prefix
class Lifetime(Entity): """ Configure a key Lifetime .. attribute:: end_date End Date **type**\: int **range:** 1..31 .. attribute:: end_hour End Hour **type**\: int **range:** 0..23 .. attribute:: end_minutes End Minutes **type**\: int **range:** 0..59 **units**\: minute .. attribute:: end_month End Month **type**\: :py:class:`MacSecKeyChainMonth <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeyChainMonth>` .. attribute:: end_seconds End Seconds **type**\: int **range:** 0..59 **units**\: second .. attribute:: end_year End Year **type**\: int **range:** 1993..2035 .. attribute:: infinite_flag Infinite Lifetime flag **type**\: bool .. attribute:: life_time Lifetime duration in seconds **type**\: int **range:** 1..2147483647 **units**\: second .. attribute:: start_date Start Date **type**\: int **range:** 1..31 .. attribute:: start_hour Start Hour **type**\: int **range:** 0..23 .. attribute:: start_minutes Start Minutes **type**\: int **range:** 0..59 **units**\: minute .. attribute:: start_month Start Month **type**\: :py:class:`MacSecKeyChainMonth <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeyChainMonth>` .. attribute:: start_seconds Start Seconds **type**\: int **range:** 0..59 **units**\: second .. attribute:: start_year Start Year **type**\: int **range:** 1993..2035 """ _prefix = 'lib-keychain-macsec-cfg' _revision = '2015-11-09' def __init__(self): super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__init__() self.yang_name = "lifetime" self.yang_parent_name = "key" self.end_date = YLeaf(YType.uint32, "end-date") self.end_hour = YLeaf(YType.uint32, "end-hour") self.end_minutes = YLeaf(YType.uint32, "end-minutes") self.end_month = YLeaf(YType.enumeration, "end-month") self.end_seconds = YLeaf(YType.uint32, "end-seconds") self.end_year = YLeaf(YType.uint32, "end-year") self.infinite_flag = YLeaf(YType.boolean, "infinite-flag") self.life_time = YLeaf(YType.uint32, "life-time") self.start_date = YLeaf(YType.uint32, "start-date") self.start_hour = YLeaf(YType.uint32, "start-hour") self.start_minutes = YLeaf(YType.uint32, "start-minutes") self.start_month = YLeaf(YType.enumeration, "start-month") self.start_seconds = YLeaf(YType.uint32, "start-seconds") self.start_year = YLeaf(YType.uint32, "start-year") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("end_date", "end_hour", "end_minutes", "end_month", "end_seconds", "end_year", "infinite_flag", "life_time", "start_date", "start_hour", "start_minutes", "start_month", "start_seconds", "start_year") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__setattr__(name, value) def has_data(self): return ( self.end_date.is_set or self.end_hour.is_set or self.end_minutes.is_set or self.end_month.is_set or self.end_seconds.is_set or self.end_year.is_set or self.infinite_flag.is_set or self.life_time.is_set or self.start_date.is_set or self.start_hour.is_set or self.start_minutes.is_set or self.start_month.is_set or self.start_seconds.is_set or self.start_year.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.end_date.yfilter != YFilter.not_set or self.end_hour.yfilter != YFilter.not_set or self.end_minutes.yfilter != YFilter.not_set or self.end_month.yfilter != YFilter.not_set or self.end_seconds.yfilter != YFilter.not_set or self.end_year.yfilter != YFilter.not_set or self.infinite_flag.yfilter != YFilter.not_set or self.life_time.yfilter != YFilter.not_set or self.start_date.yfilter != YFilter.not_set or self.start_hour.yfilter != YFilter.not_set or self.start_minutes.yfilter != YFilter.not_set or self.start_month.yfilter != YFilter.not_set or self.start_seconds.yfilter != YFilter.not_set or self.start_year.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "lifetime" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.end_date.is_set or self.end_date.yfilter != YFilter.not_set): leaf_name_data.append(self.end_date.get_name_leafdata()) if (self.end_hour.is_set or self.end_hour.yfilter != YFilter.not_set): leaf_name_data.append(self.end_hour.get_name_leafdata()) if (self.end_minutes.is_set or self.end_minutes.yfilter != YFilter.not_set): leaf_name_data.append(self.end_minutes.get_name_leafdata()) if (self.end_month.is_set or self.end_month.yfilter != YFilter.not_set): leaf_name_data.append(self.end_month.get_name_leafdata()) if (self.end_seconds.is_set or self.end_seconds.yfilter != YFilter.not_set): leaf_name_data.append(self.end_seconds.get_name_leafdata()) if (self.end_year.is_set or self.end_year.yfilter != YFilter.not_set): leaf_name_data.append(self.end_year.get_name_leafdata()) if (self.infinite_flag.is_set or self.infinite_flag.yfilter != YFilter.not_set): leaf_name_data.append(self.infinite_flag.get_name_leafdata()) if (self.life_time.is_set or self.life_time.yfilter != YFilter.not_set): leaf_name_data.append(self.life_time.get_name_leafdata()) if (self.start_date.is_set or self.start_date.yfilter != YFilter.not_set): leaf_name_data.append(self.start_date.get_name_leafdata()) if (self.start_hour.is_set or self.start_hour.yfilter != YFilter.not_set): leaf_name_data.append(self.start_hour.get_name_leafdata()) if (self.start_minutes.is_set or self.start_minutes.yfilter != YFilter.not_set): leaf_name_data.append(self.start_minutes.get_name_leafdata()) if (self.start_month.is_set or self.start_month.yfilter != YFilter.not_set): leaf_name_data.append(self.start_month.get_name_leafdata()) if (self.start_seconds.is_set or self.start_seconds.yfilter != YFilter.not_set): leaf_name_data.append(self.start_seconds.get_name_leafdata()) if (self.start_year.is_set or self.start_year.yfilter != YFilter.not_set): leaf_name_data.append(self.start_year.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "end-date" or name == "end-hour" or name == "end-minutes" or name == "end-month" or name == "end-seconds" or name == "end-year" or name == "infinite-flag" or name == "life-time" or name == "start-date" or name == "start-hour" or name == "start-minutes" or name == "start-month" or name == "start-seconds" or name == "start-year"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "end-date"): self.end_date = value self.end_date.value_namespace = name_space self.end_date.value_namespace_prefix = name_space_prefix if(value_path == "end-hour"): self.end_hour = value self.end_hour.value_namespace = name_space self.end_hour.value_namespace_prefix = name_space_prefix if(value_path == "end-minutes"): self.end_minutes = value self.end_minutes.value_namespace = name_space self.end_minutes.value_namespace_prefix = name_space_prefix if(value_path == "end-month"): self.end_month = value self.end_month.value_namespace = name_space self.end_month.value_namespace_prefix = name_space_prefix if(value_path == "end-seconds"): self.end_seconds = value self.end_seconds.value_namespace = name_space self.end_seconds.value_namespace_prefix = name_space_prefix if(value_path == "end-year"): self.end_year = value self.end_year.value_namespace = name_space self.end_year.value_namespace_prefix = name_space_prefix if(value_path == "infinite-flag"): self.infinite_flag = value self.infinite_flag.value_namespace = name_space self.infinite_flag.value_namespace_prefix = name_space_prefix if(value_path == "life-time"): self.life_time = value self.life_time.value_namespace = name_space self.life_time.value_namespace_prefix = name_space_prefix if(value_path == "start-date"): self.start_date = value self.start_date.value_namespace = name_space self.start_date.value_namespace_prefix = name_space_prefix if(value_path == "start-hour"): self.start_hour = value self.start_hour.value_namespace = name_space self.start_hour.value_namespace_prefix = name_space_prefix if(value_path == "start-minutes"): self.start_minutes = value self.start_minutes.value_namespace = name_space self.start_minutes.value_namespace_prefix = name_space_prefix if(value_path == "start-month"): self.start_month = value self.start_month.value_namespace = name_space self.start_month.value_namespace_prefix = name_space_prefix if(value_path == "start-seconds"): self.start_seconds = value self.start_seconds.value_namespace = name_space self.start_seconds.value_namespace_prefix = name_space_prefix if(value_path == "start-year"): self.start_year = value self.start_year.value_namespace = name_space self.start_year.value_namespace_prefix = name_space_prefix
class Key(Entity): """ Key Identifier .. attribute:: key_id <key> 48\-bit Key identifier **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: key_string Configure a clear text/encrypted Key string along with cryptographic algorithm **type**\: :py:class:`KeyString <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeychains.MacSecKeychain.Keies.Key.KeyString>` **presence node**\: True .. attribute:: lifetime Configure a key Lifetime **type**\: :py:class:`Lifetime <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime>` """ _prefix = 'lib-keychain-macsec-cfg' _revision = '2015-11-09' def __init__(self): super(MacSecKeychains.MacSecKeychain.Keies.Key, self).__init__() self.yang_name = "key" self.yang_parent_name = "keies" self.key_id = YLeaf(YType.str, "key-id") self.key_string = None self._children_name_map["key_string"] = "key-string" self._children_yang_names.add("key-string") self.lifetime = MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime() self.lifetime.parent = self self._children_name_map["lifetime"] = "lifetime" self._children_yang_names.add("lifetime") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("key_id") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MacSecKeychains.MacSecKeychain.Keies.Key, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MacSecKeychains.MacSecKeychain.Keies.Key, self).__setattr__(name, value) class Lifetime(Entity): """ Configure a key Lifetime .. attribute:: end_date End Date **type**\: int **range:** 1..31 .. attribute:: end_hour End Hour **type**\: int **range:** 0..23 .. attribute:: end_minutes End Minutes **type**\: int **range:** 0..59 **units**\: minute .. attribute:: end_month End Month **type**\: :py:class:`MacSecKeyChainMonth <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeyChainMonth>` .. attribute:: end_seconds End Seconds **type**\: int **range:** 0..59 **units**\: second .. attribute:: end_year End Year **type**\: int **range:** 1993..2035 .. attribute:: infinite_flag Infinite Lifetime flag **type**\: bool .. attribute:: life_time Lifetime duration in seconds **type**\: int **range:** 1..2147483647 **units**\: second .. attribute:: start_date Start Date **type**\: int **range:** 1..31 .. attribute:: start_hour Start Hour **type**\: int **range:** 0..23 .. attribute:: start_minutes Start Minutes **type**\: int **range:** 0..59 **units**\: minute .. attribute:: start_month Start Month **type**\: :py:class:`MacSecKeyChainMonth <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecKeyChainMonth>` .. attribute:: start_seconds Start Seconds **type**\: int **range:** 0..59 **units**\: second .. attribute:: start_year Start Year **type**\: int **range:** 1993..2035 """ _prefix = 'lib-keychain-macsec-cfg' _revision = '2015-11-09' def __init__(self): super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__init__() self.yang_name = "lifetime" self.yang_parent_name = "key" self.end_date = YLeaf(YType.uint32, "end-date") self.end_hour = YLeaf(YType.uint32, "end-hour") self.end_minutes = YLeaf(YType.uint32, "end-minutes") self.end_month = YLeaf(YType.enumeration, "end-month") self.end_seconds = YLeaf(YType.uint32, "end-seconds") self.end_year = YLeaf(YType.uint32, "end-year") self.infinite_flag = YLeaf(YType.boolean, "infinite-flag") self.life_time = YLeaf(YType.uint32, "life-time") self.start_date = YLeaf(YType.uint32, "start-date") self.start_hour = YLeaf(YType.uint32, "start-hour") self.start_minutes = YLeaf(YType.uint32, "start-minutes") self.start_month = YLeaf(YType.enumeration, "start-month") self.start_seconds = YLeaf(YType.uint32, "start-seconds") self.start_year = YLeaf(YType.uint32, "start-year") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("end_date", "end_hour", "end_minutes", "end_month", "end_seconds", "end_year", "infinite_flag", "life_time", "start_date", "start_hour", "start_minutes", "start_month", "start_seconds", "start_year") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime, self).__setattr__(name, value) def has_data(self): return ( self.end_date.is_set or self.end_hour.is_set or self.end_minutes.is_set or self.end_month.is_set or self.end_seconds.is_set or self.end_year.is_set or self.infinite_flag.is_set or self.life_time.is_set or self.start_date.is_set or self.start_hour.is_set or self.start_minutes.is_set or self.start_month.is_set or self.start_seconds.is_set or self.start_year.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.end_date.yfilter != YFilter.not_set or self.end_hour.yfilter != YFilter.not_set or self.end_minutes.yfilter != YFilter.not_set or self.end_month.yfilter != YFilter.not_set or self.end_seconds.yfilter != YFilter.not_set or self.end_year.yfilter != YFilter.not_set or self.infinite_flag.yfilter != YFilter.not_set or self.life_time.yfilter != YFilter.not_set or self.start_date.yfilter != YFilter.not_set or self.start_hour.yfilter != YFilter.not_set or self.start_minutes.yfilter != YFilter.not_set or self.start_month.yfilter != YFilter.not_set or self.start_seconds.yfilter != YFilter.not_set or self.start_year.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "lifetime" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.end_date.is_set or self.end_date.yfilter != YFilter.not_set): leaf_name_data.append(self.end_date.get_name_leafdata()) if (self.end_hour.is_set or self.end_hour.yfilter != YFilter.not_set): leaf_name_data.append(self.end_hour.get_name_leafdata()) if (self.end_minutes.is_set or self.end_minutes.yfilter != YFilter.not_set): leaf_name_data.append(self.end_minutes.get_name_leafdata()) if (self.end_month.is_set or self.end_month.yfilter != YFilter.not_set): leaf_name_data.append(self.end_month.get_name_leafdata()) if (self.end_seconds.is_set or self.end_seconds.yfilter != YFilter.not_set): leaf_name_data.append(self.end_seconds.get_name_leafdata()) if (self.end_year.is_set or self.end_year.yfilter != YFilter.not_set): leaf_name_data.append(self.end_year.get_name_leafdata()) if (self.infinite_flag.is_set or self.infinite_flag.yfilter != YFilter.not_set): leaf_name_data.append(self.infinite_flag.get_name_leafdata()) if (self.life_time.is_set or self.life_time.yfilter != YFilter.not_set): leaf_name_data.append(self.life_time.get_name_leafdata()) if (self.start_date.is_set or self.start_date.yfilter != YFilter.not_set): leaf_name_data.append(self.start_date.get_name_leafdata()) if (self.start_hour.is_set or self.start_hour.yfilter != YFilter.not_set): leaf_name_data.append(self.start_hour.get_name_leafdata()) if (self.start_minutes.is_set or self.start_minutes.yfilter != YFilter.not_set): leaf_name_data.append(self.start_minutes.get_name_leafdata()) if (self.start_month.is_set or self.start_month.yfilter != YFilter.not_set): leaf_name_data.append(self.start_month.get_name_leafdata()) if (self.start_seconds.is_set or self.start_seconds.yfilter != YFilter.not_set): leaf_name_data.append(self.start_seconds.get_name_leafdata()) if (self.start_year.is_set or self.start_year.yfilter != YFilter.not_set): leaf_name_data.append(self.start_year.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "end-date" or name == "end-hour" or name == "end-minutes" or name == "end-month" or name == "end-seconds" or name == "end-year" or name == "infinite-flag" or name == "life-time" or name == "start-date" or name == "start-hour" or name == "start-minutes" or name == "start-month" or name == "start-seconds" or name == "start-year"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "end-date"): self.end_date = value self.end_date.value_namespace = name_space self.end_date.value_namespace_prefix = name_space_prefix if(value_path == "end-hour"): self.end_hour = value self.end_hour.value_namespace = name_space self.end_hour.value_namespace_prefix = name_space_prefix if(value_path == "end-minutes"): self.end_minutes = value self.end_minutes.value_namespace = name_space self.end_minutes.value_namespace_prefix = name_space_prefix if(value_path == "end-month"): self.end_month = value self.end_month.value_namespace = name_space self.end_month.value_namespace_prefix = name_space_prefix if(value_path == "end-seconds"): self.end_seconds = value self.end_seconds.value_namespace = name_space self.end_seconds.value_namespace_prefix = name_space_prefix if(value_path == "end-year"): self.end_year = value self.end_year.value_namespace = name_space self.end_year.value_namespace_prefix = name_space_prefix if(value_path == "infinite-flag"): self.infinite_flag = value self.infinite_flag.value_namespace = name_space self.infinite_flag.value_namespace_prefix = name_space_prefix if(value_path == "life-time"): self.life_time = value self.life_time.value_namespace = name_space self.life_time.value_namespace_prefix = name_space_prefix if(value_path == "start-date"): self.start_date = value self.start_date.value_namespace = name_space self.start_date.value_namespace_prefix = name_space_prefix if(value_path == "start-hour"): self.start_hour = value self.start_hour.value_namespace = name_space self.start_hour.value_namespace_prefix = name_space_prefix if(value_path == "start-minutes"): self.start_minutes = value self.start_minutes.value_namespace = name_space self.start_minutes.value_namespace_prefix = name_space_prefix if(value_path == "start-month"): self.start_month = value self.start_month.value_namespace = name_space self.start_month.value_namespace_prefix = name_space_prefix if(value_path == "start-seconds"): self.start_seconds = value self.start_seconds.value_namespace = name_space self.start_seconds.value_namespace_prefix = name_space_prefix if(value_path == "start-year"): self.start_year = value self.start_year.value_namespace = name_space self.start_year.value_namespace_prefix = name_space_prefix class KeyString(Entity): """ Configure a clear text/encrypted Key string along with cryptographic algorithm .. attribute:: cryptographic_algorithm Cryptographic Algorithm **type**\: :py:class:`MacSecCryptoAlg <ydk.models.cisco_ios_xr.Cisco_IOS_XR_lib_keychain_macsec_cfg.MacSecCryptoAlg>` **mandatory**\: True .. attribute:: encryption_type encryption type used to store key **type**\: int **range:** \-2147483648..2147483647 **default value**\: 0 .. attribute:: string Key String **type**\: str **pattern:** (!.+)\|([^!].+) **mandatory**\: True This class is a :ref:`presence class<presence-class>` """ _prefix = 'lib-keychain-macsec-cfg' _revision = '2015-11-09' def __init__(self): super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__init__() self.yang_name = "key-string" self.yang_parent_name = "key" self.is_presence_container = True self.cryptographic_algorithm = YLeaf(YType.enumeration, "cryptographic-algorithm") self.encryption_type = YLeaf(YType.int32, "encryption-type") self.string = YLeaf(YType.str, "string") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance(self.__dict__[name], YList): raise YPYModelError("Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method." .format(value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("cryptographic_algorithm", "encryption_type", "string") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container") and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(MacSecKeychains.MacSecKeychain.Keies.Key.KeyString, self).__setattr__(name, value) def has_data(self): return ( self.cryptographic_algorithm.is_set or self.encryption_type.is_set or self.string.is_set) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.cryptographic_algorithm.yfilter != YFilter.not_set or self.encryption_type.yfilter != YFilter.not_set or self.string.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "key-string" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.cryptographic_algorithm.is_set or self.cryptographic_algorithm.yfilter != YFilter.not_set): leaf_name_data.append(self.cryptographic_algorithm.get_name_leafdata()) if (self.encryption_type.is_set or self.encryption_type.yfilter != YFilter.not_set): leaf_name_data.append(self.encryption_type.get_name_leafdata()) if (self.string.is_set or self.string.yfilter != YFilter.not_set): leaf_name_data.append(self.string.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if(name == "cryptographic-algorithm" or name == "encryption-type" or name == "string"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "cryptographic-algorithm"): self.cryptographic_algorithm = value self.cryptographic_algorithm.value_namespace = name_space self.cryptographic_algorithm.value_namespace_prefix = name_space_prefix if(value_path == "encryption-type"): self.encryption_type = value self.encryption_type.value_namespace = name_space self.encryption_type.value_namespace_prefix = name_space_prefix if(value_path == "string"): self.string = value self.string.value_namespace = name_space self.string.value_namespace_prefix = name_space_prefix def has_data(self): return ( self.key_id.is_set or (self.lifetime is not None and self.lifetime.has_data()) or (self.key_string is not None)) def has_operation(self): return ( self.yfilter != YFilter.not_set or self.key_id.yfilter != YFilter.not_set or (self.key_string is not None and self.key_string.has_operation()) or (self.lifetime is not None and self.lifetime.has_operation())) def get_segment_path(self): path_buffer = "" path_buffer = "key" + "[key-id='" + self.key_id.get() + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): raise YPYModelError("ancestor cannot be None as one of the ancestors is a list") else: path_buffer = _get_relative_entity_path(self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.key_id.is_set or self.key_id.yfilter != YFilter.not_set): leaf_name_data.append(self.key_id.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name([child_yang_name, segment_path]) if child is not None: return child if (child_yang_name == "key-string"): if (self.key_string is None): self.key_string = MacSecKeychains.MacSecKeychain.Keies.Key.KeyString() self.key_string.parent = self self._children_name_map["key_string"] = "key-string" return self.key_string if (child_yang_name == "lifetime"): if (self.lifetime is None): self.lifetime = MacSecKeychains.MacSecKeychain.Keies.Key.Lifetime() self.lifetime.parent = self self._children_name_map["lifetime"] = "lifetime" return self.lifetime return None def has_leaf_or_child_of_name(self, name): if(name == "key-string" or name == "lifetime" or name == "key-id"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if(value_path == "key-id"): self.key_id = value self.key_id.value_namespace = name_space self.key_id.value_namespace_prefix = name_space_prefix
class Entity_(Entity): """ Entity name .. attribute:: name <key> Entity name **type**\: str **pattern:** [\\w\\\-\\.\:,\_@#%$\\+=\\\|;]+ .. attribute:: name_xr Entity name **type**\: str **mandatory**\: True """ _prefix = 'invmgr-cfg' _revision = '2015-11-09' def __init__(self): super(InventoryConfigurations.Entity_, self).__init__() self.yang_name = "entity" self.yang_parent_name = "inventory-configurations" self.name = YLeaf(YType.str, "name") self.name_xr = YLeaf(YType.str, "name-xr") def __setattr__(self, name, value): self._check_monkey_patching_error(name, value) with _handle_type_error(): if name in self.__dict__ and isinstance( self.__dict__[name], YList): raise YPYModelError( "Attempt to assign value of '{}' to YList ldata. " "Please use list append or extend method.".format( value)) if isinstance(value, Enum.YLeaf): value = value.name if name in ("name", "name_xr") and name in self.__dict__: if isinstance(value, YLeaf): self.__dict__[name].set(value.get()) elif isinstance(value, YLeafList): super(InventoryConfigurations.Entity_, self).__setattr__(name, value) else: self.__dict__[name].set(value) else: if hasattr(value, "parent") and name != "parent": if hasattr(value, "is_presence_container" ) and value.is_presence_container: value.parent = self elif value.parent is None and value.yang_name in self._children_yang_names: value.parent = self super(InventoryConfigurations.Entity_, self).__setattr__(name, value) def has_data(self): return (self.name.is_set or self.name_xr.is_set) def has_operation(self): return (self.yfilter != YFilter.not_set or self.name.yfilter != YFilter.not_set or self.name_xr.yfilter != YFilter.not_set) def get_segment_path(self): path_buffer = "" path_buffer = "entity" + "[name='" + self.name.get( ) + "']" + path_buffer return path_buffer def get_entity_path(self, ancestor): path_buffer = "" if (ancestor is None): path_buffer = "Cisco-IOS-XR-invmgr-cfg:inventory-configurations/%s" % self.get_segment_path( ) else: path_buffer = _get_relative_entity_path( self, ancestor, path_buffer) leaf_name_data = LeafDataList() if (self.name.is_set or self.name.yfilter != YFilter.not_set): leaf_name_data.append(self.name.get_name_leafdata()) if (self.name_xr.is_set or self.name_xr.yfilter != YFilter.not_set): leaf_name_data.append(self.name_xr.get_name_leafdata()) entity_path = EntityPath(path_buffer, leaf_name_data) return entity_path def get_child_by_name(self, child_yang_name, segment_path): child = self._get_child_by_seg_name( [child_yang_name, segment_path]) if child is not None: return child return None def has_leaf_or_child_of_name(self, name): if (name == "name" or name == "name-xr"): return True return False def set_value(self, value_path, value, name_space, name_space_prefix): if (value_path == "name"): self.name = value self.name.value_namespace = name_space self.name.value_namespace_prefix = name_space_prefix if (value_path == "name-xr"): self.name_xr = value self.name_xr.value_namespace = name_space self.name_xr.value_namespace_prefix = name_space_prefix