mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
15 lines
405 B
Python
15 lines
405 B
Python
from yangson import DataModel
|
|
|
|
import cbor
|
|
import json
|
|
|
|
class Message:
|
|
def __init__(self, filename, _type):
|
|
self.filename = filename
|
|
with open(self.filename, "rb") as sf:
|
|
self.raw = { "json": json, "cbor": cbor }[_type].load(sf)
|
|
|
|
self.dm = DataModel.from_file('yang-library.json')
|
|
self.data = self.dm.from_raw(self.raw)
|
|
self.data.validate()
|