cisco-open / cisco-catalyst-wan-sdk

Cisco Catalyst WAN SDK
Apache License 2.0
17 stars 3 forks source link

Cli templates #599

Closed JimOverholt closed 6 months ago

JimOverholt commented 6 months ago

Adding classes: TemplateAPI:

Example:

template = TemplateAPI(session)
device = DevicesApi(session).controllers[0]
template_name = 'new'
template.attach(template_name, device)
template.device_to_cli(device)
template.delete(template_name)

CreateCliTemplate:

Example adding a tacacs configuration to an existing configuration:

tacacs = """
 !
 tacacs
  server 10.0.1.60
   vpn 512
   secret-key key
  exit
""".splitlines()

add_before = 'aaa'

device = DevicesApi(session).controllers[0]
template = CreateCliTemplate(session=session, device_model=device.personality, name='new', description='new')

template.load_running(device)
template.add_to_config(ConfigList(tacacs), add_before)
template.send_to_vmanage()
JimOverholt commented 6 months ago

This issue was migrated from an old repository: https://github.com/CiscoDevNet/catalystwan/pull/11