cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
863
Views
10
Helpful
1
Replies

Create nso authgroup using maagic & maapi

ifoughal
Cisco Employee
Cisco Employee

Hello, 

 

I'm currently attempting to create an Authgroup using maagic & maapi, I've been able to update it without any issues using the following nested attributes:

 

root.devices.authgroups.group["test"].default_map.remote_password
Although, the group has to exist prior, thus far I've only been able to update it after creating manually through the CLI, but what I need is to be able to create it programatically.
 
The nested objects themselves don't seem to contain any create method (such as the devices.device object).
Any ideas ?
1 Reply 1

Nabsch
Spotlight
Spotlight

Hello,

 

Here a working example

 

 

import ncs       
with ncs.maapi.Maapi() as m:
	with ncs.maapi.Session(m, 'admin', 'test_context'):
		with m.start_write_trans() as trans:
			root = ncs.maagic.get_root(trans)
			authgroup = root.devices.authgroups.group.create("test-auth")
			authgroup.default_map.create()
			authgroup.default_map.remote_name="admin"
			authgroup.default_map.remote_password="cisco"
			trans.apply()

 

 

 

Before creating the authgroup using python 

 

 

admin@ncs# show running-config devices authgroups group test-auth
--------------------------------------------------------^
syntax error: element does not exist

 

 

After creating the authgroup

 

admin@ncs# show running-config devices authgroups group test-auth
devices authgroups group test-auth
 default-map remote-name admin
 default-map remote-password $9$/2qQuqwlb9Y7by5opJuC/8mssOctVdvh5DBr0MdyM6Q=
!

 

 

You can use ncs_pycli that might help you in the future .

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: