Name

confdc — Confdc compiler

Synopsis

confdc -c [-a | --annotate YangAnnotationFile] [--deviation DeviationFile ] [-o FxsFile] [--verbose] [--fail-on-warnings] [-E | --error ErrorCode...] [-W | --warning ErrorCode...] [-w | --no-warning ErrorCode...] [--strict-yang] [--no-yang-source] [--use-description [always] ] [[--no-features] | [-F | --features Features ...]] [--ignore-unknown-features] [-p | --prefix Prefix] [--subagent MountPath] [--yangpath YangDir] [--export Agent [-f FxsFileOrDir...] ...] -- YangFile

confdc --strip-yang-source FxsFile

confdc --list-errors

confdc -c [-o CclFile] ClispecFile

confdc -c [-o BinFile] [-I Dir] MibFile

confdc -c [-o BinFile] [--read-only] [--verbose] [-I Dir] [--include-file BinFile] [--fail-on-warnings] [--warn-on-type-errors ] [--warn-on-access-mismatch ] [--mib-annotation MibA] [-f FxsFileOrDir...] -- MibFile FxsFile...

confdc --emit-h HFile [--macro-prefix Prefix] [--include-type ] [--exclude-enums ] [--fail-on-warnings ] FxsFile

confdc --emit-h HFile [-a | --annotate YangAnnotationFile] [--deviation DeviationFile ] [--strict-yang] [[--no-features] | [-F | --features Features ...]] [--ignore-unknown-features] [--yangpath YangDir] [--macro-prefix Prefix] [--include-type ] [--exclude-enums ] [--fail-on-warnings ] YangFile

confdc --emit-java JFile [--print-java-filename ] [--java-disable-prefix ] [--java-package Package] [--exclude-enums ] [--fail-on-warnings ] [-f FxsFileOrDir ...] FxsFile

confdc --emit-python PyFile [--print-python-filename ] [--no-init-py ] [--python-disable-prefix ] [--exclude-enums ] [--fail-on-warnings ] [-f FxsFileOrDir ...] FxsFile

confdc --emit-hrl HrlFile [--macro-prefix Prefix] [--include-type ] [--exclude-enums ] [--fail-on-warnings ] FxsFile

confdc --emit-hrl HrlFile [-a | --annotate YangAnnotationFile] [--deviation DeviationFile ] [--strict-yang] [[--no-features] | [-F | --features Features ...]] [--ignore-unknown-features] [--yangpath YangDir] [--macro-prefix Prefix] [--include-type ] [--exclude-enums ] [--fail-on-warnings ] YangFile

confdc --emit-mib MibFile [ --join-names capitalize | hyphen ] [--oid OID] [--top Name] [--tagpath Path] [--import Module Name] [--module Module] [--generate-oids ] [--generate-yang-annotation] [--skip-symlinks] [--top Top] [--fail-on-warnings ] [--no-comments ] [--read-only ] -- FxsFile...

confdc --mib2yang-std [-p Prefix] [-o YangFile] -- MibFile

confdc --mib2yang-mods [--mib-annotation MibA] [--keep-readonly] [--namespace Uri] [--revision Date] [-o YangDeviationFile] -- MibFile

confdc --mib2yang [--mib-annotation MibA] [--emit-doc] [--snmp-name] [--read-only] [-u Uri] [-p Prefix] [-o YangFile] -- MibFile

confdc --snmpuser EngineID User AuthType PrivType PassPhrase

confdc --revision-merge [-o ResultFxs] [-v ] [-f FxsFileOrDir...] -- ListOfFxsFiles...

confdc --lax-revision-merge [-o ResultFxs] [-v ] [-f FxsFileOrDir...] -- ListOfFxsFiles...

confdc --get-info FxsFile

confdc --get-uri FxsFile

confdc --version

DESCRIPTION

During startup the ConfD daemon loads .fxs files describing our configuration data models. A .fxs file is the result of a compiled YANG data model file. The daemon also loads clispec files describing customizations to the auto-generated CLI. The clispec files are described in clispec(5).

A yang file by convention uses .yang (or .yin) filename suffix. YANG files are directly transformed into .fxs files by confdc.

We can use any number of .fxs files when working with the ConfD daemon.

The --emit-h option is used to generate a .h file from a .fxs or YANG (.yang/.yin) file. How to use the generated .h files is described in the ConfD User Guide.

The --emit-java option is used to generate a .java file from a .fxs file. The java file is used in combination with the Java library for Java based applications.

The --emit-python option is used to generate a .py file from a .fxs file. The python file is used in combination with the Python library for Python based applications.

The --emit-hrl option is used to generate a .hrl file from a .fxs or YANG (.yang/.yin) file. The .hrl file can be used for Erlang based applications.

The --print-java-filename option is used to print the resulting name of the would be generated .java file.

The --print-python-filename option is used to print the resulting name of the would be generated .py file.

The --python-disable-prefix option is used to prevent prepending the Yang module prefix to each symbol in the generated .py file.

The --emit-mib option is used to generate an SNMP MIB from .fxs files.

The --snmpuser option is used to generate localized keys for SNMP v3.

A clispec file by convention uses a .cli filename suffix. We use the confdc command to compile a clispec into a loadable format (with a .ccl suffix).

A mib file by convention uses a .mib filename suffix. The confdc command is used for compiling the mib with one or more fxs files (containing OID to YANG mappings) into a loadable format (with a .bin suffix). See the ConfD User Guide for more information about compiling the mib.

Take a look at the EXAMPLE section for a crash course.

OPTIONS

Common options

-f, --fxsdep FxsFileOrDir...

.fxs files (or directories containing .fxs files) to be used to resolve cross namespace dependencies.

--yangpath YangModuleDir

YangModuleDir is a directory containing other YANG modules and submodules. This flag must be used when we import or include other YANG modules or submodules that reside in another directory.

-o, --output File

Put the resulting file in the location given by File.

Compile options

-c, --compile File

Compile a YANG file (.yang/.yin) to a .fxs file or a clispec (.cli file) to a .ccl file, or a MIB (.mib file) to a .bin file

-a, --annotate AnnotationFile

YANG users that are utilizing the tailf:annotate extension must use this flag to indicate the YANG annotation file(s).

This parameter can be given multiple times.

--deviation DeviationFile

Indicates that deviations from the module in DeviationFile should be present in the fxs file.

This parameter can be given multiple times.

-Ffeatures, --feature features

Indicates that support for the YANG features should be present in the fxs file. features is a string on the form modulename:[feature(,feature)*]

This option is used to prune the data model by removing all nodes that are defined with a "if-feature" that is not listed as feature.

This option can be given multiple times.

If this option is not given, nothing is pruned, i.e., it works as if all features were explicitly listed.

If the module uses a feature defined in an imported YANG module, it must be given as modulename:feature.

--no-yang-source

By default, the YANG module and submodules source is included in the fxs file, so that a NETCONF or RESTCONF client can download the module from the server.

If this option is given, the YANG source is not included.

--no-features

Indicates that no YANG features from the given module are supported.

--ignore-unknown-features

Instructs the compiler to not give an error if an unknown feature is specified with --feature.

-p, --prefix Prefix

ConfD needs to have a unique prefix for each loaded YANG module, which is used e.g. in the CLI and in the APIs. By default the prefix defined in the YANG module is used, but this prefix is not required to be unique across modules. This option can be used to specify an alternate prefix in case of conflicts. The special value 'module-name' means that the module name will be used for this prefix.

--use-description [always]

Normally, 'description' statements are ignored by confdc. Instead the 'tailf:info' statement is used as help and information text in the CLI and Web UI. When this option is specified, text in 'description' statements is used if no 'tailf:info' statement is present. If the option always is given, 'description' is used even if 'tailf:info' is present.

--export Agent ...

Makes the namespace visible to Agent. Agent is either "none", "all", "netconf", "snmp", "cli", "webui", "rest" or a free-text string. This option overrides any tailf:export statements in the module. The option "all" makes it visible to all agents. Use "none" to make it invisible to all agents.

--subagent MountPath

This option is used to compile a subagent's YANG modules for the master agent. It tells the master agent that this namespace is handled by a subagent. MountPath is an XPath expression (without instance selectors) where the namespace is mounted in the master agent's data hierarchy.

--fail-on-warnings

Make compilation fail on warnings.

-W ErrorCode

Treat ErrorCode as a warning, even if --fail-on-warnings is given. ErrorCode must be a warning or a minor error.

Use --list-errors to get a listing of all errors and warnings.

The following example treats all warnings except the warning for dependency mismatch as errors:

$ confdc -c --fail-on-warnings -W TAILF_DEPENDENCY_MISMATCH
-w ErrorCode

Do not report the warning ErrorCode, even if --fail-on-warnings is given. ErrorCode must be a warning.

Use --list-errors to get a listing of all errors and warnings.

The following example ignores the warning TAILF_DEPENDENCY_MISMATCH:

$ confdc -c -w TAILF_DEPENDENCY_MISMATCH
-E ErrorCode

Treat the warning ErrorCode as an error.

Use --list-errors to get a listing of all errors and warnings.

The following example treats only the warning for unused import as an error:

$ confdc -c -E UNUSED_IMPORT
--strict-yang

Force strict YANG compliance. Currently this checks that the deref() function is not used in XPath expressions and leafrefs.

Standard MIB to YANG options

--mib2yang-std MibFile

Generate a YANG file from the MIB module (.mib file), in accordance with the IETF standard, RFC-6643.

If the MIB IMPORTs other MIBs, these MIBs must be available (as .mib files) to the compiler when a YANG module is generated. By default, all MIBs in the current directory and all builtin MIBs are available. Since the compiler uses the tool smidump to perform the conversion to YANG, the environment variable SMIPATH can be set to a colon-separated list of directories to search for MIB files.

-p, --prefix Prefix

Specify a prefix to use in the generated YANG module.

An appendix to the RFC describes how the prefix is automatically generated, but such an automatically generated prefix is not always unique, and ConfD requires unique prefixes in all loaded modules.

Standard MIB to YANG modification options

--mib2yang-mods MibFile

Generate a combined YANG deviation/annotation file from the MIB module (.mib file), which can be used to compile the yang file generated by --mib2yang-std, to achieve a similar result as with the non-standard --mib2yang translation.

-p, --prefix Prefix

Specify a prefix to use in the generated YANG module.

An appendix to the RFC describes how the prefix is automatically generated, but such an automatically generated prefix is not always unique, and ConfD requires unique prefixes in all loaded modules.

--mib-annotation MibA

Provide a MIB annotation file to control how to override the standard translation of specific MIB objects to YANG. See mib_annotations(5).

--revision Date

Generate a revision statement with the provided Date as value in the deviation/annotation file.

--namespace Uri

Specify a uri to use as namespace in the generated deviation/annotation module.

--keep-readonly

Do not generate any deviations of the standard config (false) statements. Without this flag, config statements will be deviated to true on yang nodes corresponding to writable MIB objects.

MIB to YANG options

--mib2yang MibFile

Generate a YANG file from the MIB module (.mib file).

If the MIB IMPORTs other MIBs, these MIBs must be available (as .mib files) to the compiler when a YANG module is generated. By default, all MIBs in the current directory and all builtin MIBs are available. Since the compiler uses the tool smidump to perform the conversion to YANG, the environment variable SMIPATH can be set to a colon-separated list of directories to search for MIB files.

-u, --uri Uri

Specify a uri to use as namespace in the generated YANG module.

-p, --prefix Prefix

Specify a prefix to use in the generated YANG module.

--mib-annotation MibA

Provide a MIB annotation file to control how to translate specific MIB objects to YANG. See mib_annotations(5).

--snmp-name

Generate the YANG statement "tailf:snmp-name" instead of "tailf:snmp-oid".

--read-only

Generate a YANG module where all nodes are "config false".

MIB compiler options

-c, --compile MibFile

Compile a MIB module (.mib file) to a .bin file.

If the MIB IMPORTs other MIBs, these MIBs must be available (as compiled .bin files) to the compiler. By default, all compiled MIBs in the current directory and all builtin MIBs are available. Use the parameters --include-dir or --include-file to specify where the compiler can find the compiled MIBs.

--verbose

Print extra debug info during compilation.

--read-only

Compile the MIB as read-only. All SET attempts over SNMP will be rejected.

-I, --include-dir Dir

Add the directory Dir to the list of directories to be searched for IMPORTed MIBs (.bin files).

--include-file File

Add File to the list of files of IMPORTed (compiled) MIB files. File must be a .bin file.

--fail-on-warnings

Make compilation fail on warnings.

--warn-on-type-errors

Warn rather than give error on type checks performed by the MIB compiler.

--warn-on-access-mismatch

Give a warning if an SNMP object has read only access to a config object.

--mib-annotation MibA

Provide a MIB annotation file to fine-tune how specific MIB objects should behave in the SNMP agent. See mib_annotations(5).

Emit C header file options

--emit-h HFile

Generate a .h utility header file to be used when working with the ConfD C APIs.

Note

When the header file is generated from a YANG (.yang/.yin) file, the YANG file is currently compiled to a temporary .fxs file as an intermediary step.

--macro-prefix Prefix

Without this option, all macro definitions in the generated .h file are prepended with the argument of the prefix statement in the YANG module. If this option is used, the macro definitions are prepended with Prefix instead.

--include-type

If this option is used all macro definitions for enums in the generated .h file have the type name as part of their name.

--exclude-enums

If this option is used, macro definitions for enums are omitted from the generated .h file. This can in some cases be useful to avoid conflicts between enum symbols, or between enums and other symbols.

--fail-on-warnings

If this option is used all warnings are treated as errors and confdc will fail its execution.

Emit Erlang header file options

--emit-hrl HrlFile

Generate a .hrl utility header file to be used when working with the ConfD Erlang APIs.

Note

When the header file is generated from a YANG (.yang/.yin) file, the YANG file is currently compiled to a temporary .fxs file as an intermediary step.

--macro-prefix Prefix

Without this option, all macro definitions in the generated .hrl file are prepended with the argument of the prefix statement in the YANG module. If this option is used, the macro definitions are prepended with Prefix instead.

--include-type

If this option is used all macro definitions for enums in the generated .hrl file have the type name as part of their name.

--exclude-enums

If this option is used, macro definitions for enums are omitted from the generated .hrl file. This can in some cases be useful to avoid conflicts between enum symbols, or between enums and other symbols.

--fail-on-warnings

If this option is used all warnings are treated as errors and confdc will fail its execution.

Emit SMIv2 MIB options

--emit-mib MibFile

Generates a MIB file for use with SNMP agents/managers. See the appropriate section in the SNMP agent chapter in the ConfD User Guide for more information.

--join-names capitalize

Join element names without separator, but capitalizing, to get the MIB name. This is the default.

--join-names hyphen

Join element names with hyphens to get the MIB name.

--join-names force-capitalize

The characters '.' and '_' can occur in YANG identifiers but not in SNMP identifiers; they are converted to hyphens, unless this option is given. In this case, such identifiers are capitalized (to lowerCamelCase).

--oid OID

Let OID be the top object's OID. If the first component of the OID is a name not defined in SNMPv2-SMI, the --import option is also needed in order to produce a valid MIB module, to import the name from the proper module. If this option is not given, a tailf:snmp-oid statement must be specified in the YANG header.

--tagpath Path

Generate the MIB only for a subtree of the module. The Path argument is an absolute schema node identifier, and it must refer to container nodes only.

--import Module Name

Add an IMPORT statement which imports Name from the MIB Module.

--top Name

Let Name be the name of the top object.

--module Name

Let Name be the module name. If a tailf:snmp-mib-module-name statement is in the YANG header, the two names must be equal.

--generate-oids

Translate all data nodes into MIB objects, and generate OIDs for data nodes without tailf:snmp-oid statements.

--generate-yang-annotation

Generate a YANG annotation file containing the tailf:snmp-oid, tailf:snmp-mib-module-name and tailf:snmp-row-status-column statements for the nodes. Implies --skip-symlinks.

--skip-symlinks

Do not generate MIB objects for data nodes modeled through symlinks.

--fail-on-warnings

If this option is used all warnings are treated as errors and confdc will fail its execution.

--no-comments

If this option is used no additional comments will be generated in the MIB.

--read-only

If this option is used all objects in the MIB will be read only.

--prefix String

Prefix all MIB object names with String.

Emit SNMP user options

--snmpuser EngineID User AuthType PrivType PassPhrase

Generates a user entry with localized keys for the specified engine identifier. The output is an usmUserEntry in XML format that can be used in an initiation file for the SNMP-USER-BASED-SM-MIB::usmUserTable. In short this command provides key generation for users in SNMP v3. This option takes five arguments: The EngineID is either a string or a colon separated hexlist, or a dot separated octet list. The User argument is a string specifying the user name. The AuthType argument is one of md5, sha, or none. The PrivType argument is one of des, aes, or none. The PassPhrase argument is a string.

Emit Java options

--emit-java JFile

Generate a .java ConfNamespace file from a .fxs file to be used when working with the Java library. The file is useful, but not necessary when working with the NAVU library. JFile could either be a file or a directory. If JFile is a directory the resulting .java file will be created in that directory with a name based on the module name in the YANG module. If JFile is not a directory that file is created. Use --print-java-filename to get the resulting file name.

--print-java-filename

Only print the resulting java file name. Due to restrictions of identifiers in Java the name of the Class and thus the name of the file might get changed if non Java characters are used in the name of the file or in the name of the module. If this option is used no file is emitted the name of the file which would be created is just printed on stdout.

--java-package Package

If this option is used the generated java file will have the given package declaration at the top.

--exclude-enums

If this option is used, definitions for enums are omitted from the generated java file. This can in some cases be useful to avoid conflicts between enum symbols, or between enums and other symbols.

--fail-on-warnings

If this option is used all warnings are treated as errors and confdc will fail its execution.

-f, --fxsdep FxsFileOrDir...

.fxs files (or directories containing .fxs files) to be used to resolve cross namespace dependencies.

Misc options

--strip-yang-source FxsFile

Removes included YANG source from the fxs file. This makes the file smaller, but it means that the YANG module and submodules cannot be downloaded from the server, unless they are present in the load path.

--get-info FxsFile

Various info about the file is printed on standard output, including the names of the source files used to produce this file, which confdc version was used, and for fxs files, namespace URI, other namespaces the file depends on, namespace prefix, and mount point.

--get-uri FxsFile

Extract the namespace URI.

--version

Reports the confdc version.

EXAMPLE

Assume we have the file system.yang:

module system {
  namespace "http://example.com/ns/gargleblaster";
  prefix "gb";

  import ietf-inet-types {
    prefix inet;
  }
  container servers {
    list server {
      key name;
      leaf name {
        type string;
      }
      leaf ip {
        type inet:ip-address;
      }
      leaf port {
        type inet:port-number;
      }
    }
  }
}

To compile this file we do:

$ confdc -c system.yang

If we intend to access data from this module from our C programs, it is meaningful to generate a .h file like this:

$ confdc -c --emit-h blaster.h system.fxs

The .h file contains #define entries for the different nodes in system.yang. C code that needs to manipulate or read data from this module will typically need to include the generated .h file.

If we intend to manipulate this data from our Java programs, we must typically also invoke:

$ confdc --emit-java blaster.java system.fxs
    

Finally we show how to compile a clispec into a loadable format:

$ confdc -c mycli.cli
$ ls mycli.ccl
myccl.ccl

DIAGNOSTICS

On success exit status is 0. On failure 1. Any error message is printed to stderr.

YANG 1.1

ConfD supports YANG 1.1, as defined in draft-ietf-netmod-rfc6020bis-12, with the following exceptions:

  • Type empty in unions and in list keys is not supported.

  • Type leafref in unions are not validated, and treated as a string internally.

  • anydata is not supported.

  • The new scoping rules for submodules are not implemented. Specifically, a submodule must still include other submodules in order to access definitions defined there.

  • Inline notification statements are handled by the compiler, but not supported in the APIs.

  • The new XPath functions derived-from() and derived-from-or-self() can only be using with literal strings in the second argument.

  • Leafref paths without prefixes in top-level typedefs are handled as in YANG 1.

SEE ALSO

The ConfD User Guide

confd (1)

command to start and control the ConfD daemon

confd.conf (5)

ConfD daemon configuration file format

clispec(5)

CLI specification file format

mib_annotations(5)

MIB annotations file format