From 21aa4d30a99c2340945ac441ab8bc74472d90065 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 15:47:05 +0530 Subject: [PATCH 01/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/jsnapy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jnpr/jsnapy/jsnapy.py b/lib/jnpr/jsnapy/jsnapy.py index 0197761..83e5d46 100755 --- a/lib/jnpr/jsnapy/jsnapy.py +++ b/lib/jnpr/jsnapy/jsnapy.py @@ -961,6 +961,10 @@ def action_api_based( res = self.api_based_handling_with_dev( dev, config_data, pre_name, action, post_snap, local=local ) + elif dev is not None:# To hadle mode = telnet + res = self.api_based_handling_with_dev( + dev, config_data, pre_name, action, post_snap, local=local + ) else: res = self.api_based_handling( config_data, pre_name, action, post_snap, local=local From 94deb4b46f2e22ef6242ece8678264fd2b2537fb Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:05:49 +0530 Subject: [PATCH 02/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 6028ca6..3b42608 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.7.12, 3.8.12, 3.9.12] + python-version: [3.7.13, 3.8.12, 3.9.12] steps: - uses: actions/checkout@v2 From 57c50acbdb87b5a03d74c1f46a3d15d527e02171 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:20:27 +0530 Subject: [PATCH 03/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/check.py | 6 ++---- lib/jnpr/jsnapy/jsnapy.py | 2 +- setup.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/jnpr/jsnapy/check.py b/lib/jnpr/jsnapy/check.py index 2d63258..80918b0 100755 --- a/lib/jnpr/jsnapy/check.py +++ b/lib/jnpr/jsnapy/check.py @@ -77,10 +77,8 @@ def generate_snap_file(self, device, prefix, name, reply_format): return snapfile def splitter(self, value): - f = ( - lambda x: x.split("]")[1].count(",") - if "[" in x and "]" in x - else x.count(",") + f = lambda x: ( + x.split("]")[1].count(",") if "[" in x and "]" in x else x.count(",") ) value_list = [x[::-1].strip() for x in value[::-1].split(",", f(value))][::-1] return value_list diff --git a/lib/jnpr/jsnapy/jsnapy.py b/lib/jnpr/jsnapy/jsnapy.py index 83e5d46..836dc30 100755 --- a/lib/jnpr/jsnapy/jsnapy.py +++ b/lib/jnpr/jsnapy/jsnapy.py @@ -731,7 +731,7 @@ def connect_multiple_device( if config_data is not None: self.test_cases = self.extract_test_cases(config_data) # extract test cases - for (iter, key_value) in iteritems(host_dict): + for iter, key_value in iteritems(host_dict): hostname = key_value.get("device") username = self.args.login or key_value.get("username") password = self.args.passwd or key_value.get("passwd") diff --git a/setup.py b/setup.py index 47f2194..e1b2a06 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def set_logging_path(path): with open(path, "rt") as f: config = yaml.load(f.read(), Loader=yaml.FullLoader) - for (handler, value) in iteritems(config["handlers"]): + for handler, value in iteritems(config["handlers"]): if handler == "console": pass else: From dc3b833d00a22318e6b647915609c8c33937eb3e Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:23:22 +0530 Subject: [PATCH 04/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/operator.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/jnpr/jsnapy/operator.py b/lib/jnpr/jsnapy/operator.py index 68fdf41..5bcf10f 100755 --- a/lib/jnpr/jsnapy/operator.py +++ b/lib/jnpr/jsnapy/operator.py @@ -303,8 +303,6 @@ def exists( "passed": [], "failed": [], "test_name": test_name - # 'pre_xml': xml1, - # 'post_xml': xml2 } count_pass = 0 count_fail = 0 From f908810934427e4ad04f0d394fe33595d374a8fc Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:32:31 +0530 Subject: [PATCH 05/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/operator.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/jnpr/jsnapy/operator.py b/lib/jnpr/jsnapy/operator.py index 5bcf10f..9846f95 100755 --- a/lib/jnpr/jsnapy/operator.py +++ b/lib/jnpr/jsnapy/operator.py @@ -302,7 +302,9 @@ def exists( "testoperation": "exists", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, + # 'pre_xml': xml1, + # 'post_xml': xml2 } count_pass = 0 count_fail = 0 @@ -458,7 +460,7 @@ def not_exists( "testoperation": "not-exists", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -610,7 +612,7 @@ def all_same( "testoperation": "all-same", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -829,7 +831,7 @@ def is_equal( "testoperation": "is-equal", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1020,7 +1022,7 @@ def not_equal( "testoperation": "not-equal", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1212,7 +1214,7 @@ def in_range( "testoperation": "in-range", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1419,7 +1421,7 @@ def not_range( "testoperation": "not-range", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1625,7 +1627,7 @@ def is_gt( "testoperation": "is-gt", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1812,7 +1814,7 @@ def is_lt( "testoperation": "is-lt", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -1999,7 +2001,7 @@ def contains( "testoperation": "contains", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -2182,7 +2184,7 @@ def not_contains( "testoperation": "not_contains", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -2365,7 +2367,7 @@ def is_in( "testoperation": "is-in", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -2552,7 +2554,7 @@ def not_in( "testoperation": "not-in", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -2739,7 +2741,7 @@ def no_diff( "node_name": ele_list[0], "failed": [], "passed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -2977,7 +2979,7 @@ def list_not_less( "node_name": ele_list[0], "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } @@ -3733,7 +3735,7 @@ def regex( "testoperation": "regex", "passed": [], "failed": [], - "test_name": test_name + "test_name": test_name, # 'pre_xml': xml1, # 'post_xml': xml2 } From f11fa4c703784d2c433fa5a8fd6bda8eec5f27ce Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:36:58 +0530 Subject: [PATCH 06/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 3b42608..e651335 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -47,7 +47,7 @@ jobs: - name: Run black tool run: | sudo python -m pip install -U black; - sudo black --check --exclude="docs|build|tests|samples|venv" . + sudo black --check --diff --exclude="docs|build|tests|samples|venv" . - name: Run unit test run: | From c11ba5b95cb425c0d52e375d30a64f40aa531d58 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 17:40:23 +0530 Subject: [PATCH 07/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/jsnapy.py | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/jnpr/jsnapy/jsnapy.py b/lib/jnpr/jsnapy/jsnapy.py index 836dc30..75ee488 100755 --- a/lib/jnpr/jsnapy/jsnapy.py +++ b/lib/jnpr/jsnapy/jsnapy.py @@ -961,7 +961,7 @@ def action_api_based( res = self.api_based_handling_with_dev( dev, config_data, pre_name, action, post_snap, local=local ) - elif dev is not None:# To hadle mode = telnet + elif dev is not None: # To handle mode = telnet res = self.api_based_handling_with_dev( dev, config_data, pre_name, action, post_snap, local=local ) diff --git a/setup.py b/setup.py index e1b2a06..d6ee9e0 100755 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ else: from configparser import ConfigParser + # Function added by @gcasella # To check if the user is currently running the installation inside of a virtual environment that was installed using the `python3 -m venv venv` command. def venv_check(): From 08219a3cebdbc91cf993a0f9c63adb8f538db432 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 20:40:27 +0530 Subject: [PATCH 08/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index e651335..520188e 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -51,5 +51,10 @@ jobs: - name: Run unit test run: | + sudo python -m pip install nose + sudo python -m pip install mock + sudo python -m pip install coverage + sudo python -m pip install ntc_templates==1.4.1 + sudo python -m pip install textfsm==0.4.1 cd tests/unit sudo nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 57115c0ab19f2475a5f9d4e6523182de7dbcd365 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Thu, 9 May 2024 20:44:06 +0530 Subject: [PATCH 09/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 520188e..29f594c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -51,10 +51,10 @@ jobs: - name: Run unit test run: | - sudo python -m pip install nose + sudo pip install nose sudo python -m pip install mock sudo python -m pip install coverage sudo python -m pip install ntc_templates==1.4.1 sudo python -m pip install textfsm==0.4.1 cd tests/unit - sudo nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit + nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From e190502974f0da8cd8a481842227a9b5adaf2587 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 09:43:58 +0530 Subject: [PATCH 10/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 29f594c..233fb1a 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -34,11 +34,11 @@ jobs: - name: Install dependencies run: | - sudo python -m pip install --upgrade pip - sudo python -m pip install pylint - sudo python -m pip install -r requirements.txt - sudo python -m pip install -r development.txt - sudo python setup.py install + pip install --upgrade pip + pip install pylint + pip install -r requirements.txt + pip install -r development.txt + pip install . - name: Analysing the code with pylint run: | @@ -46,15 +46,15 @@ jobs: - name: Run black tool run: | - sudo python -m pip install -U black; - sudo black --check --diff --exclude="docs|build|tests|samples|venv" . + pip install -U black; + black --check --diff --exclude="docs|build|tests|samples|venv" . - name: Run unit test run: | - sudo pip install nose - sudo python -m pip install mock - sudo python -m pip install coverage - sudo python -m pip install ntc_templates==1.4.1 - sudo python -m pip install textfsm==0.4.1 - cd tests/unit + pip install nose + pip install mock + pip install coverage + pip install ntc_templates==1.4.1 + pip install textfsm==0.4.1 + cd tests/ nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 43bc306d879b73c34e47f5d059598de30bbb56d5 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 09:48:35 +0530 Subject: [PATCH 11/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 233fb1a..002fbcf 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -38,7 +38,7 @@ jobs: pip install pylint pip install -r requirements.txt pip install -r development.txt - pip install . + pip install jsnapy==1.3.7 --no-binary :all: --no-cache-dir - name: Analysing the code with pylint run: | From 9cbe0b1469b4a004590df7775051b422337070ae Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 10:09:23 +0530 Subject: [PATCH 12/34] Added fix to handle mode telnet --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index b88034e..08aedd7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,2 @@ [metadata] -description-file = README.md +description_file = README.md From 50590786602eec33aa93896251a4e7c03b192177 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 10:48:22 +0530 Subject: [PATCH 13/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 002fbcf..b695fd0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -38,7 +38,14 @@ jobs: pip install pylint pip install -r requirements.txt pip install -r development.txt - pip install jsnapy==1.3.7 --no-binary :all: --no-cache-dir + python setup.py sdist + ls dist/ + cp jsnapy-*.dev0.tar.gz ../ + cd ../ + tar -xzvf jsnapy-*.dev0.tar.gz + cd jsnapy-*.dev0 + python setup.py install + - name: Analysing the code with pylint run: | From 057204cf74c1ff4e2e72a9e43bc111331469af60 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 11:01:12 +0530 Subject: [PATCH 14/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index b695fd0..cbd833f 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -40,7 +40,7 @@ jobs: pip install -r development.txt python setup.py sdist ls dist/ - cp jsnapy-*.dev0.tar.gz ../ + cp dist/jsnapy-*.dev0.tar.gz ../ cd ../ tar -xzvf jsnapy-*.dev0.tar.gz cd jsnapy-*.dev0 From 697cad9db28f0c224e348fb6e9ee19f9dbeaf71e Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 11:07:17 +0530 Subject: [PATCH 15/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index cbd833f..921b02d 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -34,6 +34,8 @@ jobs: - name: Install dependencies run: | + python -m venv venv + source venv/bin/activate pip install --upgrade pip pip install pylint pip install -r requirements.txt From d2e8e44cccf8393bd75198c1f2d182cb5aafd111 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 11:10:10 +0530 Subject: [PATCH 16/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 921b02d..ddb1c63 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -51,6 +51,7 @@ jobs: - name: Analysing the code with pylint run: | + pip install pylint sudo find . -type f -name "*.py" | xargs pylint | grep . - name: Run black tool From 964d0c12f28f8f6d6cc566174206b1b003618ccd Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 11:15:15 +0530 Subject: [PATCH 17/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index ddb1c63..2a1fe4b 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -66,5 +66,7 @@ jobs: pip install coverage pip install ntc_templates==1.4.1 pip install textfsm==0.4.1 + pip install colorama + pip install icdiff==1.9.1 cd tests/ nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 4650ece335452f322445dad1190020b598e80305 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 11:20:03 +0530 Subject: [PATCH 18/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 2a1fe4b..4b9f1f9 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -61,6 +61,7 @@ jobs: - name: Run unit test run: | + source venv/bin/activate pip install nose pip install mock pip install coverage @@ -68,5 +69,6 @@ jobs: pip install textfsm==0.4.1 pip install colorama pip install icdiff==1.9.1 + pip install pyyaml cd tests/ nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 8ef1d3aa37089c7bcdbf9f1c4a0dcccf96fa8645 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 12:13:49 +0530 Subject: [PATCH 19/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4b9f1f9..8062bb8 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -70,5 +70,5 @@ jobs: pip install colorama pip install icdiff==1.9.1 pip install pyyaml - cd tests/ + cd tests/unit nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 5741c8a4d1d83c0a2d69fbaebde0952c7fa080a7 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 12:52:21 +0530 Subject: [PATCH 20/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 8062bb8..07bc00c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,7 +52,7 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - sudo find . -type f -name "*.py" | xargs pylint | grep . + sudo find .jsnapy/lib/jnpr/jsnapy -type f -name "*.py" | xargs pylint | grep . - name: Run black tool run: | From feeb4badf023d3e6b24cf0f040d335eb0a3dee13 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 13:14:24 +0530 Subject: [PATCH 21/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- lib/jnpr/jsnapy/__init__.py | 1 - lib/jnpr/jsnapy/operator.py | 19 ------------------- setup.py | 2 -- 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 07bc00c..424b2b2 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,7 +52,7 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - sudo find .jsnapy/lib/jnpr/jsnapy -type f -name "*.py" | xargs pylint | grep . + sudo find .jsnapy/ -type f -name "*.py" | xargs pylint | grep . - name: Run black tool run: | diff --git a/lib/jnpr/jsnapy/__init__.py b/lib/jnpr/jsnapy/__init__.py index 7d67505..52b4f60 100755 --- a/lib/jnpr/jsnapy/__init__.py +++ b/lib/jnpr/jsnapy/__init__.py @@ -24,7 +24,6 @@ class DirStore: # Function added by @gcasella # To check if the user is currently running the installation inside of a virtual environment that was installed using the `python3 -m venv venv` command. def venv_check(): - if hasattr(sys, "real_prefix") or ( hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix ): diff --git a/lib/jnpr/jsnapy/operator.py b/lib/jnpr/jsnapy/operator.py index 9846f95..c94e22c 100755 --- a/lib/jnpr/jsnapy/operator.py +++ b/lib/jnpr/jsnapy/operator.py @@ -326,7 +326,6 @@ def exists( # this function will find set of pre and post nodes for given Xpath pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -375,7 +374,6 @@ def exists( ) #### check only in postnode #### if postnode: - for k in range(len(postnode)): # if length of pre node is less than post node, # assign sample node @@ -483,7 +481,6 @@ def not_exists( tresult["node_name"] = element pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -631,7 +628,6 @@ def all_same( tresult["node_name"] = element pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -676,7 +672,6 @@ def all_same( tresult["failed"].append(deepcopy(node_value_failed)) else: - tresult["expected_node_value"] = value for i in range(len(post_nodes)): # if length of pre node is less than post node, assign @@ -854,7 +849,6 @@ def is_equal( tresult["expected_node_value"] = value pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -1047,7 +1041,6 @@ def not_equal( tresult["expected_node_value"] = value pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -1454,7 +1447,6 @@ def not_range( tresult["expected_node_value"] = [range1, range2] pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -1839,7 +1831,6 @@ def is_lt( tresult["expected_node_value"] = val1 pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -2026,7 +2017,6 @@ def contains( tresult["expected_node_value"] = value pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -2108,7 +2098,6 @@ def contains( } tresult["passed"].append(deepcopy(node_value_passed)) else: - ## if self._is_ignore_null(ignore_null): self.logger_testop.debug( @@ -2209,7 +2198,6 @@ def not_contains( tresult["expected_node_value"] = value pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -2291,7 +2279,6 @@ def not_contains( } tresult["failed"].append(deepcopy(node_value_failed)) else: - ## if self._is_ignore_null(ignore_null): self.logger_testop.debug( @@ -2392,7 +2379,6 @@ def is_in( tresult["expected_node_value"] = value_list pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -2481,7 +2467,6 @@ def is_in( } tresult["failed"].append(deepcopy(node_value_failed)) else: - ## if self._is_ignore_null(ignore_null): self.logger_testop.debug( @@ -2579,7 +2564,6 @@ def not_in( tresult["expected_node_value"] = value_list pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -2668,7 +2652,6 @@ def not_in( } tresult["failed"].append(deepcopy(node_value_failed)) else: - ## if self._is_ignore_null(ignore_null): self.logger_testop.debug( @@ -3207,7 +3190,6 @@ def list_not_more( pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None @@ -3855,7 +3837,6 @@ def regex( } tresult["failed"].append(deepcopy(node_value_failed)) else: - if self._is_ignore_null(ignore_null): self.logger_testop.debug( colorama.Fore.YELLOW diff --git a/setup.py b/setup.py index d6ee9e0..465da77 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,6 @@ # Function added by @gcasella # To check if the user is currently running the installation inside of a virtual environment that was installed using the `python3 -m venv venv` command. def venv_check(): - if hasattr(sys, "real_prefix") or ( hasattr(sys, "base_prefix") and sys.base_prefix != sys.prefix ): @@ -57,7 +56,6 @@ def set_logging_path(path): class OverrideInstall(install): def run(self): - for arg in sys.argv: if "--install-data" in arg: break From aff194b8f29064839c67b9cf6ed36698b3b0847c Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 13:16:38 +0530 Subject: [PATCH 22/34] Added fix to handle mode telnet --- lib/jnpr/jsnapy/operator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/jnpr/jsnapy/operator.py b/lib/jnpr/jsnapy/operator.py index c94e22c..9427ba7 100755 --- a/lib/jnpr/jsnapy/operator.py +++ b/lib/jnpr/jsnapy/operator.py @@ -3742,7 +3742,6 @@ def regex( tresult["expected_node_value"] = value pre_nodes, post_nodes = self._find_xpath(iter, x_path, xml1, xml2) if not post_nodes: - if self._is_ignore_null(ignore_null): self._debug_nodes_logger("Xpath", x_path) res = None From 9898bb16878e9bc50b06470a91ec50ab881f3d9f Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 13:25:26 +0530 Subject: [PATCH 23/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 424b2b2..e01756c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,7 +52,7 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - sudo find .jsnapy/ -type f -name "*.py" | xargs pylint | grep . + sudo find ../jsnapy/ -type f -name "*.py" | xargs pylint | grep . - name: Run black tool run: | From 1ebae156da5c7d444f3dd9449336b4b90b277ad6 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 13:49:03 +0530 Subject: [PATCH 24/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index e01756c..7af4493 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,7 +52,7 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - sudo find ../jsnapy/ -type f -name "*.py" | xargs pylint | grep . + sudo find . -type f -name "*.py" -not -path "*/venv/* | xargs pylint | grep . - name: Run black tool run: | From f26130b5439644024d470c45ac1b17e58e546b93 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 14:21:21 +0530 Subject: [PATCH 25/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 7af4493..f33f2a2 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,7 +52,9 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - sudo find . -type f -name "*.py" -not -path "*/venv/* | xargs pylint | grep . + pwd + ls -l + #sudo find . -type f -name "*.py" | xargs pylint | grep . - name: Run black tool run: | From df7a1c90ef027ec8a421ce43c4b2a1bca940fbdc Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 14:25:26 +0530 Subject: [PATCH 26/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index f33f2a2..b7acf34 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -54,7 +54,7 @@ jobs: pip install pylint pwd ls -l - #sudo find . -type f -name "*.py" | xargs pylint | grep . + sudo find ./lib/jnpr/jsnapy -type f -name "*.py" | xargs pylint | grep . - name: Run black tool run: | From 9e9fe14d919e54a25898c51f14bbb321a5f60920 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:03:26 +0530 Subject: [PATCH 27/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- development.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index b7acf34..5cb7ac0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.7.13, 3.8.12, 3.9.12] + python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9, 3.12.3] steps: - uses: actions/checkout@v2 diff --git a/development.txt b/development.txt index 5982e6e..dac4e5f 100644 --- a/development.txt +++ b/development.txt @@ -8,3 +8,6 @@ pyflakes # https://launchpad.net/pyflakes coveralls # https://coveralls.io/ unittest2>=0.5.1 # https://pypi.python.org/pypi/unittest2 pytest +pyyaml +ntc_templates==1.4.1 +textfsm==0.4.1 From bbbf5169d853e45f4b61902e19a900a7782cf142 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:06:47 +0530 Subject: [PATCH 28/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 5cb7ac0..5018d49 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9, 3.12.3] + python-version: [3.8.12, 3.9.12, 3.10.12] steps: - uses: actions/checkout@v2 @@ -64,13 +64,13 @@ jobs: - name: Run unit test run: | source venv/bin/activate - pip install nose - pip install mock - pip install coverage - pip install ntc_templates==1.4.1 - pip install textfsm==0.4.1 - pip install colorama - pip install icdiff==1.9.1 - pip install pyyaml + #pip install nose + #pip install mock + #pip install coverage + #pip install ntc_templates==1.4.1 + #pip install textfsm==0.4.1 + #pip install colorama + #pip install icdiff==1.9.1 + #pip install pyyaml cd tests/unit nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From f9037042dd43c76ef834967bc1f348745fbab92d Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:09:24 +0530 Subject: [PATCH 29/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 5018d49..4ce5c4a 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -72,5 +72,6 @@ jobs: #pip install colorama #pip install icdiff==1.9.1 #pip install pyyaml + pip install -r development.txt cd tests/unit nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From a5b69dfe1287b657193271c81e9f476799013aba Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:25:39 +0530 Subject: [PATCH 30/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 5 +++-- development.txt | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4ce5c4a..4a3b28c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -73,5 +73,6 @@ jobs: #pip install icdiff==1.9.1 #pip install pyyaml pip install -r development.txt - cd tests/unit - nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit + #cd tests/unit + #nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit + nose2 --with-coverage -vvvv tests.unit diff --git a/development.txt b/development.txt index dac4e5f..479f8b1 100644 --- a/development.txt +++ b/development.txt @@ -11,3 +11,4 @@ pytest pyyaml ntc_templates==1.4.1 textfsm==0.4.1 +nose2 From 0d6be8c176196c3665a383cc1669cbc66f9d6fd9 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:29:44 +0530 Subject: [PATCH 31/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4a3b28c..ef008e5 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -73,6 +73,6 @@ jobs: #pip install icdiff==1.9.1 #pip install pyyaml pip install -r development.txt - #cd tests/unit + cd tests/unit #nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit - nose2 --with-coverage -vvvv tests.unit + nose2 --with-coverage -vvvv From be3354c7bcda61864d8a4fca02531a5f0ed0f7ad Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:32:51 +0530 Subject: [PATCH 32/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index ef008e5..706c311 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8.12, 3.9.12, 3.10.12] + python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9, 3.12.3] steps: - uses: actions/checkout@v2 From 3e6c5cf06cfe2c1306eaacdf3a4c01ce9bc7c8b3 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:55:16 +0530 Subject: [PATCH 33/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 706c311..c339c6c 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9, 3.12.3] + python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9] steps: - uses: actions/checkout@v2 @@ -64,14 +64,6 @@ jobs: - name: Run unit test run: | source venv/bin/activate - #pip install nose - #pip install mock - #pip install coverage - #pip install ntc_templates==1.4.1 - #pip install textfsm==0.4.1 - #pip install colorama - #pip install icdiff==1.9.1 - #pip install pyyaml pip install -r development.txt cd tests/unit #nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit From 0697db5fa4be548957141e92f164029e9189ff11 Mon Sep 17 00:00:00 2001 From: chidanandpujar Date: Fri, 10 May 2024 15:58:22 +0530 Subject: [PATCH 34/34] Added fix to handle mode telnet --- .github/workflows/pylint.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index c339c6c..55f4505 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -52,8 +52,6 @@ jobs: - name: Analysing the code with pylint run: | pip install pylint - pwd - ls -l sudo find ./lib/jnpr/jsnapy -type f -name "*.py" | xargs pylint | grep . - name: Run black tool @@ -66,5 +64,4 @@ jobs: source venv/bin/activate pip install -r development.txt cd tests/unit - #nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit nose2 --with-coverage -vvvv