Skip to content

Commit

Permalink
Merge pull request #118 from akarneliuk/0.8.11
Browse files Browse the repository at this point in the history
0.8.11
  • Loading branch information
akarneliuk authored Apr 30, 2023
2 parents 46e77b1 + 745f1e0 commit 196985f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Contributors
Dev Log
=======

Release **0.8.11**:
- Previous release introduced break for telemetry in `Juniper` due to inconsistency of communicated encoudings in `Capabilities()` and what is really supported in `Subscribe()`.

Release **0.8.10**:
- Automatic detection of supported encoding and using it where applicable (e.g., in `subscribe2` method).
- Possibility to remove `qos` from `Subscribe` for platforms, which doesn't support it (e.g., `Juniper`).
Expand Down
2 changes: 1 addition & 1 deletion pygnmi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
pyGNMI module to manage network devices with gNMI
(c)2020-2023, Karneliuk
"""
__version__ = "0.8.10"
__version__ = "0.8.11"
13 changes: 10 additions & 3 deletions pygnmi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,13 @@ def capabilities(self):

return None

def convert_encoding(self, requested_encoding: str):
if requested_encoding and self.__supported_encodings and requested_encoding.lower() not in self.__supported_encodings:
def convert_encoding(self, requested_encoding: str, is_encoding_explicitly_set: bool = False):
if (
not is_encoding_explicitly_set
and requested_encoding
and self.__supported_encodings
and requested_encoding.lower() not in self.__supported_encodings
):
raise ValueError(
f"Requested encoding '{requested_encoding}' not in supported encodings '{self.__supported_encodings}'"
)
Expand Down Expand Up @@ -734,10 +739,12 @@ def _build_subscriptionrequest(self, subscribe: dict, target: str = None, extens
raise ValueError("Subsricbe updates_only should have boolean type.")

# encoding
is_encoding_explicitly_set = True
if "encoding" not in subscribe:
subscribe.update({"encoding": self.__encoding})
is_encoding_explicitly_set = False

pb_encoding = self.convert_encoding(subscribe["encoding"])
pb_encoding = self.convert_encoding(subscribe["encoding"], is_encoding_explicitly_set)

# qos
if self.__no_qos_marking:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
setup(
name="pygnmi",
packages=["pygnmi", "pygnmi.spec.v080", "pygnmi.artefacts"],
version="0.8.10",
version="0.8.11",
license="bsd-3-clause",
description="Pure Python gNMI client to manage network functions and collect telemetry.",
long_description=long_description,
long_description_content_type="text/x-rst",
author="Anton Karneliuk",
author_email="[email protected]",
url="https://github.com/akarneliuk/pygnmi",
download_url="https://github.com/akarneliuk/pygnmi/archive/v0.8.10.tar.gz",
download_url="https://github.com/akarneliuk/pygnmi/archive/v0.8.11.tar.gz",
keywords=["gnmi", "automation", "grpc", "network"],
install_requires=["grpcio", "protobuf", "cryptography", "dictdiffer"],
classifiers=[
Expand Down
1 change: 1 addition & 0 deletions tests/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"qos": {"marking": 32},
"use_aliases": False,
"mode": "once",
"encoding": "json",
}

test_telemetry_dict_poll = {
Expand Down

0 comments on commit 196985f

Please sign in to comment.