cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Integrate NSO Python with PyCharm

1403
Views
24
Helpful
11
Comments

Following the python session given by Lindblad in Cisco NSO Developers Days, I thought it would be useful to share the integration between Pycharm and NSO and use the NCS python libraries right from your development machine. Another option of course is to utilize the ipython NSO package and develop from NSO itself but I think it's much more convenient to have one developing environment for all your code and in this case it will be Pycharm

Anyways, without more talking, Lets walk on the steps on how to do it

Note: You need to have a Pycharm Professional (not community) version in order to apply the below steps (basically the remote interpreter feature)

First, in Pycharm, Go to Tools | Deployment | Configuration

1.png

Second, provide Linux details that host NSO application

1.png

Third, Define new remote python interpreter  from settings | Project:<name> | project interpreter

1.png

it will take few minutes to upload and download all helpers file needed to integrate pycharn with python, once finished you'll see all python modules installed in Linux machine appear in pycharm

1.png

Finally to make Pycharm auto-complete the libraries and read the NSO python modules, You need to define the environmental variables under interpreter setting

1.png

And That's it!. You can now develop your own service modules that use python using Pycharm integrated with NSO. For example pycharm will now autocomplete and provide suggestion when you import ncs package

1.png

Regards

Bassim Aly

Comments
Not applicable

Hello,

I would really appreciate if you can take a look at my config and point what I did wrong. Cos I followed steps listed in the thread but still not able to integrate PyCharm with NSO.

I have posted print screens at following link:

NSO PyCharm integration - Album on Imgur

Thank you!

Hi Alexey,

Does Pycharm finish uploading of helpers files to your server and Indexing? You can find them under the /root/.pycharm.in your NSO server.

Also try to ssh using the root username instead of yours to avoid any security problems.

Beginner

Thanks for the great walkthrough.  It looks like this integration is only for the Professional (aka "Paid") version of PyCharm.  Is that right?

Not applicable

Hi Bassem,

Thank you for helping me!

All the helper files are uploaded to the /home/mongolio/.pycharm_helpers. I`m trying these first on my NSO local installation so everything installed into my user home directory and there should not be access issues.

Thanks,

Hello Alexey,

Can I have a Teamviewer/WebEx Session to your setup to have a look into it and troubleshoot it together?

Hi Jemorey,

Yes you're Correct, I've the professional pycharm version. I'll update the thread with this note.

Thank You

Cisco Employee

Hello Bassem, I am having same issues as Alexey. Could you pls help me setup the Pycharm as per your notes?

Not applicable

Hi Bassem,

Last week I PMed you my e-mail. Can you please send me invite when you setup WebEx ? If you haven`t received it - please let me know and I will re-try.

Thank you!

Cisco Employee

Hello Bassem and Alexey,

Please extend this invite to me. We are having similar issues.

Thanks,

Hello Alexey and Shini

I really apologize but didnt catch your email. Today and Tomorrow I'll be available for the session, Please choose the suitable time for you according to your timezone (mine is GMT+2)

I can generate a WebEx Link and send it to you.

Sorry again for the delay

Bassim

Cisco Employee

Hello Bassem,

Thanks for the msg. I am okay with 9:00 AM CST (GMT- 5) today/tomorrow. Please send the webex as per your convenience. Alexey, hope you can join too, else propose another time. We can also record the session for you if you would like.

Thanks,

Shini

shinjain@cisco.com