Creating a tenant using the SDK
We have the tools, and we can log in. Let's now add a tenant using the SDK.
How to do it...
- Create a new Python file (on Linux, this can be done using the command
vi aciNewTenant.py
). - In the VI editor, switch to insert mode by pressing i on the keyboard
- Enter the following:
importcobra.model.pol import cobra.model.fv import cobra.mit.request polUniMo=cobra.model.pol.Uni('') tenantMo =cobra.model.fv.Tenant(polUniMo,'TenantC') config=cobra.mit.request.ConfigRequest() config.addMo(tenantMo) md.commit(config)
- Save the file by pressing the Esc key and then pressing
:wq!
. - Make the file executable using the command
chmod a+x aciLogin.py
. - Run the file using the command
python ./aciLogin.py
.