A method of automatically parsing a network device configuration and
generating a representation of one or more configuration commands for a
network device that uses a command-line interface, using a grammar-based
framework, is disclosed. One or more syntax definitions are received for
a grammar associated with the command-line interface. The syntax
definitions are compiled into a grammar object that represents the
grammar. A configuration of the network device is received. The
configuration is parsed using the grammar object. One or more
configuration values are created and stored based on parsing the
configuration. Using the configuration values, operating system version
information, and the grammar object, one or more command-line interface
commands may be automatically generated for use in configuring the device
or other network management purposes. Further, applications may use the
parameter values to customize a graphical user interface, perform range
checking, etc.