@@ -414,6 +414,41 @@ def clear_registered_ip(self, ip=None, tags=None, prefix=None):
414
414
self .unregister (ip , tags )
415
415
self .batch_end ()
416
416
417
+ def audit_registered_ip_for_tag (self , tag , ip_addresses ):
418
+ """Synchronize the current registered-ip tag to tag only the specificied IP addresses.
419
+
420
+ Sets the registered-ip list for a single tag on the device. Regardless
421
+ of the current state of the registered-ip tag list when this method is
422
+ called, at the end of the method the list for the specified tag will
423
+ contain only the ip addresses passed in the argument. The current state
424
+ of the list is retrieved to reduce the number of operations needed. If
425
+ the list for this tag is currently in the requested state, no API call
426
+ is made after retrieving the list.
427
+
428
+ **Support:** PAN-OS 6.0 and higher
429
+
430
+ Warning: This will clear any batch without it being sent, and can't be
431
+ used as part of a batch.
432
+
433
+ Args:
434
+ tag (string): Tag to audit
435
+ ip_addresses(list): List of IP addresses that should have the tag
436
+
437
+ """
438
+ device_list = self .get_registered_ip (tags = tag , prefix = self .prefix )
439
+ self .batch_start ()
440
+ registered_ips = device_list .keys ()
441
+ tag = self .prefix + tag
442
+ for ip in registered_ips :
443
+ if ip not in ip_addresses :
444
+ # The IP is not requested, unregister it for this tag
445
+ self .unregister (ip , tag )
446
+ for ip in ip_addresses :
447
+ if ip not in registered_ips :
448
+ # The IP is requested, register it with this tag
449
+ self .register (ip , tag )
450
+ self .batch_end ()
451
+
417
452
def audit_registered_ip (self , ip_tags_pairs ):
418
453
"""Synchronize the current registered-ip tag list to this exact set of ip-tags
419
454
0 commit comments