Skip to content

Commit

Permalink
24.10.2 released
Browse files Browse the repository at this point in the history
  • Loading branch information
SRBuilds committed Dec 20, 2024
1 parent 235bb92 commit 359b2a4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
8 changes: 8 additions & 0 deletions docs/source/features/24.10.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Release 24.10
*************

24.10.2
#######

* No additional features

.. Reviewed by PLM 20241127
.. Reviewed by TechComms 20241128
24.10.1
#######

Expand Down
6 changes: 3 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ documentation will be updated accordingly.
:header-rows: 0

* - pySROS release: |pySROSProjectVersion|
* - Document Number: 3HE 20087 AAAF TQZZA
* - Document Number: 3HE 20087 AAAG TQZZA

.. Reviewed by PLM 20240926
.. Reviewed by TechComms 20240927
.. Reviewed by PLM 20241127
.. Reviewed by TechComms 20241128
.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion pysros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__doc__ = """Library for management of Nokia SR OS nodes."""

__version__ = "24.10.1"
__version__ = "24.10.2"
1 change: 1 addition & 0 deletions pysros/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
pysros_err_annotation_invalid = (TypeError, "Cannot find annotation")
pysros_err_annotation_cannot_delete = (TypeError, "Cannot delete annotation")
pysros_err_annotation_invalid_key = (SrosMgmtError, "Invalid annotation key")
pysros_err_annotation_not_unique = (SrosMgmtError, "Multiple matches for specified annotation {ann_name}")
pysros_err_too_many_leaflist_annotations = (SrosMgmtError, "Too many annotations in leaflist")
pysros_err_expected_type_but_got_another = (TypeError, "expected {expected} object but got {type_name}")
pysros_err_annotation_invalid_module = (SrosMgmtError, "Invalid annotation module")
Expand Down
24 changes: 13 additions & 11 deletions pysros/request_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
_text_in_tag_tail = lambda x: x.tail and x.tail.strip()
_text_in_tag_text = lambda x: x.text and x.text.strip()
_create_root_ele = lambda: etree.Element("dummy-root", nsmap={"nokia-attr": COMMON_NAMESPACES["attrs"]})
_metadata_from_xml = lambda e, rev_ns_map: {f"""{rev_ns_map.get(_get_tag_ns(k), "")}:{_get_tag_name(k)}""": v for k, v in e.attrib.items()} if e.attrib else {}
_metadata_from_xml = lambda e, rev_ns_map: {Identifier(rev_ns_map.get(_get_tag_ns(k), ""),_get_tag_name(k)).model_string: v for k, v in e.attrib.items()} if e.attrib else {}

def subelement(parent, tag, nsmap, text=None, attrib=None, add_ns=None):
"""Wrapper around etree.Subelement, that raises SrosMgmtError instead of ValueError."""
Expand Down Expand Up @@ -780,26 +780,28 @@ def _fix_xml_identityref_prefix(self, value, value_type, *, is_leaflist=False, n
value = [value]
return value


def _find_metadata_model_by_annotation(self, ann: Annotation) -> Model:
module_name = getattr(ann, "module", None)
namespace = getattr(ann, "namespace", None)
candidates = self.rd._modeled_metadata_no_module.get(ann.key, [])
for m in candidates:
if m.name == ann.key:
if module_name and module_name != m.name.prefix:
continue
if namespace and namespace != m.namespace:
continue
return m
_raise_unknown_attribute(ann)
if namespace:
if module_name:
if self.rd._ns_map.get(module_name, None) != namespace:
_raise_unknown_attribute(ann)
else:
module_name = self.rd._ns_map_rev.get(namespace, None)
if not module_name:
_raise_unknown_attribute(ann)
return self._find_metadata_model_by_name(f"{module_name}:{ann.key}" if module_name else ann.key)

def _find_metadata_model_by_name(self, name: str) -> Model:
#part of public API - metadata will be most likely set as string
id = Identifier.from_model_string(name)
if id.is_lazy_bound():
candidates = self.rd._modeled_metadata_no_module.get(name)
if not candidates:
_raise_unknown_attribute(name)
if len(candidates) > 1:
raise make_exception(pysros_err_annotation_not_unique, ann_name = name)
return candidates[0]
candidate = self.rd._modeled_metadata.get(name)
if not candidate:
Expand Down

0 comments on commit 359b2a4

Please sign in to comment.