Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added fix to handle mode telnet #411

Merged
merged 34 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
21aa4d3
Added fix to handle mode telnet
chidanandpujar May 9, 2024
94deb4b
Added fix to handle mode telnet
chidanandpujar May 9, 2024
57c50ac
Added fix to handle mode telnet
chidanandpujar May 9, 2024
dc3b833
Added fix to handle mode telnet
chidanandpujar May 9, 2024
f908810
Added fix to handle mode telnet
chidanandpujar May 9, 2024
f11fa4c
Added fix to handle mode telnet
chidanandpujar May 9, 2024
c11ba5b
Added fix to handle mode telnet
chidanandpujar May 9, 2024
08219a3
Added fix to handle mode telnet
chidanandpujar May 9, 2024
57115c0
Added fix to handle mode telnet
chidanandpujar May 9, 2024
e190502
Added fix to handle mode telnet
chidanandpujar May 10, 2024
43bc306
Added fix to handle mode telnet
chidanandpujar May 10, 2024
9cbe0b1
Added fix to handle mode telnet
chidanandpujar May 10, 2024
5059078
Added fix to handle mode telnet
chidanandpujar May 10, 2024
057204c
Added fix to handle mode telnet
chidanandpujar May 10, 2024
697cad9
Added fix to handle mode telnet
chidanandpujar May 10, 2024
d2e8e44
Added fix to handle mode telnet
chidanandpujar May 10, 2024
964d0c1
Added fix to handle mode telnet
chidanandpujar May 10, 2024
4650ece
Added fix to handle mode telnet
chidanandpujar May 10, 2024
8ef1d3a
Added fix to handle mode telnet
chidanandpujar May 10, 2024
5741c8a
Added fix to handle mode telnet
chidanandpujar May 10, 2024
feeb4ba
Added fix to handle mode telnet
chidanandpujar May 10, 2024
aff194b
Added fix to handle mode telnet
chidanandpujar May 10, 2024
9898bb1
Added fix to handle mode telnet
chidanandpujar May 10, 2024
1ebae15
Added fix to handle mode telnet
chidanandpujar May 10, 2024
f26130b
Added fix to handle mode telnet
chidanandpujar May 10, 2024
df7a1c9
Added fix to handle mode telnet
chidanandpujar May 10, 2024
9e9fe14
Added fix to handle mode telnet
chidanandpujar May 10, 2024
bbbf516
Added fix to handle mode telnet
chidanandpujar May 10, 2024
f903704
Added fix to handle mode telnet
chidanandpujar May 10, 2024
a5b69df
Added fix to handle mode telnet
chidanandpujar May 10, 2024
0d6be8c
Added fix to handle mode telnet
chidanandpujar May 10, 2024
be3354c
Added fix to handle mode telnet
chidanandpujar May 10, 2024
3e6c5cf
Added fix to handle mode telnet
chidanandpujar May 10, 2024
0697db5
Added fix to handle mode telnet
chidanandpujar May 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7.12, 3.8.12, 3.9.12]
python-version: [3.8.12, 3.9.12, 3.10.12, 3.11.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -34,22 +34,34 @@ 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
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
pip install -r development.txt
python setup.py sdist
ls dist/
cp dist/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: |
sudo find . -type f -name "*.py" | xargs pylint | grep .
pip install pylint
sudo find ./lib/jnpr/jsnapy -type f -name "*.py" | xargs pylint | grep .

- name: Run black tool
run: |
sudo python -m pip install -U black;
sudo black --check --exclude="docs|build|tests|samples|venv" .
pip install -U black;
black --check --diff --exclude="docs|build|tests|samples|venv" .

- name: Run unit test
run: |
source venv/bin/activate
pip install -r development.txt
cd tests/unit
sudo nosetests -v --with-coverage --cover-package=jnpr.jsnapy --cover-inclusive -a unit
nose2 --with-coverage -vvvv
4 changes: 4 additions & 0 deletions development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ 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
nose2
1 change: 0 additions & 1 deletion lib/jnpr/jsnapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
6 changes: 2 additions & 4 deletions lib/jnpr/jsnapy/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/jnpr/jsnapy/jsnapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 handle 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
Expand Down
Loading
Loading