11-11-2019 03:48 PM
Hi Devnet team,
Am working with the IOS-XE CSR lab (RESTCONF/NETCONF). It appears that the Dev box in this sandbox is missing the NETCONF client install. Also, without external Internet access, I couldn't PIP install it. Am I missing something?
------------
File "get_capabilities.py", line 3, in <module>
from ncclient import manager
ImportError: No module named ncclient
------------
I was able to get NETCONF commands working from my local laptop, but seems as though the Dev server should be a one stop shop.
Thanks,
-Mike
Solved! Go to Solution.
11-12-2019 09:23 AM
Thanks, i was looking at the wrong sandbox as i see you are using this one here - so slight difference here. When you first login there is no ncclient.
[developer@devbox ~]$ pip list | grep ncc DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
What is meant to happen is for the user to installed the requirements.txt file (with pip)
[developer@devbox ~]$ ls bin Desktop Downloads sbx_iosxe shutdown.sh [developer@devbox ~]$ cd sbx_iosxe/ [developer@devbox sbx_iosxe]$ ls ansible-playbooks guestshell learning_labs LICENSE other pull-requests.md README.md requirements.txt sandbox_tests yang [developer@devbox sbx_iosxe]$ cat requirements.txt ansible>=2.4.2.0 paramiko requests ncclient pyang [developer@devbox sbx_iosxe]$ [developer@devbox sbx_iosxe]$ [developer@devbox sbx_iosxe]$ pip install -r requirements.txt
However, as you noted this does not happen due to the security posture of the sandbox. Can you share the link to the learning lab and i will have our team update the link or add libraries to the devbox template. In the mean time you can use the sandbox i linked in the past comment, which has this pre-installed.
I have never seen ncclient installed in the Guestshell, as this is meant to be used 'off-box' for netconf automation.
Thanks!
11-12-2019 04:12 AM
Hi there, i am sorry you are having difficulty with this sandbox (i am guessing you are using this one here). I have reserved one just now and ran the following for python 2 (default) and python 3.
(venv) STUACLAR-M-R6EU:~ stuaclar$ ssh root@10.10.20.20 The authenticity of host '10.10.20.20 (10.10.20.20)' can't be established. ECDSA key fingerprint is SHA256:IZJVFckeMZy8BIdcqaFRl5gFxs7LTD8L5Uu7XvvJVmo. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.10.20.20' (ECDSA) to the list of known hosts. root@10.10.20.20's password: Last failed login: Tue Nov 12 12:46:17 GMT 2019 from 192.168.104.1 on ssh:notty There was 1 failed login attempt since the last successful login. Last login: Wed Jun 6 14:40:15 2018 from 10.10.2.21 Updating Sample Code Repo fatal: unable to access 'https://github.com/DevNetSandbox/sbx_iosxe/': Could not resolve host: github.com; Unknown error Activating Python 2.7.13 Virtual Environment ************************************************************* Welcome to the IOS XE Programmability Sandbox! You are in '~/sbx_iosxe', which is a code samples repository for use with this Sandbox. This repo is available at https://github.com/DevNetSandbox/sbx_iosxe. A Python 2.7.13 Virtual Environment has been activated. If you wish to work with Python 3.6, you can switch with: deactivate source ~/venv/python3/bin/activate The IOS XE device is available at: IP: 10.10.20.48 User: cisco Pass: cisco_1234! Have fun! (python2) [root@localhost sbx_iosxe]# pip freeze | grep ncc ncclient==0.5.3 (python2) [root@localhost sbx_iosxe]# source ~/venv/python3/bin/activate (python3) [root@localhost sbx_iosxe]# pip freeze | grep ncc ncclient==0.5.3
After this i went to
(python3) [root@localhost netconf]# pwd /root/sbx_iosxe/yang/netconf
Then ran the python script
(python3) [root@localhost netconf]# ls get_capabilities.py get_hostname.py get_interfaces_config.py get_interfaces.xml (python3) [root@localhost netconf]# python get_capabilities.py ***Here are the Remote Devices Capabilities*** urn:ietf:params:netconf:base:1.0 urn:ietf:params:netconf:base:1.1 [removed] urn:ietf:params:xml:ns:yang:smiv2:VPN-TC-STD-MIB urn:ietf:params:xml:ns:netconf:base:1.0 urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults urn:ietf:params:netconf:capability:notification:1.1 (python3) [root@localhost netconf]#
There should be no requirements to install any dependency for this. Please let me know if this helps or you have further questions, i am looking at the right sandbox etc...
BR
11-12-2019 08:47 AM
Thanks for the clarification.
The issue I saw was actually on the devbox in the sandbox. Lab was IOS-XE on CSR recommended code.
[developer@devbox yang]$ cd netconf/
[developer@devbox netconf]$ python --version
Python 2.7.5
[developer@devbox netconf]$ python get_capabilities.py
Traceback (most recent call last):
File "get_capabilities.py", line 3, in <module>
from ncclient import manager
ImportError: No module named ncclient
[developer@devbox netconf]$ pip install ncclient
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting ncclient
---snip---
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fcea9f905d0>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/ncclient/
ERROR: Could not find a version that satisfies the requirement ncclient (from versions: none)
ERROR: No matching distribution found for ncclient
^Z
[1]+ Stopped pip install ncclient
[developer@devbox netconf]$
etc.
If I understand correctly, is the only real way to run this through guestshell on the router? I'm making that assumption as .48 is the router in the topology. It wasn't clear from the lab docs what and where I should run my tasks.
Thanks.
11-12-2019 09:23 AM
Thanks, i was looking at the wrong sandbox as i see you are using this one here - so slight difference here. When you first login there is no ncclient.
[developer@devbox ~]$ pip list | grep ncc DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
What is meant to happen is for the user to installed the requirements.txt file (with pip)
[developer@devbox ~]$ ls bin Desktop Downloads sbx_iosxe shutdown.sh [developer@devbox ~]$ cd sbx_iosxe/ [developer@devbox sbx_iosxe]$ ls ansible-playbooks guestshell learning_labs LICENSE other pull-requests.md README.md requirements.txt sandbox_tests yang [developer@devbox sbx_iosxe]$ cat requirements.txt ansible>=2.4.2.0 paramiko requests ncclient pyang [developer@devbox sbx_iosxe]$ [developer@devbox sbx_iosxe]$ [developer@devbox sbx_iosxe]$ pip install -r requirements.txt
However, as you noted this does not happen due to the security posture of the sandbox. Can you share the link to the learning lab and i will have our team update the link or add libraries to the devbox template. In the mean time you can use the sandbox i linked in the past comment, which has this pre-installed.
I have never seen ncclient installed in the Guestshell, as this is meant to be used 'off-box' for netconf automation.
Thanks!
11-12-2019 11:44 AM
Thanks. That Sandbox (IOS XE on CSR Recommended Code) was what I was using. Link
Understand how it would be valuable to have the lab user pip install those packages - if they could :). Sounds like the linux VM template does need to be updated to make that devbox fully functional. Probably also worth looking at the other similar XE sandboxes.
Appreciate the follow up. Can mark this closed now.
11-13-2019 03:11 AM
01-24-2021 11:58 PM
I believe this is sandbox (IOS-XE on CSR latest Code) is still missing critical packages. I am unable to use the "requests" package even though it exists in the requirements.text file.
On trying to do a pip install I get the error:
As mentioned previously, due to the security posture of the sandboxes this cannot be installed from the internet. Can this issue be kindly looked into.
Thanks,
Olumide
01-25-2021 01:50 AM
@olumide The issue was investigated and looked into in 2019, internet access to the always on sandbox as you noted is denied by security design.
Hope this helps.
01-25-2021 06:24 AM
Hi Stuart,
Thanks for your prompt response.
I guess my question is, how can obtain/install the request module in the aforementioned sandbox as I need to utliise certain methods in the module?
Is there a work around?
01-25-2021 07:03 AM
@olumide i am not aware of work around within the sandbox. The ENG team always looking at ways to open up access, utilising AMP, Umbrella etc. It’s a question of balancing the security posture with the requirements for a given sandbox.
Typically for this function in my testing environment i run a CSR locally in Vagrant or in AWS.
Hope this helps.
01-25-2021 05:48 PM
Ok fair enough. I use vagrant strictly for Python scripting. I guess I will need to incorporate it with my network emulator - EVE-NG.
Thanks for your assistance Stuart.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: