<?php // load 'PAN Configurator' library require_once "../lib/panconfigurator.php"; /*************************************************************** ****************************************************************/ // input and ouput xml files $inputfile = 'sample-configs/panorama-example.xml'; $outputfile = 'output.xml'; // Create a new PanoramaConf object $p = new PanoramaConf(); // and load it from a XML file $p->load_from_file($inputfile); print "\n***********************************************\n\n"; // display some statiscs for debug and exit program! print "\n\n***********************************************\n"; $p->display_statistics();
* * *****************************************************************************/ // load PAN-Configurator library require_once "../lib/panconfigurator.php"; // input and output files $origfile = "sample-configs/panorama-example.xml"; $outputfile = "output.xml"; $targetDG = 'Perimeter-FWs'; $targetProfile = 'Shared Production Profile'; // We're going to load a PANConf object (PANConf is for PANOS Firewall, // PanoramaConf is obviously for Panorama which is covered in another example) $panc = new PanoramaConf(); $panc->load_from_file($origfile); // Did we find VSYS1 ? $dg = $panc->findDeviceGroup($targetDG); if (is_null($dg)) { derr("DeviceGroup {$targetDV} was not found ? Exit\n"); } print "\n***********************************************\n\n"; // Going after each pre-Security rules to add a profile foreach ($dg->securityRules->rules() as $rule) { print "Rule '" . $rule->name() . "' modified\n"; $rule->setSecurityProfileGroup($targetProfile); } print "\n***********************************************\n"; $panc->save_to_file($outputfile); //display some statistics $panc->display_statistics(); //more debugging infos memory_and_gc('end');