Disclosure of Invention
The technical problem to be solved by the present invention is to overcome the defects of the prior art, and to provide a method for upgrading a plurality of network devices in batches by an ethernet broadcast manner, wherein a packet sending program communicates with the network devices to be upgraded through a switching device, one packet sending program or a plurality of packet sending programs simultaneously send packets to a switch device, a plurality of devices to be upgraded are connected to the switch, and if more devices are to be upgraded, one or more switches can be connected to the switch to increase the number of upgraded devices.
In order to solve the technical problems, the invention adopts the technical scheme that:
a method for upgrading a plurality of network devices in batches in an Ethernet broadcasting mode comprises the following steps:
step 1, a package sending program monitors equipment registration information, searches an upgrade file corresponding to the equipment type in a version library according to the equipment registration information and starts to send the upgrade file;
step 2, when the upgrade file starts to be sent, a package sending program divides the upgrade file into a plurality of Ethernet broadcast packages carrying the feature codes of the method and the equipment type, and obtains the MD5 value of the upgrade file and the total number of the divided packages of the upgrade file, wherein the Ethernet broadcast packages comprise a start package and a plurality of content packages;
step 3, the packet sending program circularly and sequentially sends a start packet and a plurality of content packets to a multi-port switch;
step 4, connecting the device to be upgraded to the multi-port switch, starting the package receiving program in the device to be upgraded, receiving the start package first, dropping the received Ethernet broadcast package in the mode before the start package is not received, confirming whether the current version number is consistent with the file version number in the start package after the start package is received, dropping all content packages subsequently if the current version number is consistent with the file version number in the start package, receiving the content packages out of order until the content packages with all sequence numbers are received if the current version number is inconsistent with the file version number, combining the content packages into a file, calculating the MD5 value of the file, upgrading the file if the MD5 value of the file is consistent with the MD5 value of the file in the start package, and not upgrading the file and deleting the file if the MD5 value is inconsistent with the file.
Further, the longest content of each of the ethernet broadcast packets describing the file is 1000 bytes.
Further, the file to be filled in the start packet is divided into the total number of packets, the file name, the file version number, and the MD5 value of the file, and the packet sequence number, the packet length, and the MD5 value of the packet content to be filled in the content packet.
Further, the step 4 further includes the following steps: when receiving the content package, the MD5 value of the content package is also calculated, if the MD5 value is consistent with the MD5 value in the start package, the content package is received, and if the MD5 value is not consistent with the MD5 value, the content package is dropped.
Further, the step 1 further comprises: the process requirement of the package sending program can increase the characteristic of simultaneously upgrading a plurality of devices in batches, each device can register the type of the device with the package sending program, and the package sending program can search the upgrading file of the device type from the version library according to the device type and start the process of upgrading the device type.
Further, the step 2 further comprises: the process of the package sending program requires that the package sending program is added and carried out at the same time, and the switch is added to add the network which is upgraded at the same time and carry out the upgrading at the same time.
After the technical scheme is adopted, compared with the prior art, the invention has the following beneficial effects.
The invention sends the package procedure to communicate with upgraded network equipment through the switching equipment, a package procedure or a plurality of package procedures send packages to the switching equipment at the same time, connect a plurality of equipment needing to be upgraded to the switch, if more equipment needs to be upgraded, one or a plurality of switches can be connected on the switch to increase and upgrade more equipment, and improve the upgrading efficiency of the network equipment.
The following describes embodiments of the present invention in further detail with reference to the accompanying drawings.
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 will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and the following embodiments are used for illustrating the present invention and are not intended to limit the scope of the present invention.
Example one
As shown in fig. 1, in the method for batch upgrading multiple network devices by using an ethernet broadcast manner in this embodiment, an ethernet two-layer packet is used as a packet carrier, that is, only an ethernet header is included in a packet, and a destination address of the ethernet header is a broadcast MAC: and the packet type in the Ethernet header is a self-defined packet type: 0xFF11, wherein the data packet header is a data packet header defined by itself, and the data packet header has the following parameters:
1 > The signature of this method.
2 > The type of device upgraded.
3 > Packet types, which can be classified into
Starting a package: this package type transmits the upgrade file name, version number, package total.
The MD5 value for this document, this MD5 value was used to teach the integrity of this document.
Content package: this packet is the packet content of a file that is divided into a plurality of ethernet packets.
Registering a package: the user device registers the device type with the packaging program.
4 > Packet sequence number. An upgrade file is divided into a plurality of ethernet packets, each occupying a fixed packet sequence number.
5 > The packet content length.
6 > The MD5 value for the package contents, this MD5 value is used to teach the package integrity.
This approach has one packetizer program and one packetizer program. And the package sending program divides the upgrading file of the equipment into a plurality of Ethernet broadcast packages according to the packet header according to the equipment type in the registration package in the network and sends the Ethernet broadcast packages.
And the packaging program is arranged in each device with the function, and when a start packet of the device type is not received, a registration packet of the device type is regularly sent to register the device, the packet sending program is informed of the requirement of batch upgrading of the device, the packaging program can monitor the mode feature code packet at the same time, and a plurality of Ethernet broadcast packets belonging to the device are assembled into a finished upgrading file to be upgraded for the device according to the requirement.
The package issuing program consists of a version library, a registration function and a package issuing function.
The registration function monitors and processes a registration request from the network equipment, and once the network equipment has the registration request, the registration function searches the version library for the upgrade version of the equipment type and sends the upgrade version to the packet sending function to send the upgrade packet of the equipment in a fragmentation mode.
The package receiving program is built in the network device. The packet receiving program also has two functions, a registration function and a packet receiving and packaging function.
The method comprises the following specific steps:
step 1, a packet sending program monitors equipment registration information, searches an upgrade file corresponding to the equipment type in a version library according to the equipment registration information and starts to send the upgrade file.
And 2, when the upgrade file of the equipment type is started to be transmitted, the package transmitting program divides the upgrade file into a plurality of Ethernet broadcast packages carrying the feature codes of the method and the equipment type. And acquiring the MD5 value of the file, and acquiring the total number of the divided packages of the file. The upgrade file is sequentially divided, and the longest content of each package recording the file is 1000 bytes.
And 3, a packet sending program circularly and sequentially sends the start packet and a plurality of content packets to a multi-port switch. It can be that several package-sending programs are simultaneously sent to a multi-port exchanger, so that it can raise the speed of equipment upgrade, and the required filling file in the starting package can be divided into total number of data package, file name, file version number and file MD5 value. The packet sequence number, packet length, and MD5 value of the packet content that needs to be filled in the content packet.
And 4, connecting the equipment to be upgraded to the multi-port switch, wherein the packet receiving program in the equipment starts to work, the starting packet needs to be received first, and the received Ethernet broadcast packet in the mode is discarded before the starting packet is not received. After receiving the start package, confirming whether the current version number of the file in the start package is consistent or not, if so, subsequently discarding all content packages, if not, receiving the content packages out of order until receiving the content packages with all sequence numbers, then combining the content packages into a file, calculating the MD5 value of the file, if the MD5 value is consistent, if the MD5 value of the file in the start package is consistent, upgrading the file, and if not, not upgrading the file, and deleting the file. When receiving the content package, the MD5 value of the content package is also calculated, if the MD5 value is consistent with the MD5 value in the start package, the content package is received, and if the MD5 value is not consistent with the MD5 value, the content package is dropped.
If more devices need to be upgraded, one or more switches may be connected to the switch to add more devices to the upgrade. The step 1 may further include a process requirement of the package sending program, which may increase the characteristic of batch upgrade to multiple devices at the same time, each device may register the type of the device with the package sending program, and the package sending program may search the upgrade file of the device type from the version library according to the device type and start the process of upgrading the device type, which may increase switches, so as to increase the number of networks that may be upgraded at the same time. Step 2, the process requirement of the package sending program can be increased to increase the upgrading speed, and the switch can be increased to increase the number of networks which can be upgraded simultaneously.
The method of the invention is characterized in that a packet sending program communicates with the upgraded network equipment through the switching equipment, one packet sending program or a plurality of packet sending programs simultaneously send packets to the switch equipment, a plurality of equipment needing to be upgraded are connected to the switch, if more equipment needs to be upgraded, one or a plurality of switches can be connected to the switch to increase the upgrading of more equipment.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.