DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

additional modules and submodules is included, if
needed. import is used to refer to definitions in another
YANG module. It pulls references from the YANG
module but does not actually pull in the body of the file
that’s being imported. It’s very common to have
definitions of data types and groupings defined in a
module that are imported and used in several other
modules. The include statement is used to pull a
submodule into a main module. A module does not have
to be contained in a single file. It can easily be split into
several submodules for maintenance purposes and for
easier separation of content. The include statement
completely pulls the submodule into the main module.


After the import and include sections of the data
model, an optional section of data type definitions
follows. This is where any extra data types that are
needed to build the module are defined. The next section
is where the actual data model is built. All the
configuration and operational data declarations are in
this part. An optional section at the end is used to define
custom RPCs and notifications.


A YANG data model can be defined by combining all the
data nodes discussed earlier in this chapter. Example 12-
4 shows this in a YANG data model example.


Example 12-4 YANG Data Model Example

Click here to view code image


// Contents of "bogus-interfaces.yang"
module bogus-interfaces {
namespace
"http://bogus.example.com/interfaces";
prefix "bogus";
import "ietf-yang-types" {
prefix yang;
}
organization "Bogus Inc.";
contact "[email protected]";
description
Free download pdf