Cisco-SAN / mdssdk

Python SDK/API library for Cisco MDS Switches
Other
5 stars 15 forks source link

Is it possible to use v1.3.x with MDS 8.4(2a)? #16

Closed 212850a closed 2 years ago

212850a commented 2 years ago

I've installed mdssdk via PIP (latest 1.3.3 for today) and tried to use Switch module with MDS 8.4(2a) switch. The following error I get:

>>> from mdssdk.switch import Switch
>>> switch_obj = Switch(ip_address=ip_address, username=user, password=pw, verify_ssl=False)
Traceback (most recent call last):
File "/lib/python3.8/site-packages/mdssdk/switch.py", line 105, in __init__
  self.parse_sh_inv(use_ssh=True)
File "/lib/python3.8/site-packages/mdssdk/utility/switch_utility.py", line 56, in _parse_sh_inv
  self._product_id = eachline["product_id"]
KeyError: 'product_id'

It's due to self.parse_sh_inv for MDS 8.4(2a) contains "pid" (but not "product_id"), "sn" (but not "serialnum") and "descr" (but not "desc"). I believe it's due to v1.3.x only support MDS 9.2 as per your support matrix. Isn't it? Is there any way I can use latest v1.3 with MDS 8.4(2a) switches? What version of mdssdk from PIP I can use with MDS 8.4(2a) switches?

Thanks!

srbharadwaj commented 2 years ago

Currently pip is not supported, its still under test, it should be available by Feb hopefully, till then please uninstall and follow the procedure listed here https://github.com/Cisco-SAN/mdssdk#installation-steps

srbharadwaj commented 2 years ago

Please check and let me know if u still see the issue

212850a commented 2 years ago

Please check and let me know if u still see the issue

After installation via install.sh (https://github.com/Cisco-SAN/mdssdk#installation-steps) I can use mdssdk modules from master branch with MDS switch with NXOS 8.4(2a) without issues. Please inform once pip can be used.

Thanks!

srbharadwaj commented 2 years ago

Thank you for the confirmation, will keep this open until pip install is implemenetd expected ETA is sometime in Feb 2022

fvaninet commented 2 years ago

Yes, PIP install would definitely improve MDSSDK adoption

srbharadwaj commented 2 years ago

v1.4 should have pip install changes integrated. Please check.

212850a commented 2 years ago

v1.4 should have pip install changes integrated. Please check.

I've just installed mdssdk 1.4.0 from pip and and tried to use Switch module with MDS 8.4(2a) switch. The following error I get:

>>> from mdssdk.switch import Switch
>>> switch_obj = Switch(ip_address=ip_address, username=user, password=pw, verify_ssl=False)
Traceback (most recent call last):
File "/lib/python3.8/site-packages/mdssdk/switch.py", line 111, in __init__
  self.parse_sh_inv(use_ssh=True)
File "/lib/python3.8/site-packages/mdssdk/utility/switch_utility.py", line 54, in _parse_sh_inv
  self._product_id = eachline["product_id"]
KeyError: 'product_id'

So the same problem what v1.3.0 had before. Is there any way I can use latest v1.4.0 with MDS 8.4(2a) switches?

srbharadwaj commented 2 years ago

Checking...

srbharadwaj commented 2 years ago

@212850a did you execute export NET_TEXTFSM=$HOME/mdssdk-templates/ after doing a pip install?

212850a commented 2 years ago

@212850a did you execute export NET_TEXTFSM=$HOME/mdssdk-templates/ after doing a pip install?

Yes, I did. It's due to self.parse_sh_inv for MDS 8.4(2a) contains "pid" (but not "product_id"), "sn" (but not "serialnum") and "descr" (but not "desc").

srbharadwaj commented 2 years ago

@212850a did you execute export NET_TEXTFSM=$HOME/mdssdk-templates/ after doing a pip install?

Yes, I did. It's due to self.parse_sh_inv for MDS 8.4(2a) contains "pid" (but not "product_id"), "sn" (but not "serialnum") and "descr" (but not "desc").

The reason it contains 'pid' is because most probably your NET_TEXTFSM is not pointing to the correct path, can you please try the following steps

rm -rf $HOME/mdssdk-templates/
python3.8 -m venv testmdssdk
cd testmdssdk
source bin/activate
pip install mdssdk
export NET_TEXTFSM=$HOME/mdssdk-templates/

and then try to create the switch object? If you are still facing the same pls drop a mail(subharad@cisco.com), lets go over a quick webex to debug this issue

212850a commented 2 years ago

My apologies - I tried to use old templates, didn't notice that they were generated in $HOME/mdssdk-templates/. After I switched to $HOME/mdssdk-templates/ everything works as it should.

srbharadwaj commented 2 years ago

Thanks for the confirmation. Closing the issue.