Abstract:
A system and method for generating configuration code using an SNMP MIB, comprising generating a first configuration layer based on an XML MIB derived from the SNMP MIB. The first configuration layer is configured to provide an SNMP Agent with access to a second configuration layer. A second configuration layer is generated for a configuration table based on the XML MIB and comprises methods for managing the configuration table. The second configuration layer is configured to receive a configuration request containing configuration information representing a change to the configuration table from the SNMP Agent, call a first configuration listener method from a configuration listener layer, and receive a first status code from the configuration listener layer.

Description:
RELATED APPLICATIONS 
     This application claims the benefit under 35 USC 119(e) of U.S. Provisional Patent application No. 60/551,754, entitled “System and Method for Comprehensive Code Generation for System Management,” filed Mar. 10, 2004, which is hereby fully incorporated by reference herein. This application is related to U.S. patent application Ser. No. 10/683,317, filed Oct. 10, 2003 entitled “System and Method for Providing Access Control,” by Richard MacKinnon, Kelly Looney, and Eric White, U.S. Provisional Patent Application No. 60/551,704, entitled “System and Method for Network Management XML Architectural Abstraction,” by Keith Johnston and Mario Garcia, filed Mar. 10, 2004 and U.S. patent application Ser. No. 11/076,672, entitled “System and Method for Network Management XML Architectural Abstraction” by Keith Johnston and Mario Garcia filed Mar. 10, 2005, each of which is hereby fully incorporated by reference. 
    
    
     TECHNICAL FIELD OF THE INVENTION 
     This invention generally relates to the management of complex systems and specifically to reducing the manual labor involved in writing the configuration code to allow the system to be managed. 
     BACKGROUND 
     Prior code generation systems generate parts of the software management system. For example, SNMP toolkits ship with code generators to generate the stubs that the SNMP agent will call. Persistence systems generate a persistence layer automatically (for example, the JAXB toolkit). However, these prior art systems do not automatically generate all software layers at once. 
     SUMMARY OF THE INVENTION 
     The invention automates generation of configuration code so developers can focus on the implementation instead of the infrastructure needed to build the framework required for system management. This solution generates all the layers at once—leaving only the implementation of the configuration ‘listeners’ to react to changes in the configuration. In one embodiment, the input to the code generation is an SNMP MIB. The output is a layer to connect the SNMP agent code (generated by the SNMP agent toolkit) to the config API, a complete config API that notifies config listeners, and the input to the JAXB persistence API (e.g., an XML schema). The only code the developer now has to write is the configuration listeners, which will react to configuration changes and update the RNSA systems appropriately. One advantage of this solution over previous solutions is its completeness. 
     One embodiment of the present invention includes a method that generates configuration code using an SNMP MIB, comprising generating a first configuration layer based on an XML MIB derived from the SNMP MIB, wherein the first configuration layer is configured to provide an SNMP Agent with access to a second configuration layer, generating the second configuration layer for a configuration table based on the XML MIB comprising methods for managing the configuration table. The second configuration layer is configured to receive a configuration request containing configuration information representing a change to the configuration table from the SNMP Agent, call a first configuration listener method from a configuration listener layer, receive a first status code from the configuration listener layer. If the status code indicates a success, the method further includes saving the configuration information with a JAXB layer and calling a second configuration listener method to persist the change. 
    
    
     
       BRIEF DESCRIPTION OF THE FIGURES 
       A more complete understanding of the present invention and the advantages thereof may be acquired by referring to the following description, taken in conjunction with the accompanying drawings in which like reference indicates like features and wherein: 
         FIG. 1  illustrates the flow of one embodiment of the code generation system and method of the invention; 
         FIG. 2  illustrates the calling hierarchy for one embodiment of the configuration system and method; and 
         FIGS. 3-8  provide UML diagrams illustrating one embodiment of the class structure and algorithms for an embodiment of the configuration system. 
     
    
    
     DETAILED DESCRIPTION 
     Preferred embodiments of the invention are illustrated in the FIGURES, like numerals being used to refer to like and corresponding parts of the various drawings. 
     The following applications are hereby fully incorporated by reference herein in their entirety: U.S. application Ser. No. 10/683,317, filed Oct. 10, 2003 entitled “SYSTEM AND METHOD FOR PROVIDING ACCESS CONTROL,” by Richard MacKinnon, Kelly Looney, and Eric White; U.S. Provisional Application No. 60/551,698, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR BEHAVIOR-BASED FIREWALL MODELING,” by Patrick Turley which converted into U.S. application Ser. No. 11/076,719, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR BEHAVIOR-BASED FIREWALL MODELING,” by Richard MacKinnon, Kelly Looney, and Eric White; U.S. Provisional Application No. 60/551,754, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR COMPREHENSIVE CODE GENERATION FOR SYSTEM MANAGEMENT,” by Keith Johnston which converted into U.S. application Ser. No. 11/078,223, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR COMPREHENSIVE CODE GENERATION FOR SYSTEM MANAGEMENT,” by Keith Johnston; U.S. Provisional Application No. 60/551,703, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR PROVIDING A CENTRALIZED DESCRIPTION/CONFIGURATION OF CLIENT DEVICES ON A NETWORK ACCESS GATEWAY,” by Patrick Turley and Keith Johnston; U.S. Provisional Application No. 60/551,702, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR ACCESS SCOPE CONTROL (“WALLED GARDENS”) FOR CLIENTS OF A NETWORK ACCESS GATEWAY,” by Patrick Turley, Keith Johnston, and Steven D. Tonnesen which converted into U.S. application Ser. No. 11/076,591, filed Mar. 10, 2005 entitled “METHOD AND SYSTEM FOR CONTROLLING NETWORK ACCESS,” by Patrick Turley, Keith Johnston, and Steven D. Tonnesen; U.S. Provisional Application No. 60/551,699, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR DYNAMIC BANDWIDTH CONTROL,” by Patrick Turley, et al.; U.S. Provisional Application No. 60/551,697, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR DETECTION OF ABERRANT NETWORK BEHAVIOR BY CLIENTS OF A NETWORK ACCESS GATEWAY,” by Steven D. Tonnesen which converted into U.S. application Ser. No. 11/076,652, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR DETECTION OF ABERRANT NETWORK BEHAVIOR BY CLIENTS OF A NETWORK ACCESS GATEWAY,” by Steven D. Tonnesen; U.S. Provisional Application No. 60/551,705, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR DOUBLE-CAPTURE/DOUBLE-REDIRECT TO A DIFFERENT LOCATION,” by Keith Johnston, et al. which converted into U.S. application Ser. No. 11/076,646, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR DOUBLE-CAPTURE/DOUBLE-REDIRECT TO A DIFFERENT LOCATION,” by Keith Johnston, et al.; U.S. Provisional Application No. 60/551,704, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR NETWORK MANAGEMENT XML ARCHITECTURAL ABSTRACTION,” by Keith Johnston and Mario Garcia which converted into U.S. application Ser. No. 11/076,672, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR NETWORK MANAGEMENT XML ARCHITECTURAL ABSTRACTION,” by Keith Johnston and Mario Garcia; and U.S. Provisional Application No. 60/660,408, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR PROVIDING A CENTRALIZED DESCRIPTION!CONFIGURATION OF CLIENT DEVICES ON A NETWORK ACCESS GATEWORK,” by Patrick Turley, et al. 
       FIG. 1  shows the flow of one embodiment of the code generation system and method of the invention. The SNMP MIB  102  is used to generate the XML file  104 . The XML file  104  is then used to produce the XML Schema  106  for JAXB code generation (represented at  108 ), the RSN SNMP code  110  that extends the SNMP toolkit code, and the RSN Config API  112 , which is used by both the SNMP code and an HTML Admin interface to update the JAXB layer and notify any config listeners (discussed in conjunction with  FIG. 5  below). 
     The XML version of the MIB contains metadata about the configuration variables in the system. According to one embodiment, the XML MIB is generated by a tool called library access SMI (libsmi), which is a library that allows management applications to access SMI MIB module definitions. The XML schema for the MIB can be generated as described in U.S. Provisional Application No. 60/551,704, filed Mar. 10, 2004 entitled “SYSTEM AND METHOD FOR NETWORK MANAGEMENT XML ARCHITECTURAL ABSTRACTION,” by Keith Johnston and Mario Garcia, U.S. application Ser. No. 11/076,672, filed Mar. 10, 2005 entitled “SYSTEM AND METHOD FOR NETWORK MANAGEMENT XML ARCHITECTURAL ABSTRACTION,” by Keith Johnston and Mario Garcia. The JAXB persistence classes are generated by the JAXB implementation provided by Sun Microsystems (Sun Microsystems is a trademark of Sun Microsystems, Inc. of Santa Clara, Calif.). The JAXB tool binds an XML schema to a representation in JAVA code. 
     The config API  112  provides a high-level abstraction (e.g., language specific, such as JAVA) of the MIB table and group objects. The table and group classes, as described in conjunction with  FIG. 4  and the configService class, described in conjunction with  FIG. 3 , are generated based on the XML MIB. Additionally, the listener interfaces, described in conjunction with  FIG. 5 , are generated from the XML MIB. Config API  112  can be generated by parsing the XML MIB, generating an internal representation of the data structures of the MIB and translating them to a high-level language. 
     SNMP code  110  is also generated from the XML MIB. According to one embodiment, the SNMP code  110  can be generated using the iReasoning SNMP Agent Builder by iReasoning, Inc. of Reno, Nev. The SNMP code  110  can be the iReasoning SNMP agent extended to support the classes of the Config API in response to table and group operation. 
     Thus, the code generator to generate very specific code for the SNMP agent and the JAXB schema. According to one embodiment, the metadata comes from the MIB, so the constraints on the data are limited to SNMP constraints. The metadata contained in the XML includes the data type of the field, including several predefined types (RSN-specific types): string, integer, and enumerated types are the most common data types. These are mapped to XMLSchema types supported by JAXB. Additionally, methods to convert between the SNMP agent and the config API use the data type information to convert between these two layers. Code in the config API layer is also generated to validate constraints on the data. For example, if a field is an IP address, the code in the config layer can ensure that the value passed in is a valid IP address. 
     Using code generation allows the addition of new features relatively quickly. For example, a two phase commit mechanism can be used in the config listeners. When a configuration change comes in through SNMP—first a “preSet” method can be called in the config listener. If that method does not return an error, then the “set” method can be called. However, by the time the set method is called, the value has been persisted in the JAXB layer. If an error occurs in the set method, then the code generated config API can restore the original value and persist it. Another example where the code generation can be useful is in logging. When any configuration change is made in the system, a log message is written. The code that generates the log message is all generated by the code generator. Another example of a feature that can be added through code generation is a test to see if the value being set actually changed. This check in the config API can be code generated for every value and every table. If no value changed—then the config listener is not called. 
       FIG. 2  shows the calling hierarchy for one embodiment of the configuration system and method of the invention. At block  202  are the custom classes written by a user. These classes include code that initializes the system at startup—those classes access the persistence layer through the generated config API and the JAXB layer. The other custom classes are the config listener classes. These classes respond to changes in the configuration system—the config API calls the listeners when a change is made in the configuration. 
     The remaining layers are classes that are all automatically code generated according to the invention. The iReasoning SNMP code  204  is, for example, generated by an iReasoning-provided tool. The config API is generated by the RSN code generator. The JAXB layer  206  is generated from an XML schema, which itself is generated by the RSN code generator. One of skill in the art can appreciate that other automated mechanisms can be used to generate these remaining layers of code (and that other classes of code can be automatically generated). 
       FIGS. 3 to 8  consist of UML diagrams illustrating the high level class structure and algorithms for one embodiment of the configuration system. 
       FIG. 3  is a class diagram illustrating the ConfigService class  300 . For convenience, one embodiment of the Config API has one entry point that provides access to most of its functionality. The ConfigService class implements the singleton pattern and can be thought of as a service. The ConfigService class is code generated by the RSN code generator from the XML MIB. A single instance of this class provides access to all the table and group objects generated from the MIB, described in conjunction with  FIG. 4 . 
       FIG. 4  shows the framework classes for managing tables and groups. MIB schemas organize data in tables and groups. Tables consist of similar rows; each row can contain one or more properties. Groups are simpler data structures containing one or more properties. ConfigTable is a framework base class which contains basic methods for managing config tables. ConfigGroup is another framework base class which contains basic methods for managing config groups. 
     For each table in the XML MIB, a subclass of ConfigTable is generated. These derived classes are named &lt;Class&gt;ConfigTable where &lt;Class&gt; is the name of the table in the XML MIB. One example of a subclass &lt;Class&gt;ConfigTable is illustrated at  402 . They contain methods for managing table rows. Specifically, they provide methods for adding, deleting, and updating table rows. 
     Similarly, for each group in the XML MIB, a subclass of ConfigGroup is generated. These derived classes are named &lt;Class&gt;ConfigGroup (represented at  404 ) where &lt;Class&gt; is the name of the group in the XML MIB. They contain methods for managing group entries. Specifically, they provide methods for setting the values of group properties. 
     By using the data structures described above, the API provides an abstraction that hides the details of the underlying implementation. The API can be extended to other schemas such as JMX. 
       FIG. 5  illustrates one embodiment of the configuration listener class structure. IConfigTableListener (represented at  502 ) is an interface that, according to one embodiment, all table listeners implement. It defines the following methods: 
     
       
         
               
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 preRowAdd(row) 
                 Called before a row is 
               
               
                   
                   
                 added 
               
               
                   
                 preRowDelete(row) 
                 Called before a row is 
               
               
                   
                   
                 deleted 
               
               
                   
                 preRowUpdate(row) 
                 Called before a row is 
               
               
                   
                   
                 updated 
               
               
                   
                 rowAdded(row) 
                 Called after a row has 
               
               
                   
                   
                 been added 
               
               
                   
                 rowDeleted(row) 
                 Called after a row has 
               
               
                   
                   
                 been deleted 
               
               
                   
                 rowUpdated(row) 
                 Called after a row has 
               
               
                   
                   
                 been updated 
               
               
                   
                   
               
             
          
         
       
     
     The implementation classes for the methods, according to one embodiment, are not code generated and are user written. This is where the framework user inserts domain specific code to react to configuration changes. Each of these methods returns a status code determining whether the operation succeeds or fails. If the operation fails, the framework undoes any changes and the original values are retained. If the operation succeeds, the data is persisted to the configuration XML file. Thus these methods provide a way for the framework user to “veto” any configuration changes. 
     I&lt;Class&gt;ConfigListener (represented at  504 ) is a code generated interface that defines method for monitoring changes to a configuration group where &lt;Class&gt; is the name of the group in the XML MIB. Since each config group has different properties, these interfaces define methods of the following form: 
     
       
         
               
               
               
             
           
               
                   
                   
               
             
             
               
                   
                 preSet&lt;Property&gt; 
                 Called before a 
               
               
                   
                   
                 property in the group 
               
               
                   
                   
                 is set 
               
               
                   
                 set&lt;Property&gt; 
                 Called after a property 
               
               
                   
                   
                 in the group is set 
               
               
                   
                   
               
             
          
         
       
     
     As with table listeners above, the implementation classes for the methods are user coded and return the appropriate status code. 
       FIGS. 6 and 7  are sequence diagrams illustrating how configuration listeners can be registered with their respective table and group configuration objects. In this particular embodiment, registration is done in the listener constructor. When a table or group listener is instantiated, the constructor calls the setListener() method of the table or group configuration object they want to monitor. In these diagrams, Startup Service represents the initialization code that runs when the system is brought online. 
       FIG. 8  is a sequence diagram illustrating an example where a custom SNMP agent  802  is attempting to add a row to a table. At  804 , the SNMP agent first obtains the config table handle from the ConfigService  806 . At  808 , the agent  802  then calls the addRow() method on the config table object  810 . The config table object  810  checks if it has a config table listener registered, and if found calls its preRowAdd() method (step  812 ). The config table listener  814  can at this point return a success or failure status code (step  816 ). If success is returned, the config table object  810  saves the new row with the JAXB service  818  (step  820 ). At step  822 , then calls the rowAdded() method on the config table listener  814 . The listener  814  again has the opportunity to veto the change by returning a failure status code (step  826 ). If the call succeeds, the change remains and the method returns. Otherwise the change is reverted and nothing is saved to the XML store (step  828 ).