ncdiff.ModelCompiler class

class ncdiff.ModelCompiler(folder)[source]

Bases: object

Abstraction of a YANG file compiler.

dir_yang

Path to yang files.

Type:str
dependencies

Dependency infomation stored in an Element object.

Type:Element
context

A CompilerContext object that holds the context of all modules.

Type:CompilerContext
module_prefixes

A dictionary that stores module prefixes. It is keyed by module names.

Type:dict
module_namespaces

A dictionary that stores module namespaces. It is keyed by module names.

Type:dict
identity_deps

A dictionary that stores module identities. It is keyed by bases.

Type:dict
pyang_errors

A list of tuples. Each tuple contains a pyang error.Position object, an error tag and a tuple of some error arguments. It is possible to call pyang.error.err_to_str() to print out detailed error messages.

Type:list

__init__ instantiates a ModelCompiler instance.

build_dependencies()[source]

High-level api: Briefly compile all yang files and find out dependency infomation of all modules.

Returns:Nothing returns.
Return type:None
get_dependencies(module)[source]

High-level api: Get dependency infomationa of a module.

Parameters:module (str) – Module name that is inquired about.
Returns:A tuple with two elements: a set of imports and a set of depends.
Return type:tuple
compile(module)[source]

High-level api: Compile a module.

Parameters:module (str) – Module name that is inquired about.
Returns:A Model object.
Return type:Model