Disclosure of Invention
Aiming at the defects or improvement requirements of the prior art, the invention provides an information model version difference comparison scheme, and solves the problem of low efficiency in the maintenance, management and multi-version adaptation development work of the information model at present. The invention comprises the following steps: (1) when a multi-version southbound interface information model is maintained, an automatic information model version management and identification method is provided, and the accuracy and efficiency of manual identification are improved; (2) when the management and control system adapts to the multi-version information model, compatibility increment adaptation is carried out according to the difference between different versions, and repeated adaptation brought by the full data information model is avoided.
To achieve the above object, according to an aspect of the present invention, there is provided an information model version difference comparison method, including:
s1, comparing the new version information model files and the old version information model files through a version difference comparison tool, automatically numbering the model files according to a comparison result, and generating a new information model library;
and S2, according to the version number reported by the equipment, the management and control system adapts to the latest information model library, and identifies and processes incompatible differences.
In an embodiment of the present invention, the step S1 includes:
s11, importing the information model files of the new version and the old version, and generating parameter nodes and path difference information by adopting a node analysis mode and based on XML format analysis; generating a difference expansion mark and a difference detail according to a difference comparison rule;
s12, writing the difference extension marks and the difference details in the step S11 into a new version information model file;
s13, summarizing the difference extension marks of the new version information model in the step S11, and generating a new information model file version number;
and S14, summarizing the version number of each new information model file in the step S13, and generating a new model library version number.
In an embodiment of the present invention, the step S11 includes:
s111, respectively reading new and old information model files, and acquiring all node parameter information and node path information described in the information model files in a node analysis mode, wherein the node path information is < the ID of the node, and the path of a father node >; node parameter information < parameter ID, parameter data type, parameter value field, parameter default value, parameter mandatory constraint, parameter keyword constraint, parameter general description and comment >;
s112, traversing the node path information of the new model, matching the node parameter information and the node path information of the node in the old model file, and executing the step S119 if the node path information and the node parameter information are successfully matched;
s113, if the IDs of the nodes are not matched and the difference expansion mark is added, executing a step S115;
s114, if the parent node paths are not matched, the difference expansion mark is modified;
s115, if the parameter keyword constraints are not matched, the difference expansion mark is a keyword constraint increase or a keyword constraint deletion;
s116, if the parameters are not matched with the mandatory constraints, marking the difference expansion as mandatory constraint addition or mandatory constraint deletion;
s117, if the parameter value fields are not matched, the difference expansion mark is added to the value field or deleted from the value field;
s118, if the parameter data type, the parameter default value, the parameter general description and the comment are not matched, the difference expansion is marked as general modification;
and S119, completing the traversal of the node path information of the new model.
In an embodiment of the present invention, the step S12 includes:
s121, traversing the new model difference expansion mark obtained in the step S11, and writing the new model difference expansion mark into a new model file;
s122, if the difference expansion mark is node deletion \ path modification, writing the path information of the old model node into a new model file as difference details;
s123, if the difference expansion mark is value domain deletion, or forced constraint deletion, or keyword constraint deletion, writing the old model node parameter information into a new template file as difference details;
and S124, traversing the node path information of the old model, matching the node path information of the node in the new model file, if the node path information does not exist in the new model file, writing the node parameter information and the node path information into the new model file, and marking the difference expansion as node deletion.
In an embodiment of the present invention, the step S13 includes:
s131, defining the format of the version number of the model file to be A.B.C, wherein A/B/C is a number;
s132, if node deletion, value domain deletion, forced constraint deletion, keyword constraint deletion or path modification exists in the difference expansion tag set of the new model file, the model file is incompatible modification, and the version number changes are as follows: if a is increased by 1, B is equal to 0, and C is equal to 0, go to step 135;
s133, if node \ value domain addition \ mandatory constraint addition \ keyword constraint addition exists in the new model file difference expansion tag set, the model file is compatible and modified, and the version number changes are as follows: if a is not changed, B is increased by 1, and C is equal to 0, then step 136 is executed;
s134, if node \ value domain \ mandatory constraint \ keyword constraint increase exists in the new model file difference expansion tag set, the model file is generally modified, and the version number changes are as follows: if A is not changed, B is not changed to 1, and C is increased by 1, executing step 136;
s135, traversing the difference detail in the step S123 in the step S12, and writing the version number of the old model file into each difference detail;
and S136, writing the version number of the new model file into the file version information.
In an embodiment of the present invention, the step S14 includes:
s141, defining the format of the version number of the model file to be X.Y, wherein X/Y is a number;
s142, if the version number a of the file in the model file version number set is increased by 1, increasing X by 1, and if X is not changed, increasing Y by 1;
and S143, writing the version number of the new model library into the version control file.
In an embodiment of the present invention, the step S1 includes:
s21, the management and control system analyzes and loads the new equipment model library file package;
s22, the new/old equipment loads the information model library file packages respectively and reports the current model library version number and the model file version number to the control system;
s23, the management and control system reports the version number of the current model file according to the equipment, traverses the difference details in the matched model file, and adapts to the corresponding node parameter information and node path information;
and S24, the management and control system generates or analyzes the device data instance to complete data interaction.
In one embodiment of the present invention, in the step S23:
traversing the version number of the model file if the version number of the current model library of the control system is not matched with the version number of the model library reported by a certain device;
and traversing all the difference expansion mark nodes if the version number of the current model file of the control system is not matched with the version number of the model file reported by a certain device.
In an embodiment of the present invention, the step S24 includes:
when the management and control system converts equipment interaction message data according to the information model example, if the difference extension marks exist in the nodes in the message, the message interaction data is generated according to the difference details of the model file of the old version when the message data is converted.
According to another aspect of the present invention, there is also provided an information model version difference comparison apparatus, including a new information model library generating module and a difference identification processing module, wherein:
the new information model base generation module is used for comparing the new version information model files with the old version information model files through a version difference comparison tool, automatically numbering the model files according to a comparison result and generating a new information model base;
and the difference identification processing module is used for adapting the latest information model base according to the version number reported by the equipment, and identifying and processing incompatible differences.
Generally, compared with the prior art, the technical scheme of the invention has the following beneficial effects:
the invention adopts automatic analysis, identification and record of model difference information, and sends the version difference information of the data information model in the southbound interface of the network equipment to the latest version model library. Based on the method adopted by the invention, the management and control system only needs to maintain a set of current latest model base and adaptation rules, compatibility processing is only carried out on incompatible differences, and the compatible difference items are directly adapted according to the latest version. Additional adaptation work is avoided, the artificial factors of difference identification and compatibility judgment are reduced, and accuracy and efficiency are improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention. In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
The XSD is used as a description language of the southbound interface information model of the network equipment, and the method provided by the invention is required to be adopted for version management and compatible processing of a management and control system of the XSD information model. In order to solve the problems in the prior art, as shown in fig. 1, the invention provides an information model version difference comparison method, which comprises the following steps:
s1, comparing the new version information model files and the old version information model files through a version difference comparison tool, automatically numbering the model files according to a comparison result, and generating a new information model library;
in the step S1 of the method, the comparing of the new and old version information model files by the version difference comparison tool, and automatically numbering the model files according to the comparison result to generate the new information model library specifically include the following steps:
s11, importing the information model files of the new version and the old version, and generating parameter nodes and path difference information by adopting a node analysis mode and based on XML format analysis; generating a difference expansion mark and a difference detail according to a difference comparison rule;
as shown in fig. 2, step S11 is specifically as follows:
and S111, respectively reading the new and old information model files, and acquiring all node parameter information and node path information described in the information model file by adopting a node analysis mode. The node path information is < own node ID, father node path >; node parameter information < parameter ID, parameter data type, parameter value field, parameter default value, parameter mandatory constraint, parameter keyword constraint, parameter general description and comment >;
and S112, traversing the node path information of the new model, and matching the node parameter information and the node path information of the node in the old model file. If the node path information and the node parameter information are both successfully matched, executing step S119;
s113, if the IDs of the nodes are not matched and the difference expansion mark is added, executing a step S115;
s114, if the paths of the father nodes are not matched, the difference expansion mark is modified;
s115, if the parameter keyword constraints are not matched, the difference expansion mark is a keyword constraint increase or a keyword constraint deletion;
s116, if the parameters are not matched with the mandatory constraints, marking the difference expansion as mandatory constraint addition or mandatory constraint deletion;
s117, if the parameter value domains are not matched, the difference expansion mark is added or deleted in the value domain;
s118, if the parameter data type, the parameter default value, the parameter general description and the comment are not matched, the difference expansion is marked as general modification;
s119, completing traversal of the node path information of the new model;
s12, writing the difference extension marks and the difference details in the step S11 into a new version information model file;
as shown in fig. 3, step S12 is specifically as follows:
s121, traversing the new model difference expansion mark obtained in the step S11, and writing the new model difference expansion mark into a new model file;
s122, if the difference expansion mark indicates the conditions of node deletion \ path modification and the like, writing the path information of the old model node as difference details into a new model file;
s123, if the difference expansion mark is in the conditions of value domain deletion \ forced constraint deletion \ keyword constraint deletion and the like, writing the parameter information of the old model node as difference details into a new template file;
s124, traversing the node path information of the old model, matching the node path information of the node in the new model file, if the node path information does not exist in the new model file, writing the node parameter information and the node path information into the new model file, and marking the difference expansion as node deletion;
s13, summarizing the difference extension marks of the new version information model in the step S11, and generating a new information model file version number;
as shown in fig. 4, step S13 is specifically as follows:
s131, defining the format of the model file version number as a.b.c (where a/B/C is a number, and default version a is 0/B is 0/C is 0);
s132, if node deletion \ value domain deletion \ forced constraint deletion \ keyword constraint deletion \ path modification exists in the new model file difference expansion tag set, the model file is incompatible modification at this time, and the version number changes are as follows: if a is increased by 1, B is equal to 0, and C is equal to 0, go to step 135;
s133, if node \ value domain addition \ mandatory constraint addition \ keyword constraint addition exists in the new model file difference expansion tag set, the model file is compatible and modified, and the version number changes are as follows: if a is not changed, B is increased by 1, and C is equal to 0, then step 136 is executed;
s134, if node \ value domain addition \ forced constraint addition \ keyword constraint addition exists in the new model file difference expansion tag set, the model file is generally modified, and the version number changes are as follows: if A is not changed, B is not changed to 1, and C is increased by 1, executing step 136;
s135, traversing the difference detail in the step S123 in the step S12, and writing the version number of the old model file into each difference detail;
s136, writing the version number of the new model file into file version information;
and S14, summarizing the version number of each new information model file in the step S13, and generating a new model library version number.
As shown in fig. 5, step S14 is specifically as follows:
s141, defining a version number format of the model file as x.y (X/Y is a number, and default version X is 0/Y is 0);
s142, if the version number a of the file in the model file version number set is increased by 1, increasing X by 1, and if X is not changed, increasing Y by 1;
s143, writing the version number of the new model library into the version control file;
s2, according to the version number reported by the device, the management and control system adapts to the latest information model base, and identifies and processes incompatible differences;
as shown in fig. 6, the method specifically includes the following steps:
s21, the management and control system analyzes and loads the new equipment model library file package;
s22, the new/old equipment loads the information model library file package respectively, and reports the current model library version number and the model file version number to the control system;
s23, the management and control system reports the version number of the current model file according to the equipment, traverses the difference details in the matched model file, and adapts to the corresponding node parameter information and node path information;
and S24, the management and control system generates or analyzes the device data instance to complete data interaction.
The technical scheme of the invention is illustrated by the following specific examples:
s1, comparing the new version information model files and the old version information model files through a version difference comparison tool, automatically numbering the model files according to a comparison result, and generating a new information model library;
s2, according to the version number reported by the equipment, the management and control system adapts to the latest information model base, and identifies and processes incompatible differences;
in the step S1 of the method, the comparing of the new and old version information model files by the version difference comparison tool, and automatically numbering the model files according to the comparison result to generate the new information model library specifically include the following steps:
s11, importing new and old version information model files, and generating node parameter information difference and node path information difference based on XML format analysis in a node analysis mode; generating a difference expansion mark and a difference detail according to a difference comparison rule;
s12, writing the difference extension marks and the difference details in the step S11 into a new version information model file;
s13, summarizing the difference extension marks of the new information model in the step S11 to generate the version number of the information model file;
s14, summarizing the version number of each new information model file in the step S13 to generate a model library version number;
wherein, step S11 is specifically as follows:
and S111, respectively reading the new and old information model files, and acquiring all node parameter information and node path information described in the information model files in a node analysis mode. The node path information is < own node ID, father node path >; node parameter information < parameter ID, parameter data type, parameter value field, parameter default value, parameter mandatory constraint, parameter keyword constraint, parameter general description and comment >;
and S112, traversing the node path information of the new model, and matching the node path information of the node in the old model file. If the node path information and the node parameter information are both successfully matched, executing step S119;
s113, if the IDs of the nodes are not matched and the difference expansion flag diff-flag is node-add, executing the step S115;
s114, if the paths of the father nodes are not matched, the difference expansion flag diff-flag is a path modification 'path-modification';
s115, if the parameter keyword constraints are not matched, the difference expansion mark diff-flag is added with the keyword constraints or deleted 'key-add' or 'key-delete' with the keyword constraints;
s116, if the parameters are not matched with the mandatory constraints, deleting a 'regulatory-add' or a 'regulatory-delete' flag for the difference expansion flag diff-flag;
s117, if the parameter value fields are not matched, the difference expansion mark diff-flag is range-add or range-delete;
s118, if the parameter data type, the parameter default value, the parameter general description, and the comment do not match, the difference extension is marked as general modification "diff-flag";
s119, completing traversal of the node path information of the new model;
example (c): xsd, certain node parameter information is < xsd, element name ═ slot "type ═ int32," default ═ 00, "range ═ 1-256" >, if the value domain range of the node parameter is expanded in a new version model <1-512>, and the parent node path is increased by one layer of depth (the parent layer path is changed from./qos-configuration/to./qos-configuration/hqos), then the difference extension flag is diff-flag ═ range-add | path-mode.
Wherein, step S12 is specifically as follows:
s121, traversing the new model difference expansion mark obtained in the step S11, and writing the new model difference expansion mark into a new model file; as shown in the example, after writing the difference extension flag, the node description in the new XSD model is changed to < XSD, element name ═ slot "type ═ int32," default ═ 00, "range ═ 1-256," diff-flag ═ range-add | path-modification >
S122, if the difference expansion mark indicates the conditions of node deletion \ path modification and the like, taking the path information of the old model node as difference details and writing the difference details into a new model file;
as shown in the example, after writing the difference details, the node description in the new XSD model is changed
<xsd:element name="slot"type="int32"default="00"range="1-512"diff-flag="range-add|path-modify"diff-detail="pre-range=1-256|pre-path=../qos-config"/>
S123, if the difference expansion mark is in the conditions of value domain deletion \ forced constraint deletion \ keyword constraint deletion and the like, writing the old model node information into a new template file as difference details;
s124, traversing the node path information of the old model, matching the node path information of the node in the new model file, if the node path information does not exist in the new model file, writing the node parameter information and the node path information into the new model file, and marking the difference expansion as node deletion 'node-delete';
wherein, step S13 is specifically as follows:
s131, defining the format of the model file version number as a.b.c (where a/B/C is a number, and default version a is 0/B is 0/C is 0);
s132, if node deletion \ value domain deletion \ forced constraint deletion \ keyword constraint deletion \ path modification exists in the new model file difference expansion tag set, the model file is incompatible modification at this time, and the version number changes are as follows: if a is increased by 1, B is equal to 0, and C is equal to 0, go to step 135;
s133, if node \ value domain addition \ mandatory constraint addition \ keyword constraint addition exists in the new model file difference expansion tag set, the model file is compatible and modified, and the version number changes are as follows: if a is not changed, B is increased by 1, and C is equal to 0, then step 136 is executed;
s134, if node \ value domain addition \ forced constraint addition \ keyword constraint addition exists in the new model file difference expansion tag set, the model file is generally modified, and the version number changes are as follows: if A is not changed, B is not changed to 1, and C is increased by 1, executing step 136;
s135, traversing the difference detail in the step S123 in the step S12, and writing the version number of the old model file into each difference detail;
s136, writing the version number of the new model file into file version information;
as shown in the example, in the fos-qos.xsd file, version information < xsd: revsion ver ═ 0.0.1 > before modification, and after the node modification, the new model version number is changed to 1.0.0 and version information < xsd: revsion ver ═ 1.0.0 > is written.
And the old model version number is written in each difference extension flag and difference detail. An element name, slot, int32, default, 00, range, 1-512, diff-ver, 0.0.1, diff-flag, range-add, path-modify, diff-detail, pre-range, 1-256, pre-path, qos-configuration,/>, and the like
Wherein, step S14 is specifically as follows:
s141, defining a version number format of the model file as x.y (X/Y is a number, and default X is 0/Y is 0);
s142, if the file version number A in the model file version number set is increased by 1, increasing X by 1, and if not, keeping X unchanged, and increasing Y by 1;
s143, writing the version number of the new model library into the version control file;
in order to manage the whole model library, the version numbers of the model files in the model file set need to be collected for describing the information of the whole model library. And summarizing and writing the model library version description into version data by using a version control file xsd-library.
In the method S2, the management and control system adapts to the latest information model library according to the version number reported by the device, and identifies and processes the difference details. The method specifically comprises the following steps:
s21, the management and control system analyzes and loads the new equipment model library file package;
s22, the new/old equipment loads the information model library file packages respectively and reports the current model library version number and the model file version number to the control system;
version information in an xsd-library. ini file needs to be loaded to the version number of the model library, and < xsd: version > node information in each model file fos-xxx. xsd needs to be loaded to the version number of the model file, and the version number of the model file is reported to the control system.
S23, the management and control system reports the version number of the current model file according to the equipment, traverses the difference details in the matched model file, and adapts to the corresponding node parameter information and node path information;
traversing the version number of the model file if the version number of the current model library of the control system is not matched with the version number of the model library reported by a certain device;
if the version number of the current model file of the management and control system is not matched with the version number of the model file reported by a certain device, traversing all difference extension mark nodes, namely xsd (element node) carrying diff-ver/diff-type/diff-detail elements;
s24, the management and control system generates or analyzes the device data instance to complete data interaction;
when the management and control system converts equipment interaction message data according to the information model example, if the difference extension marks exist in the nodes in the message, the message interaction data is generated according to the difference details of the model file of the old version when the message data is converted. Example (c):
as shown in the example, the information model of fos-qos.xsd is as follows according to the message data of the new version device (ver ═ 1.0.0):
...
<qos-config>
<hqos>
<slot>300</slot>
<is-enable>true</is-enable>
......
</hqos>
</qos-config>
if the matched version is the old device version number (ver is 0.0.1), the message data is as follows:
...
<qos-config>
<slot>123</slot>
<is-enable>true</is-enable>
......
</qos-config>
therefore, for the old device, for incompatible modification, after identifying the difference details, the management and control system can generate data node path and parameter information for the node according to the details.
Further, as shown in fig. 7, the present invention provides an information model version difference comparison apparatus, which includes a new information model library generation module and a difference identification processing module, wherein:
the new information model base generation module is used for comparing the new version information model files with the old version information model files through a version difference comparison tool, automatically numbering the model files according to a comparison result and generating a new information model base;
and the difference identification processing module is used for adapting the latest information model base according to the version number reported by the equipment, and identifying and processing incompatible differences.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and that any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the present invention.