- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
07-10-2019 07:03 PM - edited 07-11-2019 04:19 AM
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 7.7.7.7 to my firewall with the tag SFTP. So once the object hits the firewall the name would be H-7.7.7.7 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)
pano.add(panogrp)
#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()
panogrp.add(sftp_server)
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 ... 🙂
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 LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!