cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
391
Views
20
Helpful
9
Replies
Highlighted

Questions YDK + Python Environment

Hi Boss, In the past, I used MS VS code based on Win10(Python) + Yang Explorer (Generate API) to communicate with cisco device. Now I installed YDK in Centos7 (only terminal environment). But I found we have to programme Python in Linux environment if we would like to use YDK ? Is that true ? Do I need to install Centos7 Desktop and YDK. Do python programme in Centos7 and call YDK API in Centos 7 ?? Please give me some advice for YDK developer environment. thanks a lot ydk-py$ cd core/samples samples$ ./bgp.py -h Usage: bgp.py [-h | --help] [options] Options: -h, --help show this help message and exit -v VERSION, --version=VERSION force NETCONF version 1.0 or 1.1 -u USERNAME, --user=USERNAME login user name -p PASSWORD, --password=PASSWORD login user password --proto=PROTOCOL Which transport protocol to use, one of ssh or tcp --host=HOST NETCONF agent hostname or IP address --port=PORT NETCONF agent SSH port
Jacky Zhang
Global Telecom
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
VIP Mentor

Hi

To have your Python environment Wurth ydk, have you followed one of these links:
https://github.com/CiscoDevNet/ydk-gen

https://github.com/CiscoDevNet/ydk-py

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

View solution in original post

Highlighted
Participant

Hi Jacky

The YDK does not have GUI and therefore can be used in terminal only environment. Desktop is not needed, but for the developer it is always a plus, because it gives you ability to use some powerful IDE (Eclipse or Pycharm) for your application development and debugging.

Regarding Linux environment in Centos-7 and RHEL-7.

It all depends, how the Python was installed. If Python was installed using 'yum install python3-devel', the executables and libraries will be installed in the system paths and therefore no additional environment settings are needed. If Python was installed from source, then you need to configure PATH to include Python interpreter path, and LD_LIBRARY_PATH and CMAKE_LIBRARY_PATH to include path of dynamically loaded Python library. This is described in documentation here. For gNMI service it is also required to include grpc and protoc library paths to LD_LIBRARY_PATH. This is described in documentation here.

In addition it is strongly recommended for your project to use Python Virtual Environment, which separates working environment from system Python installation.

Yan Gorelik
YDK Solutions

View solution in original post

9 REPLIES 9
Highlighted
VIP Mentor

Hi

To have your Python environment Wurth ydk, have you followed one of these links:
https://github.com/CiscoDevNet/ydk-gen

https://github.com/CiscoDevNet/ydk-py

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question

View solution in original post

Highlighted

Hello Francesco,

 

How are you!  I hope and believe everything is good for you.

Thank you very much for your reply.

 

I do follow this guide to install YDK but I faced some issue.   May I know if you install ydk in your real linux system or install ydk in the python virtual environment ?

https://github.com/CiscoDevNet/ydk-py

 

2  Could you please give me a brief introduction about your DevNet develop environment ?

Which Linux version , server or desktop.   which Python IDE ??

 

Thanks 

BR
Jacky Zhang

Jacky Zhang
Global Telecom
Highlighted
Participant

Hi Jacky

The YDK does not have GUI and therefore can be used in terminal only environment. Desktop is not needed, but for the developer it is always a plus, because it gives you ability to use some powerful IDE (Eclipse or Pycharm) for your application development and debugging.

Regarding Linux environment in Centos-7 and RHEL-7.

It all depends, how the Python was installed. If Python was installed using 'yum install python3-devel', the executables and libraries will be installed in the system paths and therefore no additional environment settings are needed. If Python was installed from source, then you need to configure PATH to include Python interpreter path, and LD_LIBRARY_PATH and CMAKE_LIBRARY_PATH to include path of dynamically loaded Python library. This is described in documentation here. For gNMI service it is also required to include grpc and protoc library paths to LD_LIBRARY_PATH. This is described in documentation here.

In addition it is strongly recommended for your project to use Python Virtual Environment, which separates working environment from system Python installation.

Yan Gorelik
YDK Solutions

View solution in original post

Highlighted

Hello Yangorelik

 

Thank you so much for your reply.

 

As I am newer I am sorry if my questions are simple or silly.  Please let me know if you I got your points.

 

1 although CiscoDevNet/ydk-gen guide  mentioned ydk installation at the beginning and mentioned python virtual environment at the bottom.  Actually,  I could run/activate python virtual environment first then follow guide to complete the ydk installation.  Am I correct ?

 

2 May I know which ways do you prefer in your real develop environment.

1 Linux +  VIm + test.py to do programs without Python IDE 

2 Linux + Python IDE to do programs

 

3 Can you give me brief introduction about your DevNet develop environment ?

 

Thank you again and have a nice day

 

BR

Jacky Zhang

Jacky Zhang
Global Telecom
Highlighted

Hi Jacky

Here are my answers:
1. You can definitely activate Python virtual environment and then install YDK.

2. I prefer #2 - Linux + IDE. My choice of Python IDE is PyCharm (community edition is free). I also use Eclipse for C++ development.

3. I did development in all YDK supported platforms. All worked fine as long as you have sudo access to the file system. My preferred platform is Ubuntu 18.04. The Mac OSX, CentOS and RHEL are more knowledge demanding platforms, for configuration you need to do a bit more than in Ubuntu. In most cases I used default for the platform software (C/C++ compiler, Python3 etc.). But I also had experience with systems that required manual installation of C/C++ compiler, third party packages, and Python3 installation from source. Most of these approaches and solutions are documented in Readme files on the GitHub.

Yan Gorelik
YDK Solutions
Highlighted


Hi Yan,

 

Thank you very much for your reply and sharing.

 

I think you have very senior program development background. 

 

These days, I used Yang Explorer(NetConf) to generate Python Script.  I feel Yang Explorer is very useful tool.

 

Since I haven't dig into YDK too much.  I am not aware if YDK may be more powerful than Yang Explorer.

 

Below is my feel I just would like to exchange my thoughts and feeling with you. Maybe I am wrong and welcome your input.

 

DevNet is not complicated in terms of logic.  In general speaking , Manipulate network devices by program instead of traditional CLI

 

Now there is one painful point for me that I am not expert for Yang-Model and XML.   So it is difficult for me to create correct “ XML Data + Yang Model.”

 

Yang Explorer is capable to translate data to Python or YDK program with “XML Data + Yang Model”.   I just only copy/paste to VS code with minor adjustment

 

I am glad to meet you in DevNet Develop community.

 

Thank you and have a nice day.

 

 

Jacky Zhang
Global Telecom
Highlighted

1. Yes you can definitely use python environment. I personally don't use python environment.
2. My daily machine is a System76 laptop based on PoP OS. I use vim and Visual Studio Code (and less often Atom). However I use Pycharm community also when working hardly on some projects to get versioning if not using a git :-)
To do some development testing, I use dockers or multipass (Canonical) to fork ubuntu machine (more easy and faster than deploying a VM on VMware workstation or virtual box)

3. Devnet is the Cisco BU for all development stuff for all Cisco related products. They share some codes on devnet website and Github. For those who start scripting, they also put at your disposal some labs to get trained on python development, REST API, ...


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Highlighted

Thanks a lot Francesco.

 

 

 

 

 

 

Jacky Zhang
Global Telecom
Highlighted

You’re welcome

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question