Example: Device Management / System
10 min
end to end walkthrough export a configuration template from a "golden" edge and apply it on another, plus manage users, tokens, and certificates setup from litmussdk system import templates, users, tokens, certificates 1\ export a configuration template the full template captures everything devices, tags, flows, marketplace registries, ntp, dns, opc, etc \# what can be exported? items = templates list available configurable items() \# export everything full = templates download template complete() 2 6 0 fix in versions <2 6 0, download template complete() raised typeerror on every call fixed in 2 6 0 now works as documented for a partial export partial = templates download template( dns=true, ntp=true, timezone=true, devices=\["device id 1", "device id 2"], flows=\["flow id 1"], ) 2\ save and apply on another edge import json with open("plant floor config json", "w") as f json dump(full, f, indent=2) \# on another edge with its own connection with open("plant floor config json") as f templates apply template(json load(f)) for air gap deployments, see air gap features for a programmatic builder 3\ users and groups all users = users list users() new user = users create user( username="ops jane", email="jane\@example com", full name="jane smith", password=" ", group id=group id, ) users delete user(new user id) 4\ api tokens (oauth clients) all tokens = tokens list tokens() new token = tokens create oauth token( name="ci pipeline", scope="admin", ) client id = new token\["client id"] client secret = new token\["client secret"] # store securely; not retrievable later tokens delete token(new token\["id"]) 5\ certificates all certs = certificates list certificates() certificates upload certificate( cert path="/path/to/cert pem", key path="/path/to/key pem", name="my https cert", ) certificates delete certificate(cert id) 6\ network and system info from litmussdk system import network, general \# network interfaces interfaces = network list interfaces() \# system version and uptime info = general get system info() version = general get version() 7\ events and audit log from litmussdk system import events recent = events list events(limit=100) for evt in recent print(f"{evt\['timestamp']} {evt\['type']} {evt\['message']}") see also air gap features docid\ dmvq8b6h macksn07230r programmatic template builder for offline deployment managing connections docid\ vwtfo9sxcmrbfx9cafenw if you're sourcing the template from one edge and applying on another