This is a set of classes to help when working with UDMI. See https://github.com/faucetsdn/udmi/blob/master/README.md
There are currently seven classes representing the corresponding UDMI types:
- Config
- Discover
- MetaData
- Pointset
- Properties
- State
They are available at the top level of this module. ie udmi.Pointset
So far the subtypes used in UDMI such as config_pointest are not representated by classes and remain dicts
They do three useful things currently:
They perform data validation against the published version 1 UDMI json schemas on creation, throwing an exception if the input data is malformed.
Uniform serialisation to the udmi json format from object orientated interface.
There's a method that serialises timestamps given in python datetime format correctly.
pip install pyudmi
You can create these objects in two ways. Each class has a normal Python constructor to make programatic creation easier eg:
import udmi
config = udmi.Config(timestamp, system, pointset, gateway)
And a class method common to them all:
config = udmi.Config.from_string(udmi_string)
To serialise as a udmi json string use the method as_udmi
udmi_string = config.as_udmi()