Invention content
In view of the above problems, the application describes a kind of implementation method of the network management configuration module based on TLV structures, described
Method includes:
User is needed to configure into parameter and creates a XML file;
A generic configuration masterplate file is created for equipment;
It obtains network management configuration information and shows;
Down distributing configuration data;
Wherein, the ID of the static control of Chinese and English display in need, each static control are stored in the XML file
Corresponding globally unique ID.
Preferably, configuration interface is realized based on MFC, initialization function is logged according to user before the configuration interface is shown
The Chinese and English selected when gateway system corresponds to the parameter to obtain in the XML file.
Preferably, the generic configuration masterplate file uses the elongated message structures of TLV.
Preferably, the generic configuration masterplate file include the group of multigroup MIB parameters node composition, MIB parameters node with
And the group being made of one group of MIB parameter node.
Preferably, the MIB parameters node includes the corresponding TAG of the MIB parameters node, the MIB parameters nodal value
Length and the MIB parameters node value.
Preferably, the group being made of one group of MIB parameter node includes cache file and described by one group of MIB parameter
The index of the group of node composition.
Preferably, the process for obtaining the network management configuration information and display includes step:
Generate generic configuration masterplate file object objPackage;
Call the corresponding Tag values of the configuration parameter and length addition array that addItem methods will obtain;
GetData method tissues are called to need the data for being sent to server, then by TLV data of composition, corresponding
Command code and the message object of return send asynchronous message as parameter call ClientSendSyncMsg to sever;
Call setData parsings from server's by the object objPackage if the message is sent successfully
Message, and stored according to group and item;
Call network bytes sequence translation interface that transformed value is assigned to the corresponding controls of Tag to show.
Preferably, the process of down distributing configuration data includes step:
Obtain the corresponding value of configuration interface input frame control;
Network bytes sequence conversion is carried out, generic configuration masterplate file object objPackage is generated;
AddItem methods are called, by transformed value and corresponding Tag values and length, array is added;
GetData method tissues are called to need the data for being sent to server;
Using the TLV data of composition, corresponding command code and the message object of return as parameter call
ClientSendSyncMsg sends asynchronous message to sever;
Sever is again by configuration distributing to the equipment.
Above-mentioned technical proposal has the following advantages that or advantageous effect:It is a kind of based on TLV structures present invention is mainly used for providing
Network management configuration module implementation method, mainly include XML file design, generic configuration class design, network management configuration acquisition of information
And display and configuration data issue several parts.Network management system is to manage the integrated management software platform of a variety of distinct devices, this hair
The bright flexibility that message structure length is fully taken into account when message structure designs, use TLV can be changed long structure, avoid by
According to regular length structure design when, the problem of needing the structure that front and back defines to be consistent, otherwise can report an error, especially exist
In the case that MIB nodes change;It will directly show that the page respectively configures the control ID and TAG value of parameter in TLV structure designs
By MAP structure connections, the operation of the display control bundle variable in regular length design to parameters is eliminated;It is right simultaneously
Network bytes sequence is converted, and configuration parameter is assigned to the operations such as corresponding control on interface and is sealed by the construction of TLV and parsing
Dress, provides calling interface easy to use.Configure interface calling, reduce front desk service configuration section exploitation and safeguard at
Originally it and bears;New configuration interface meets easily extension, the requirement of easy care, facilitates and support following demand, such as business configuration
Templating.
Embodiment one
As shown in Figure 1, a kind of implementation method of the network management configuration module based on TLV structures, including step:
The all types of parameters that user needs to configure are created into a XML file;
A generic configuration masterplate file is created for equipment;
It obtains network management configuration information and shows;
Down distributing configuration data.
Wherein, the implementation method of the network management configuration module based on TLV structures includes mainly XML file design, generic configuration
Design, gateway configuration information acquisition and the display of masterplate and issuing for configuration data.
Specifically, the process that all types of parameters that user needs to configure are created to a XML file is predominantly related to
The design of XML file.Configuration management partial page Chinese and English is based primarily upon XML file realization in the present embodiment, and configuration interface is
It is realized based on MFC, the element on interface is made of different controls, and each control corresponds to globally unique ID.In XML texts
In part, the ID of the static control of Chinese and English display stores corresponding Chinese and English, the initialization letter before interface display as needed
The Chinese and English that the when of logging in network management system according to user in OnInitDialog selects is counted to obtain corresponding Chinese and English and call
SetWindowText functions are shown.By taking Port Mirroring configures as an example:
The process that a generic configuration masterplate file is created for equipment relates generally to the design of generic configuration masterplate file.This
The message structure that front and back communicates in embodiment, using the elongated message structures of TLV, generic configuration class CCommConfig is (i.e. general
Configuration template file) expansibility and ease for maintenance of interface are fully taken into account at the beginning of design, while to facilitate and support future
Demand, and can reduce exploitation and maintenance cost and the burden of front desk service configuration section by configuring the calling of interface.
Network bytes sequence is converted, the construction of TLV and parsing etc. are encapsulated, and calling interface easy to use is provided.
It is as shown in table 1 below with configuration class CCommConfig attributes:
1 CCommConfig members lists of table
Main method and function are as follows:
CCommConfig::CreateGroup methods:An item group is created, and is added to array end;
CCommConfig::AddItem methods:An item is added in the last one group into array;
CCommConfig::GetData methods:Tissue needs the data for being sent to server;
CCommConfig::SetData methods:The message from server is parsed, and is deposited according to group and item
Storage;
CCommConfig::GetItemInfo methods:According to the corresponding TAG value of node, taken in Group after parsing
Go out corresponding value;
Wherein, CTlvItem and CTlvItemGroup is the corresponding class of generic configuration class members, and CTlvItem is MIB ginsengs
Number node class, CTlvItemGroup are the group classes of MIB parameter nodes composition.
CTlvItem members lists and main method are as shown in table 2:
2 CTlvItem members lists of table
Main method and function are as follows:
CTlvItem::GetItemID methods:Take the corresponding TAG of MIB parameter nodes;
CTlvItem::GetValue methods:Take the corresponding value of MIB parameter nodes;
CTlvItem::GetSize methods:Take the length of MIB parameter nodal values;
Shown in CTlvItemGroup members lists and main method table 3:
3 CTlvItemGroup members lists of table
Title |
Type |
Explanation |
m_arrItem |
CArray<CSnmpItem*,CSnmpItem*> |
Cache one group of CSnmpItem |
m_nIndex |
int |
Index in group |
Main method and function:
CTlvItemGroup::AddItem methods:Newly create an item;
CTlvItemGroup::GetItemInfo methods:Read an item information in the group;
CTlvItemGroup::GetData methods:All item of the group are converted into the format of TLV;
CTlvItemGroup::Release methods:Delete all item in the group, Free up Memory.
As shown in Fig. 2, the acquisition and display of network management configuration information are the initialization functions before interface display
It is completed in OnInitDialog.Generic configuration class CCommConfig object objPackage are first generated, the object is then passed through
It calls the corresponding Tag values of each configuration parameter, length that addItem methods will obtain that array is added, recalls getData methods
Tissue needs the data for being sent to server, then makees the TLV data of composition, corresponding command code and the message object of return
Asynchronous message is sent to sever for parameter call ClientSendSyncMsg, passes through CCommConfig objects if success
ObjPackage calls setData to parse the message from server, and is stored according to group and item;Finally call
Transformed value is assigned to the corresponding controls of Tag to show by network bytes sequence translation interface.
During down distributing configuration data, after having modified the value of configuration parameter and determining modification, responded in ACK button
Event in complete configuration data and issue.As shown in figure 3, obtaining the corresponding value of configuration interface input frame control first, then
Network bytes sequence conversion is carried out, generates generic configuration class CCommConfig object objPackage, and call addItem methods,
By transformed value and corresponding Tag and length, array is added, recalls getData method tissues and needs to be sent to server
Data, then using the TLV data of composition, corresponding command code and the message object of return as parameter call
ClientSendSyncMsg sends asynchronous message to sever, and sever again can come into force configuration distributing to equipment.
The implementation method for the network management configuration module based on TLV structures that the present embodiment proposes, XML realize configuration management interface
The message structure length of Chinese and English display, the communication of network management configuration front and back is variable, and the page will be directly shown in TLV structure designs
The control ID of each configuration parameter, by MAP structure connections, eliminates the display to parameters in regular length design with TAG value
The operation of control bundle variable, and network bytes sequence is converted, the construction of TLV and parsing etc. are encapsulated, and are provided simple easy
Interface calls.When supporting the management configuration to miscellaneous equipment, if the corresponding MIB of configuration item is consistent, can directly prop up
It holds without changing code;If inconsistent, only structure and the page display of request needs to distinguish with unit type,
Its code different models of equipment is generally applicable, and without change, the configuration interface in general class is also generally applicable between distinct device, can be fast
Speed supports the management configured to miscellaneous equipment.And code is succinct, realizes that the time is short, it is characterised in that including:
1) XML realizes Chinese and English.For XML file for storage configuration administrative section page Chinese and English, configuration interface is to be based on
What MFC (Microsoft Foundation Classes, Microsoft Foundation class libraries) was realized, existed by loading XML dynamic link libraries
XML file can be very easily operated in program.Element on interface is made of different controls, and each control is corresponding complete
The unique ID of office.In XML file, the ID of the static control of Chinese and English display stores corresponding Chinese and English as needed, on boundary
Face show before initialization function OnInitDialog in when logging in network management system according to user the Chinese and English that selects obtain pair
The Chinese and English answered simultaneously calls SetWindowText functions to show.
2) control is associated with TAG.It will directly show that the page respectively configures the control ID and TAG of parameter in Data Structure Design
Value eliminates the operation of the display control bundle variable in regular length design to parameters by MAP structure connections.
3) message structure length is variable.Front and back message communicating uses TLV variable length formats, and the ends client and sever are only
Configuration parameter need to be packaged and be parsed by the group packet and unpacking rule of TLV, without as struct regular lengths
Structure design needs the ends client and sever to preserve the corresponding structure of configuration parameter of identical structure and length respectively like that,
The mistake caused by structure is inconsistent is avoided, is dealt with also relatively more flexible.
4) construction of TLV and parsing.Network managment foreground and background communication information structure is about set to TLV structures, in client to sever
When sending GET request, each parameter to be obtained is organized into TLV character strings according to the structure and is sent to by client needs
The ends server, the ends sever need that first data packet is split and (parsed) according to TLV structures to want to know after receiving data
The value of which configuration parameter is taken from equipment.It the ends sever also will be according to the structure by the configuration parameter got after getting value
Value is organized into TLV character strings and returns to the ends client, and the ends client receive to be split by TLV structures after the value of return and (solve
Analysis) at each configuration item and value and shown.SET asks similarly, not repeat in this way.
5) self-defined generic configuration class provides interface and calls.Writing code in order to avoid repetition leads to code redundancy, makes work(
It can reuse, shorten the development time of similar functions, here convert the general network bytes sequence of each configuration item, TLV
Construction and the functions such as parsing encapsulated, directly called by generating the object of generic configuration class, code structure is succinct,
It uses and is convenient to.
The elongated message structure refers to that the message structure length that front and back is communicated is not fixed, can be according to agreement
TLV groups packet and unpack rule configuration parameter constructed and parsed, message-length regard configuration parameter type, number and value and
It is fixed.
The TLV structures, tag-length-value (TLV), Tag (label), Length (length), Value (value),
In data communication field, T, the length of L field are often fixed (being usually 1~4bytes), and V field lengths are variable.T fields indicate
Type of message, L field indicate that message length, V fields are often used to store the content of message.
The XML dynamic link libraries when parsing XML file in a program, need to introduce msxml6.dll, there is no need to me
Oneself write the syntax analyzer of XML.It is a COM (Component Object Model) library of object, will be carried out
Required all objects are encapsulated when XML parsings.Because COM be it is a kind of occur in a binary format it is reusable right
As and language it is unrelated, it can be called with any language (such as VC, C++Builder etc.), in the application realize pair
The parsing of XML document.
The present invention is directed to the configuration management in Network Management System, provides a kind of network management configuration mould based on TLV structures
The implementation method of block, by under XML file design, the design of generic configuration class, network management configuration acquisition of information and display and configuration data
Send out part a few and complete jointly the configuration management function in network management system.The support of administration page Chinese and English of the present invention is to be based on XML
It realizes, generic configuration class CCommConfig provides abundant interface, and client is corresponding by configuring relevant MIB node
TAG and value (null value is assigned when GET) call the relevant interface function tissue that CCommConfig is provided to need to be sent to server's
Data send GET and SET requests to server, and the relevant interface function parsing that CCommConfig is provided then is called in GET successes
Server return message and display, deal with very simple and convenient.Mainly there is configuration item in this system:RSTP, port mirror
Picture, QOS, ACL access control, QINQ, alarm configuration, PON, IGMP, SNMP, ONU mandate, SWITCH, VLAN, VOIP, IPTV,
DHCP etc..The device type that webmaster of the present invention has been supported has the OLT of two kinds of models of FP6508 and FP8680 and various types of
ONU, to support directly support, if not the management configuration of miscellaneous equipment when the corresponding MIB of configuration item is consistent
Unanimously, then only structure and the page display of request need to distinguish with unit type, and other code different models of equipment can
It is general, without change, it can quickly support the management configured to miscellaneous equipment.
The present invention provides the implementation method of the network management configuration module based on TLV structures, front and back communication information structure is long
Degree is variable, and the control ID that the display page is directly respectively configured to parameter in Data Structure Design is closed with TAG value by MAP structures
Connection eliminates the operation of the display control bundle variable in regular length design to parameters.Self-defined generic configuration class,
Network bytes sequence is converted, the construction of TLV and parsing etc. are encapsulated, and calling interface easy to use is provided.Configure interface
Calling, reduce exploitation and maintenance cost and the burden of front desk service configuration section;Meanwhile new configuration interface, meet easy
Extension, the requirement of easy care facilitate following demand of supporting, such as the templating of business configuration.
Interface in generic configuration class is unrelated with device type, generally applicable in the management configuration of distinct device, to branch
The management configuration to miscellaneous equipment is held, when the corresponding MIB of configuration item is consistent, can directly support, if inconsistent, be
Structure and the page display of request need to distinguish with unit type, and other code different models of equipment are generally applicable, without changing
It is dynamic, it can quickly support the management configured to miscellaneous equipment.
For a person skilled in the art, after reading above description, various changes and modifications undoubtedly will be evident.
Therefore, appended claims should regard the whole variations and modifications for covering the true intention and range of the present invention as.It is weighing
The range and content of any and all equivalences within the scope of sharp claim, are all considered as still belonging to the intent and scope of the invention.