Skip to content

Commit ffcb73e

Browse files
committed
Support vsys for import_file().
1 parent 5271e97 commit ffcb73e

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

bin/panxapi.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,11 @@ def main():
251251
action = 'import'
252252
if options['ad_hoc'] is not None:
253253
extra_qs_used = True
254+
vsys = options['vsys'][0] if len(options['vsys']) else None
254255
xapi.import_file(category=options['import'],
255256
file=options['file'],
256257
filename=options['name'],
258+
vsys=vsys,
257259
extra_qs=options['ad_hoc'])
258260
print_status(xapi, action)
259261
print_response(xapi, options)
@@ -903,7 +905,7 @@ def usage():
903905
--file path import file path
904906
--strict yes|no multi-config strict-transactional
905907
--vsys vsys VSYS for dynamic update/partial commit/
906-
operational command/report
908+
operational command/report/import
907909
-l api_username[:api_password]
908910
-h hostname
909911
-P port URL port number

doc/pan.xapi.rst

+5-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ Threat PCAP export
434434
exporting from firewall devices, however this requirement will be
435435
removed in a future version of PAN-OS.
436436

437-
import_file(category=None, file=None, filename=None)
438-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
437+
import_file(category=None, file=None, filename=None, vsys=None)
438+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
439439

440440
The import_file() method performs the ``type=import`` import file API
441441
request with the **category** argument.
@@ -460,6 +460,9 @@ import_file(category=None, file=None, filename=None)
460460
the ``Content-Disposition`` header. If **filename** is not specified
461461
and **file** specifies a path, the basename of the path is used.
462462

463+
The **vsys** argument is used to set the location to a specific
464+
Virtual System.
465+
463466
log(self, log_type=None, nlogs=None, skip=None, filter=None, interval=None, timeout=None)
464467
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
465468

doc/panxapi.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ SYNOPSIS
6868
--file path import file path
6969
--strict yes|no multi-config strict-transactional
7070
--vsys vsys VSYS for dynamic update/partial commit/
71-
operational command/report
71+
operational command/report/import
7272
-l api_username[:api_password]
7373
-h hostname
7474
-P port URL port number
@@ -276,6 +276,9 @@ DESCRIPTION
276276

277277
The **--name** option is used to specify the file name.
278278

279+
The **--vsys** option is used to set the location to a specific
280+
Virtual System.
281+
279282
The **--ad-hoc** option is used to specify additional import
280283
arguments, for example:
281284

@@ -408,8 +411,8 @@ DESCRIPTION
408411

409412
``--vsys`` *vsys*
410413
Specify optional **vsys** for dynamic update (**-U**), partial vsys
411-
commit (**--partial** vsys), commit-all (**-A**) and operational
412-
commands (**-o**).
414+
commit (**--partial** vsys), commit-all (**-A**), operational
415+
commands (**-o**) and import (**--import**).
413416

414417
*vsys* can be specified using name (**vsys2**) or number (**2**).
415418

lib/pan/xapi.py

+3
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ def import_file(self,
10431043
category=None,
10441044
file=None,
10451045
filename=None,
1046+
vsys=None,
10461047
extra_qs=None):
10471048
self.__set_api_key()
10481049
self.__clear_response()
@@ -1052,6 +1053,8 @@ def import_file(self,
10521053
query['key'] = self.api_key
10531054
if category is not None:
10541055
query['category'] = category
1056+
if vsys is not None:
1057+
query['vsys'] = vsys
10551058
if extra_qs is not None:
10561059
query = self.__merge_extra_qs(query, extra_qs)
10571060

0 commit comments

Comments
 (0)