06-22-2021 01:05 AM
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
Solved! Go to Solution.
07-09-2021 06:16 AM
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
07-06-2021 08:02 AM
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!
07-09-2021 06:16 AM
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
07-09-2021 08:27 AM
07-09-2021 04:47 AM - edited 09-24-2021 06:18 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide