CheckPoint-R81如何导出和导入策略-下
2022-03-15 11:23阅读:
1.[Expert@CP-R81:0]# python import_export_package.py
Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
1
Please specify the path to the file you wish to import:
'exported__package__Standard__2022_03_14_15_14.tar.gz'
Please select a login method:
1. Enter user credentials manually
2. Login as Root
3. Use an existing session file
4. Use an existing session UID
99. Back
2
The script will run with the following parameters:
Custom name for imported package (optional) = None
Management Server IP = 127.0.0.1
Management Server Port = 443
Management Server Domain = None
1. Change Settings
2. Run
99. Back
2
A package named Standard already exists. Are you sure you want to
import?
1.Yes
2.No
1
Please enter either '1' or '2'
Traceback (most recent call last):
File 'import_export_package.py', line
67, in
import_package(client, args)
File
'/home/admin/mycpapi/ExportImportPolicyPackage-master/importing/import_package.py',
line 47, in import_package
choice = input()
File '', line 0
^
SyntaxError: unexpected EOF while parsing
[Expert@CP-R81:0]#
2.修改出错的文件:
print('A package
named ' + package + ' already exists. Are you sure you want to
import?')
print('1.Yes')
print('2.No')
choice = ''
chosen =
False
while not
chosen:
choice = input()
choice = '1' # add new line
if
choice not in ['1', '2']:
print('Please enter either '1' or '2'')
else:
chosen = True
if choice ==
'2':
exit(0)
3.[Expert@CP-R81:0]# python import_export_package.py
Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
1
Please specify the path to the file you wish to import:
'exported__package__Standard__2022_03_14_15_14.tar.gz'
Please select a login method:
1. Enter user credentials manually
2. Login as Root
3. Use an existing session file
4. Use an existing session UID
99. Back
2
The script will run with the following parameters:
Custom name for imported package (optional) = None
Management Server IP = 127.0.0.1
Management Server Port = 443
Management Server Domain = None
1. Change Settings
2. Run
99. Back
2
A package named Standard already exists. Are you sure you want to
import?
1.Yes
2.No
1
Importing general objects
Adding applications-sites
Failed to import application-site with name [Web_ABB]. Error:
message: Unrecognized parameter [primary-category-id]
code: generic_err_invalid_parameter_name
Failed to import application-site with name
[Web_ABB_Allow_stsint.abb.com]. Error: message: Unrecognized
parameter [primary-category-id]
code: generic_err_invalid_parameter_name
Failed to import application-site with name [Web_Sina]. Error:
message: Unrecognized parameter [primary-category-id]
code: generic_err_invalid_parameter_name
Adding simple-gateways
Failed to import simple-gateway with name
[partial_export_error_simple-gateway_ec3bbaa2-a134-2248-9000-861c5877f186_CP-R81].
Error: message: Unrecognized parameter [enabled] (full path:
platform-portal-settings.enabled)
code: generic_err_invalid_parameter_name
Adding access-layers
Imported 4 out of 4 access-layers (100%)
Adding networks
Managed to import API object from type network by add-objects-batch
API call.
Now trying to publish.
Failed to publish import of Networks from said file were not
imported!. Message: message: Publish failed because of validation
errors
code: err_publish_failed
errors:
- message: More than one object named 'EXT-10.137.162.0'
exists.
Failed to import API object from type network by add-objects-batch
API call.
Falling back to add objects one by one.
Object 'EXT-10.137.162.0' was renamed to
'NAME_COLLISION_RESOLVED_EXT-10.137.162.0' to resolve the name
collision
Imported 2 out of 2 networks (100%)
Adding groups
Imported 1 out of 1 groups (100%)
Importing Access_Layer [Content]
Adding access-rules
Imported 2 out of 2 access-rules (100%)
Importing Access_Layer [APP]
Adding access-rules
Failed to import access-rule. Error: message: Requested object
[Web_ABB_Allow_stsint.abb.com] not found
code: generic_err_object_not_found
Also failed to generate placeholder object: message: Validation
failed with 1 warning
code: err_validation_failed
warnings:
- message: The port is already used by another service.
Failed to import access-rule. Error: message: Requested object
[Web_ABB] not found
code: generic_err_object_not_found
Also failed to generate placeholder object: message: Validation
failed with 1 warning
code: err_validation_failed
warnings:
- message: The port is already used by another service.
Failed to import access-rule. Error: message: Requested object
[Web_Sina] not found
code: generic_err_object_not_found
Also failed to generate placeholder object: message: Validation
failed with 1 warning
code: err_validation_failed
warnings:
- message: The port is already used by another service.
Imported 5 out of 5 access-rules (100%)
Importing Access_Layer [APP_and_Content]
Adding access-rules
Imported 1 out of 1 access-rules (100%)
Importing Access_Layer [IMPORTED LAYER Network]
Adding access-rules
Imported 3 out of 3 access-rules (100%)
Adding access-sections
Imported 3 out of 3 access-sections (100%)
[Expert@CP-R81:0]#