# Patent

## Title
Method and apparatus for data model prediction

## Abstract

Data Model Prediction tries to emulate the existing non-programmable interfaces by accurately predicting the data structures and operations required to provide the programmable interfaces.

## Background
PRIORITY CLAIM; CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims benefit of Provisional Appln. 60/521,636, filed Jun. 8, 2004, the entire contents of which is hereby incorporated by reference as if fully set forth herein, under 35 U.S.C. §119(e).
This application is related to U.S. application Ser. No. 11/148,709, filed Jun. 8, 2005, of Krishnam Raju Datla et al., entitled “Apparatus and Method for Intelligent Configuration Editor,” U.S. application Ser. No. 11/148,725, filed Jun. 8, 2005, of Krishnam Raju Datla et al., entitled “Apparatus and Method for Programmable Network Intelligence,” U.S. application Ser. No. 11/148,489, filed Jun. 8, 2005, of Krishnam Raju Datla et al., entitled “Method and Apparatus Providing Unified Compliant Network Audit,”; and U.S. application Ser. No. 11/148,708, filed Jun. 8, 2005, of Krishnam Raju Datla et al., entitled “Configuration Syntax and Semantic Validation”.


FIELD OF THE INVENTION
The present invention generally relates to network management. The invention relates more specifically to approaches for modeling data useful in network device configuration.
COPYRIGHT NOTICE
A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
BACKGROUND
The approaches described in this section could be pursued, but are not necessarily approaches that have been previously conceived or pursued. Therefore, unless otherwise indicated herein, the approaches described in this section are not prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
A typical network device, such as a router or a switch as used in packet-switched networks, provides a command line interface (CLI) that is accessible through Telnet, Secure Shell (SSH) and serial port interface for changing the device status or configuration. Each configuration command for the device has an associated syntax. A Network Management Station (NMS) can use the configuration commands to provide a higher level or enhanced management capability to the network operator. The NMS requires knowledge of the device configuration commands and the syntax of the commands to perform changing the configuration of a device.
One disadvantage with a CLI is that it is suitable for a human operator, but not for programs that can configure and control the device. A programmable API is required for such tasks. The devices can be built with programmable APIs, but providing a programmable interface on already existing systems and devices can be very expensive, if not impractical. It would be beneficial to have an automated approach for generating a programmable interface for an existing device or for devices that are already deployed at operating sites.
The NETCONF network device configuration protocol under development by the Internet Engineering Task Force (IETF) provides mechanisms to install, manipulate, and delete the configuration of network devices. It uses an Extensible Markup Language (XML) based data encoding for the configuration data as well as the protocol messages. The NETCONF protocol operations are realized on top of a Remote Procedure Call (RPC) layer. NETCONF is an emerging standard, and many network devices do not presently support it. Further, many network devices cannot directly execute commands that are delivered in XML, and many network management applications cannot interoperate with XML documents that conform to NETCONF.
Certain past approaches have attempted to implement a configuration interface layer on top of the CLI supported by Cisco IOS Software from Cisco Systems, Inc. These approaches have supported a narrow range of device types and configuration. These implementations also have required manual coding of the CLI rules, and since the data model is custom, have also required manual coding of processes for transformation of the model to the CLI and CLI to the model.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:
FIG. 1A is a block diagram that illustrates an overview of a Data Model Prediction engine and its components.
FIG. 1B is a block diagram showing one embodiment of an EDI runtime system.
FIG. 2 is a block diagram showing organization of command modes in a network operating system.
FIG. 3 is a block diagram of an example network device command using a containment model.
FIG. 4 is a class diagram of object classes that may be used to implement a CLI command structure.
FIG. 5A is a diagram showing a first example CLI parser graph.
FIG. 5B is a diagram showing a second example CLI parser graph.
FIG. 6 shows a sample hierarchy of an IDM package.
FIG. 7 is a diagram that illustrates an example structure of the intermediate data model.
FIG. 8 illustrates the general structure of an intermediate data model instance.
FIG. 9A, FIG. 9B are diagrams showing the general mapping between a Keyword parser node and a Non-keyword parser node, and their corresponding IDM container and XSD structure.
FIG. 9C illustrates Sequence and Loop Containers and their associated CLI and XSD structure.
FIG. 10A, FIG. 10B are diagrams of IDM data structures based on and corresponding to FIG. 5A, FIG. 5B.
FIG. 11 illustrates delete operation and cardinality relationships.
FIG. 12 illustrates four cases in which Naming Properties may be detected.
FIG. 13A illustrates CLI to XML transformation for an example set of nodes A to H, inclusive.
FIG. 13B illustrates XML to CLI transformation for the nodes shown in the example of FIG. 13A.
FIG. 14 illustrates example main classes that may be used to implement an intermediate model builder program.
FIG. 15 is a block diagram that illustrates a computer system upon which an embodiment may be implemented.



DETAILED DESCRIPTION
A method and apparatus for data model prediction is described. In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention.
Embodiments are described herein according to the following outline:

    
    
        1.0 General Overview
        2.0 Structural and Functional Overview
        3.0 Method and Apparatus for Data Model Prediction
        
            3.1 EDI Runtime System
            3.2 CLI View Data Structure
            3.3 Intermediate Model Data Structure
            3.4 Building An Intermediate Data Model Based On A Command Line Interface Data Model
            3.5 Transformation From CLI To XML Format
            3.6 Transformation Error Handling
            3.7 Example Interface Design
        
        
        4.0 Implementation Mechanisms—Hardware Overview
        5.0 Extensions and Alternatives
    
    


The following acronyms have the following definitions throughout this document:

    
    
        CLI: Command Line Interface
        C2X: CLI to XML
        E-DI: Enhanced Device Interface
        IDM: Intermediate Data Model
        IDM View: The IDM graph data structure
        CLI View: The CLI parser graph data structure
        PCA: Parse Chain Analyzer
        X2C: XML to CLI
        kw: Keyword
        non-kw: Non-keyword
        minOcc: Minimum occurrences
        cr: Carriage return position for command
        negCr: Carriage return position for negation command

1.0 General Overview

    
    


The needs identified in the foregoing Background, and other needs and objects that will become apparent for the following description, are achieved in the present invention, which comprises, in one aspect, a method for data model prediction, comprising the machine-implemented steps of receiving one or more command line interface commands associated with a network device; creating and storing a knowledge base comprising a representation of a syntax and semantics of the commands; receiving from the knowledge base a data structure representing a particular configuration command among the commands; and creating and storing an intermediate data model that represents the configuration command.
According to a feature, creating the intermediate data model includes predicting one or more attributes of the configuration command, and in response to programmatic input, selectively transforming the intermediate data model into a text representation of the particular configuration command or into a structured document representation of the particular configuration command. According to another feature, the knowledge base is created and stored in an automatic command learning process based on receiving and interpreting a plurality of the commands as the commands are provided to the network device.
In various other features, the predicting includes predicting one or more names of one or more parameters to the particular configuration command, or the predicting includes predicting whether a particular parameter is mandatory or optional to complete the particular command, or the predicting includes predicting data types of the parameters, or the predicting includes predicting a cardinality attribute of the particular configuration command, or the predicting includes predicting an order of the parameters.
In one feature, the intermediate data model represents a command using one or more container objects and one or more properties objects. In another feature, the knowledge base is created based on receiving information from one or more CLI management information bases (MIBs) and one or more SNMP MIBs supported on the device.
In still another feature, selectively transforming includes selectively transforming the intermediate data model into an extensible markup language (XML) representation of the particular configuration command. In a related feature, the XML representation conforms to NETCONF protocol and is transformed in response to receiving one or more NETCONF XML requests.
In other aspects, the invention encompasses a computer apparatus and a computer-readable medium configured to carry out the foregoing steps.
2.0 Structural and Functional Overview
According to one embodiment, the approach described herein can build a data model that accurately represents the command line interface that is supported by one or more network devices. The data model predicts the data structures required to generate the device native commands. The data model can be used to generate programmable interfaces, which can be used by other programs or network management systems to configure and control the devices.
A Data Model Prediction approach disclosed herein attempts tries to derive the data structures required to represent native commands supported on a particular device. Generally, device commands follow certain syntax and semantics, and may take one or more parameters. Each parameter may have an associated type and constraints. Some parameters may be mandatory and others are optional. The syntax for a particular device may require parameters to appear in a particular sequence. A command can have a single instance or multiple instances.
In one embodiment, automated logic builds a knowledge base that represents the commands and the syntax for each command supported by a device under one or more command views. In an embodiment, a Capability Detection engine builds the knowledge base. The knowledge base may comprise information stored in a database either in the form of binary data, text, or a set of structured electronic documents, e.g., XML documents. The Data Model Prediction approach herein uses the command knowledge base to build an accurate data model.
According to an embodiment, the Data Model Prediction approach herein predicts the data structures and parameters in the data structures with the following aspects: Cardinality, which specifies if the number of instances allowed; whether a parameter is mandatory or optional; data type of parameters such as integer, Boolean, string, etc.; and order of the parameters present in the structure such as sequence, choice and all.
In one embodiment, predicted data structures are represented in the form of Containers and Properties. A Container can contain other Containers and Properties. A Property represents a leaf item in the hierarchy and may represent a specific parameter in the command.
In an embodiment, a command and its associated keywords and parameters are represented in a hierarchical structure of Containers and Properties. If a command has one keyword followed by a parameter, which defines the value for the keyword, then the command is represented by a property. As an example of a Data Model for a simple command, the command “hostname sj-rtr1” may be represented in XML format as: <Property Name=‘Hostname’Type=‘String’MinOcc=‘1’Annotation=‘hostname string’>
If a command has a keyword and followed by multiple parameters, then the command is represented by a Container which may contain other Containers and Properties. As an example of a Data Model for such a more complex command, the command “ip address ip_address mask [secondary]” may be represented as shown in Table 1:







TABLE 1





XML REPRESENTATION OF COMPLEX COMMAND















<Container Name=‘IPAddress’ MinOcc=‘1’ Order=‘jahi-idm:sequence’


Annotation=‘IP address’ >


 <Property Name=‘IPAddressValue’ Type=‘IPAddress’ MinOcc=‘1’


Annotation=‘IP address’ >


 </Property>


 <Property Name=‘IPSubnetMask’ Type=‘IPAddress’ MinOcc=‘1’


Annotation=‘IP subnet mask’ >


 </Property>


 <Property Name=‘Secondary’ Type=‘Boolean’ MinOcc=‘0’


Annotation=‘Make this IP address a secondary address’ >


 </Property>


</Container>









An embodiment determines a command name. Each container and property is identified with a name. The name is derived from the name of the parameter. Some parameters may not have associated name. In that case, a name is derived from the description of the parameter using natural language processing.
An embodiment determines whether a command parameter is mandatory or optional. Whether a parameter is mandatory or optional is predicted by analyzing the command and its parameters. If the command can be completed without a particular parameter, then the parameter is optional. If the command cannot be completed with a specific parameter, then that parameter is mandatory. If a parameter is optional, all the subsequent parameters may not be optional, and may be dependent on the predecessor parameters. All parameters are analyzed completely to determine if a parameter is mandatory or optional.
An embodiment determines the cardinality of a command. A command can have one or more instances. If a command has cardinality of 1, that is, a single instance, then issuing multiple such commands causes a device to overwrite previous commands and apply only the most recently ones. If a command has cardinality of more than 1, then issuing multiple such commands causes a device to create and apply multiple instances in the device configuration.
In one embodiment, the cardinality of a command is predicted using the negation version of that particular command. For example, assume a command has the form ‘hostname name’ and sets the name of the device in question. If the syntax of the negation command is ‘no hostname’ or ‘no hostname [name]’, which indicates that the ‘name’ is an optional parameter, then the ‘hostname’ command has cardinality of 1. If the negation command syntax is ‘no hostname name’, which indicates ‘name’ is a mandatory parameter that must be specified to negate the command, then the hostname command has cardinality of more than 1.
An embodiment determines the required order of parameters. A command can accept a parameter from a set of multiple parameters. In that case the data structure must specify the order as choice for the possible parameters. If the command has parameters that follow one another in a strict order, then the sequence must be used.
A parameter may have a data type for values it can accept, such as Integer, String, Boolean, IP address, etc. According to an embodiment, the data type for the values of parameters is predicted. If a parameter accepts only digits, then the type may be integer; if a parameter accepts characters as valid input, then the type is String; if the parameter expects a numeric string with subfields delimited using periods, then the type is IP address.
FIG. 1A is a block diagram that illustrates an overview of a Data Model Prediction engine and its components. A network element or network device 102 is coupled to a data model generating system 104 that comprises a capability detection engine 122 and a data modeling subsystem 124. Capability detection engine 122 comprises an SNMP detection engine 106 and SNMP to data model (DM) builder 110. Data modeling subsystem 124 comprises a command detection engine 112 and CLI view to DM builder 116. System 104 also is coupled to data storage 120.
In an alternative embodiment, system 104 is disconnected from the network device 102 and receives CLI commands from a configuration file, network management system, application, or user input terminal.
SNMP detection engine 106 and command detection engine 112 receive copies of commands that a user or application issues to network device 102. SNMP detection engine 106 detects commands that are issued using or conform to Simple Network Management Protocol (SNMP), and creates a structured representation of the commands in one or more SNMP XML documents 108. SNMP to DM builder 110 receives the SNMP XML documents and forms at least a part of data model 118 based on them.
Command detection engine 112 detects commands that are conform to a general execution or configuration command syntax for network device 102 and creates a structured representation of the commands in one or more command view XML documents 114. CLI view to DM builder 116 receives the XML documents and forms at least a part of data model 118 based on them.
3.0 Method and Apparatus for Data Model Prediction
A detailed description of example approaches for data model prediction are now described in the context of an Enhance Device Interface (E-DI) system that provides an XML programmatic interface for configuring network devices from Cisco Systems, Inc., San Jose, Calif., that run Cisco IOS® Software and Cisco CATOS Software. The E-DI system allows a network management application to configure Cisco devices using the IETF NETCONF protocol. The description in this section is provided merely as one example of how to make and use the general approaches that are otherwise described and claimed herein. Thus, the embodiment of this section is intended to provide one clear example but not to limit the full scope of the invention, which is set forth in the appended claims.
In overview, the E-DI XML interface provides for device configuration using a data model that follows closely the native device CLI command structure. The E-DI can replicate a complete CLI command set of the managed devices externally. Thus XML interface covers a complete set of capabilities that are available through the CLI. Furthermore, because E-DI uses an automated CLI learning process, E-DI can support to a wide variety device versions and software versions.
A foundation of XML interface includes a data model definition and processes providing for the transformation from XML to CLI (X2C) and CLI to XML (C2X). The following subsections describes the E-DI data model or Intermediate Data Model (IDM), an algorithm for deriving the data model from the CLI knowledge base, and algorithms for the X2C and C2X transformations.
In one embodiment, the E-DI interoperates with an automatically generated CLI command knowledge base. By generating the XML data model using a generic rule from the CLI knowledge base, E-DI can perform the X2C and C2X transformation. Therefore, the XML interface is not a separate feature that needs to be developed separately; instead, once the CLI is supported for a specific device, the XML interface is automatically available. Further, in an embodiment the E-DI data model, as its CLI counterpart, is device and software version specific, and reflects the true capabilities of the device.
3.1 EDI Runtime System
FIG. 1B is a block diagram showing one embodiment of an EDI runtime system. In one embodiment, EDI runtime system 130 comprises an IDM builder (1), X2C transform module (3), and C2X transform module (4). IDM builder (1) receives a CLI view 132 that provides a view of one or more CLI commands from a CLI knowledge base 140. IDM builder (1) builds an intermediate data model based on the CLI knowledge base, resulting in creating and temporarily storing an IDM data structure or IDM View (2). X2C transform module (3) and C2X transform module (4) are respectively responsible for transforming XML data 136 to one or more CLI commands 138 and CLI to XML, based on the IDM view (2). An XSD generator 134 also may interact with IDM view (2) to generate one or more XSD streams or documents.
In an embodiment, at run-time the IDM is built from the CLI View 132 on demand, as X2C and C2X transformation for a specific device type and software version is needed. To conserve memory, the IDM may be removed from memory when it is not used for an extended period of time.
3.2 CLI View Data Structure
The CLI View 132 is a graph of Parser Nodes that an E-DI CLI parser uses to parse or validate CLI that is entered by a user at an E-DI console. A CLI View 132 is created for each IOS CLI mode. Thus, a complete CLI knowledge base is composed of a set of CLI Views 132 bound by the entry commands that lead one view to another view.
In an embodiment, E-DI CLI Views 132 are packaged or organized per device family and major IOS release. For example, one package of the CLI knowledge base 140 is provided for the Cisco 29xx router family with IOS version 12.2. This document describes details of CLI structure that are relevant to IDM conversion.
FIG. 2 is a block diagram showing organization of command modes in a network operating system such as used in Cisco IOS Software. From the perspective of an external CLI user, commands are organized into a hierarchy of command modes as indicated by tree 204. A main command mode 200 has one or more sub-modes 202. A user enters a sub-mode 202 using an entry command 206 and exits the sub-mode using an exit command. In an embodiment, an external process, which is termed a FastTrack process 212 in one example embodiment, learns device CLI commands for each command mode. Therefore, the E-DI CLI knowledge base 140 is also organized according to the CLI modes, having one CLI View 132 per CLI mode.
As a comparison, FIG. 2 also shows how the commands within a CLI command mode relate to internal functional subsystems of a network operating system. The main command mode 200 includes a parser subsystem 208 and one or more functional subsystems 210A, 210B, 210C. The main command mode 200 is associated with commands 214, 216 contributed by many subsystems. Typically a command from a particular subsystem 210A, 210B, 210C will start with the same prefix, for example, “aaa <xxx>. Other sub-modes, other than the interface sub-modes, generally contain commands contributed by a specific subsystem.
FIG. 3 is a block diagram of an example network device command using a containment model. An E-DI CLI parser graph, described below, uses the containment model. In the containment model, a token such as command token 302 of a CLI command 300 contains zero or more tokens that represent valid tokens that can follow according to the syntax of the associated command.
A particular token may contain a <cr> (carriage return) tag that specifies that the command can terminate there, as seen in FIG. 5A, described further below. A particular token also may contain a <negCr> (negation carriage return) tag that specifies that the negation or “no” version of the command can terminate there. Proceeding downward from a root node such as mode node 304, the token that has the first <negCr> (from the root) can be used to specify a delineation of the command. A delineating node accepts a “delete” management operation that deletes the entire command from the IDM. Information below the delineating node represents parameters of the command, while information above the delineating node is grouping criteria (prefix) or a naming parameter (key) of the command.
In an embodiment, a command is defined strictly syntactically based on the first <negCr> position, not based on the actual semantic of the command. A CommandContainer may be a Container of one or more semantically separate but related commands.
In an embodiment, the CLI command structure is represented in E-DI as a graph of ParserNodes. Child nodes represent choices of next acceptable tokens following the parent node. A ParserNode can be visited from multiple parent nodes; thus a sub-graph or a node can be shared or referenced from multiple parent nodes. A node can also refer back to one of its ancestor nodes, creating a loop. Excluding any loops, if the shared sub-graphs or nodes were duplicated the structure would appear as a tree of CLI tokens.
FIG. 4 is a class diagram of object classes that may be used to implement a CLI command structure. A ParserNode class 402 comprises subclasses identified as a KeywordNode class 404, StringNode class 408, NumberNode class 410, and IpAddressNode class 412. The class and its subclasses may be implemented in an embodiment using an object-oriented computer programming environment with a language such as JAVA, C++, etc.
Each subclass represents a type of CLI input token. There are two basic categories of tokens: keyword token and parameter tokens. A keyword token is represented by the KeywordNode class 404, and parameter tokens are represented by StringNode class 408, NumberNode class 410, and IpAddressNode class 412, which are associated with command parameter nodes 406.
A simple example of the ParserNodes for a simple hostname command consists of only two nodes. More complex examples are shown in FIG. 5A, FIG. 5B. FIG. 5A is a diagram showing a first example CLI parser graph, and FIG. 5B is a diagram showing a second example CLI parser graph. Referring first to FIG. 5A, a parser graph 500 represents the following three commands:
1. “mpls”“label”“range”<min><max>[“static”<min><max>]
2. “mpls”“discovery”“hello”“holdtime”<holdtime>
3. “mpls”“discovery”“hello”“interval”<interval>
The commands represented in the graph may be delineated by walking the graph from the root “mpls” node 502 downward until the first <negCr> tag is reached in a branch of the graph. For example, the first command is delineated by visiting “mpls” node 502, “label” node 503, and “range node 504, which has a <negCr> tag. The third command is delineated by nodes 502, 505, 510, 508, which also has a <negCr> tag.
The second example of FIG. 5B illustrates a more complex graph in which a sub-graph and nodes are shared or referenced by multiple nodes. Specifically, graph 520 comprises a sub-graph 522 that a “DistributeList” node 524 references. Further, an “IPACLName” sub-graph 526 is referenced by both “in” node 532 and “out” node 530.
3.3 Intermediate Data Model Data Structure
In an embodiment, the IDM data model is packaged in a manner that mirrors the E-DI CLI view packaging. For each CLI command mode, a package is created. FIG. 6 shows a sample hierarchy of an IDM package. In one embodiment, a hierarchy 600 comprises a root node 602 representing a root configuration mode and one or more child nodes 604A, 604B representing top level configuration modes. Each child node 604 may have one or more further child nodes 606 that represent corresponding command sub-modes. In an embodiment, hierarchy 600 is defined in one XSD document per command mode.
Since a common CLI View package may be shared across different devices in a device family and across devices that use different software versions, the IDM package associated with the shared CLI View may be shared as well. No IDM specific sharing is required.
According to an embodiment, the E-DI model provides for automatic definition of the data model from CLI and for automatic run-time transformation from XML to CLI and from CLI to XML. IDM automated model generation is facilitated using a data model that follows the CLI command structure. Elements and grouping of elements of the data model reflect the syntactical structure of the CLI and not necessarily the semantics of the elements.
Thus, the IDM structure matches almost one-to-one with the CLI model structure. In general, one leaf node of a CLI parser graph is associated with one leaf IDM node, such as a Property that represents a Value or Parameter. Further, one non-leaf IDM CLI node produces one non-leaf IDM node, namely a Container, and an optional leaf IDM node, which is a Property. A shared sub-graph in the CLI model also translates into a shared sub-graph in the IDM. Likewise, a loop in the CLI model translates into a loop in the IDM.
FIG. 7 is a diagram that illustrates an example structure of the intermediate data model. Non-leaf IDM nodes, such as nodes 7023, 704, 706, are Containers, and each leaf IDM node 708 is a Property. A leaf IDM node may be a Container that that represents a loop reference, as described further below.
To relate the IDM with the CLI commands from which it is derived, Containers are categorized, based on their position relative to the Mode and Command boundary, into CLI mode/submode ModeContainer, PrefixContainer, CommandContainer, and DataContainer objects.
A ModeContainer indicates the boundary of a CLI mode or submode.
A CommandContainer indicates the boundary of a CLI command. Some very simple commands may contain only one property and are directly contained under a ModeContainer or PrefixContainer. In this case, the CLI command boundary is the Property node. The definition of what a Command is strictly defined based on the first <negCr> position, not based on the actual semantic of the command. A CommandContainer may in-fact be a Container of one or more semantically separate but related commands.
A NamingContainer is a special container created to group the command's naming properties or keys for commands that can have multiple instances (non-singleton).
The IDM structure resembles a tree, but some nodes can have extra references from other parent nodes. These multi-reference IDM nodes correspond to multi-referenced CLI nodes.
In addition to categorization based on position, each Container can be categorized based on the order of its child nodes. Such an order relates to the syntactical constraints of an IDM XML configuration request for use in the X2C and C2X transformation processes, and not the model structure in the Device component. This ordering approach is consistent with CLI configuration rules in which the same command that affects the same data can appear more than once in configuration file, and the last command instance overrides all other previous instances of the same command.
In an embodiment, IDM uses, as Orders: Choice, Sequence, Sequence-of-Choice and Loop. Choice means that there can be only one child under the Container and it must be one of the child Containers or Properties. Sequence means that the child Containers or Properties must appear in the defined sequence. Sequence-of-Choice is a Sequence of zero or more members of the Choice. Loop is represents a looping or list structure; in XSD this is a sequence of group that contains a sequence and choice tags.
FIG. 8 illustrates the general structure of an intermediate data model instance. FIG. 8 shows how the CLI Model structure and the IDM structure are related. In general, one CLI Parser node maps to one or two IDM nodes: a Container, a Container and a Property or just a Property. In some cases a CLI Parser node does not map to any IDM node. Since a non-leaf CLI node denotes a Choice, most IDM Containers are either a Choice or a Sequence-of-Choice.
Since a non-keyword parser node represents a value, the non-keyword parser node maps to both a Container and Property. For example, CLI node D maps to IDM Sequence D and Value D. The extra Property is set as the Value Property of the Container and although it is stored as the first child of the Container it is not part of the Container Order. That is, the XSD order of a Choice with a Value Property is a Sequence of two items: the Value Property and a Choice the Container members except for the Value Property. This approach is illustrated in FIG. 9B, second row.
A Value Property that appears above the Command boundary is the Key Property Value, which is defined inside an extra Container called Naming. Thus, a non-keyword parser node maps into either a Choice Container and a Value, or a Sequence-of-Choice Container and a Naming Container.
FIG. 9A, FIG. 9B are diagrams showing the general mapping between a Keyword parser node and a Non-keyword parser node, and their corresponding IDM container and XSD structure. FIG. 9A shows a mapping for a keyword node container. FIG. 9B shows a mapping for a non-keyword node container.
In one embodiment, two exceptions to the Sequence-of-Choice and Choice Container types are provided: Sequence and Loop. A Sequence is created in a few cases in which a non-branching series of CLI parser nodes is found. In IDM a Sequence can only contain leaf Property nodes, and an optional Choice or Sequence-of-Choice last child. For example, structure (A (B |C) D) is invalid; instead it will be expressed as (A (BD+CD)).
In one embodiment, by mirroring the CLI Model structure, an IDM Container or Property name is derived from their associated CLI node. The name of an IDM Container represents a group of nodes that syntactically follow that Container node, but does not necessarily represent a semantic grouping of the child nodes.
A loop container is created when a CLI parser node revisit one of its ancestor node or itself. In IDM, the resulting loop is flattened, and instead of creating an infinite nesting structure, an infinite sequence is created. That is, instead of <x><x>. . . , the tags <x/><x>. . . are used. The use of loop containers is discussed further in this document.
FIG. 9C illustrates the Sequence and Loop Containers and their associated CLI and XSD structure.
FIG. 10A, FIG. 10B are diagrams of IDM data structures based on and corresponding to FIG. 5A, FIG. 5B. Referring first to FIG. 10A, a comparison with FIG. 5A shows that the node sequence “mpls” “label” “range” is converted into a Sequence, and that the other containers are transformed to a Choice node or Sequence-of-Choice node depending on the command boundary. FIG. 10B presents a sample IDM with multi-referenced nodes.
An embodiment of the IDM also supports a delete operation and cardinality functions. A close mirroring of the CLI model structure and the IDM structure is also reflected in how the CLI <cr> and <negCr> tags map to delete operations and cardinality concepts in the IDM. A <cr> tag in a CLI parser node means that the IDM Container associated with that node can be empty or does not require any child nodes. Therefore, the child nodes have a cardinality of minOcc=0 (optional). A <negCr> tag in a CLI parser node corresponds to a Container or Property that accepts a delete operation, or that can be empty. FIG. 11 illustrates the foregoing relationships.
In one embodiment, the effect of a delete operation is determined according to the following set of rules. The meaning of a delete operation depends on where the delete operations are specified. A delete operation specified in a NamingContainer node deletes a multi-instance command identified by the name inside the NamingContainer. Semantically, a delete operation specified in a NamingContainer node deletes multiple related configuration nodes that are identified by the key property. A delete operation in a CommandContainer node deletes a singleton command. For certain CommandContainer nodes, the delete operation deletes multiple related configuration sharing the same prefix. A delete operation in a Command Property node deletes a simple singleton command. A delete operation in the DataContainer or simple Property node sets the data to false or null.
According to one embodiment, the IDM provides X2C and C2X Mapping Data. Since the IDM is automatically generated from CLI data, and the IDM and CLI structure are similar, a relationship between the generated IDM node and CLI node is known. The mapping of all IDM Properties and an IDM Container with corresponding CLI nodes is captured for use in performing X2C and C2X transformation processes. Since the mapping is primarily done through the IDM Property, a CLI node maps to a Property if a Property is created from that CLI node. If only a Container is created, then the CLI node maps to the Container.
3.4 Building an Intermediate Data Model Based on a Command Line Interface Data Model
According to one embodiment, the IdmnBuilder module (1) FIG. 1B primarily determines, from an input CLI View 132, whether a CLI View element represents a Container or Property, the Container type, and the Order. These characteristics determine the basic structure of the IDM, to which the following additional information is added: Name of Container and Property; Description; Property type; Naming Property; Cardinality; and mapping information between IDM and CLI.
In an embodiment, the IDM is created using a recursive algorithm, implemented in appropriate software hosted on a general-purpose data processor configured as a network management station, which traverses the CLI parser graph. For example, a method Build( ) may be implemented according to the pseudocode of Table 2:







TABLE 2





PSEUDOCODE FOR BUILD METHOD















    Build (ParserNode,


     ParentParserNode,


     ParentContainer,


     PreviousBooleanProperty,


     UnusedName)


    {


1. Consume non-branching (down & up) keyword Parser Nodes and save


   the string for name.


2. Create a Container for ParserNode?


   Determine Container name.


   Use PreviousBooleanProperty and UnusedName for name conflict


   resolution.


3. Create a Property for ParseNode?


   Determine Property name.


   Use PreviousBooleanProperty and UnusedName for name conflict


   resolution.


   Add New Property to New Container or ParentContainer.


4. Recursively call Build( ) for each child nodes.


   }









The following further describes the rules used within the Build( ) method given in the example of Table 2.
Determining whether a Container or Property is represented is the primary decision in building the IDM. The decision determines the structure of the IDM model and affects the naming decision as well. The primary criteria in determining the presence of a Container or Property are the CLI parser node's child node count and the presence or absence of the <cr> and <negCr> tags. Generally, in an embodiment, a leaf CLI node maps to a Property, and a non-leaf IDM CLI node maps to a Container and optionally to a Property if the CLI node is a non-keyword node.
In one embodiment, logical rules implemented in the Build( ) method drive determining whether a Container or Property is represented. A container creation rule and a property creation rule may be implemented. For example, a container creation rule may express the logic shown in Table 3.







TABLE 3





CONTAINER CREATION RULE

















A new Container is created for a parser node if:



1. Node's hint (keyword string) = “interface”



2. Leads to a sub-mode.



3. # child nodes > 1



4. if # child node = 1



  a. if # sibling = 1 AND # grand-child > 1



  b. If it lead to a multi-referenced node.



  c. If it is a keyword with both <cr> and <negCr>










A Container can be created both for keyword and non-keyword parser nodes. A Container created from a keyword node that contains a <negCr> tag is a Boolean container since an empty container represents a Boolean value.
As another example, a property creation rule may provide that a Property is created for: a Non-keyword parser node; and a Leaf keyword parser node that has not been used to create a Boolean Container. In an embodiment, when both Container and Property are created for the same parser node, the Property is set as the Value Property of the Container. The new Container will be passed into the recursive Build( ) method to be used as a parent for the IDM node created for the child parser nodes. If no new Container and Property are created, then the collected keyword derived name is passed to all child node processing. Table 4 presents an example of the resulting model structure.







TABLE 4





MODEL STRUCTURE FOR CONTAINER AND PROPERTY

















Assume that a “cdp” command is contained in



DeviceConfiguration mode.









“cdp” ( “holdtime” <negCr> <number> <cr, negCr>









| “timer” <negCr> <number> <cr, negCr> )











0
|M
DeviceConfiguration // SEQ_OF_CHOICE




|
(



1
|P
 k:“CDP” // SEQ_OF_CHOICE




|
 (



2
|C-
  pk:“HoldTime” Integer (10,255)



3
|C-
  pk:“Timer” Integer (5,900




|
 )










In the example of Table 4, the “cdp” keyword becomes a Container because it has multiple child nodes. The “holdtime” value does not become a Container because it only has a <negCr> tag and not a <cr> tag. The name “HoldTime” is used in creating the integer property.
The Container Type signifies the position of the Container within the IDM Containment hierarchy. In an embodiment, the following rules are used to identify Container types.
1. ModeContainer is the root container created for a CLI mode.
2. CommandContainer is the first container from the root that has a <negCr>.
3. PrefixContainer is the container between (1) and (2).
4. DataContainer is the container under (2).
5. A special NamingContainer is created to contain naming properties.
Container Order determines the ordering constraints of an IDM XML configuration request. In an embodiment, the following are rules used to identify the Container Order for a given Parser Node and its parent. Since CLI nodes represent Choice order, the general rules are:
1. # of child node=0−> not a Container
2. # of child node >1−> a Choice for Command Container or below, and Sequence-of-Choice for Prefix Container. One exception is Member of a Container that contains Naming Container is a Sequence-of-Choice.
The exceptions to the rules are Sequence and Loop. A Sequence is created generally for a string of non-branching nodes below the Command boundary. Specifically, a node that satisfies the following condition maps to a Sequence:
# of child node=1 and
a. The child is a multi-referenced node.
b. The node has both <cr> and <negCR>.
c. # child=1 AND # of sibling>0, check the parent's first child. If parent's first child's child nodes>0, Container is Sequence.
In an embodiment, the Loop attribute is not determined during Container creation, but later when a loop condition is detected when the node is revisited. Loop creation is discussed separately herein.
In an embodiment, a Container name and Property name are determined. In one embodiment, a Container is named according to the logic in Table 5.







TABLE 5





NAMING A CONTAINER
















1.
For a keyword, use the hint or CLI keyword string. Except for



the following:



  If keyword is “interface” use “InterfaceName”.


2.
If a keyword has neither <cr> nor <negCr> and it is followed



by another keyword, keep processing the keyword and concatenate



the processed keyword strings. (The keyword must not be



multi-referenced.)


3.
Use the unused name from parent parser node as prefix.


4.
Check and resolve naming conflict within its parent Container.



(See Resolving Naming Conflicts subsection.)









According to an embodiment, a Property is named according to the logic of Table 6.







TABLE 6





NAMINIG A PROPERTY
















1.
Keyword-derived Boolean Property is named using keyword string.


2.
Non-Boolean Property is named as follows:



  If parent parser node has keyword with neither <cr>



nor <negCr>, and the keyword has not been used as Container name,



then use the parent keyword.



  Construct name from CLI description. (See Deriving Name



from Description subsection.)


3.
Use the unused name from parent parser node as prefix.


4.
Check and resolve naming conflict within its parent Container. (See



Resolving Naming Conflicts subsection.)









In one embodiment, a name may be derived from a description. Names derived from CLI keywords do not require extensive processing. However, names derived from description text requires additional rules so that the constructed name is well formed, and can be understood within the context of the Container. In one embodiment, to convert description text into a name, the description text is tokenized into words, and rules are applied to each word. After applying the word rules, additional rules are then applied to create the name.
In one embodiment, the rules for preparing the word tokens are driven by the data shown in Table 7, which can be stored along with a specific IDU to ensure that the naming for that package remains the same given a version of the naming algorithm.







TABLE 7





RULES FOR TOKENIZING WORDS
















1.
Ignore-able word. Words that are unimportant for naming are excluded, for example, the



word “the”.


2.
Ignore-able last word. This is to specify words that are to be ignored only if they appear at



the end.


3.
Last word requiring next word. This is to specify words the following word.


4.
Known suffix whose first letter must be capitalized. This is to specify common suffix



that should be treated like a separate word by capitalizing the first letter. E.g. Number.


5.
Character substitution. This is to replace some character such as % into percent.


6.
Word substitution. This is for replacing words that mean the same thing with the same



word. For example Address for addr.


7.
Phrase (multiple words) substitution. This is used to replace a multiple words with a



single word, and to ensure that the multiple tokens are included in the name and not



counted as separate words.


8.
Name Substitution. After the name is constructed using the generic rule, if required it can



be replaced with a custom name. To provide additional context, optionally the parser node



hint, and the parent parser node hint can also be specified; in this case the name is



substituted only if the parser node hints matches as well.









In one embodiment, the algorithm set forth in Table 8 is used.







TABLE 8





PROCESS FOR TOKENIZING WORDS
















1.
Create a list of words by tokenizing the description. Before tokenizing, erase some known



patterns from the string, such as [<][{circumflex over ( )}>]*[>]['][s]


2.
Tokenize based on the following separator: {}<>()[]-_,{circumflex over ( )}@#!‘\’\“$|.?;:\V=” and



excluding %,&,+,* which will be replaced with words instead


3.
For each word:










a.
Check words to ignore.



b.
Check for phrase substitution (multi-word analysis).



c.
Format the word:










i.
Check word substitution, if found use the substitute.



ii.
Check acronym substitution, if found use the acronym.



iii.
Do character substitution, then capitalize first letter and capitalize first letter




of known suffix.










d.
If name is empty, try blank out non alphanumeric characters in the line. (creating one




word list.)








4.
Make name from word list. Start by using 4 word. If not unique under its parent, try 5, 6,



7 up to 8 tokens. Name must be a valid XML element identifier.










a.
For first word, add “n” if it's number.



b.
For last word:










i.
check if it is last word to be ignored.



ii.
check if it's a last word that require following word.










c.
skip duplicate



d.
skip consecutive numeric tokens. This is for removing phrase that comes from a




range such as 10-100.



e.
If the word list is empty, (there are a few non-keyword parser node empty hint) then




as the last resort use the parser node name - “Node” + “Param”.










Certain embodiments provide for resolving naming conflicts. For example, an IDM Container and Property name must be unique within a parent Container. In most cases, such conflicts are caused by an insufficient number of tokens used in a name that is derived from a text description. In some cases, CLI could result in duplicated Properties derived from separate Parser nodes that are semantically equal. These observations may be used, in one embodiment, in a process summarized in the pseudo-code of Table 9, in which child node processing resolves naming conflicts.







TABLE 9





RESOLVING NAME CONFLICTS
















1.
Use description to construct name. Start with using 4 tokens or if



Candidate Name is already based on description, start with 5 tokens.



Repeat up to 8 tokens if necessary, until a unique name is found.


2.
If name from (1) is not unique, and the name was originally derived



from keyword, concatenate keyword name with description name



from (1).


3.
If name from (2) is not unique, and there is a preceding Property



within the same Container, use preceding Property name as prefix



separated with “-” to the candidate-name.


4.
As a last resort, if name from (3) is still not unique, add unique



number suffix to the name and report duplicate name.









Since the IDM processes described thus far do not understand the semantics of any of the commands, naming conflict resolution does not detect duplicated properties, and may result in semantically common Properties with different names. For example, the Properties MonthYear1, and MonthYear1-DayMonth are semantically same as MonthYear and DayMonth; however, they map to different CLI nodes, and hence result in duplicated names. In this case, the duplicate name MonthYear is resolved by adding “1” as suffix, and the duplicate name DayMonth is resolved by appending the MonthYear1 as prefix.
In one embodiment, a Key Property or Properties (compound key) uniquely identifies a parent Container from sibling Containers. For non-sub-mode commands, assuming that a single negation command will not clear multiple lines of configuration, Key Properties are detected by examining the Properties that precede the first <negCr> tag. For sub-mode commands, the Key Properties are Properties that precede the Sub-mode node. Not all actual Keys can be detected, however; one such exception is a list command.
FIG. 12 illustrates four cases in which Naming Properties may be detected. Key Properties that are identified in the model are grouped and moved into an extra Container named “Naming.”
In an embodiment, Property Data Types are derived from the CLI parser node types by stripping the “Node” suffix. Two exceptions are that a KeywordNode translates to Boolean, and a NumberNode translates to Integer. These are the basic Data Types that are exposed in the XSD documents; others may be provided in other embodiments.
In an embodiment, each Container and Property is marked to indicate whether it can be deleted. For example, a Container or Property created from one or more Parser Nodes that are followed by a <negCr> tag accepts “delete” operation in the XML request. The first <negCr> tag from the root that is associated with the CommandContainer corresponds to a delete operation to delete the entire Command Container. An inner <negCr> tag specifies disabling or nullifying only the Data Container or Property.
A Key Properties delete operation is moved to its Naming Container. The Naming Container becomes capable of deletion, and the flag indicating deletion capability is cleared for the Naming Properties inside the Naming Container. Properties within a delete-able Container may also be delete-able consistent with the associated CLI behavior. For example, in the command kw <negCr> <int param> <negCr>|<cr>, the second <negCr> tag translates to a delete-able Property for nullifying the property.
In an embodiment, a Delete operation is distinct from a Nullify operation. For example, the no keyword before a CLI command causes a device either to delete the entire command, or to nullify a command's parameter. In an embodiment, the “no” keyword translates to the IETF NETCONF protocol delete operation on the XML element to be deleted or nullified. The no for deleting the entire command translates into delete operation in the CommandContainer for singleton command or the NamingContainer of a multi-instance command. The no for nullifying a parameter translates into delete operation on the Property associated with the parameter or on the Container if the no applies to all the parameters in the Container.
A Container and Property with delete can have child XML elements that will be ignored. This approach is consistent with a CLI that allows values in the no command. Further, this approach allows a configuration to be negated by simply apply the no prefix in CLI or the delete operation in XML. In addition to the delete operation attribute, the XSD for the Container or Property will have a xs:nillable=‘true’ attribute. This attribute allows the XML element to contain no child elements.
Container and Property Cardinality values determine the minimum and maximum occurrences of the node under its parent Container. Cardinality values for Containers at the Command level or above, are minOcc=0 and maxOcc=unbounded, since there can be 0 or more command lines in a configuration file. The cardinality values do not specify whether the Command is singleton or multi-instance. A multi-instance Command is specified by its Naming Container. In an embodiment, for Containers and Properties under the Command level, the following logical rules apply:
1. Default min and max occurrences are −1, which implies no specific constraints are explicitly specified. In XML this implies min and max occurrences of 1.
2. If parent parser node has <cr>, then the min occurrence of the Container and Property created for the current parser node is 0. (Optional)
3. If parser node is the same as the node, we have a loop. Mark members of the Loop Container max occurrence=UNBOUNDED.
The following paragraphs address techniques for handling multi-referenced IDM Nodes and Loops. As described above, both the CLI structure and IDM structure defined herein may contain nodes that are referenced from multiple parents. Such multiple referencing occurs below the Command boundary and it is a necessary feature for constructing complex CLI syntax that contains optional tokens, multiple complex options sharing common CLI phrases, or a loop.
In the CLI View, in an embodiment, multi-referenced CLI nodes are directly referenced as Java references from multiple parents. In the IDM View, a multi-referenced IDM node has one parent and optional reference parents. Thus, the structure resembles a logical tree. References from additional nodes are stored as a reference parent list. Additionally, the same multi-referenced child DM node can appear as more than one member within the same IDM node.
In one embodiment, to support multi-referenced CLI nodes, the rules of Table 10 are used in constructing the IDM.







TABLE 10





CONSTRUCTING MULTI-REFERENCED NODES
















1.
To detect a revisited CLI node (excluding the loop case addressed in (5) below) and to



reuse the IDM sub-tree associated with that node, maintain a Visited CLI Node Table



that maps CLI node id to its associated IDM node.


2.
At the beginning of the visit, place just a Boolean object as a placeholder to indicate that



the CLI node has been visited and to prevent looping.


3.
At the end of the visit, if a Property is created store the reference to that Property in the



Visited CLI Node Table, if no Property is created and a Container is created, store the



reference to that Container in the table.


4.
When a CLI node is revisited (multi-referenced), check if there is a multi-referenced IDM



node associated with that CLI node, and check the multi-referenced IDM node's parent



Container.










a.
Check for loop by traversing up the parent path. If the multi-referenced IDM node




exists is in the parent path, then the node is in a loop. Do not add the IDM node as a




child member, but mark the multi-referenced IDM node as a Loop Container, and




set the loopRefId of the current node to the Loop Container id.



b.
If the parent Container is a Choice or Sequence-of-Choice, then add the multi-




referenced IDM node as a new child member and add new reference parent.



c.
If the parent Container is a Sequence, then reference all the sequence's child




members following and including the multi-referenced IDM node.



d.
While adding a multi-referenced IDM node as a child member, check if the node




exists as a member with the same member name (the same node can be present as a




proper child and a reference child in the same Container). If there is, add the current




IDM node as a reference parent to the IDM node. This reference parent pointer is




required for X2C transformation.










A multi-referenced IDM will require special handling in the X2C and C2X processing for the correct parent path to be chosen.
A Loop Container is a special case of the multi-referenced IDM node in which the node that is revisited is one of its ancestors. Instead of creating a reference to the ancestor, creating a loop in the IDM structure, the loop referencing the IDM Container (it must be a Container) simply maintains the ID of the multi-referenced IDM node as its loopRefId. A Loop Container does not fit one of the standard Orders: Sequence, Choice or Sequence-of-Choice. In terms of XSD, a Loop is a Sequence-of-Group, with Group max occurrence being unbounded, and where the Group is defined as:












Sequence {


 1) One or more optional LoopRef Containers. These Containers can


 be empty.


 2) One or more non-LoopRef Containers or Properties.


}









The following is a simple example that illustrates loop structure. Assume that the CLI supports a command having the form:
filter map <map name> vlan-list (<vlan id>([,|−]<vlan id>)*)+
The IDM associated with this command is shown in Table 11:







TABLE 11





IDM FOR EXAMPLE FILTER MAP COMMAND















  <Container ID=‘529’ Name=‘Filter’ MinOcc=‘1’


Order=‘cpi:sequence’ Annotation=‘Apply a VLAN Map’ >


    <Property ID=‘530’ Name=‘VLANMapName’ Type=‘String’


MinOcc=‘1’ Annotation=‘VLAN map name’ />


   <Container ID=‘531’ Name=‘VlanList’ MinOcc=‘1’


Order=‘cpi:all’ Annotation=‘VLANs to apply filter to’ >


     <Container ID=‘532’ Name=‘VLANId’ MinOcc=‘1’


Deleteable=‘true’ Type=‘command’ Loop=‘true’ Order=‘cpi:all’


Annotation=‘VLAN id’ >


       <Property ID=‘533’ Name=‘VLANIdValue’


       Type=‘Integer’


MinOcc=‘1’ MaxOcc=‘0’ Deleteable=‘true’ Annotation=‘VLAN id’ />


      <Container ID=‘534’ Name=‘Comma’ MinOcc=‘0’


      MaxOcc=‘0’


loopRefId=‘532’ Order=‘cpi:sequence’ Annotation=‘comma’/>


       <Container ID=‘535’ Name=‘Dash’ MinOcc=‘0’


       MaxOcc=‘0’


loopRefId=‘532’ Order=‘cpi:sequence’ Annotation=‘hyphen’ />


     </Container>


      <Property ID=‘536’ Name=‘All’ Type=‘Boolean’


      MinOcc=‘1’


Deleteable=‘true’ Annotation=‘Remove this filter from all VLANs’ />


   </Container>


  </Container>









As another example, Table 12 presents XML text for a command of the form: filter map6vlan-list 6, 7, 9-10.







TABLE 12





EXAMPLE XML FOR FILTER COMMAND

















<Filter>



 <VLANMapName>map6</VLANMapName>



 <VlanList>



  <VLANId>



   <VLANIdValue>6</VLANIdValue>



   <Comma/>



   <VLANIdValue>7</VLANIdValue>



   <Comma/>



   <VLANIdValue>9</VLANIdValue>



   <Dash/>



   <VLANIdValue>10</VLANIdValue>



  </VLANId>



 </VlanList>



</Filter>










In a more complex loop, the Loop Referencing Container may not be a direct child of the Loop Container but contained under one or more hierarchy of Containers.
The Loop Property is a Property that has a maximum occurrences (maxOcc) value of “unbounded,” and associated with a CLI parser node that references itself.
Optionally, in one embodiment, certain model simplifications may be performed. In one embodiment, an enumeration simplification is performed either during or after model construction. Enumeration post-processing converts a Choice Container of Boolean Properties into an enumeration. Boolean Properties that are reverted back to its numeration are renamed with their original CLI keyword values.
In another embodiment, simplification involves not handling certain command patterns. For example, as noted above, an IDM Sequence cannot contain another Container. Therefore, although the following three patterns can be detected, they cannot be used, as it would require custom naming rule that is inconsistent with the IDM naming:

A(BC+C)=A[B]C 

A(B+CB)=A[C]B 

A(BC+DC)=A[B+D]C 

3.5 Transformation from CLI to XML Format
Referring again to FIG. 1B, in an embodiment, a C2X module (4) transforms one or more CLI commands 138 from a network device into XML data 136 for use in an XML response or notification, such as a response or notification that is compatible with the NETCONF protocol. In an embodiment, the C2X module (4) performs a transformation using the mapping information in the IDM View (2) that is produced by the IdmBuilder (1) during model generation. According to an embodiment, the C2X module (4) implements the algorithm set forth in Table 13.







TABLE 13





CLI TO XML TRANSFORMATION
















1.
Parse and verify syntax of all CLI lines. This provides CLI View names and the parser nodes



for the CLI lines.


2.
For each CLI line and each CLI parse node in the line, find the associated IDM node.


3.
Walk up the IDM node to construct a path to the IDM node from the root.


4.
Construct the associated IdmDataNode list for the IDM node path from (3). This represents



an XML path for that CLI parse node.


5.
Repeat (2) for all the parse nodes of the CLI line and combine the XML path with the



previously constructed XML path.


6.
While we are walking down the CLI path maintain a table mapping IDM node and its



reference parent constructed by checking if the previous Container is a reference parent of



the current IDM node.


7.
Use the table constructed in (6) while walking up the IDM structure in (3) to choose the



reference parent to traverse up.


8.
Since the same IDM node can exist as multiple members of the same of IDM parent node -



with different member name, the member name must be recorded. This member name will



be used for the element tag instead of the node name.









In Table 13, steps 6 to 8 determine which parent to traverse up to in step (3), while handling any multi-referenced IDM Node. FIG. 13A illustrates the C2X transformation for an example set of nodes A to H, inclusive. If a parsing error arises when the CLI commands are parsed at step 1, in an embodiment, the device configuration commands that fail parsing are not dropped. In addition to reporting errors, the CLIs that fail parsing are in the generated XML document, delimited by a cmd tag.
Referring again to FIG. 1B, in an embodiment, an X2C Transformation module (3) receives transforms XML data 136, such as data from a NETCONF XML request, into CLI for a target device. The X2C Transform process is performed using the mapping information in the IDM View (2) that is produced by the IdmBuilder module (1) during model generation. According to an embodiment, the X2C Transform process uses the algorithm of Table 14:







TABLE 14





XML TO CLI TRANSFORMATION
















1.
Parse request using XML DOM parser to produce DOM tree.


2.
Walk the DOM tree and find a corresponding entry in the IDM View, and create



IdmDataNode tree which represents the XML request. This step also serves as a validator for



the XML request.


3.
Walk the IdmDataNode tree in the request down to leaf IDM nodes.


4.
As each leaf IDM node is visited, find the corresponding parser node in the CLI View, then



traverse up the CLI parser graph and build a CLI path for that particular leaf IDM node.


5.
Repeat (4) for other leaf IDM nodes and as we traverse up connect it up to the CLI path



from the previous IDM node.


6.
When all the nodes in the IdmDataNode tree is completely traverse, create the CLI string



expression from the CLI path using the CLI keywords and parameter values.


7.
Create a table to store the selected parent CLI node id for multi-referenced CLI node id.



Initialize the table at the top of IdmDataNode tree and populate it on the way down to each



leaf IDM node. Thus the mapping is valid only for that leaf IDM node.


8.
In looking up the CLI command id for a given IDM node id, for a ValueChoice Container



check also:










a.
If CLI command id is null, the mapping is in the Value Property.



b.
If the first child is the Value Property, lookup the CLI node id based on the Value




Property.



c.
If the first child is a Naming Container, the Value Property should be the first child




of the Naming Container.








9.
For a Container with Value Property, lookup the command id from the Value Property. (The



mapping information is stored against the Value Property, not the container.)


10.
For a Choice or Sequence-of-Choice, or for Container that contains only one member,



simply use the CLI node associated with its parent Container or in some cases its Grand-



parent Container if there is no CLI node mapping for the parent Container.


11.
For a Sequence if the child node has a reference parent:










a.
If there is last leaf IDM node's CLI node id from processing a preceding child node,




then use that last leaf IDM node's CLI node id as the parent.



b.
Otherwise, use the Container command id as its parent.








12.
For Loop Container:










a.
If there is last leaf IDM node's CLI node id from processing a preceding child node,




then use that last leaf IDM node's CLI node id as the parent.








13.
For Loop Referencing Container










a.
If there is last leaf IDM node's CLI node id from processing a preceding child node,




specify the last leaf IDM node's CLI node id as the parent of the Loop Container's




command id. (The Loop Container id is identified by loopRefId.)








14.
As we traverse up the CLI parser graph in (4) above, use the table constructed in (7) to



determine which parent to traverse up.









Step (7) is used to determine which parent to chose in traversing up the CLI View parser graph in step (4) above, taking into account any multi-referenced IDM Node. FIG. 13B illustrates X2C transformation.
In the foregoing approaches, CLI commands can be embedded inside XML configuration statements wrapped inside the cmd tag. One use of this approach is to support transformation of CLI that is not known to the E-DI CLI parser at the time that transformation is performed.
3.6 transformation Error Handling
In one embodiment, when the C2X Transform module (4) of FIG. 1B is used to transform CLI to XML, errors may be reported by the E-DI CLI Parser as it performs a syntax check of the CLI. A list of command lines that failed CLI parsing is reported. In another embodiment, CLI commands or lines that failed a syntax check may be embedded in a CLI tag. In another embodiment, in the X2C Transform module (3) of FIG. 1B, the location of errors is reported as the String Path of the element in error.
In either embodiment, E-DI run-time 130 provides the following error processing options: Stop, Ignore, or Skip. Stop means to stop processing when an error is encountered. Ignore, which is applicable only to X2C, means to ignore the error and generate output for the element in error. Skip means to skip to the next valid input and do not produce invalid output.
3.7 Example Interface Design
An example interface design is shown in FIG. 14, which illustrates the main classes associated with IdmBuilder. In an embodiment, to allow versioning, client code does not instantiate the IdmBuilder class directly, but performs instantiation through the IdmBuilderFactory class. Which IdmBuilder to instantiate is determined based on the namespace in an XML request.
4.0 Implementation Mechanisms—Hardware Overview
FIG. 15 is a block diagram that illustrates a computer system 1500 upon which an embodiment of the invention may be implemented. Computer system 1500 includes a bus 1502 or other communication mechanism for communicating information, and a processor 1504 coupled with bus 1502 for processing information. Computer system 1500 also includes a main memory 1506, such as a random access memory (“RAM”) or other dynamic storage device, coupled to bus 1502 for storing information and instructions to be executed by processor 1504. Main memory 1506 also may be used for storing temporary variables or other intermediate information during execution of instructions to be executed by processor 1504. Computer system 1500 further includes a read only memory (“ROM”) 1508 or other static storage device coupled to bus 1502 for storing static information and instructions for processor 1504. A storage device 1510, such as a magnetic disk or optical disk, is provided and coupled to bus 1502 for storing information and instructions.
Computer system 1500 may be coupled via bus 1502 to a display 1512, such as a cathode ray tube (“CRT”), for displaying information to a computer user. An input device 1514, including alphanumeric and other keys, is coupled to bus 1502 for communicating information and command selections to processor 1504. Another type of user input device is cursor control 1516, such as a mouse, trackball, stylus, or cursor direction keys for communicating direction information and command selections to processor 1504 and for controlling cursor movement on display 1512. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g.,y), that allows the device to specify positions in a plane.
The invention is related to the use of computer system 1500 for data model prediction. According to one embodiment of the invention, data model prediction is provided by computer system 1500 in response to processor 1504 executing one or more sequences of one or more instructions contained in main memory 1506. Such instructions may be read into main memory 1506 from another computer-readable medium, such as storage device 1510. Execution of the sequences of instructions contained in main memory 1506 causes processor 1504 to perform the process steps described herein. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the invention. Thus, embodiments of the invention are not limited to any specific combination of hardware circuitry and software.
The term “computer-readable medium” as used herein refers to any medium that participates in providing instructions to processor 1504 for execution. Such a medium may take many forms, including but not limited to, non-volatile media, volatile media, and transmission media. Non-volatile media includes, for example, optical or magnetic disks, such as storage device 1510. Volatile media includes dynamic memory, such as main memory 1506. Transmission media includes coaxial cables, copper wire and fiber optics, including the wires that comprise bus 1502. Transmission media can also take the form of acoustic or light waves, such as those generated during radio wave and infrared data communications.
Common forms of computer-readable media include, for example, a floppy disk, a flexible disk, hard disk, magnetic tape, or any other magnetic medium, a CD-ROM, any other optical medium, punchcards, papertape, any other physical medium with patterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any other memory chip or cartridge, a carrier wave as described hereinafter, or any other medium from which a computer can read.
Various forms of computer readable media may be involved in carrying one or more sequences of one or more instructions to processor 1504 for execution. For example, the instructions may initially be carried on a magnetic disk of a remote computer. The remote computer can load the instructions into its dynamic memory and send the instructions over a telephone line using a modem. A modem local to computer system 1500 can receive the data on the telephone line and use an infrared transmitter to convert the data to an infrared signal. An infrared detector can receive the data carried in the infrared signal and appropriate circuitry can place the data on bus 1502. Bus 1502 carries the data to main memory 1506, from which processor 1504 retrieves and executes the instructions. The instructions received by main memory 1506 may optionally be stored on storage device 1510 either before or after execution by processor 1504.
Computer system 1500 also includes a communication interface 1518 coupled to bus 1502. Communication interface 1518 provides a two-way data communication coupling to a network link 1520 that is connected to a local network 1522. For example, communication interface 1518 may be an integrated services digital network (“ISDN”) card or a modem to provide a data communication connection to a corresponding type of telephone line. As another example, communication interface 1518 may be a local area network (“LAN”) card to provide a data communication connection to a compatible LAN. Wireless links may also be implemented. In any such implementation, communication interface 1518 sends and receives electrical, electromagnetic or optical signals that carry digital data streams representing various types of information.
Network link 1520 typically provides data communication through one or more networks to other data devices. For example, network link 1520 may provide a connection through local network 1522 to a host computer 1524 or to data equipment operated by an Internet Service Provider (“ISP”) 1526. ISP 1526 in turn provides data communication services through the world wide packet data communication network now commonly referred to as the “Internet” 1528. Local network 1522 and Internet 1528 both use electrical, electromagnetic or optical signals that carry digital data streams. The signals through the various networks and the signals on network link 1520 and through communication interface 1518, which carry the digital data to and from computer system 1500, are exemplary forms of carrier waves transporting the information.
Computer system 1500 can send messages and receive data, including program code, through the network(s), network link 1520 and communication interface 1518. In the Internet example, a server 1530 might transmit a requested code for an application program through Internet 1528, ISP 1526, local network 1522 and communication interface 1518. In accordance with the invention, one such downloaded application provides for data model prediction as described herein.
The received code may be executed by processor 1504 as it is received, and/or stored in storage device 1510, or other non-volatile storage for later execution. In this manner, computer system 1500 may obtain application code in the form of a carrier wave.
5.0 Extensions and Alternatives
In the foregoing specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

## Claims

1. A method, comprising the machine-implemented steps of:
receiving one or more command line interface commands associated with a network device;
creating and storing a knowledge base comprising a representation of a syntax and semantics of the commands;
receiving from the knowledge base a data structure representing a particular configuration command among the commands;
creating and storing an intermediate data model that represents the configuration command, wherein creating the intermediate data model includes predicting one or more attributes of the configuration command;
in response to programmatic input, selectively transforming the intermediate data model into a text representation of the particular configuration command or into a structured document representation of the particular configuration command;
wherein selectively transforming includes selectively transforming the intermediate data model into an extensible markup language (XML) representation of the particular configuration command.

2. A method as recited in claim 1, wherein the knowledge base is created and stored in an automatic command learning process based on receiving and interpreting a plurality of the commands as the commands are provided to the network device.

3. A method as recited in claim 1, wherein the predicting includes predicting one or more names of one or more parameters to the particular configuration command.

4. A method as recited in claim 3, wherein the predicting includes predicting whether a particular parameter is mandatory or optional to complete the particular command.

5. A method as recited in claim 3, wherein the predicting includes predicting data types of the parameters.

6. A method as recited in claim 3, wherein the predicting includes predicting a cardinality attribute of the particular configuration command.

7. A method as recited in claim 3, wherein the predicting includes predicting an order of the parameters.

8. A method as recited in claim 1, wherein the intermediate data model represents a command using one or more container objects and one or more properties objects.

9. A method as recited in claim 1, wherein the knowledge base is created based on receiving information from one or more CLI management information bases (MIBs) and one or more SNMP MIBs supported on the device.

10. A method as recited in claim 1, wherein the XML representation conforms to NETCONF protocol and is transformed in response to receiving one or more NETCONF XML requests.

11. An apparatus for creating an intermediate data model useful in transforming network device command representations, comprising:
means for receiving one or more command line interface commands associated with a network device;
means for creating and storing a knowledge base comprising a representation of a syntax and semantics of the commands;
means for receiving from the knowledge base a data structure representing a particular configuration command among the commands;
means for creating and storing an intermediate data model that represents the configuration command, wherein creating the intermediate data model includes predicting one or more attributes of the configuration command;
means for selectively transforming the intermediate data model into a text representation of the particular configuration command or into a structured document representation of the particular configuration command, in response to programmatic input;
wherein selectively transforming includes selectively transforming the intermediate data model into an extensible markup language (XML) representation of the particular configuration command, wherein the XML representation conforms to NETCONF protocol and is transformed in response to receiving one or more NETCONF XML requests.

12. An apparatus as recited in claim 11, wherein the knowledge base is created and stored in an automatic command learning process based on receiving and interpreting a plurality of the commands as the commands are provided to the network device.

13. An apparatus as recited in claim 11, wherein the predicting means includes means for predicting one or more names of one or more parameters to the particular configuration command.

14. An apparatus as recited in claim 13, wherein the predicting means includes means for predicting whether a particular parameter is mandatory or optional to complete the particular command.

15. An apparatus as recited in claim 13, wherein the predicting means includes means for predicting data types of the parameters.

16. An apparatus as recited in claim 13, wherein the predicting means includes means for predicting a cardinality attribute of the particular configuration command.

17. An apparatus as recited in claim 13, wherein the predicting means includes means for predicting an order of the parameters.

18. An apparatus for creating an intermediate data model useful in transforming network device command representations, comprising:
a network interface that is coupled to the data network for receiving one or more packet flows therefrom;
a processor;
one or more stored sequences of instructions which, when executed by the processor, cause the processor to carry out the steps of:
receiving one or more command line interface commands associated with a network device;
creating and storing a knowledge base comprising a representation of a syntax and semantics of the commands;
receiving from the knowledge base a data structure representing a particular configuration command among the commands;
creating and storing an intermediate data model that represents the configuration command, wherein creating the intermediate data model includes predicting one or more attributes of the configuration command;
in response to programmatic input, selectively transforming the intermediate data model into a text representation of the particular configuration command or into a structured document representation of the particular configuration command;
wherein selectively transforming includes selectively transforming the intermediate data model into an extensible markup language (XML) representation of the particular configuration command, wherein the XML representation conforms to NETCONF protocol and is transformed in response to receiving one or more NETCONF XML requests.

19. An apparatus as recited in claim 18, wherein the knowledge base is created and stored in an automatic command learning process based on receiving and interpreting a plurality of the commands as the commands are provided to the network device.

20. An apparatus as recited in claim 18, wherein the predicting includes predicting one or more names of one or more parameters to the particular configuration command.

21. An apparatus as recited in claim 20, wherein the predicting includes predicting whether a particular parameter is mandatory or optional to complete the particular command.

22. An apparatus as recited in claim 20, wherein the predicting includes predicting data types of the parameters.

23. An apparatus as recited in claim 20, wherein the predicting includes predicting a cardinality attribute of the particular configuration command.

24. An apparatus as recited in claim 20, wherein the predicting includes predicting an order of the parameters.

25. A computer-readable volatile or non-volatile storage medium storing one or more sequences of instructions for creating an intermediate data model useful in transforming network device command representations, which instructions, when executed by one or more processors, cause the one or more processors to carry out the steps of:
receiving one or more command line interface commands associated with a network device;
creating and storing a knowledge base comprising a representation of a syntax and semantics of the commands;
receiving from the knowledge base a data structure representing a particular configuration command among the commands;
creating and storing an intermediate data model that represents the configuration command, wherein creating the intermediate data model includes predicting one or more attributes of the configuration command;
in response to programmatic input, selectively transforming the intermediate data model into a text representation of the particular configuration command or into a structured document representation of the particular configuration command;
wherein selectively transforming includes selectively transforming the intermediate data model into an extensible markup language (XML) representation of the particular configuration command.

26. A computer-readable medium as recited in claim 25, wherein the predicting includes predicting one or more names of one or more parameters to the particular configuration command.

27. A computer-readable medium as recited in claim 26, wherein the predicting includes predicting data types of the parameters.

28. A computer-readable medium as recited in claim 26, wherein the predicting includes predicting a cardinality attribute of the particular configuration command.