2  yangdiff-pro User Guide

 

graphics18

 

2.1  Introduction

The yangdiff-pro program is used to compare two revisions of the same YANG file.  

2.1.1  Features

The yangdiff-pro program has the following features:

2.1.2  Starting yangdiff-pro

The current working directory in use when yangdiff-pro is invoked is important.  It is most convenient to run yangdiff-pro from a work directory, rather than the installation directory or within the module library.

The yangdiff-pro program can be invoked several ways:

 

 

yangdiff-pro --version

 

 

yangdiff-pro --help

yangdiff-pro --help --brief

yangdiff-pro --help --full

 

 

yangdiff-pro --old=foo.2008-09-01.yang --new=foo

 

 

yangdiff-pro --config=~/yangdiff-pro-project1.conf

 

 

yangdiff-pro --difftype=terse
--output=~/project-X-diffs.log \

--old=/public/project-X/modules \

--new=/work

 

 

 

yangdiff-pro --difftype=revision
--output=~/foo-project-X-revision.txt \

--old=/public/project-X/modules \

--new=/work/foo.yang

 

 

 

2.1.3  Stopping yangdiff-pro

There is no interactive mode for yangdiff-pro, so there is no need for a command to exit the program.

The Control C character sequence can be used to cancel the yangdiff-pro processing in progress.  However, this will leave any partially completed output files in place.

 

2.1.4  Configuration Parameter List

The following configuration parameters are used by yangdiff-pro.  Refer to the CLI Reference for more details.

yangdiff-pro CLI Parameters

 

parameter

description

--config

Specifies the configuration file to use for parameters.

--datapath

Sets the data file search path.

--difftype

Specifies the type of differences report that should be output.

--feature-disable

Leaf list of features to disable

--feature-enable

Specifies a feature that should be enabled

--feature-enable-default

Specifies if a feature should be enabled or disabled by default

--header

Specifies whether the module header data should be compared or not.

--help

Get context-sensitive help, then exit.

--help-mode

Adjust the help output (--brief, or --full).

--home

Override $HOME environment variable

--indent

Specifies the indent count to use when writing data.

--log

Specifies the log file to use instead of STDOUT. See the YumaPro User Manual for a general discussion of logging.

--log-append

Controls whether a log file will be reused or overwritten.

--log-level

Specifies verbosity level of log message output

--modpath

Sets the module search path.

--new

Specifies the location of the new revision to compare.

--no-config

Specifies that the default config file should not be loaded

--old

Specifies the location of the old revision to compare.

--output

Specifies where output files should be generated.

--runpath

Sets the executable file search path.

--subdirs

Controls whether sub-directories are searched for YANG files.

--version

Prints the program version and then exit.

--warn-idlen

Controls how identifier lengths are checked.

--warn-error

Treat all warnings as errors

--warn-linelen

Controls how line lengths are checked.

--warn-off

Suppresses the specified warning number.

--warn-up

Elevates the specified warning number to an error

--yumapro-home

Specifies the $YUMAPRO_HOME project root to use when searching for files.

2.2  Comparing YANG Modules

The yangdiff-pro program compares YANG files in the following maner:

If the --old parameter is missing, then the module search path will be used to find the specified module with the same name.  If the --old parameter contains just a module name, then the module search path will be used to find a module with the new name.

The --new parameter is required.  It can represent one YANG file or a directory of new YANG modules.

The --difftype parameter is optional.  The 'normal' report mode is used if this parameter is missing.

The --output parameter will be used for the report file, if it is specified.

 

symbol

description

A

Definition has bend added.

M

Definition has been modified.

D

Definition has been deleted.

 

2.3  Diff Reports

 

This section uses the example module below (test/test3a.yang) to demonstrate the different report formats available.  The old module revision is test/test3.yang.

The following command is used in all 3 examples, except the value of the --difftype parameter is changed each time.

 

 

yangdiff-pro --old=test3a --new=test3 --difftype=<enum>

 

 

2.3.1  Terse Report

If --difftype=terse is selected, then a brief summary of all changes will be listed.  There will be no indentation, and only the change (Add, Modify, Delete), and the top-level definition is identified.

 

 

// Generated by yangdiff-pro 0.9.7.473

// Copyright (c) 2009, Netconf Central, All Rights Reserved.

 

// old: test3 (2008-10-19) test3.yang

// new: test3 (2009-09-09) test3a.yang

 

D revision '2008-10-19'

A revision '2009-09-09'

A feature X

A identity testbase

A identity testbase1

M typedef C

D container test-D1

D leaf test-D

M container test33

 

 

2.3.2  Normal Report

If --difftype=normal is selected, then a complete summary of all changes will be listed.

If a change line is indented, it indicates a sub-statement of the object in the previous line has been changed.

 

 

// Generated by yangdiff-pro 0.9.7.473

// Copyright (c) 2009, Netconf Central, All Rights Reserved.

 

// old: test3 (2008-10-19) test3.yang

// new: test3 (2009-09-09) test3a.yang

 

D revision '2008-10-19'

A revision '2009-09-09'

A feature X

A identity testbase

A identity testbase1

M typedef C

   M type

      M range from 'min .. 41 | 45' to 'min .. 41'

D container test-D1

D leaf test-D

M container test33

   D presence 'not a top-level mand...'

   M choice f

      M case f1

         M leaf f1

            A if-feature 'X'

 

 

2.3.3  Revision Statement

If --difftype=revision is selected, then a complete summary of all changes will be printed in the form of a YANG revision statement.  The current date will be used for the revision-date field of the revision statement.

 

 

// Generated by yangdiff-pro 0.9.7.473

// Copyright (c) 2009, Netconf Central, All Rights Reserved.

 

// old: test3 (2008-10-19) test3.yang

// new: test3 (2009-09-09) test3a.yang

 

   revision 2009-09-10 {

      description "

         - Removed revision '2008-10-19'

         - Added revision '2009-09-09'

         - Added feature X

         - Added identity testbase

         - Added identity testbase1

         - Changed typedef C

            - Changed type

               - Changed range from 'min .. 41 | 45' to 'min .. 41'

         - Removed container test-D1

         - Removed leaf test-D

         - Changed container test33

            - Removed presence 'not a top-level mand...'

            - Changed choice f

               - Changed case f1

                  - Changed leaf f1

                     - Added if-feature 'X'

      ";

   }