From db0985c465dfdbaf2d51ca11e1ad16cb4357aca7 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Tue, 29 Oct 2024 12:16:16 +0530 Subject: [PATCH 01/16] Added file --- connector/src/yang/connector/gnmi.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 8dc8ec8..86f55d0 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -351,6 +351,11 @@ def connect(self): ) else: self.channel = grpc.insecure_channel(target) + self.channel = grpc.insecure_channel(target = 'localhost:50051', + options=[ + ('grpc.max_send_message_length', device.settings.MAX_MESSAGE_LENGTH_WAIT), + ] + ) self.metadata = [ ("username", username), ("password", password), From 120f5195a5f74fa4f14b8d981889e263765e8969 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Tue, 29 Oct 2024 12:24:45 +0530 Subject: [PATCH 02/16] added file --- connector/src/yang/connector/gnmi.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 86f55d0..d2b3c8f 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -304,7 +304,9 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - options = [('grpc.max_receive_message_length', 1000000000)] + options = [('grpc.max_receive_message_length', 1000000000) + ('grpc.max_send_message_length', 1000000000)] + # Gather certificate settings root = dev_args.get('root_certificate') if not root: @@ -351,11 +353,7 @@ def connect(self): ) else: self.channel = grpc.insecure_channel(target) - self.channel = grpc.insecure_channel(target = 'localhost:50051', - options=[ - ('grpc.max_send_message_length', device.settings.MAX_MESSAGE_LENGTH_WAIT), - ] - ) + self.channel = grpc.insecure_channel(target, options) self.metadata = [ ("username", username), ("password", password), From 74748b4627ac64bc51d433f0850572c920077eeb Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Tue, 29 Oct 2024 15:19:06 +0530 Subject: [PATCH 03/16] Updated gnmi.pyfile --- connector/src/yang/connector/gnmi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index d2b3c8f..d6cf35a 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -304,7 +304,7 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - options = [('grpc.max_receive_message_length', 1000000000) + options = [('grpc.max_receive_message_length', 1000000000), ('grpc.max_send_message_length', 1000000000)] # Gather certificate settings From b81c3b12b3eff553d8a0cbc2de34e1ca8114185e Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Tue, 29 Oct 2024 16:00:30 +0530 Subject: [PATCH 04/16] trigger pipeline From b71eedbc3ec7a29c3557b64fb0811c22714412f1 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Tue, 29 Oct 2024 19:46:47 +0530 Subject: [PATCH 05/16] Updated file --- connector/src/yang/connector/gnmi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index d6cf35a..57a4a61 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -305,7 +305,8 @@ def connect(self): target = '{0}:{1}'.format(host, port) options = [('grpc.max_receive_message_length', 1000000000), - ('grpc.max_send_message_length', 1000000000)] + ('grpc.max_send_message_length', 1000000000) + ] # Gather certificate settings root = dev_args.get('root_certificate') From 0b9bac8eab6e4dcf30aa950c6240dd7a4d162055 Mon Sep 17 00:00:00 2001 From: SOHAN TIRPUDE Date: Wed, 30 Oct 2024 16:40:59 +0530 Subject: [PATCH 06/16] added support to pass value to GRPC message_length options --- connector/src/yang/connector/gnmi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 57a4a61..16fa32b 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -32,6 +32,9 @@ def to_plaintext(string): return string +GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 +GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 + # create a logger for this module log = logging.getLogger(__name__) @@ -304,9 +307,10 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - options = [('grpc.max_receive_message_length', 1000000000), - ('grpc.max_send_message_length', 1000000000) - ] + options = [('grpc.max_receive_message_length', + getattr(self.device.settings, 'GRPC_MAX_RECEIVE_MESSAGE_LENGTH', GRPC_MAX_RECEIVE_MESSAGE_LENGTH)), + ('grpc.max_send_message_length', + getattr(self.device.settings, 'GRPC_MAX_SEND_MESSAGE_LENGTH', GRPC_MAX_SEND_MESSAGE_LENGTH))] # Gather certificate settings root = dev_args.get('root_certificate') From 4c86efb47a2d7f99433d9dd6e5d2af75db3989e7 Mon Sep 17 00:00:00 2001 From: SOHAN TIRPUDE Date: Mon, 4 Nov 2024 16:44:59 +0530 Subject: [PATCH 07/16] updated gnmi option code --- connector/src/yang/connector/gnmi.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 16fa32b..5b9835a 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -307,11 +307,14 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - options = [('grpc.max_receive_message_length', - getattr(self.device.settings, 'GRPC_MAX_RECEIVE_MESSAGE_LENGTH', GRPC_MAX_RECEIVE_MESSAGE_LENGTH)), - ('grpc.max_send_message_length', - getattr(self.device.settings, 'GRPC_MAX_SEND_MESSAGE_LENGTH', GRPC_MAX_SEND_MESSAGE_LENGTH))] + max_receive_message_length = getattr(getattr(self.device, 'settings', {}), 'GRPC_MAX_RECEIVE_MESSAGE_LENGTH', + GRPC_MAX_RECEIVE_MESSAGE_LENGTH) + max_send_message_length = getattr(getattr(self.device, 'settings', {}), 'GRPC_MAX_SEND_MESSAGE_LENGTH', + GRPC_MAX_SEND_MESSAGE_LENGTH) + options = [('grpc.max_receive_message_length', max_receive_message_length), + ('grpc.max_send_message_length', max_send_message_length)] + # Gather certificate settings root = dev_args.get('root_certificate') if not root: From 00c40b0248e38414743e67c3dfb35208ac4ffded Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Wed, 6 Nov 2024 13:00:21 +0530 Subject: [PATCH 08/16] Added attributes in setting file --- connector/src/yang/connector/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/connector/src/yang/connector/settings.py b/connector/src/yang/connector/settings.py index 6737e68..5c56223 100644 --- a/connector/src/yang/connector/settings.py +++ b/connector/src/yang/connector/settings.py @@ -8,3 +8,7 @@ def __init__(self, *args, **kwargs): self.NETCONF_SCREEN_LOGGING_MAX_LINES = 40 # Enable XML formatting by default self.NETCONF_LOGGING_FORMAT_XML = True + # Default receive message length + GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 + # Default send message length + GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 From fd621a5f958995812b260bd93d3d63904f80dc57 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Wed, 6 Nov 2024 13:07:59 +0530 Subject: [PATCH 09/16] trigger pipeline From f246f18cb96aaf48fd3294dba4243b40c9595aef Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Thu, 7 Nov 2024 10:24:41 +0530 Subject: [PATCH 10/16] Added support for setting in gnmi.py --- connector/src/yang/connector/gnmi.py | 5 +++++ connector/src/yang/connector/settings.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 5b9835a..c79ac68 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -35,6 +35,8 @@ def to_plaintext(string): GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 +from .settings import Settings + # create a logger for this module log = logging.getLogger(__name__) @@ -242,6 +244,9 @@ def __init__(self, *args, **kwargs): self.results = deque() self.metadata = None + # connection_info is set by BaseConnection class + self.settings = self.connection_info.pop('settings', Settings()) + @property def connected(self): """Return True if session is connected.""" diff --git a/connector/src/yang/connector/settings.py b/connector/src/yang/connector/settings.py index 5c56223..eebfb7f 100644 --- a/connector/src/yang/connector/settings.py +++ b/connector/src/yang/connector/settings.py @@ -9,6 +9,6 @@ def __init__(self, *args, **kwargs): # Enable XML formatting by default self.NETCONF_LOGGING_FORMAT_XML = True # Default receive message length - GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 + self.GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 # Default send message length - GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 + self.GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 From 17dadba9b703d4cdfeed4b435a45be3a17e34f86 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Thu, 7 Nov 2024 10:26:51 +0530 Subject: [PATCH 11/16] Added support for setting in gnmi.py --- connector/src/yang/connector/gnmi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index c79ac68..2686bbc 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -245,7 +245,7 @@ def __init__(self, *args, **kwargs): self.metadata = None # connection_info is set by BaseConnection class - self.settings = self.connection_info.pop('settings', Settings()) + settings = self.connection_info.pop('settings', Settings()) @property def connected(self): From a91f50059c64bbe622d621d04c5819b061522d50 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Thu, 7 Nov 2024 17:03:35 +0530 Subject: [PATCH 12/16] updated the file --- connector/src/yang/connector/gnmi.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 2686bbc..bc20d50 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -245,7 +245,7 @@ def __init__(self, *args, **kwargs): self.metadata = None # connection_info is set by BaseConnection class - settings = self.connection_info.pop('settings', Settings()) + self.settings = self.connection_info.pop('settings', Settings()) @property def connected(self): @@ -312,10 +312,8 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - max_receive_message_length = getattr(getattr(self.device, 'settings', {}), 'GRPC_MAX_RECEIVE_MESSAGE_LENGTH', - GRPC_MAX_RECEIVE_MESSAGE_LENGTH) - max_send_message_length = getattr(getattr(self.device, 'settings', {}), 'GRPC_MAX_SEND_MESSAGE_LENGTH', - GRPC_MAX_SEND_MESSAGE_LENGTH) + max_receive_message_length = self.setting.GRPC_MAX_RECEIVE_MESSAGE_LENGTH + max_send_message_length = self.setting.GRPC_MAX_SEND_MESSAGE_LENGTH options = [('grpc.max_receive_message_length', max_receive_message_length), ('grpc.max_send_message_length', max_send_message_length)] From 83edd5092e5383471b7537bad25fb48bb661da13 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Thu, 7 Nov 2024 17:14:20 +0530 Subject: [PATCH 13/16] remove default GRPC attributes --- connector/src/yang/connector/gnmi.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index bc20d50..9144858 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -31,10 +31,6 @@ def banner(string): def to_plaintext(string): return string - -GRPC_MAX_RECEIVE_MESSAGE_LENGTH = 1000000000 -GRPC_MAX_SEND_MESSAGE_LENGTH = 1000000000 - from .settings import Settings # create a logger for this module @@ -312,8 +308,8 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - max_receive_message_length = self.setting.GRPC_MAX_RECEIVE_MESSAGE_LENGTH - max_send_message_length = self.setting.GRPC_MAX_SEND_MESSAGE_LENGTH + max_receive_message_length = self.settings.GRPC_MAX_RECEIVE_MESSAGE_LENGTH + max_send_message_length = self.settings.GRPC_MAX_SEND_MESSAGE_LENGTH options = [('grpc.max_receive_message_length', max_receive_message_length), ('grpc.max_send_message_length', max_send_message_length)] From 263cf62bca39fef0e4d6ea77c4d745e556974219 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Thu, 7 Nov 2024 18:22:53 +0530 Subject: [PATCH 14/16] Updated with get --- connector/src/yang/connector/gnmi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connector/src/yang/connector/gnmi.py b/connector/src/yang/connector/gnmi.py index 9144858..bbd541b 100644 --- a/connector/src/yang/connector/gnmi.py +++ b/connector/src/yang/connector/gnmi.py @@ -308,8 +308,8 @@ def connect(self): port = str(dev_args.get('port')) target = '{0}:{1}'.format(host, port) - max_receive_message_length = self.settings.GRPC_MAX_RECEIVE_MESSAGE_LENGTH - max_send_message_length = self.settings.GRPC_MAX_SEND_MESSAGE_LENGTH + max_receive_message_length = self.settings.get('GRPC_MAX_RECEIVE_MESSAGE_LENGTH') + max_send_message_length = self.settings.get('GRPC_MAX_SEND_MESSAGE_LENGTH') options = [('grpc.max_receive_message_length', max_receive_message_length), ('grpc.max_send_message_length', max_send_message_length)] From f39e7673254da73bd58bec52d63ba7985e8e2860 Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Mon, 11 Nov 2024 19:05:45 +0530 Subject: [PATCH 15/16] Added changelog --- .../docs/changelog/undistributed/changelog_add_grcp.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 connector/docs/changelog/undistributed/changelog_add_grcp.rst diff --git a/connector/docs/changelog/undistributed/changelog_add_grcp.rst b/connector/docs/changelog/undistributed/changelog_add_grcp.rst new file mode 100644 index 0000000..9709445 --- /dev/null +++ b/connector/docs/changelog/undistributed/changelog_add_grcp.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + New +-------------------------------------------------------------------------------- +* yang.connector + + * Added support for GRPC_MAX_RECEIVE_MESSAGE_LENGTH and GRPC_MAX_SEND_MESSAGE_LENGTH attributes to pick up from testbed settings. \ No newline at end of file From c7e23a06f6a46fa10497092b98a087ea95012daf Mon Sep 17 00:00:00 2001 From: Parimi Bala Neeraja Date: Wed, 13 Nov 2024 21:11:41 +0530 Subject: [PATCH 16/16] removed extra line --- connector/docs/changelog/undistributed/changelog_add_grcp.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/connector/docs/changelog/undistributed/changelog_add_grcp.rst b/connector/docs/changelog/undistributed/changelog_add_grcp.rst index 9709445..1760751 100644 --- a/connector/docs/changelog/undistributed/changelog_add_grcp.rst +++ b/connector/docs/changelog/undistributed/changelog_add_grcp.rst @@ -2,5 +2,4 @@ New -------------------------------------------------------------------------------- * yang.connector - * Added support for GRPC_MAX_RECEIVE_MESSAGE_LENGTH and GRPC_MAX_SEND_MESSAGE_LENGTH attributes to pick up from testbed settings. \ No newline at end of file