Cisco CML のライセンス状態を Python から取得する
Cisco CML のライセンス状態を Python から取得するサンプルコードをメモしておきます。 virl2_client.models.licensing の features() を利用することでライセンス状態を取得出来ます。
検証環境¶
CML 2.7.x と CML 2.8.0 で試しましたが、いずれも動作しました。
| 対象 | バージョン |
|---|---|
| CML | 2.8.0 |
| macOS | 15.3 |
| Python | 3.12.7 |
サンプルコード¶
sample.py
#!/usr/bin/env python
import json
from virl2_client import ClientLibrary
from virl2_client.models.licensing import Licensing
address = "10.0.0.1"
username = "admin"
password = "password"
client = ClientLibrary(address, username, password, ssl_verify=False)
client.is_system_ready(wait=True)
licensing = client.licensing
features = licensing.features()
print(json.dumps(features, indent=2))
実行例¶
% python sample.py
SSL Verification disabled
[
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "CML - Enterprise License",
"description": "Cisco Modeling Labs - Enterprise License with 20 nodes capacity included",
"in_use": 1,
"status": "IN_COMPLIANCE",
"version": "1.0",
"min": 0,
"max": 1,
"minEndDate": "2025-07-04 00:00:01",
"maxEndDate": "2025-07-04 00:00:01"
},
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"name": "CML - Expansion Node License",
"description": "Cisco Modeling Labs - Expansion node capacity for CML Enterprise Servers",
"in_use": 300,
"status": "IN_COMPLIANCE",
"version": "1.0",
"min": 0,
"max": 300,
"minEndDate": "2025-07-04 00:00:01",
"maxEndDate": "2025-07-04 00:00:01"
}
]