Forum Discussion
Upload programatically external data group file?
Here's iControl REST curl examples. You should be able to find equivalent Python classes for these endpoints.
To create an LTM external group, you need to 1) Upload the file to BIG-IP and 2) Create the data-group object from the file.
1) Uploading a data file and creating the file object
To upload the remote file http://172.16.10.10/dg-testSw.txt to BIG-IP and create the file object named dg-testSw.txt based on the data file, run
curl -sku admin: https:///mgmt/tm/sys/file/data-group \
-X POST -H "Content-type: application/json" \
-d '{"name":"dg-testSw.txt", "separator":":=", "type":"string", "sourcePath":"http://172.16.10.10/dg-testSw.txt"}'
The above call is equivalent to the following tmsh command:
tmsh create sys file data-group dg-testSw.txt separator ":=" source-path http://172.16.10.10/dg-testSw.txt type string
The file object dg-testSw.txt is created under the /Common partition by default. To store the object under a different partition, add the partition property to the JSON body: e.g., "partition":"testFolder".
The separator property describes the key-value separator string. In this example, it is ":=". The type property describes the type of the data. In this example, it is "string". Possible values are: integer, ip or string. In this example, the following data is used.
"darth" := "vader",
"luke" := "skywalker",
"han" := "solo",
"leia" := "organa",
"moff" := "tarkin",
Please refer to v11: iRules Data Group Updates for the data format.
To delete the data-group file object dg-testSw.txt, run
curl -sku admin: https:///mgmt/tm/sys/file/data-group/dg-testSw.txt -X DELETE
2) Creating the ltm data-group object
To create the ltm data-group object dg-testSw from the above file object, run
curl -sku admin: https:///mgmt/tm/ltm/data-group/external \
-X POST -H "Content-type: application/json" \
-d '{"name":"dg-testSw", "externalFileName":"dg-testSw.txt"}'
The above call is equivalent to the following tmsh command:
tmsh create ltm data-group external dg-testSw external-file-name dg-testSw.txt
To delete the ltm data-group object dg-testSw, run
curl -sku admin: https:///mgmt/tm/ltm/data-group/external/dg-testSw -X DELETE
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