Summary of the invention
In view of this, the object of the present invention is to provide a kind of method and device of switching network device configuration file, reduce the setup time of the network equipment after upgrading, improve the accuracy of configuration, and then increase work efficiency.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of device of switching network device configuration file, this device comprises: former business model module and objective business model module; Wherein,
Former business model module, for putting the content of every attribute of the former business model of filling in documents according to first wife, sends to objective business model module by the former business model after having filled in;
Objective business model module, send for utilizing former business model module filled in after former business model, fill in the content of every attribute of objective business model according to preset transformation rule; The objective business model after having filled in is utilized to generate target configuration file.
In such scheme, described objective business model module, specifically for carrying out associating preserving as transformation rule using api command corresponding for the every attribute in configuration every in objective business model, the api command corresponding with the attribute of the configuration in former business model.
In such scheme, described objective business model module, specifically for:
During the attribute one_to_one corresponding of the attribute in the configuration of objective business model and the configuration of former business model, then the api command that api command corresponding for the attribute configured in former business model is corresponding with the attribute configured in objective business model is associated;
The attribute of the attribute in the configuration of objective business model and the configuration of former business model differs a pair at once, then associated by api command corresponding with the attribute configured in objective business model for one or more api command corresponding for the attribute configured in former business model.
In such scheme, described objective business model module, specifically for extracting the attribute of the configuration in objective business model one by one, according to the transformation rule of this attribute, utilizes the api command of association from former business model, obtain corresponding content and preserve.
In such scheme, described device also comprises: transceiver module, for obtaining former configuration file from the network equipment, former configuration file is sent to former business model module;
Accordingly, described former business model module, specifically for receiving the former configuration file that transceiver module is sent.
Present invention also offers a kind of method of switching network device configuration file, the method comprises:
The content of every attribute of the former business model of filling in documents is put according to first wife;
Utilize the former business model after having filled in, fill in the content of every attribute of objective business model according to preset transformation rule;
The objective business model after having filled in is utilized to generate target configuration file.
In such scheme, described transformation rule, for: api command corresponding for the every attribute in configuration every in objective business model, the api command corresponding with the attribute of the configuration in former business model are associated.
In such scheme, described api command corresponding for every attribute in configuration every in objective business model, the api command corresponding with the attribute of the configuration in former business model to be associated, specifically comprise:
During the attribute one_to_one corresponding of the attribute in the configuration of objective business model and the configuration of former business model, then the api command that api command corresponding for the attribute configured in former business model is corresponding with the attribute configured in objective business model is associated;
The attribute of the attribute in the configuration of objective business model and the configuration of former business model differs a pair at once, then associated by api command corresponding with the attribute configured in objective business model for one or more api command corresponding for the attribute configured in former business model.
In such scheme, described content of filling in every attribute of objective business model according to preset transformation rule, comprise: the attribute extracting the configuration in objective business model one by one, according to the transformation rule of this attribute, the api command of association is utilized from former business model, to obtain corresponding content and preserve.
In such scheme, described put the content of every attribute of the former business model of filling in documents according to first wife before, the method also comprises: from the network equipment, obtain former configuration file.
The method of switching network device configuration file provided by the present invention and device, can be the content of every attribute of objective business model by the Content Transformation of each attribute in former business model by preset transformation rule, recycle the objective business model after having filled in and generate target configuration file, thus the setup time of the network equipment after upgrading, the accuracy of raising configuration can be reduced, and then increase work efficiency; In addition, because transformation rule is for writing according to actual conditions and being preset in device provided by the invention, so transformation rule can be changed according to actual conditions, the present invention is enable to be applicable to plurality of application scenes.
Embodiment
Basic thought of the present invention is: the content of putting every attribute of the former business model of filling in documents according to first wife; Utilize the former business model after having filled in, fill in the content of every attribute of objective business model according to preset transformation rule; The objective business model after having filled in is utilized to generate target configuration file.
Below in conjunction with drawings and the specific embodiments, the present invention is further described in more detail.
The invention provides a kind of device of switching network device configuration file, as shown in Figure 1, this device comprises: former business model module 11 and objective business model module 12; Wherein,
Former business model module 11, for putting the content of every attribute of the former business model of filling in documents according to first wife, sends to objective business model module 12 by the former business model after having filled in;
Objective business model module 12, send for utilizing former business model module 11 filled in after former business model, fill in the content of every attribute of objective business model according to preset transformation rule, utilize the objective business model after having filled in generate target configuration file.
Described former business model module 11, also for preserving former business model;
Wherein, described former business model comprises: the list that each configuration that before software upgrading, any one former business comprises, the api command that every attribute of configuration is corresponding form, and the concrete method generating former business model is prior art, does not repeat here.Described former business model module 11 can preserve one or more former business model, the quantity of the concrete former business that concrete quantity will be changed according to reality at every turn and determining.
Described objective business model module 12, also for preserving objective business model;
Wherein, described objective business model comprises: the list of the api command composition that every attribute of each configuration of any one target service needs after software upgrading, configuration is corresponding, the concrete method generating objective business model is prior art, does not repeat here.Described objective business model module 12 can preserve one or more objective business model, the quantity of the objectives business that concrete quantity will be changed according to reality at every turn and determining.
Described device, also comprises: transceiver module 13, for obtaining former configuration file, former configuration file is sent to former business model module 11; Accordingly, described former business model module 11, the first wife specifically for sending according to transceiver module 13 puts the content of every attribute of the former business model of filling in documents.
Described former business model module 11, specifically for api command corresponding according to the attribute configured in former business model one by one, extracts content and preserves from former configuration file;
Wherein, described in save as and be kept in internal memory corresponding to this attribute according to prior art, do not repeat here.
Described objective business model module 12, specifically for receive that former business model module 11 sends filled in after former business model after, extract the attribute of the configuration in objective business model one by one, according to the transformation rule of this attribute, the api command of association is utilized from former business model, to obtain corresponding content and preserve;
Wherein, described transformation rule is: api command corresponding for the every attribute in configuration every in objective business model, the api command corresponding with the attribute of the configuration in former business model are associated, specifically comprise:
During the attribute one_to_one corresponding of configuration of any one attribute in any one configuration of objective business model and former business model, then the api command that api command corresponding for the attribute configured in former business model is corresponding with the attribute configured in objective business model is associated;
An attribute of any one attribute in any one configuration of objective business model and the configuration of former business model differs a pair at once, then associated by api command corresponding with the attribute configured in objective business model for one or more api command corresponding for the attribute configured in former business model.
Described objective business model module 12, specifically for utilizing the objective business model after having filled in generate target configuration file, sends to transceiver module 13 by target configuration file; Accordingly, described transceiver module 13, also for target configuration file that receiving target business model module 12 is sent;
Wherein, described utilization filled in after objective business model to generate target configuration file be prior art, can comprise: utilize the content that every attribute of the every configuration in objective business model is corresponding, generate target configuration file.
The device of switching network device configuration file provided by the invention as software, can be installed in Network Management Equipment in a transport network, also can be arranged in any computer.During actual use, by the control of the Network Management Equipment or computer of installing this device, obtain the former configuration file of specified network equipment and the network equipment sending to this to specify target configuration file by the transceiver module of this device, this network equipment utilizes target configuration file to carry out subsequent operation according to prior art.
The method of switching network device configuration file of the present invention as shown in Figure 2, comprises the following steps:
Step 201: preset former business model, objective business model and transformation rule.
Step 202: obtain former configuration file, puts the content of every attribute of the former business model of filling in documents according to first wife.
Here, described content of putting every attribute of the preset former business model of filling in documents according to first wife is: api command corresponding according to the attribute configured in former business model one by one, extracts content and preserve from former configuration file.
Step 203: utilize the former business model after having filled in, fill in the content of every attribute of objective business model according to preset transformation rule.
Be specially: the attribute extracting the configuration in objective business model one by one, according to the transformation rule of this attribute, utilize the api command of association from former business model, obtain corresponding content and preserve.
Step 204: utilize the objective business model after having filled in generate target configuration file.
After above-mentioned steps 201 completes, device provided by the invention, according to the control of installed equipment, obtains the former configuration file of specified network equipment, performs step 202.
After above-mentioned steps 204 completes, target configuration file also can be sent to the network equipment obtaining former configuration file by device provided by the invention, and this network equipment utilizes target configuration file to carry out subsequent operation according to prior art.
The embodiment of the present invention, suppose that network equipment A software version before software upgrading is 33, wherein Ethernet service comprises: Service configures, and has " index ", " uerslabel " and " ceVlanPreserve " attribute in Service configuration; After software upgrading, software version is 34, and wherein Ethernet service comprises L2vpn configuration, has " index " and " ceVlanPreserve " attribute, then realize the method for the present invention to switching network device configuration file, comprise the following steps in L2vpn configuration:
Step 301: preset former Ethernet service model, target Ethernet service model and transformation rule.
Here, described former Ethernet service model comprises: " index ", " uerslabel " and " ceVlanPreserve " attribute in Service configuration and corresponding api command, as shown in table 1, the api command that in table 1, attribute " index " is corresponding is " 0xa405000e service instance<1-4096> ", and the rest may be inferred for the corresponding relation of other attributes and api command;
Table 1
Described target Ethernet service model comprises: " index " and " ceVlanPreserve " attribute in L2vpn configuration and corresponding api command, as shown in table 2, the api command that in table 2, attribute " index " is corresponding is " 0xa405001e service instance<1-4096> ", the rest may be inferred for corresponding relation between other attribute and api commands, do not repeat;
Table 2
Described transformation rule is as shown in table 3:
Table 3
Wherein, " userLabel " attribute in table 1 does not have in table 2, not this attribute of the Ethernet service model namely in software version 34, then without the need to transformation rule that this attribute preset is corresponding.
Step 302: obtain former configuration file, puts the content of every attribute of the former Ethernet service model of filling in documents according to first wife.
Step 303: the attribute extracting the configuration in target Ethernet service model one by one, according to the transformation rule of this attribute, utilizes the api command of association from former Ethernet service model, obtain corresponding content and preserve.
Step 304: utilize target Ethernet service model to generate target configuration file.
The above, be only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.