A method of regenerating a network device configuration command based on configuration
data stored in the network device is provided. The configuration data is created
as a result of parsing and processing of the configuration command. The command
comprises at least one command element that can have a plurality of values. At
least one linear node is created and stored in a parse tree for representing said
at least one command element. The linear node comprises a begin option node having
a single entrance; a next option node coupled to the begin option node; and an
end option node coupled to the begin option node. The end option node has a single
exit. A linear command regeneration template is created and stored in a memory.
The linear command regeneration template comprises information identifying how
to regenerate a command. The command is then regenerated based on the linear command
regeneration template and based on data from a database. Each of the plurality
of branches represents one possible value of a command element of the configuration
command. Each branch is connected back to the begin option node through a next
option node. During parsing of a command, each command element is represented by
a different linear node.