Disclosure of Invention
The invention provides a data configuration method, which is used for realizing the automatic extraction of key fields of data to carry out configuration work, and can better shorten the processing time and improve the working efficiency.
In a first aspect, the present disclosure provides a data configuration method, including:
acquiring a first node where first data is located and first fields of all child nodes taking the first node as a father node;
generating a first rule table according to the first field;
generating a first rule setting table according to the first field and the first rule table;
and configuring the first data according to the first rule table and the first rule setting table.
In one possible design, the first field includes: the first node comprises a first line number of a first node, a second line number of a father node of the first node, a first hierarchy of the first node, a first name of the first node and a first attribute value corresponding to the first name;
the second field of the first rule table includes: the first node comprises a first attribute value corresponding to a first name of a first node when the first name is a first rule, a first attribute value corresponding to a first item number when the first node is used as a first father node, a first attribute value corresponding to the first name when the first father node is used as a father node of a second node, a first method value, a first attribute value corresponding to the first method value when the first name is a first load number, and a first network element name where the first node is located, wherein the first method value is a value in the first name;
the third field of the first rule setting table includes: the first name of the third node is a first attribute value corresponding to the first rule when the first rule is set, the first attribute value corresponding to the first name when the third node is used as a second father node, the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node, and the first network element name where the third node is located, wherein the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node is equal to the first attribute value corresponding to the first name of the first node in the second field when the first name of the first node is the first rule.
In one possible design, the method includes:
acquiring first data needing to be newly added, wherein the first data comprises a second attribute value; inquiring a first rule table, and when a second attribute value is found in a first attribute value corresponding to a first name of a first rule; inquiring a first attribute value corresponding to the first name of the second attribute value in the first rule table, namely the first item number;
inquiring a maximum value M in first attribute values corresponding to the first name with the first item number, taking x as increment, and taking a first attribute value corresponding to the newly added first name with the first item number as M + x;
newly adding a first record in the first rule table, wherein the first record comprises: the second attribute value and a first attribute value M + x corresponding to the first name of the first item; wherein M, x is an integer greater than 0;
when the second attribute value is not found in the corresponding first attribute value when the first name is the first rule; and after the first record is newly added, taking a first attribute value corresponding to the first name when the first name is the first rule as a first attribute value corresponding to the first name when a second father node in the third field is taken as a father node of the fourth node, and generating a second record newly added in the first rule setting table.
In one possible design, the method further includes:
acquiring second data, wherein the second data comprises a third attribute value to be deleted; and querying the first rule table, determining a third record of which the corresponding first attribute value is equal to the third attribute value when the first name is the first rule, and deleting the third record.
In one possible design, the method further includes:
acquiring third data to be deleted, wherein the third data comprises a fourth attribute, inquiring the first rule table, determining a fourth record of which the corresponding first attribute value is equal to the fourth attribute value when the first name is the first rule, and deleting the fourth record;
and inquiring a corresponding fifth record in the first rule setting table according to the fourth attribute, and deleting the fifth record.
In one possible design, after determining the third record for which the corresponding first attribute value is equal to the third attribute value when the first name is the first rule, the method further includes:
acquiring a first attribute value corresponding to the first name in the third record when the first name is the first item number; when the first name is a first item number, the number of records which can be marked by the corresponding first attribute value is L, and L is an integer which is greater than 0;
and deleting the third record, and deleting all records corresponding to the first attribute value corresponding to the first name when the number of the query records is null.
In one possible design, before configuring the first data according to the first rule table and the first rule setting table, the method further includes:
comparing the first rule tables one by one and comparing the first rule setting tables one by one according to the first network element names;
when the sixth record in the first rule table is different, saving the sixth record;
when the seventh record is different in the first rule setting table, the seventh record is saved.
In a second aspect, the present disclosure also provides a data configuration apparatus, including:
the acquisition module is used for acquiring a first node where the first data is located and first fields of all child nodes taking the first node as a father node;
the first determining module is used for generating a first rule table according to the first field; the first rule setting table is also used for generating a first rule setting table according to the first field and the first rule table;
and the second determining module is used for configuring the first data according to the first rule table and the first rule setting table.
In a third aspect, the present disclosure also provides a database, including:
a processor; and the number of the first and second groups,
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform any of the data configuration methods of the first aspect via execution of the executable instructions.
In a fourth aspect, the disclosed embodiments also provide a storage medium, on which a computer program is stored, where the program, when executed by a processor, implements any one of the data configuration methods in the first aspect.
The disclosure provides a data configuration method and a device, wherein first fields of a first node where first data are located and all child nodes taking the first node as a father node are obtained; generating a first rule table according to the first field; generating a first rule setting table according to the first field and the first rule table; and configuring the first data according to the first rule table and the first rule setting table, thereby realizing the configuration work of automatically extracting the key fields of the data, better shortening the processing time and improving the working efficiency.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. 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.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Fig. 1 is an application scenario diagram of a data configuration method according to an example embodiment of the present disclosure, as shown in fig. 1, there are n PDN GateWay (PDN GateWay, PGW) network elements, which are the 1 st PGW101, the 2 nd PGW102, the 3 rd PGW103 to the nth PGWn, nodes, parent nodes, hierarchies, and node attribute information related to content charging data on all PGW network elements are extracted as configuration data into a database 104, when a user needs to configure data, first a system platform logs in each PGW network element through a Secure Shell (SSH) protocol, reads data in the configuration file by running a configuration file in a script acquisition network element, extracts nodes, parent nodes, hierarchies, and node attribute information related to content charging data as fields of the configuration data, and generates a first line number of a first node, a second line number of a parent node of the first node, a second line number of the parent node, and a second line number of the first node, The first level of the first node, the first name of the first node, and the first attribute value corresponding to the first name are records of the first field. The records are stored in a database, the node detailed information recorded in the database is expanded, records of key fields for the node detailed information are extracted, wherein the key fields comprise a first attribute value corresponding to the first name of a first node when the first name of the first node is a first rule, a first attribute value corresponding to the first name when the first node is a first father node, a first attribute value corresponding to the first name when the first father node is a father node of a second node, a first method value, a first attribute value corresponding to the first name when the first name is a first load number, and a first network element name where the first node is located, and the records of the key fields are collected into a first rule table 105. Generating a first rule setting table 106 according to the first field and the first rule table 105, wherein the fields of the first rule setting table 106 comprise: the first name of the third node is a first attribute value corresponding to the first rule when the first rule is set, the first attribute value corresponding to the first name when the third node is used as a second father node, the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node, and the first network element name where the third node is located, wherein the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node is equal to the first attribute value corresponding to the first name of the first node in the second field when the first name of the first node is the first rule. Then, according to the first rule table 105 and the first rule setting table 106, the first data is configured to be added or deleted. The processing mode can realize automatic acquisition, extraction and configuration of configuration data, thereby greatly reducing the configuration workload.
FIG. 2 is a flow diagram illustrating a data configuration method according to an example embodiment of the present disclosure; as shown in fig. 2, the data configuration method provided in this embodiment includes:
step 201, acquiring a first node where first data is located and first fields of all child nodes taking the first node as a father node;
specifically, the login system platform logs in a PGW network element through a secure shell protocol, acquires a configuration file in the network element by running a script, reads data in the configuration file line by line, extracts node, parent node, hierarchy and node attribute information related to content charging data as fields of the configuration data, generates a record in which a first line number of a first node, a second line number of the parent node of the first node, a first hierarchy of the first node, a first name of the first node, and a first attribute value corresponding to the first name are first fields, and stores the record in a database. The PGW network element is divided into a 1.x version and a 2.0 version according to the software version, for the PGW network element of the 1.x version, "managed element" 1, Epg "1, Pgw" 1, ServiceIdentification "1" in the Operation Maintenance and Administration (OAM) state, and the returned report is stored as a file for storage. For the network element of version 2.0, the ericsson.xml File is directly acquired through an SSH File Transfer Protocol (SFTP). The following processing steps take the network element of version 1.x as an example, and the processing manner of the network element of version 2.0 is not described herein again.
For example, a record stored in a database table includes a first field having: the first node comprises a first line number id of the first node, a second line number pid of a father node of the first node, a first level of the first node, a first name node of the first node and a first attribute value attr corresponding to the first name. As shown in fig. 3. The generation method of each field is as follows:
(1) id: the number is counted from the line "ServiceIdentification 1", and the line number is incremented by 1 from 1000000.
(2) level: based on the indentation of the line "ServiceIdentification 1", every subsequent line is indented with 3 more spaces, and then level + 1.
(3) pid: the first time before the line is located, the level is lower than the node id number of the line.
The pid value and the id value of the "ServiceIdentification ═ 1" line coincide.
(4) And (3) a node: the node name of the row in which it resides.
(5) attr: and attribute values corresponding to the node names.
Step 202, generating a first rule table according to the first field;
specifically, the node detailed information recorded in the database is expanded, and a record of a key field for the node detailed information is extracted, where the key field includes a first attribute value corresponding to a first name of a first node when the first name is a first rule, a first attribute value corresponding to a first name and a first item number when the first node is a first parent node, a first attribute value corresponding to the first name when the first parent node is a parent node of a second node, a first method value, a first attribute value corresponding to the first name and a first network element name where the first node is located, where the first method value is a value in the first name. The records of these key fields are assembled into a first rule table. The first rule table may be divided into 3 tables according to a difference of the first attribute value, where the 3 tables are a rule table for storing an Internet Protocol (IP) address, a rule table for storing a website address, and a rule table for storing a security encryption authentication. In the following, a rule setting table for storing IP addresses is taken as an example, and other rule tables are not described herein again.
For example, as shown in fig. 4, when the first rule of the first name in the first field is header rule, the corresponding first attribute value UN-CCTV is read, and the node where the header rule is located is taken as a parent node, and the first attribute value corresponding to the first item number of the first name in the corresponding child node is found to be 100; when the corresponding child node is found out to be used as a father node, the first name is a first attribute value 1 corresponding to the first name; finding a first method value network-prefix and a first attribute value corresponding to the network-prefix in a first name column, wherein the first attribute value has a plurality of IP addresses, and each IP address is taken as a record in a first rule table, such as 1.189.177.0/24, 1.31.110.0/25 and the like; find the corresponding first attribute value 1291846378 when the first name is the first load number payload, and the first network element name SAEGW06 where the node is located.
Step 203, generating a first rule setting table according to the first field and the first rule table;
since the first rule table may be divided into 3 tables according to the difference of the first attribute value, which are a rule table for storing an Internet Protocol (IP) address, a rule table for storing a website address, and a rule table for storing security encryption authentication, the corresponding first rule setting table may also be divided into 3 tables, which are a rule setting table for storing an IP address, a rule setting table for storing a website address, and a rule setting table for storing security encryption authentication, for example, the rule setting table for storing an IP address is taken as an example, and the other rule setting tables are not described herein again.
Specifically, the node detailed information recorded in the database is expanded, and a record of a key field for the node detailed information is extracted, where the key field includes a first attribute value corresponding to a first name of a third node when the first name of the third node is set as a first rule, a first attribute value corresponding to the first name when the third node is used as a second parent node, a first attribute value corresponding to the first name when the second parent node is used as a parent node of a fourth node, and a first network element name where the third node is located, where the first attribute value corresponding to the first name when the first name of the first node is equal to the first attribute value corresponding to the first name of the first node in the second field when the second parent node is used as the parent node of the fourth node. The records of these key fields are assembled into a first rule set table. Similarly, the first rule setting table may be correspondingly divided into 3 tables, which are a rule setting table for storing an Internet Protocol (IP) address, a rule setting table for storing a website address, and a rule setting table for storing a security encryption authentication.
For example, as shown in fig. 5, the first rule reading the first name in the first field is set to the first attribute value net-hrs corresponding to the headerfulleset, the node where the headerfulleset is located is taken as the parent node, the first attribute value 17800 corresponding to the child node where the first name is the priority of the first rule is found, the first attribute value UN-CCTV corresponding to the child node where the first name is taken as the parent node is found, and the first network element name SAEGW06 where the node is located.
And 204, configuring the first data according to the first rule table and the first rule setting table.
Specifically, when the platform receives the configuration data instruction, first, a first rule table and a first rule setting table stored in the database are read. When the data configuration instruction is newly added first data, a first rule table is inquired, and when a second attribute value is found in first attribute values corresponding to a first name of a first rule; inquiring a first attribute value corresponding to the first name of the second attribute value in the first rule table, namely the first item number; inquiring a maximum value M in first attribute values corresponding to the first name with the first item number, taking x as increment, and taking a first attribute value corresponding to the newly added first name with the first item number as M + x; newly adding a first record in the first rule table, wherein the first record comprises: the second attribute value and a first attribute value M + x corresponding to the first name of the first item; wherein M, x is an integer greater than 0; when the second attribute value is not found in the corresponding first attribute value when the first name is the first rule; and after the first record is newly added, taking a first attribute value corresponding to the first name when the first name is the first rule as a first attribute value corresponding to the first name when a second father node in the third field is taken as a father node of the fourth node, and generating a second record newly added in the first rule setting table.
For example, when a data record with an IP address of 1.189.223.0 and an attribute value of UN-CCTV is newly added, it is queried whether the attribute value exists in the first rule table, if so, the maximum Term number in the first rule table is obtained, for example, 100, each Term number marks 10 records, and the newly added first record is added to the newly created Term number 200 in the first rule table by an increment of 100 as the Term number. If the attribute value is not inquired in the first rule table, after a first record is newly added in the first rule table, the attribute value UN-CCTV is obtained in the first record, and a record is newly added in the first rule setting table according to the corresponding relation that the attribute value is the same as the third field in the first rule setting table.
More specifically, when the data configuration instruction is to delete the third attribute value of the second data, the first rule table is queried, the third record of which the corresponding first attribute value is equal to the third attribute value is determined when the first name is the first rule, and the third record is deleted.
Further specifically, when the data configuration instruction is to delete third data, where the third data includes a fourth attribute, the first rule table is queried, a fourth record is determined, where a first attribute value corresponding to the first name is equal to the fourth attribute value, and the fourth record is deleted; and inquiring a corresponding fifth record in the first rule setting table according to the fourth attribute, and deleting the fifth record.
Further specifically, after determining a third record of which the corresponding first attribute value is equal to the third attribute value when the first name is the first rule, obtaining a first attribute value corresponding to the first name in the third record when the first name is the first item number; when the first name is a first item number, the number of records which can be marked by the corresponding first attribute value is L, and L is an integer which is greater than 0;
and when the third record is deleted, inquiring whether the record number L is empty, and when the record number L is empty, deleting all records with the first name being the first attribute value corresponding to the first item number.
The method extracts the node, father node, level and node attribute information related to the content charging data as the field of the configuration data, and then extracts the first rule table and the first rule setting table corresponding to the IP address, the website and the security encryption authentication from the association relation of the node and the father node in the field. Therefore, when the data is configured, the data can be newly added and deleted according to the extracted first rule table and the first rule setting table, so that the processing time is better shortened, and the working efficiency is improved.
Further specifically, before configuring the first data according to the first rule table and the first rule setting table, the first rule table and the first rule setting table on each PGW network element may be read, and the first rule tables may be compared one by one and the first rule setting tables may be compared one by one; when the sixth record in the first rule table is different, saving the sixth record; when the seventh record is different in the first rule setting table, the seventh record is saved. Or, one PGW network element may be selected from all PGW network elements as a standard, and the other PGW network elements are compared with the PGW network element and recorded. The recorded differences may be used for maintenance checks to ensure the accuracy of subsequent configuration data.
Fig. 6 is a schematic structural diagram of a data configuration apparatus according to an example embodiment of the present disclosure. As shown in fig. 6, the data copying apparatus 60 according to the present embodiment includes:
an obtaining module 601, configured to obtain a first node where the first data is located and first fields of all child nodes using the first node as a parent node;
a first determining module 602, configured to generate a first rule table according to the first field; the first rule setting table is also used for generating a first rule setting table according to the first field and the first rule table;
the second determining module 603 is configured to configure the first data according to the first rule table and the first rule setting table.
In one possible design, the first field includes: the first node comprises a first line number of a first node, a second line number of a father node of the first node, a first hierarchy of the first node, a first name of the first node and a first attribute value corresponding to the first name;
the second field of the first rule table includes: the first node comprises a first attribute value corresponding to a first name of a first node when the first name is a first rule, a first attribute value corresponding to a first item number when the first node is used as a first father node, a first attribute value corresponding to the first name when the first father node is used as a father node of a second node, a first method value, a first attribute value corresponding to the first method value when the first name is a first load number, and a first network element name where the first node is located, wherein the first method value is a value in the first name;
the third field of the first rule setting table includes: the first name of the third node is a first attribute value corresponding to the first rule when the first rule is set, the first attribute value corresponding to the first name when the third node is used as a second father node, the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node, and the first network element name where the third node is located, wherein the first attribute value corresponding to the first name when the second father node is used as a father node of the fourth node is equal to the first attribute value corresponding to the first name of the first node in the second field when the first name of the first node is the first rule.
In one possible design, the second determining module 603 is configured to: acquiring first data needing to be newly added, wherein the first data comprises a second attribute value; inquiring a first rule table, and when a second attribute value is found in a first attribute value corresponding to a first name of a first rule; inquiring a first attribute value corresponding to the first name of the second attribute value in the first rule table, namely the first item number;
inquiring a maximum value M in first attribute values corresponding to the first name with the first item number, taking x as increment, and taking a first attribute value corresponding to the newly added first name with the first item number as M + x;
newly adding a first record in the first rule table, wherein the first record comprises: the second attribute value and a first attribute value M + x corresponding to the first name of the first item; wherein M, x is an integer greater than 0;
when the second attribute value is not found in the corresponding first attribute value when the first name is the first rule; and after the first record is newly added, taking a first attribute value corresponding to the first name when the first name is the first rule as a first attribute value corresponding to the first name when a second father node in the third field is taken as a father node of the fourth node, and generating a second record newly added in the first rule setting table.
In one possible design, the second determining module 603 is further configured to: acquiring second data, wherein the second data comprises a third attribute value to be deleted; and querying the first rule table, determining a third record of which the corresponding first attribute value is equal to the third attribute value when the first name is the first rule, and deleting the third record.
In one possible design, the second determining module 603 is further configured to: acquiring third data to be deleted, wherein the third data comprises a fourth attribute, inquiring the first rule table, determining a fourth record of which the corresponding first attribute value is equal to the fourth attribute value when the first name is the first rule, and deleting the fourth record;
and inquiring a corresponding fifth record in the first rule setting table according to the fourth attribute, and deleting the fifth record.
In one possible design, after determining the third record whose corresponding first attribute value is equal to the third attribute value when the first name is the first rule, the second determining module 603 is further configured to:
acquiring a first attribute value corresponding to the first name in the third record when the first name is the first item number; when the first name is a first item number, the number of records which can be marked by the corresponding first attribute value is L, and L is an integer which is greater than 0;
and deleting the third record, and deleting all records corresponding to the first attribute value corresponding to the first name when the number of the query records is null.
In one possible design, before configuring the first data according to the first rule table and the first rule setting table, the first determining module 602 is further configured to:
comparing the first rule tables one by one and comparing the first rule setting tables one by one according to the first network element names;
when the sixth record in the first rule table is different, saving the sixth record;
when the seventh record is different in the first rule setting table, the seventh record is saved.
FIG. 7 is a block diagram illustrating a database according to an example embodiment of the present disclosure. As shown in fig. 7, the present embodiment provides a database 70, which includes:
a processor 701; and the number of the first and second groups,
a memory 702 for storing executable instructions of the processor, which may also be a flash (flash memory);
wherein the processor 701 is configured to perform the respective steps of the above-described method via execution of executable instructions. Reference may be made in particular to the description relating to the preceding method embodiment.
Alternatively, the memory 702 may be separate or integrated with the processor 701.
When the memory 702 is a device independent from the processor 701, the database 70 may further include:
the bus 703 is used to connect the processor 701 and the memory 702.
In addition, embodiments of the present application further provide a computer-readable storage medium, in which computer-executable instructions are stored, and when at least one processor of the user equipment executes the computer-executable instructions, the user equipment performs the above-mentioned various possible methods.
Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. Additionally, the ASIC may reside in user equipment. Of course, the processor and the storage medium may reside as discrete components in a communication device.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.