CN111061464B - Analysis code generation method, device, equipment and storage medium - Google Patents

Analysis code generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN111061464B
CN111061464B CN201911161225.4A CN201911161225A CN111061464B CN 111061464 B CN111061464 B CN 111061464B CN 201911161225 A CN201911161225 A CN 201911161225A CN 111061464 B CN111061464 B CN 111061464B
Authority
CN
China
Prior art keywords
redfish
service
configuration file
code
code generation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911161225.4A
Other languages
Chinese (zh)
Other versions
CN111061464A (en
Inventor
刘畅
张典
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN201911161225.4A priority Critical patent/CN111061464B/en
Publication of CN111061464A publication Critical patent/CN111061464A/en
Application granted granted Critical
Publication of CN111061464B publication Critical patent/CN111061464B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/74Reverse engineering; Extracting design information from source code

Abstract

The invention discloses a code generation method for resolving Redfish service, which comprises the following steps: determining a configuration file corresponding to the Redfish service; and calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service. Therefore, when the analysis code of the Redfish service is generated, the code of the Redfish service can be automatically generated and analyzed by using the code generation framework only by inputting the configuration file of the Redfish service into the code generation framework, and a software developer does not need to manually write and analyze Java classes of resources in the code and relationship information of the resources, so that the workload of the software developer is huge, and the working efficiency is improved. The invention also discloses a code generation device, equipment and a computer readable storage medium for analyzing the Redfish service, and the technical effects can be realized.

Description

Analysis code generation method, device, equipment and storage medium
Technical Field
The present invention relates to a code generation method, apparatus, device and computer readable storage medium for resolving a Redfish service.
Background
Redfish is a standard intended to provide simple and secure management for a converged hybrid IT and Software Defined Data Center (SDDC). Redfish combines human readability and machine capabilities, and exposes information directly to modern tool chains using common Internet and Web service standards. Resources exist in the Redfish service, and different resources have an association relationship. At present, when the resource of the Redfish service is obtained, the resource of the Redfish service is mainly obtained by analyzing the code, but for Redfish services of different versions, the attribute information and the relationship information of the resource are different, so that for the Redfish services of different versions, a software developer needs to manually compile the Java class of the resource in the analysis code and the relationship information of the resource, the workload is huge, the development efficiency is low, and the analysis efficiency of the Redfish service is reduced.
Disclosure of Invention
The invention aims to provide a code generation method, a device, equipment and a computer readable storage medium for analyzing a Redfish service, so as to quickly generate an analysis code of the Redfish service.
In order to achieve the above object, the present invention provides a code generation method for resolving a Redfish service, including:
determining a configuration file corresponding to the Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: the Java class corresponding to the resource and the self-defined relation annotation corresponding to the relation information are set on the Java class.
Wherein, the determining the configuration file corresponding to the Redfish service includes:
acquiring a standard document corresponding to the Redfish service;
and analyzing the standard document to generate a configuration file corresponding to the Redfish service.
Wherein, the calling code generation framework analyzes the configuration file, and after generating the analysis code corresponding to the Redfish service, the method further comprises:
and analyzing the Redfish service by using the analysis code.
Wherein, the analyzing the Redfish service by using the analysis code comprises:
s1, acquiring the current resource of the Redfish service;
s2, determining a target Java class corresponding to the current resource by using the analysis code, and storing each current resource;
s3, judging whether the target Java class has a target relation annotation or not; if so, go to S4; if not, go to S5;
s4, obtaining target relation resources related to the current resources through the target relation annotations, taking the target relation resources as the current resources, and continuing to execute S2;
s5, judging whether unresolved resources exist or not; if yes, selecting the unresolved resource as the current resource to continue to execute S2; if not, the flow ends.
To achieve the above object, the present invention further provides a code generating apparatus for resolving a Redfish service, including:
the configuration file determining module is used for determining a configuration file corresponding to the Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
the code generation module is used for calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: the Java class corresponding to the resource and the self-defined relation annotation corresponding to the relation information are set on the Java class.
Wherein the configuration file determining module comprises:
the document determining unit is used for acquiring a standard document corresponding to the Redfish service;
and the configuration file generating unit is used for analyzing the standard document and generating a configuration file corresponding to the Redfish service.
Wherein, this scheme still includes:
and the analysis module is used for analyzing the Redfish service by utilizing the analysis code.
Wherein the parsing module comprises:
a resource obtaining unit, configured to obtain a current resource of the Redfish service;
the determining unit is used for determining a target Java class corresponding to the current resource by using the analysis code;
the storage unit is used for storing each current resource;
the first judgment unit is used for judging whether the target Java class has a target relation annotation or not;
an obtaining unit, configured to obtain, when a target relation annotation exists in the target Java class, a target relation resource having a relation with the current resource through the target relation annotation, and trigger the determining unit and the storage unit with the target relation resource as the current resource;
a second judging unit, configured to judge whether an unresolved resource exists when the target Java class does not have the target relationship annotation; if the current resource exists, selecting the unresolved resource as the current resource to trigger the determining unit and the storage unit.
To achieve the above object, the present invention further provides a code generating device for resolving a Redfish service, including: a memory for storing a computer program; and the processor is used for realizing the steps of the code generation method for analyzing the Redfish service when the computer program is executed.
To achieve the above object, the present invention further provides a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the code generation method for resolving a Redfish service described above.
As can be seen from the above solutions, the code generation method for resolving a Redfish service provided in the embodiment of the present invention includes: determining a configuration file corresponding to the Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources; calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: the Java class corresponding to the resource and the self-defined relationship annotation corresponding to the relationship information are set on the Java class.
Therefore, when the analysis code of the Redfish service is generated, the code of the Redfish service can be automatically generated and analyzed by using the code generation framework only by inputting the configuration file of the Redfish service into the code generation framework, and a software developer does not need to manually write and analyze Java classes of resources in the code and relationship information of the resources, so that the workload of the software developer is huge, and the working efficiency is improved. The invention also discloses a code generation device, equipment and a computer readable storage medium for analyzing the Redfish service, and the technical effects can be realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a code generation method for resolving a Redfish service disclosed in the embodiment of the present invention;
FIG. 2 is a schematic diagram of a crawler algorithm control flow disclosed in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a code generation apparatus for resolving a Redfish service according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a code generation device for resolving a Redfish service, which is disclosed in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that Redfish is used as a new generation of data center equipment management standard, and has a wide application scenario. By deeply following the development process of the Redfish standard, the Redfish standard is found to have obvious regularity and is embodied in the following aspects:
1) the data format is very regular: redfish transmits data in a json (JavaScript Object Notation) format, and describes the json format by xml (extensible markup language) metadata, so that the data representation has strong analysis regularity. The currently common json analysis framework is suitable for the method;
2) the transmission protocol is well regulated: the method adopts http (HyperText Transfer Protocol), supports encryption authentication, and can also be realized through a common http communication frame;
3) the updating mode of the data format is very regular, the field can be newly added or abandoned, but the analysis of the format cannot be difficult;
4) the analysis rule is relatively mature, the analysis of the Redfish resource is essentially to capture the Redfish service by a crawler algorithm, and the link mode among the resources also follows a plurality of specific rules.
Therefore, the analysis code of the Redfish can be automatically generated through a code frame actually, and a user only needs to generate a corresponding configuration file (the configuration file also contains the setting of some analysis rules) according to the data structure of each Redfish version to tell the frame, so that the frame can automatically generate the corresponding analysis code, and the analysis of the Redfish service is realized.
Referring to fig. 1, a code generation method for resolving a Redfish service provided in the embodiment of the present invention; the method can comprise the following steps:
s101, determining a configuration file corresponding to a Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
determining a configuration file corresponding to the Redfish service includes: acquiring a standard document corresponding to a Redfish service; and analyzing the specification document to generate a configuration file corresponding to the Redfish service.
It should be noted that, for the Redfish services of different versions, the Redfish official may issue the specification documents corresponding to the Redfish services of different versions, and according to the specification documents, the user can know which resources are available for the Redfish service of the version, which attributes of the resources are available, and which relationships between the resources are available, and convert them into corresponding configuration files; the configuration file may be a configuration file written by a user after analyzing the specification document, or may be a configuration file automatically generated after analyzing the specification document by the system, which is not specifically limited herein.
Specifically, in the Redfish service, each resource has a specific json format, so that Redfish resources with different attributes can be described by configuration files with json or xml formats; similarly, because the relationships between the resources in the Redfish service are described by a fixed format, the relationships between the resources in the Redfish service can be described by a configuration file; furthermore, the specification document of the Redfish service is also specified in many details, such as: whether the http request is encrypted or not, whether single authentication or bidirectional authentication is used or not, and the like can be described in a configuration file by means of configuration information, and the code generation framework is informed by the configuration file so as to be configured by the code generation framework to the relevant analysis code.
In this application, the attribute information of the resource in the Redfish service is specifically used to describe the type of the resource, for example: for two resources, i.e., a System and a Processor, the attribute information of the former is a System resource, the attribute information of the latter is a Processor resource, and one System includes links to a plurality of processors, and this relationship is the relationship information in the present application.
S102, calling a code generation framework to analyze a configuration file and generating an analysis code corresponding to a Redfish service; wherein, the analysis code comprises: the system comprises a Java class corresponding to the resource and a custom relationship annotation which is arranged on the Java class and corresponds to the relationship information.
It should be noted that, the code generation framework in this embodiment may automatically generate an analysis code according to the configuration information in the configuration file; the configuration information in the configuration file includes the above-mentioned attribute information of the resources in the Redfish service, the relationship information between the resources, and other information that needs to be configured.
If the configuration information is attribute information of the resource, a Java object class corresponding to the resource may be automatically generated through the code generation framework, and meanwhile, an annotation corresponding to json parsing (annotation type is provided by a json parsing framework commonly used in jackson, gson, and the like) is set on an attribute of the class, and these generation operations are all implemented in a mature technical manner, which is not specifically described herein. If the configuration information is the relationship information between the resources, the framework can be described in a manner of combining annotation and method on the code, that is: after the relation among the resources is described through the configuration file and then is delivered to the framework, the framework generates a corresponding object class, corresponding custom annotation is set on the class method, and the method marked by the custom annotation can be called through reflection in the execution process of the source code and serves as a core condition for controlling the crawling of the resources; if the configuration information is other information that needs to be configured, for example: whether the http request is encrypted or not, whether single authentication or bidirectional authentication is used, and the like, the code generation framework can directly configure the relevant codes according to the configuration information, which is not described in detail herein.
In summary, it can be seen that, because the parsing flow of the Redfish service is regular and basically fixed at present, the relationships between the resources of the Redfish service and the resources are regularly describable, and the development of the Redfish standard is often backward compatible, and the influence on the parsing code and the code generation framework is small, the application proposes an idea of automatically generating the parsing code through the code generation framework, that is: the method comprises the steps of describing key characteristics such as attributes and relations among resources in an Rredfish specification in a configuration file mode, automatically generating java classes in analysis codes through a code generation framework, expressing relations among the resources in a user-defined annotation mode, and controlling a process. Through the mode, the code generation framework can automatically generate and analyze the core key codes of the Redfish service by utilizing the configuration file, the development efficiency of software developers is greatly improved, and meanwhile, a company can also open the source of the framework, so that the influence of the company is improved.
Based on any of the foregoing embodiments, in this embodiment, after invoking a code generation framework to analyze a configuration file and generating an analysis code corresponding to a Redfish service, the method further includes:
and resolving the Redfish service by using the resolving code.
After S101 to S102, the code generation framework may generate an analysis code corresponding to the Redfish service according to the configuration file, and the Redfish service may be analyzed by the analysis code, so as to capture each resource of the Redfish service. In addition, in the scheme, after the analysis code corresponding to the Redfish service is generated, the analysis code can be tested by using the code generation framework, and if the test is successful, the Redfish service is analyzed by using the analysis code. During testing, feasibility analysis of the codes can be carried out through various testing modes in the frame, after the analysis codes are proved to be correct, the test is successful, and the Redfish service can be analyzed by utilizing the analysis codes.
Further, the process of analyzing the Redfish service through the analysis code specifically comprises the following steps:
s1, acquiring the current resource of the Redfish service;
s2, determining a target Java class corresponding to the current resource by using the analysis code, and storing each current resource;
s3, judging whether the target Java class has a target relation annotation or not; if so, go to S4; if not, go to S5;
s4, obtaining target relation resources related to the current resources through the target relation annotations, taking the target relation resources as the current resources, and continuing to execute S2;
s5, judging whether unresolved resources exist or not; if yes, selecting the unresolved resource as the current resource to continue to execute S2; if not, the flow ends.
In this embodiment, the present solution is specifically described by taking two resources, i.e. a System and a Processor, as an example, where a System includes links to multiple processors, and this relationship uses a self-defined annotation of a frame in a configuration file to tell the frame, and the following is an exemplary configuration file provided in this application:
Figure BDA0002286197800000071
Figure BDA0002286197800000081
further, the code generation framework generates an analytic code according to the configuration file, the analytic code includes a java class, and sets a corresponding annotation, such as a JSON conversion annotation and a relationship annotation among resources, according to the content of the configuration file, wherein the JSON conversion annotation has the functions of: and mapping the attributes of JSON data returned by the Redfish resource to the attributes of a java class. Such as: returning a json called system1, he has an attribute called Id. However, the attribute corresponding to the java class is called SystemId, and this annotation can put the value of Id into SystemId, where it is mapped when data is converted. The following provides an exemplary system java class for the application:
Figure BDA0002286197800000082
Figure BDA0002286197800000091
it should be noted that, the relationship annotation among the resources in the analysis code can control the generation and execution flow of the code, so the framework generates a corresponding java class according to various resources in the configuration file, and sets the relationship among the resources in the class, and the core part in the analysis code is universal, and can make the setting of some parameters through the configuration file, so the analysis code is generated.
It should be noted that the core part in the analysis code is a crawler algorithm control flow which controls the acquisition of resources, and refer to fig. 2, which is a schematic view of a crawler algorithm control flow disclosed in the embodiment of the present invention; according to the process, when the Redfish service is analyzed through the analysis code, the current resource of the Redfish service is acquired at first, and the current resource is added into the queue; it can be understood that, since only the current resource just added exists in the queue, the current resource is the head-of-queue resource of the queue; based on the Java class and the custom relationship annotation generated by the framework, scanning the class of the queue head resource, and checking whether the Java class has the custom relationship annotation; it should be noted that, because the relationship of each resource in the Redfish service is in a tree structure, other resources having a relationship necessarily exist in the acquired head-of-queue resource, and therefore a custom relationship annotation necessarily exists in the head-of-queue resource. However, if there is a phenomenon that the Java class of the resource in the head-of-queue resource does not have a relationship annotation during the parsing process, it is necessary to check whether there is an unresolved resource; if the resource exists, selecting the unresolved resource as the current resource, and putting the unresolved resource into the queue as the head resource to continue to execute subsequent operations; if not, the flow ends.
In this embodiment, the custom relationship annotation of the head of queue resource is referred to as a target relationship annotation, and the target relationship resource is obtained by calling the method labeled by the target relationship annotation, the current resource is dequeued from the queue, the obtained target relationship resource is taken as the current resource and added into the queue again, at this time, the head of queue resource in the queue is the just obtained target relationship resource, and the step of obtaining the head of queue resource is continuously executed until the queue result is empty, and the cycle is ended. It can be seen that, through the crawler algorithm control flow, Java class and custom relationship annotation, the analysis of the Redfish service can be realized, and certainly, the application is not limited to the above-mentioned manner for analyzing the Redfish service, which is only to prove the feasibility of the analysis code generation scheme in the present scheme, and may also be replaced by other core codes, but the essence is to perform the flow control of the crawler algorithm.
In summary, the code generation framework in the present application can generate a corresponding analysis code by analyzing the configuration file; the configuration file describes the attribute of the resources and the relationship among the resources, and also contains other configuration information; the resource relation in the configuration file is realized in the mode of self-defined annotation and the like in the analysis codes, and the process control of the core codes is carried out by combining a crawler algorithm; after the analysis code is generated, the framework can also provide some test functions, and the Redfish can be analyzed after the test; moreover, after the framework in the application is completed, if redfish issues a new version, the framework does not need to be changed to adapt to the new version of redfish in general, but small-scale updating of the framework to be compatible with the new version or repair problems is not excluded. Therefore, the analysis code can be dynamically generated according to the configuration file through the framework, and is used for analyzing the Redfish service to generate a core code of a universal analysis Redfish service, so that the development time of software developers is greatly reduced.
In the following, the code generation apparatus provided by the embodiment of the present invention is introduced, and the code generation apparatus described below and the code generation method described above may be referred to each other.
Referring to fig. 3, a code generating apparatus for resolving a Redfish service provided in an embodiment of the present invention includes:
a configuration file determining module 100, configured to determine a configuration file corresponding to a Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
a code generation module 200, configured to invoke a code generation framework to analyze the configuration file, and generate an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: the Java class corresponding to the resource and the self-defined relation annotation corresponding to the relation information are set on the Java class.
Wherein the configuration file determining module comprises:
the document determining unit is used for acquiring a standard document corresponding to the Redfish service;
and the configuration file generating unit is used for analyzing the standard document and generating a configuration file corresponding to the Redfish service.
Wherein, this scheme still includes:
and the analysis module is used for analyzing the Redfish service by utilizing the analysis code.
Wherein the parsing module comprises:
a resource obtaining unit, configured to obtain a current resource of the Redfish service;
the determining unit is used for determining a target Java class corresponding to the current resource by using the analysis code;
the storage unit is used for storing each current resource;
the first judgment unit is used for judging whether the target Java class has a target relation annotation or not;
an obtaining unit, configured to obtain, when a target relation annotation exists in the target Java class, a target relation resource having a relation with the current resource through the target relation annotation, and trigger the determining unit and the storage unit with the target relation resource as the current resource;
a second judging unit, configured to judge whether an unresolved resource exists when the target Java class does not have the target relationship annotation; if the current resource exists, selecting the unresolved resource as the current resource to trigger the determining unit and the storage unit.
Referring to fig. 4, a schematic structural diagram of a code generation device for resolving a Redfish service disclosed in the embodiment of the present invention is shown; the apparatus may include:
a memory 11 for storing a computer program;
a processor 12 for implementing the steps of the code generation method according to any of the above-described method embodiments when executing said computer program.
In this embodiment, the device may be a PC (Personal Computer), or may be a terminal device such as a smart phone, a tablet Computer, a palmtop Computer, or a portable Computer.
The device may include a memory 11, a processor 12, and a bus 13.
The memory 11 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 11 may in some embodiments be an internal storage unit of the device, for example a hard disk of the device. The memory 11 may also be an external storage device of the device in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the device. Further, the memory 11 may also include both an internal storage unit of the device and an external storage device. The memory 11 may be used not only to store application software installed in the device and various types of data, such as program codes for executing a code generation method, but also to temporarily store data that has been output or is to be output.
The processor 12 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as program codes for executing code generation methods.
The bus 13 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
Further, the device may further include a network interface 14, and the network interface 14 may optionally include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are generally used to establish a communication connection between the device and other electronic devices.
Optionally, the device may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-emitting diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the device and for displaying a visualized user interface.
Fig. 4 shows only the device with the components 11-14, and it will be understood by those skilled in the art that the structure shown in fig. 4 does not constitute a limitation of the device, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the code generation method of any method embodiment are realized.
Wherein the storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A code generation method for analyzing Redfish service is characterized by comprising the following steps:
determining a configuration file corresponding to the Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: java classes corresponding to the resources and custom relationship annotations corresponding to the relationship information and arranged on the Java classes;
wherein, the determining the configuration file corresponding to the Redfish service includes:
acquiring a standard document corresponding to the Redfish service; and analyzing the standard document to generate a configuration file corresponding to the Redfish service.
2. The code generation method according to claim 1, wherein the invoking code generation framework analyzes the configuration file, and after generating the parsing code corresponding to the Redfish service, further comprises:
and analyzing the Redfish service by using the analysis code.
3. The code generation method according to claim 2, wherein the parsing the Redfish service using the parsing code includes:
s1, acquiring the current resource of the Redfish service;
s2, determining a target Java class corresponding to the current resource by using the analysis code, and storing each current resource;
s3, judging whether the target Java class has a target relation annotation or not; if so, go to S4; if not, go to S5;
s4, obtaining target relation resources related to the current resources through the target relation annotations, taking the target relation resources as the current resources, and continuing to execute S2;
s5, judging whether unresolved resources exist or not; if yes, selecting the unresolved resource as the current resource to continue to execute S2; if not, the flow ends.
4. A code generation apparatus that resolves a Redfish service, comprising:
the configuration file determining module is used for determining a configuration file corresponding to the Redfish service; the configuration file describes attribute information of resources in the Redfish service and relationship information among the resources;
the code generation module is used for calling a code generation framework to analyze the configuration file and generating an analysis code corresponding to the Redfish service; wherein, the analysis code comprises: java classes corresponding to the resources and custom relationship annotations corresponding to the relationship information and arranged on the Java classes;
wherein the configuration file determining module comprises:
the document determining unit is used for acquiring a standard document corresponding to the Redfish service;
and the configuration file generating unit is used for analyzing the standard document and generating a configuration file corresponding to the Redfish service.
5. The code generation apparatus according to claim 4, further comprising:
and the analysis module is used for analyzing the Redfish service by utilizing the analysis code.
6. The code generation apparatus of claim 5, wherein the parsing module comprises:
a resource obtaining unit, configured to obtain a current resource of the Redfish service;
the determining unit is used for determining a target Java class corresponding to the current resource by using the analysis code;
the storage unit is used for storing each current resource;
the first judgment unit is used for judging whether the target Java class has a target relation annotation or not;
an obtaining unit, configured to obtain, when a target relation annotation exists in the target Java class, a target relation resource having a relation with the current resource through the target relation annotation, and trigger the determining unit and the storage unit with the target relation resource as the current resource;
a second judging unit, configured to judge whether an unresolved resource exists when the target Java class does not have the target relationship annotation; if the current resource exists, selecting the unresolved resource as the current resource to trigger the determining unit and the storage unit.
7. A code generation apparatus that resolves a Redfish service, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the code generation method for resolving a Redfish service according to any of claims 1 to 3 when executing the computer program.
8. A computer-readable storage medium, characterized in that a computer program is stored thereon, which, when being executed by a processor, carries out the steps of the code generation method of resolving a Redfish service according to any of claims 1 to 3.
CN201911161225.4A 2019-11-24 2019-11-24 Analysis code generation method, device, equipment and storage medium Active CN111061464B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911161225.4A CN111061464B (en) 2019-11-24 2019-11-24 Analysis code generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911161225.4A CN111061464B (en) 2019-11-24 2019-11-24 Analysis code generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111061464A CN111061464A (en) 2020-04-24
CN111061464B true CN111061464B (en) 2022-04-22

Family

ID=70298580

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911161225.4A Active CN111061464B (en) 2019-11-24 2019-11-24 Analysis code generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111061464B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112003827B (en) * 2020-07-27 2022-07-08 山东英信计算机技术有限公司 Configurable Redfish service analysis method and system based on parallel computing
CN112379882B (en) * 2020-10-30 2023-12-26 中国人寿保险股份有限公司 Simulation server construction method, simulation server and electronic equipment
CN112631603B (en) * 2020-12-30 2022-04-08 文思海辉智科科技有限公司 Word string analysis method and system and electronic equipment
CN113703781B (en) * 2021-07-16 2023-07-21 苏州浪潮智能科技有限公司 Storage system interface generation method and device, electronic equipment and readable storage medium
CN113672233B (en) * 2021-07-16 2023-12-22 济南浪潮数据技术有限公司 Server out-of-band management method, device and equipment based on Redfish

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030018720A (en) * 2001-08-31 2003-03-06 (주) 소프트4소프트 Method for generating source code browser for software maintenance and system therefor
CN106648587A (en) * 2016-09-28 2017-05-10 福州宇嘉软件科技有限公司 Annotation-based Web application code generation method
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN106873949A (en) * 2015-12-11 2017-06-20 泰康保险集团股份有限公司 Code generating method and its device
CN108334411A (en) * 2018-01-30 2018-07-27 郑州云海信息技术有限公司 Resource transfer method and device based on Redfish in a kind of BMC

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040148370A1 (en) * 2003-01-23 2004-07-29 Electronic Data Systems Corporation System and method for composing, configuring, deploying, and managing services using a graphical user interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030018720A (en) * 2001-08-31 2003-03-06 (주) 소프트4소프트 Method for generating source code browser for software maintenance and system therefor
CN106873949A (en) * 2015-12-11 2017-06-20 泰康保险集团股份有限公司 Code generating method and its device
CN106648587A (en) * 2016-09-28 2017-05-10 福州宇嘉软件科技有限公司 Annotation-based Web application code generation method
CN106844643A (en) * 2017-01-13 2017-06-13 王洋 A kind of Database Dynamic generation method based on template engine
CN108334411A (en) * 2018-01-30 2018-07-27 郑州云海信息技术有限公司 Resource transfer method and device based on Redfish in a kind of BMC

Also Published As

Publication number Publication date
CN111061464A (en) 2020-04-24

Similar Documents

Publication Publication Date Title
CN111061464B (en) Analysis code generation method, device, equipment and storage medium
US10592319B2 (en) API notebook tool
CN108108162B (en) Application programming interface generation method and device
WO2019127844A1 (en) Method and device for generating electronic report, computer equipment, and storage medium
CN111078539B (en) Test method, device, system and computer readable storage medium
US9367432B2 (en) Testing system
US11003835B2 (en) System and method to convert a webpage built on a legacy framework to a webpage compatible with a target framework
CN107145784B (en) Vulnerability scanning method and device and computer readable medium
CN111414350B (en) Service generation method and device
CN111581920A (en) Document conversion method, device, equipment and computer storage medium
WO2021249356A1 (en) Form data verification method, system, server, and user terminal
CN111813701A (en) HTTP-based interface testing method and device, computer equipment and storage medium
CN110647471A (en) Interface test case generation method, electronic device and storage medium
CN111177113A (en) Data migration method and device, computer equipment and storage medium
CN111209326A (en) Data query method and device, electronic equipment and storage medium
CN113703781B (en) Storage system interface generation method and device, electronic equipment and readable storage medium
CN113296752A (en) Method, system, device and storage medium for generating API document
CN113050921A (en) Webpage conversion method, device, storage medium and computer equipment
CN110688315A (en) Interface code detection report generation method, electronic device, and storage medium
CN114036178A (en) Service interface generation method, device, computer and readable storage medium
CN114489603A (en) Code generation method, apparatus, electronic device, medium, and product
CN109783134B (en) Front-end page configuration method and device and electronic equipment
CN111596905A (en) Method, device, storage medium and terminal for generating java object
CN110780983A (en) Task exception handling method and device, computer equipment and storage medium
CN113032003B (en) Development file export method, development file export device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant