Automation of a vsys configuration

Announcements

ATTENTION Customers, All Partners and Employees: The Customer Support Portal (CSP) will be undergoing maintenance and unavailable on Saturday, November 7, 2020, from 11 am to 11 pm PST. Please read our blog for more information.

Reply
Highlighted
L2 Linker

Automation of a vsys configuration

We would like to automate the configuration of a new vsys, uisng inputs from a file or script with the required information, using either the set commands or the API.

Has anyone attempted to do this, and what is the best way and how to gather the require commands etc for this.

Any suggestions would be helpful.

 

Thanks you

David

Highlighted
L7 Applicator

Hi David

 

assuming you already have at least one vsys configured and want to re-use it's properties, you can easily do this through CLI 

 

first you'll want to collect the current vsys's info. the easiest way to collect the info so it can be easily edited later is by setting the config output to 'set' commands

 

> set cli config-output-format set 

this will change the show config output to a list of set commands rather than XML. next collect the current info

 

> configure 
Entering configuration mode
[edit]                                                                                                                           
# show vsys vsys1

this will output all the vsys1 specific config in the form of re-usable set commands:

 

set vsys vsys1 import network interface [ ethernet1/1 ethernet1/2 ethernet1/3 ethernet1/9 ethernet1/10 ethernet1/4 ethernet1/7 et
hernet1/8 ethernet1/5 ethernet1/6 ae1 ae2 tunnel.1 tunnel vlan loopback loopback.5 tunnel.2 loopback.20 tunnel.230 ]
set vsys vsys1 import network virtual-wire [ replay vw3 ]
set vsys vsys1 import network vlan 
set vsys vsys1 import network virtual-router vr_internet
set vsys vsys1 application 
....

 

which you can then edit to suit your needs. When you're done editing the vsys config and want to put the config into the device, make sure to temporarily enable 'scripting mode' which will allow better handling of a large copy/paste operation:

 

> set cli scripting-mode on 
> configure
Entering configuration mode
[edit]                                                                                                                           
# 

 

hope this helps!

Tom

Tom Piens - PANgurus.com
New to PAN-OS or getting ready to take the PCNSE? check out amazon.com/dp/1789956374
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!