Forum Discussion

JSC's avatar
JSC
Icon for Nimbostratus rankNimbostratus
Apr 27, 2017

Importing ASM profile with iControl REST to a custom BigIP partition

Using iControl REST for ASM module (F5 BigIP v12.1.2), I cannot figure out how to import an ASM profile to a custom partition, only

/common
seems possible...

Is there a specific parameter or HTTP header to provide?

payload={}

payload['file']=open('/home/user/sample_asm.xml,"rb").read()

payload['name']='ASM_POLICY'

bigip.post('https://%s/mgmt/tm/asm/tasks/import-policy?ver=12.1.2' % (BIGIP_ADDRESS), data=json.dumps(payload))

thanks,

JSC

2 Replies

  • Extrapolating from the example on page 42 of the user guide, I suspect that all you need to add is a "partition" keyword/value pair to the payload. For example, if you're importing the policy into the "foo" partition, then you'd add

    payload['partition']='~foo'
    to the sample shown above.

    The tilde (

    ~
    ) in front of the partition name seems to be absolutely necessary.

  • Hi, actually I have same problem when I do those commands:

    1) tmsh
    2) cd /desiredPartition/
    3) load asm policy file /var/tmp/tmp_policy.xml
    

    It does load policy to Common partition. Even all relations to Common partition are replaced by proper one within XML file. It works correctly via GUI, but not via TMSH.

    What should I do to be able to use either Rest call or TMSH to be able to upload ASM policy to proper partition? Btw, version I use 12.1.3.3

    Thanks, Zdenek