Open rkkilari opened 1 year ago
hi @rkkilari,
I have used the pyang_tool.py as inspiration..
but essentially you need this to get started..
from pyang import statements
from pyang.statements import ModSubmodStatement
from pyang.repository import FileRepository
from pyang.context import Context
repo = FileRepository(path="ios-xe_17.6.5")
ctx = Context(repo)
module: ModSubmodStatement = ctx.read_module("Cisco-IOS-XE-native")
statements.validate_module(ctx, module)
Hope that helps :-)
Esben
Can we use pyang in a python program? Can anyone help providing some links where such an example code is provided. I tried to use pyang to 1) load yang file 2) parse it in to statements and ... 3) traverse the statements and generate angular code templates as per container leaf, leaf-list, ...