In, bigiq-rest-api-device licensing - requests, we provide an example of how to leverage the rest api for BIG-IQ licensing by adding a device to an existing license pool using python and the requests lib. The example takes advantage of python class inheritance and the requests module python requests.
Because the python requests module is supported with python version 2.7.9 and above, the automation cannot run directly within the BIG-IQ shell. Why you ask, because the distribution of Linux used for the BIG-IQ application of rest framework ships with python 2.4.3.
For simplification the script attached will use httplib client protocol, python httplib, and will provide a good comprehensive example of licensing a BIGIP running directly on BIG-IQ.
Log into BIG-IQ as root.
Create a directory under /shared/. and call it scripts. Or whatever you'd like.
scp license.py to root@<bigiq.ip>:/shared/scripts/.