Forum Discussion
Code snippet for iControl API on upload_policy()
Hi,
I am writing a perl script to upload the modified ASM policies to F5. Is there any related perl snippet code available regarding using the following iControl SOAP API?
upload_policy( in String policy_name, in ASM__FileTransferContext file_context );
Appreciate your earliest response.
Best regards
Hyder
7 Replies
- JRahm
Admin
I haven't seen any perl wrt ASM, but we have some python test code you can take a look at in our sdk that might point you in the right direction.
- Hyder_141209
Altostratus
Thanks for your answer Jason. Unfortunately, my version is 11.6.0 and was looking for a SOAP call related snippet.
Thanks.
Best regards
Hyder
- JRahm
Admin
ah yes, drove the train right through that SOAP intersection... :)
 
I think the ASM file transfer contexts works similar to the standard context, but I'll reach out to see if I can get you a definitive answer. This might help get you started while I ask around.
 
- Hyder_141209
Altostratus
Thanks for the link Jason. I can now upload the policy file to the /var/tmp/ directory. However, while trying to import_policy to the iApp its failing and showing the following error message:
Exception: Common::OperationFailed primary_error_code : 0 (0x00000000) secondary_error_code : 0 error_string : Import policy failed. Messages: [fatal] Cannot read exported security policy file. [fatal] Cannot read from input file.]BigIP version: 11.6.0 HF6
Appreciate your further input on this.
Best regards
Hyder
- JRahm
Admin
usually there are two steps when uploading objects: upload to the system, then import to the configuration. I think that second step needs to happen before you can reference from the iApp, but I don't know the methods you are using so can't be sure.
- Hyder_141209
Altostratus
Thanks Jason.
Have done the upload correctly and actually can see the file uploaded there as well. The issue is only when running the SOAP import_policy().
policy name is /TEST01/test.com.app/test.com_policy
remote file name at F5 /var/tmp/ is test.com_policy
The part of the code is:
$check_resp->($f5_iface->import_policy(SOAP::Data->name(webapp_name => $policyname), SOAP::Data->name(filename => $remote_file_location_name)));Have changed webapp_name to /TEST01/test.com.app. However, still the same error message. Any reference or sample code available on import_policy()?
Cheers.
Best regards Hyder
- Hyder_141209
Altostratus
This is SOAP trace I can see at F5:
/TEST01/test.com.app/test.com /shared/tmp/test.com_policyAnything missing?
Best regards
Hyder
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com