Ok, i will first start by saying ive never attempted anything like this before. Im an old school network engineer but times are a changing and im trying to learn how to automate simple tasks. All I need to do is promt the user to enter and IP address and then add that IP Address to a specific device group with 1 tag on it. for example i want to add 188.8.131.52 to my firewall with the tag SFTP. So once the object hits the firewall the name would be H-184.108.40.206 and description would simply be the ticket number of the request and the ip would be learned via input and then I would automatically include the tag. ive been reading forums and other items and came up with a little script below. This is what I have so far, but im kinda stuck now. Ive only been messing around with this for a couple of days...
#This defines the panorama device interface to connect to and the DeviceGroup
device = ["x.x.x.x"]
devicegroup = ["mydevice"]
auth_key = "<my-key>"
#This intitaties the panorama connection
pano = panorama.Panorama(device, api_key=auth_key)
#This defines the device group we wil be connecting to
panogrp = panorama.DeviceGroup(devicegroup)
#This will set the IP address of the SFTP source to add to the Firewall
ip_address = input('Please enter the ip address you wish to add to the SFTP whitelist, (example x.x.x.x): ')
#This will set the description of the node to the Release Ticket number
description = input("Please enter the release ticket number: ")
#This formats the name to match the existing standards in the firewall
name = ("H-"+ip_address)
#declares an object to create
sftp_server = pandevice.objects.AddressObject()
any suggestions to make it better and or complete the adding of the node..im not sure im even on the right path so far... thanks for any insight ... :)
Solved! Go to Solution.
You're on the right path, just a few tweaks:
devicegroupshould be strings like
auth_key, not lists
sftp_server = pandevice.objects.AddressObject(name=name, value=ip_address, description=description)
create() / apply() / delete()on the object to make the configuration change, depending on if you're trying to create, update, or delete:
thank you, i am still learning how this all works, but that makes sense. I apprecaite the guidance. Ill let you know my outcome once i get this going.
my next goal is doing the commit to panorama and the device group push.
Thank You again!!
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!