cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
524
Views
0
Helpful
2
Replies

Python upgrade script with attach_init() (phase0)

Olof1
Level 1
Level 1

Hello,

 

I'm trying to write a package upgrade script. The one in https://community.cisco.com/t5/nso-developer-hub-documents/nso-service-upgrade-with-python/ta-p/3640379 seems to work fine but I would like to avoid keeping the old YANG leafs.

 

In Java there's a attachInit() method to do this. I can see a attach_init() in the Python API but I cannot get it to work. Any working examples out there? 

1 Accepted Solution

Accepted Solutions

I finally managed to write an update script in Python. We had to start ncs in --start-phase0 and use start_phase(), init_upgrade(), perform_upgrade() and commit_upgrade().

 

In-service upgrade would be much nicer though. I will ask our Cisco rep for a feature request.

 

Thanks!

View solution in original post

2 Replies 2

Jan Lindblad
Cisco Employee
Cisco Employee
The attach_init() needs to be called in "phase 0" to work, which isn't when you are calling it. Unfortunately there is currently (NSO 4.7) no good way to get an upgrade callback at the right time in python, only in java. If you wrote a java upgrade snippet that started a python VM that connected to NSO, and did the work, that might work. Another, possibly better, approach would be to write a feature request for python upgrade callback support.

I finally managed to write an update script in Python. We had to start ncs in --start-phase0 and use start_phase(), init_upgrade(), perform_upgrade() and commit_upgrade().

 

In-service upgrade would be much nicer though. I will ask our Cisco rep for a feature request.

 

Thanks!