cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1930
Views
20
Helpful
4
Replies

Service Upgrade with Python NSO5.3+

lweddewer
Level 5
Level 5

Hello,

tried to use the new upgrade Python Class available starting with NSO version 5.3

 

class RfsSdwanSubVpnsUpgrade(ncs.upgrade.Upgrade):
    def upgrade(self, cdbsock, trans):

It seems to work with the write transaction (trans) in the upgrade methode which makes it easy to do the write access.

 

Is there a way to also get a MAAGIC based High-Level access to the cdbsock? This would make it very easy to write the code.

 

Regards

Lothar

1 Accepted Solution

Accepted Solutions

Hallo @Alexander Stevenson ,

it was a long way to go. but finaly we found a way that works for us:

Reading old data from cdb:

Based on the class maagic_MaagiBackend an own backend class CdbBackend reading data from the cdbsock. According to that we also had to build a class CdbCursor (based on _nc.maagi.Cursor).

 

Finaly get a root Object:

    def get_root_cdb(m):
        backend_server = CdbBackend(m)
        maagic_root = maagic.Root( backend_server)
        m.__dict__['maagic_object'] = maagic_root
        return maagic_root

and from here one can use the wellknown High-Level Maagic Methods accessing the old data;)

 

Writing data to the new stucture using the provided  transaction trans:

Don't except it but we don't find a way to get Maagic High Level access via the transaction trans. Looks like Maagic doesn_t work in this phase.

 

Fiinaly we fall back to use class Maapi methods(create(), set_elem(),...).
Building some small wrapping methods make using it a little bit easier for colleagues mostly have experience using Maagic High-Level access.

 

Regards
Lothar

View solution in original post

4 Replies 4

Alexander Stevenson
Cisco Employee
Cisco Employee

 

Hello @lweddewer,

 

It sure seems challenging to find any concrete information on MAAGIC. I found these 3 resources, which may be helpful to you:

 

Hope this helps!

Hallo @Alexander Stevenson ,

it was a long way to go. but finaly we found a way that works for us:

Reading old data from cdb:

Based on the class maagic_MaagiBackend an own backend class CdbBackend reading data from the cdbsock. According to that we also had to build a class CdbCursor (based on _nc.maagi.Cursor).

 

Finaly get a root Object:

    def get_root_cdb(m):
        backend_server = CdbBackend(m)
        maagic_root = maagic.Root( backend_server)
        m.__dict__['maagic_object'] = maagic_root
        return maagic_root

and from here one can use the wellknown High-Level Maagic Methods accessing the old data;)

 

Writing data to the new stucture using the provided  transaction trans:

Don't except it but we don't find a way to get Maagic High Level access via the transaction trans. Looks like Maagic doesn_t work in this phase.

 

Fiinaly we fall back to use class Maapi methods(create(), set_elem(),...).
Building some small wrapping methods make using it a little bit easier for colleagues mostly have experience using Maagic High-Level access.

 

Regards
Lothar

 

 

@lweddewer  Thanks for updating us! We appreciate it.

W. Y.
Level 1
Level 1

Hi Lothar,

 

I think this link will help you https://community.cisco.com/t5/nso-developer-hub-documents/nso-service-upgrade-with-python/ta-p/3640379

One question, I also try to use the function you have to upgrade a mandatory leaf in Yang with NSO 5.5 but failed. Is it working by you?

---> fixed