CN109245920B - Automatic switch configuration method and device, switch and storage medium - Google Patents

Automatic switch configuration method and device, switch and storage medium Download PDF

Info

Publication number
CN109245920B
CN109245920B CN201810968372.1A CN201810968372A CN109245920B CN 109245920 B CN109245920 B CN 109245920B CN 201810968372 A CN201810968372 A CN 201810968372A CN 109245920 B CN109245920 B CN 109245920B
Authority
CN
China
Prior art keywords
file
switch
flash disk
media directory
configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810968372.1A
Other languages
Chinese (zh)
Other versions
CN109245920A (en
Inventor
李伟
卢兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kyland Technology Co Ltd
Original Assignee
Kyland Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kyland Technology Co Ltd filed Critical Kyland Technology Co Ltd
Priority to CN201810968372.1A priority Critical patent/CN109245920B/en
Publication of CN109245920A publication Critical patent/CN109245920A/en
Application granted granted Critical
Publication of CN109245920B publication Critical patent/CN109245920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0876Aspects of the degree of configuration automation
    • H04L41/0886Fully automatic configuration

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Automation & Control Theory (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an automatic switch configuration method, an automatic switch configuration device, a switch and a storage medium. Wherein, the method comprises the following steps: after detecting the insertion of a USB flash disk, mounting the USB flash disk into a file system media directory of a switch system; checking whether a target file exists in the file system media directory; and if the target file exists, configuring the switch system according to the target file. The embodiment of the invention solves the problems that the configuration process in the prior art is complex and is not suitable for configuring the switch system in a complex equipment use environment, can realize that the switch system can be configured according to the user requirement only by one USB flash disk when the switch system is installed and used, and is more convenient and quicker in the configuration process.

Description

Automatic switch configuration method and device, switch and storage medium
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to an automatic switch configuration method, an automatic switch configuration device, a switch and a storage medium.
Background
The task of the network pipe type switch is to keep all network resources in good condition. The network management type switch product provides a plurality of network management modes such as a remote login network based on a terminal control port, a webpage and a remote terminal protocol. Therefore, network management personnel can carry out local or remote real-time monitoring on the working state and the network running condition of the network management type switch, and comprehensively manage the working states and working modes of all the switch ports. In order to ensure the normal operation of the network management type switch, a network manager can perform field debugging on the network management type switch, for example, system upgrade, configuration backup, log export and configuration update on the network management type switch.
In the prior art, a computer and a network management type switch are usually connected by a cable, and the network management type switch is configured by the computer.
In the process of implementing the invention, the inventor finds that in a complex equipment use environment, field debugging is not suitable for configuration by using a computer connection switch sometimes. The user wishes the configuration process to be more convenient and faster.
Disclosure of Invention
The invention provides an automatic switch configuration method, an automatic switch configuration device, an automatic switch and a storage medium, which can be used for automatically configuring and automatically upgrading a network management type switch and optimizing the configuration process of the network management type switch.
In a first aspect, an embodiment of the present invention provides an automatic switch configuration method, including:
after detecting the insertion of the USB disk, mounting the USB disk under a file system media directory of a switch system;
checking whether a target file exists in a file system media directory;
and if the target file exists, configuring the switch system according to the target file.
In a second aspect, an embodiment of the present invention further provides an apparatus for automatically configuring a switch, including:
the USB disk mounting module is used for mounting the USB disk into a file system media directory of the switch system after the USB disk insertion is detected;
the file checking module is used for checking whether a target file exists in a file system media directory;
and the system configuration module is used for configuring the switch system according to the target file if the target file exists.
In a third aspect, an embodiment of the present invention further provides a switch, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the switch auto-configuration method according to the embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the switch auto-configuration method according to the embodiment of the present invention.
After the insertion of the USB flash disk is detected, the USB flash disk is mounted to a file system media directory of a switch system; checking whether a target file exists in a file system media directory; if the target file exists, the switch system is configured according to the target file, the problems that the configuration process in the prior art is complex and is not suitable for configuring the switch system in a complex equipment use environment are solved, the switch system can be configured according to user requirements only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
Drawings
Fig. 1 is a flowchart of an automatic switch configuration method according to an embodiment of the present invention;
fig. 2 is a flowchart of an automatic switch configuration method according to a second embodiment of the present invention;
fig. 3 is a flowchart of an automatic switch configuration method according to a third embodiment of the present invention;
fig. 4 is a flowchart of an automatic switch configuration method according to a fourth embodiment of the present invention;
fig. 5 is a flowchart of an automatic switch configuration method according to a fifth embodiment of the present invention;
fig. 6 is a flowchart of an automatic switch configuration method according to a sixth embodiment of the present invention;
fig. 7 is a schematic architecture diagram of a switch system according to a sixth embodiment of the present invention;
fig. 8 is a block diagram of an automatic configuration apparatus for a switch according to a seventh embodiment of the present invention;
fig. 9 is a schematic structural diagram of a switch according to an eighth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an automatic switch configuration method according to an embodiment of the present invention, where this embodiment is applicable to a case of configuring a network management type switch, and the method can be executed by an automatic switch configuration device according to an embodiment of the present invention, and the device can be implemented in a software and/or hardware manner and can be generally integrated in a network management type switch. As shown in fig. 1, it specifically includes the following steps:
step 101, after detecting the insertion of the USB disk, mounting the USB disk into a file system media directory of a switch system.
After the switch system is started, the switch system detects whether a Universal Serial Bus (USB) interface of the switch system is plugged with a flash disk. When the insertion of the USB disk is detected, the switch system carries out enumeration identification on the USB disk through a system drive, and then mounts the USB disk to a file system media directory/media of the switch system. The file system media directory is a mount point for the storage device. When a device is to be used by the switch system, the device must be first mapped to a directory, which is called a mount point, so that the device can be read, and the mapping action is "mount". Specifically, after detecting the insertion of the flash disk, the switch system automatically establishes a disk directory under the file system media directory, then mounts the flash disk on the disk directory, and accesses the flash disk by accessing the disk directory.
The USB flash disk belongs to an enumeration stage from the access switch system to before normal operation. Enumeration is to let the switch system recognize the flash disk and prepare resources for it. And establishing a data transmission mechanism between the switch system and the USB flash disk. The operation at this stage is specified by the USB communication protocol, and therefore belongs to a standard flow established by the International Organization for Standardization (ISO), that is, an ISO standard flow.
Step 102, checking whether a target file exists in a file system media directory.
The method comprises the steps of reading a file in the USB flash disk by accessing a directory corresponding to the USB flash disk under a media directory of a file system, checking the content of the file, and checking whether a target file exists in the directory corresponding to the USB flash disk. The target file is a file for configuring the switch system. The object file may include: the method comprises the steps of upgrading a system image file, starting a loading program, starting a configuration file during starting and the like. Before the USB flash disk is inserted into the switch system, a user can store the target file to the USB flash disk according to service requirements.
And 103, if the target file exists, configuring the switch system according to the target file.
And if the target file exists in the directory corresponding to the USB flash disk, configuring the switch system according to the type of the target file.
In the automatic configuration method for the switch provided by the embodiment, after the insertion of the flash disk is detected, the flash disk is mounted in a file system media directory of a switch system; checking whether a target file exists in a file system media directory; if the target file exists, the switch system is configured according to the target file, the problems that the configuration process in the prior art is complex and is not suitable for configuring the switch system in a complex equipment use environment are solved, the switch system can be configured according to user requirements only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
Example two
Fig. 2 is a flowchart of an automatic switch configuration method according to a second embodiment of the present invention, which is embodied on the basis of various alternatives in the foregoing embodiments: the target file is a system upgrading mirror image file; if the target file exists, configuring the switch system according to the target file, wherein the configuration comprises the following steps: identifying version information of a system upgrade image file in a file system media directory; and if the version of the system upgrading image file in the file system media directory is higher than the version of the current system upgrading image file of the switch system, upgrading the system partition according to the system upgrading image file in the file system media directory. As shown in fig. 2, it specifically includes the following steps:
step 201, after detecting the insertion of the flash disk, mounting the flash disk into a file system media directory of the switch system.
Step 202, checking whether a target file exists in a file system media directory.
Step 203, identifying version information of the system upgrade image file in the file system media directory.
The system upgrading image file is used for upgrading the switch system. The system image file is to compress the operating system partition on a system installation optical disc or a hard disc into an image file completely, and the image file contains all the information of the system partition of the optical disc or the hard disc and can be used for system installation.
And after the system upgrade image file is checked in the file system media directory, identifying the version information of the system upgrade image file in the file system media directory. Optionally, the version information of the system upgrade image file is identified according to the file name or the attribute information of the system upgrade image file. For example, the file name of the system upgrade image file is Aquam81XX _38.0.13.5. mfi. Wherein the x field in aqua 81XX _ xx.x.xx.5.mfi is used for version information identification.
And step 204, if the version of the system upgrade image file in the file system media directory is higher than the version of the current system upgrade image file of the switch system, upgrading the system partition according to the system upgrade image file in the file system media directory.
The current system upgrade image file of the switch system refers to a system upgrade image file corresponding to the current system of the switch system, and is a system upgrade image file used when the switch system is upgraded to the current system.
And judging the version of the system upgrading image file in the file system media directory and the version of the current system upgrading image file of the switch system according to the version information of the system upgrading image file in the file system media directory and the version information of the current system upgrading image file of the switch system. For example, the sizes of the fields used for version information identification are compared. And the system upgrade image file with a larger field has a high version.
And if the version of the system upgrading image file is higher than that of the current system upgrading image file of the switch system, the switch system enters a system upgrading state, and upgrading the system partition according to the system upgrading image file in the file system media directory. The system partition is a partition for starting the switch. System upgrades are actually a software package deletion and reassembly process. In the upgrading process of the system partition, the switch system automatically deletes the old software package in the system partition according to the system upgrading image file and reloads the new software package.
In the method for automatically configuring the switch provided by this embodiment, if a system upgrade image file exists in a file system media directory, version information of the system upgrade image file in the file system media directory is identified; if the version of the system upgrade image file in the file system media directory is higher than the version of the current system upgrade image file of the switch system, the system partition is upgraded according to the system upgrade image file in the file system media directory, so that the switch system can be upgraded according to user requirements only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
EXAMPLE III
Fig. 3 is a flowchart of an automatic switch configuration method according to a third embodiment of the present invention, which is embodied on the basis of various alternatives in the foregoing embodiments: the target file is a starting loading program; if the target file exists, configuring the switch system according to the target file, wherein the configuration comprises the following steps: identifying version information of a boot loader in a file system media directory; and if the version of the start loading program in the file system media directory is higher than the version of the current start loading program of the switch system, upgrading the start loading program partition according to the start loading program in the file system media directory. As shown in fig. 3, it specifically includes the following steps:
step 301, after detecting the insertion of the flash disk, mounting the flash disk into a file system media directory of the switch system.
Step 302, checking whether a target file exists in a file system media directory.
Step 303, identify version information of the boot loader in the file system media directory.
Wherein the boot loader is run before the switch system kernel is run. The boot loader may initialize hardware devices, create memory space maps, and bring the switch system's software and hardware environment to an appropriate state to prepare the correct environment for the final invocation of the switch system kernel. The load startup task of the entire switch system is completely completed by the boot loader. Alternatively, the boot loader may be Redboot. The Redboot is a starting loader which independently runs on an embedded system, and is a popular starting loader with good function and portability at present.
After the boot loader is checked in the file system media directory, version information of the boot loader is identified. Optionally, the version information of the boot loader is identified according to the file name or the attribute information of the boot loader. For example, the file name of the boot loader is Redboot-Jaguar2-32.0.10.5. img. Wherein, the x field in Redboot-Jaguar2-xx.x.xx.x.img is used for version information identification.
And step 304, if the version of the start loading program in the file system media directory is higher than the version of the current start loading program of the switch system, upgrading the start loading program partition according to the start loading program in the file system media directory.
The current starting loader of the switch system refers to the starting loader in the switch system. And judging the version of the start loading program in the file system media directory and the level of the version of the current start loading program of the switch system according to the version information of the start loading program in the file system media directory and the version information of the current start loading program of the switch system. For example, the sizes of the fields used for version information identification are compared. The boot loader version is high with a large field.
And if the version of the start loading program in the file system media directory is higher than the version of the current start loading program of the switch system, upgrading the start loading partition according to the start loading program in the file system media directory. The boot loader partition is a partition for performing a load boot task of the entire switch system. In the upgrading process of the starting loading partition, the switch system automatically writes the starting loading program in the media directory of the file system into the starting loading partition. Optionally, the switch system saves a backup of the current boot loader of the switch system in the boot loader partition. If the upgraded switch system fails to start, the backup of the current starting loading program of the switch system stored in the starting loading partition of the switch system is restored.
In the method for automatically configuring the switch provided by this embodiment, if the starting loader exists in the file system media directory, the version information of the starting loader in the file system media directory is identified; if the version of the starting loading program in the file system media directory is higher than the version of the current starting loading program of the switch system, the starting loading program partition is upgraded according to the starting loading program in the file system media directory, so that the starting loading program of the switch system can be upgraded according to the user requirement only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
Example four
Fig. 4 is a flowchart of an automatic switch configuration method according to a fourth embodiment of the present invention, which is embodied on the basis of various alternatives in the foregoing embodiments: the target file is a starting configuration file; if the target file exists, configuring the switch system according to the target file, wherein the configuration comprises the following steps: and importing the boot configuration file in the file system media directory into the switch system. As shown in fig. 4, it specifically includes the following steps:
step 401, after detecting the insertion of the flash disk, mounting the flash disk into a file system media directory of the switch system.
Step 402, checking whether a target file exists in a file system media directory.
Step 403, importing the boot configuration file in the file system media directory into the switch system.
The Startup configuration file start _ config is a configuration file that is automatically loaded when the switch system is started. And importing the boot configuration file in the file system media directory into the switch system, storing the boot configuration file into a Non-Volatile Random Access Memory (NVRAM) of the switch system, and covering the current boot configuration file of the switch system. When the exchanger system is started next time, the startup configuration file in the media directory of the file system is read.
According to the automatic switch configuration method provided by the embodiment, the boot configuration file in the file system media directory is imported into the switch system through the boot configuration file in the file system media directory, so that the boot configuration file of the switch system can be updated according to the user requirement only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
EXAMPLE five
Fig. 5 is a flowchart of an automatic switch configuration method according to a fifth embodiment of the present invention, which is embodied on the basis of various alternatives in the foregoing embodiments: after the flash disk is mounted under the file system media directory, the method further comprises the following steps: and generating a current backup configuration file according to the current starting configuration file and the current time stamp of the switch system, and storing the current backup configuration file to the USB flash disk.
Optionally, after the flash disk is mounted in the file system media directory, the method further includes: exporting the system log of the switch system to the USB flash disk.
Optionally, after detecting the insertion of the flash disk, the method further includes: the control state prompting device outputs the USB flash disk insertion prompting information; after the flash disk is mounted under a file system media directory of a switch system, the method further comprises the following steps: the control state prompting device outputs the USB flash disk mounting prompting information; after the switch system is configured according to the target file, the method further comprises the following steps: and the control state prompting device outputs configuration completion information and unloads the USB flash disk.
As shown in fig. 5, it specifically includes the following steps:
step 501, after detecting the insertion of the flash disk, controlling the state prompting device to output flash disk insertion prompting information, and mounting the flash disk into a file system media directory of a switch system, and controlling the state prompting device to output flash disk mounting prompting information.
The state prompting device is used for prompting the state of the switch system in the configuration process. Optionally, the status prompt device is a Light-Emitting Diode (LED) lamp. The prompting information output by the state prompting device is light information. The display pattern of the LED lights matches the state of the switch system during configuration. The display mode of the LED lamp comprises the following steps: a light-up mode, a flashing mode, and a light-off mode.
Specifically, after the switch system is started, the LED lamp is in a lamp-out mode. After the USB flash disk is detected to be inserted, the switch system controls the LED lamp to enter a light-up mode from a light-out mode, and therefore USB flash disk insertion prompt information is output. And the user determines that the USB flash disk is inserted into the switch system according to the lighting mode of the LED lamp, and the switch system starts to mount the USB flash disk into a file system media directory of the switch system. After the switch system mounts the USB flash disk into a file system media directory of the switch system, the LED lamp is controlled to enter a flashing mode from a lighting mode, and therefore USB flash disk mounting prompt information is output. And the user determines that the USB flash disk is mounted to the file system media directory of the switch system by the switch system according to the flashing mode of the LED lamp, and the switch system starts to access and operate the USB flash disk.
Step 502, generating a current backup configuration file according to the current startup configuration file and the current timestamp of the switch system, and storing the current backup configuration file to the flash disk.
The method comprises the steps of obtaining a current startup configuration file of a switch system, renaming the current startup configuration file of the switch system according to a current timestamp to serve as a current backup configuration file, and storing the current backup configuration file to a USB flash disk. For example, the file name of the current boot configuration file is start _ config. The current boot configuration file for the switch system is renamed to start _ config _ xxx according to the current timestamp. Where xxx is the current timestamp.
Therefore, the current startup configuration file of the switch system is backed up, and the current backup configuration files generated in different configuration processes are distinguished through the time stamps.
Step 503, exporting the system log of the switch system to the flash disk.
The system log is information for recording hardware, software and system problems in the switch system, and can monitor events occurring in the switch system. The system log records every detail of the operation of the switch system and plays an important role in the stable operation of the switch system. By checking the system log of the switch system, the user can find out the reason of the switch system failure in time. The system log of the switch system is exported to the USB flash disk, so that the system log of the switch system is backed up. It should be noted that the system log backup in step 503 may be continuously performed during the entire connection process of the flash disk and the switch, or may be performed after the system configuration is completed and before the flash disk is unloaded.
Step 504, checking whether the target file exists in the file system media directory.
And 505, if the target file exists, configuring the switch system according to the target file.
Step 506, controlling the state prompting device to output configuration completion information and unloading the flash disk.
After the switch system is configured according to the target file, the switch system control state prompting device outputs configuration completion information and unloads the USB flash disk, so that a user can determine that the switch system is configured according to the configuration completion information. And simultaneously, when the switch system outputs the configuration completion information by the control state prompting device, the USB flash disk is unloaded after the files in the USB flash disk are synchronously stored. Specifically, after the switch system is configured, the switch system controls the LED lamp to enter a light-off mode from a blinking mode, thereby outputting configuration completion information. And the user determines that the switch system is configured and finished and the USB flash disk is unloaded according to the fact that the LED lamp enters the light-out mode from the flashing mode, and the USB flash disk can be taken out.
In the method for automatically configuring the switch provided by this embodiment, after the flash disk is mounted to the file system media directory, a current backup configuration file is generated according to a current startup configuration file and a current timestamp of the switch system, the current backup configuration file is stored to the flash disk, and a system log of the switch system is exported to the flash disk, so that the current startup configuration file and the system log of the switch system are backed up; the switch system control state prompting device outputs prompting information according to the state of the switch system in the configuration process, so that a user can determine the state of the switch system in the configuration process in real time according to the prompting information output by the state prompting device.
EXAMPLE six
Fig. 6 is a flowchart of an automatic switch configuration method according to a sixth embodiment of the present invention, which is embodied on the basis of various alternatives in the foregoing embodiments. As shown in fig. 6, it specifically includes the following steps:
step 10, the switch system initializes.
And 11, creating a universal serial bus automatic mounting module. After the execution of step 11 is completed, step 13 is executed.
The usb automatic mount module corresponds to the usb mount module 701 in the seventh embodiment described below.
And step 12, creating a universal serial bus automatic configuration module. After the execution of step 12 is completed, step 20 is executed.
The serial bus automatic configuration module is equivalent to the file checking module 702, the system configuration module 703, the configuration file backup module, and the system log export module in the seventh embodiment described below. Step 12 is performed in synchronization with step 11. After the switch system is started, 2 modules are created: the automatic mounting module of the universal serial bus and the automatic configuration module of the universal serial bus are matched with 2 modules to carry out automatic configuration of the switch. Fig. 7 is a schematic architecture diagram of a switch system according to a sixth embodiment of the present invention. As shown in fig. 7, the application programs of the switch system include a usb automatic mount module and a usb automatic configuration module.
And step 13, checking whether the USB flash disk is inserted. If yes, go to step 14; if not, continue to step 13. After the switch system is started, a user can insert the USB flash disk.
And step 14, lighting the light-emitting diode lamp and automatically mounting the USB flash disk.
After the USB automatic mounting module is started, when the USB automatic mounting module detects that the USB flash disk exists, the LED lamp is lightened, and the USB flash disk is mounted to the file system media directory.
And step 15, notifying the universal serial bus mounting event.
The USB automatic mounting module informs the USB automatic configuration module of a USB mounting event through a callback function mode so that the USB automatic configuration module can know that the USB loading is successful.
And step 16, waiting for the event that the USB automatic configuration module completes configuration, and controlling the light emitting diode lamp to flicker.
And step 17, finishing automatic configuration. If yes, go to step 18; if not, the process continues to step 16.
And step 18, setting the light-emitting diode lamp to be turned off.
And 19, unloading the flash disk after synchronously storing the files in the flash disk. After the execution of step 19 is completed, the flow ends.
And 20, waiting for the mounting event of the universal serial bus.
And step 21, judging whether the universal serial bus mounting event is successfully acquired. If yes, go to step 22; if not, continue to step 20.
Step 22, checking the file system media directory.
The USB automatic configuration module checks the file system media directory after receiving the USB mounting event.
And step 23, detecting whether a high-version system image file exists. If yes, go to step 24; if not, continue to step 25.
And 24, automatically upgrading the system.
And step 25, detecting whether a high-version startup loader exists. If yes, go to step 26; if not, continue to step 27.
And step 26, automatically starting the upgrading of the loading program.
And 27, automatically backing up the boot configuration file to the USB flash disk.
And step 28, automatically backing up the system log to the USB flash disk.
And step 29, detecting whether a startup configuration file exists. If yes, go to step 30; if not, continue to step 31.
And step 30, automatically importing the boot configuration file from the USB flash disk to the system. After the execution of step 30 is completed, step 31 is executed.
And step 31, informing the USB automatic mounting module of the USB automatic configuration module to complete the configuration event. After the execution of step 30 is completed, step 16 is executed.
In this embodiment, the execution sequence of step 23, step 25, step 27, step 28 and step 29 may be variously combined according to the business requirement. The execution sequence provided in this embodiment is merely an example.
Alternatively, the switch may be a Software Defined Network (SDN) switch. Relevant data defining a network protocol, a master/slave device, a communication mode and a working mode of an SDN controller in an SDN switch are generally stored in a configuration file of the switch. The automatic switch configuration method provided by the embodiment of the invention can facilitate the SDN switch to complete the configuration work related to the SDN.
According to the automatic switch configuration method provided by the embodiment, the automatic universal serial bus mounting module and the automatic universal serial bus configuration module are created after the switch system is started, and the automatic universal serial bus mounting module and the automatic universal serial bus configuration module are matched to perform automatic switch configuration, so that a user can use the USB flash disk to perform system upgrading, configuration backup, log export and configuration file updating of the switch system according to service requirements, and the method is more convenient and rapid and provides user experience.
EXAMPLE seven
Fig. 8 is a block diagram of an automatic switch configuration apparatus according to a seventh embodiment of the present invention. As shown in fig. 8, the apparatus may be configured in a core switch, and includes: a flash disk mounting module 701, a file checking module 702 and a system configuration module 703.
The flash disk mounting module 701 is configured to mount a flash disk into a file system media directory of a switch system after detecting that the flash disk is inserted; a file checking module 702, configured to check whether a target file exists in a file system media directory; a system configuration module 703, configured to configure the switch system according to the target file if the target file exists.
In the automatic switch configuration device provided by this embodiment, after detecting that the usb disk is inserted, the usb disk is mounted in the file system media directory of the switch system; checking whether a target file exists in a file system media directory; if the target file exists, the switch system is configured according to the target file, the problems that the configuration process in the prior art is complex and is not suitable for configuring the switch system in a complex equipment use environment are solved, the switch system can be configured according to user requirements only by one USB flash disk when the switch system is installed and used, and the configuration process is more convenient and faster.
Optionally, on the basis of the above technical solution, the target file may be a system upgrade image file;
the system configuration module 703 may include:
the first information identification unit is used for identifying the version information of the system upgrade image file in the file system media directory;
the first upgrading unit is used for upgrading the system partition according to the system upgrading image file in the file system media directory if the version of the system upgrading image file in the file system media directory is higher than the version of the current system upgrading image file of the switch system.
Optionally, on the basis of the above technical scheme, the target file is a start loader;
the system configuration module 703 may include:
the second information identification unit is used for identifying version information of the starting loading program in the media directory of the file system;
and the second upgrading unit is used for upgrading the startup loading program partition according to the startup loading program in the file system media directory if the version of the startup loading program in the file system media directory is higher than the version of the current startup loading program of the switch system.
Optionally, on the basis of the above technical scheme, the target file is a boot configuration file;
the system configuration module 703 may include:
and the file import unit is used for importing the startup configuration file in the file system media directory into the switch system.
Optionally, on the basis of the above technical solution, the apparatus further includes:
and the configuration file backup module is used for generating a current backup configuration file according to the current starting configuration file of the switch system and the current timestamp, and storing the current backup configuration file to the USB flash disk.
Optionally, on the basis of the above technical solution, the apparatus further includes:
and the system log export module is used for exporting the system log of the switch system to the USB flash disk.
Optionally, on the basis of the above technical solution, the usb disk mount module 701 may further include: the insertion information prompting unit is used for controlling the state prompting device to output the USB flash disk insertion prompting information;
the flash disk mounting module 701 may further include: the mounting information prompting unit is used for controlling the state prompting device to output the USB flash disk mounting prompting information;
the flash disk mounting module 701 may further include: and the completion information prompting unit is used for controlling the state prompting device to output configuration completion information and unloading the USB flash disk.
The automatic switch configuration device provided by the embodiment of the invention can execute the automatic switch configuration method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example eight
Fig. 9 is a schematic structural diagram of a switch according to an eighth embodiment of the present invention. Fig. 9 illustrates a block diagram of an exemplary switch 812 suitable for use in implementing embodiments of the present invention. The switch 812 shown in fig. 9 is only an example and should not bring any limitations to the function and scope of use of the embodiments of the present invention.
As shown in fig. 9, the switch 812 is in the form of a general purpose computing device. The components of the switch 812 may include, but are not limited to: one or more processors or processing units 816, a system memory 828, and a bus 818 that couples various system components including the system memory 828 and the processing unit 816.
Bus 818 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Switch 812 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by the switch 812 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 828 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)830 and/or cache memory 832. The switch 812 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 834 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 9, often referred to as a "hard drive"). Although not shown in FIG. 9, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 818 by one or more data media interfaces. Memory 828 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 840 having a set (at least one) of program modules 842, which may be stored for example in memory 828, such program modules 842 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 842 generally perform the functions and/or methodologies of the described embodiments of the invention.
The switch 812 may also communicate with one or more external devices 814 (e.g., keyboard, pointing device, display 824, etc.), with one or more devices that enable a user to interact with the switch 812, and/or with any devices (e.g., network card, modem, etc.) that enable the switch 812 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 822. Also, the switch 812 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 820. As shown, the network adapter 820 communicates with the other modules of the switch 812 over the bus 818. It should be appreciated that although not shown in fig. 9, other hardware and/or software modules may be used in conjunction with the switch 812, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 816 executes various functional applications and data processing by running programs stored in the system memory 828, for example, to implement the switch auto-configuration method provided by the embodiment of the present invention. Namely, after the USB flash disk is detected to be inserted, the USB flash disk is mounted under a file system media directory of a switch system; checking whether a target file exists in a file system media directory; and if the target file exists, configuring the switch system according to the target file.
Example nine
The ninth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for automatically configuring the switch according to the ninth embodiment of the present invention. The method specifically comprises the following steps: after detecting the insertion of the USB disk, mounting the USB disk under a file system media directory of a switch system; checking whether a target file exists in a file system media directory; and if the target file exists, configuring the switch system according to the target file.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, Ruby, Go, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (7)

1. A method for automatically configuring a switch, comprising:
after detecting the insertion of a USB flash disk, mounting the USB flash disk into a file system media directory of a switch system;
checking whether a target file exists in the file system media directory;
if the target file exists, configuring the switch system according to the target file;
the target file is a system upgrading mirror image file;
if the target file exists, configuring the switch system according to the target file, including:
identifying version information of a system upgrade image file in the file system media directory;
if the version of the system upgrade image file in the file system media directory is higher than the version of the current system upgrade image file of the switch system, upgrading the system partition according to the system upgrade image file in the file system media directory;
or the target file is a starting loader;
if the target file exists, configuring the switch system according to the target file, including:
identifying version information of a boot loader in the file system media directory;
if the version of the starting loading program in the file system media directory is higher than the version of the current starting loading program of the switch system, upgrading the starting loading program partition according to the starting loading program in the file system media directory;
the boot loader is operated before the switch system kernel is operated;
or the target file is a startup configuration file;
if the target file exists, configuring the switch system according to the target file, including:
and importing the startup configuration file in the media directory of the file system into the switch system.
2. The method of claim 1, further comprising, after mounting the flash disk under a file system media directory:
and generating a current backup configuration file according to the current starting configuration file and the current time stamp of the switch system, and storing the current backup configuration file to the USB flash disk.
3. The method of claim 1, further comprising, after mounting the flash disk under a file system media directory:
exporting a system log of the switch system to the USB flash disk.
4. The method of claim 1, after said detecting a USB flash drive insertion, further comprising: the control state prompting device outputs the USB flash disk insertion prompting information;
after the mounting of the flash disk into the file system media directory of the switch system, the method further includes: controlling the state prompting device to output USB flash disk mounting prompting information;
after the configuring the switch system according to the target file, the method further includes: and controlling the state prompting device to output configuration completion information and unloading the USB flash disk.
5. An apparatus for automatically configuring a switch, comprising:
the USB flash disk mounting module is used for mounting the USB flash disk into a file system media directory of a switch system after the USB flash disk is detected to be inserted;
the file checking module is used for checking whether a target file exists in the file system media directory;
the system configuration module is used for configuring the switch system according to the target file if the target file exists;
the target file is a system upgrading mirror image file;
the system configuration module includes:
the first information identification unit is used for identifying the version information of the system upgrade image file in the file system media directory;
the first upgrading unit is used for upgrading the system partition according to the system upgrading image file in the file system media directory if the version of the system upgrading image file in the file system media directory is higher than the version of the current system upgrading image file of the switch system;
or the target file is a starting loader;
the system configuration module further comprises:
the second information identification unit is used for identifying version information of the starting loading program in the media directory of the file system;
the second upgrading unit is used for upgrading the starting loading program partition according to the starting loading program in the file system media directory if the version of the starting loading program in the file system media directory is higher than the version of the current starting loading program of the switch system;
the boot loader is operated before the switch system kernel is operated;
or the target file is a startup configuration file;
the system configuration module further comprises:
and the file import unit is used for importing the startup configuration file in the file system media directory into the switch system.
6. A switch, characterized in that the switch comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the switch auto-configuration method of any of claims 1-4.
7. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the switch auto-configuration method according to any one of claims 1 to 4.
CN201810968372.1A 2018-08-23 2018-08-23 Automatic switch configuration method and device, switch and storage medium Active CN109245920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810968372.1A CN109245920B (en) 2018-08-23 2018-08-23 Automatic switch configuration method and device, switch and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810968372.1A CN109245920B (en) 2018-08-23 2018-08-23 Automatic switch configuration method and device, switch and storage medium

Publications (2)

Publication Number Publication Date
CN109245920A CN109245920A (en) 2019-01-18
CN109245920B true CN109245920B (en) 2021-09-17

Family

ID=65068904

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810968372.1A Active CN109245920B (en) 2018-08-23 2018-08-23 Automatic switch configuration method and device, switch and storage medium

Country Status (1)

Country Link
CN (1) CN109245920B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113849209A (en) * 2021-09-22 2021-12-28 北京东土科技股份有限公司 Method, device, equipment and storage medium for updating switch software

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1620020A (en) * 2003-11-20 2005-05-25 国际商业机器公司 Automatic configuration of the network devices via connection to specific switch ports
CN101226477A (en) * 2007-01-16 2008-07-23 北京共创开源软件有限公司 Method for implementing Linux operating system being suitable for mobile application
CN103106091A (en) * 2013-01-31 2013-05-15 深圳市开立科技有限公司 Start-up system and method of operating system based on removable storage media
CN103338127A (en) * 2013-07-18 2013-10-02 上海大亚科技有限公司 Method for realizing automatic configuration update of switch and system upgrade control
CN106815098A (en) * 2017-01-20 2017-06-09 杭州当虹科技有限公司 Setting backup and the method and system for recovering based on linux system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1620020A (en) * 2003-11-20 2005-05-25 国际商业机器公司 Automatic configuration of the network devices via connection to specific switch ports
CN101226477A (en) * 2007-01-16 2008-07-23 北京共创开源软件有限公司 Method for implementing Linux operating system being suitable for mobile application
CN103106091A (en) * 2013-01-31 2013-05-15 深圳市开立科技有限公司 Start-up system and method of operating system based on removable storage media
CN103338127A (en) * 2013-07-18 2013-10-02 上海大亚科技有限公司 Method for realizing automatic configuration update of switch and system upgrade control
CN106815098A (en) * 2017-01-20 2017-06-09 杭州当虹科技有限公司 Setting backup and the method and system for recovering based on linux system

Also Published As

Publication number Publication date
CN109245920A (en) 2019-01-18

Similar Documents

Publication Publication Date Title
US9507581B2 (en) Systems and methods of device firmware delivery for pre-boot updates
CN106681751B (en) Unified firmware management system and management method and computer readable medium
US8997090B2 (en) Installing an operating system in a host system
US9043776B2 (en) Transferring files to a baseboard management controller (‘BMC’) in a computing system
CN107589994B (en) Method, device, system and storage medium for managing application process priority
US9766876B2 (en) Methods of updating software components, computer systems and memory apparatus
CN109587005B (en) Connection detection method and device, computer equipment and readable storage medium
US8903967B2 (en) Out-of-band management of third party adapter configuration settings in a computing system
CN103365696A (en) BIOS (Basic Input Output System) image file obtaining method and device
CN113760306B (en) Method and device for installing software, electronic equipment and storage medium
US20190205109A1 (en) Computer system, baseboard management controller, and os installation method
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
US8086834B2 (en) System and method for populating a dedicated system service repository for an information handling system
US20040221024A1 (en) Apparatus and method for setting environment of client in client / server system, and program recording medium therefor
CN109245920B (en) Automatic switch configuration method and device, switch and storage medium
CN111694684A (en) Abnormal construction method and device of storage equipment, electronic equipment and storage medium
CN112988192A (en) Version updating method and device, electronic equipment and storage medium
US20210055937A1 (en) Using a single process to install a uefi-supported os or a non-uefi supported os on a hardware platform
US20150212866A1 (en) Management system for service of multiple operating environments, and methods thereof
CN112559006A (en) Enterprise client automatic upgrading method, system, equipment and storage medium
KR100671046B1 (en) Application program install system and method using usb
CN113986269A (en) Containerized application deployment method and device, electronic equipment and storage medium
CN114116034A (en) Distributed flashing method and device
CN111459525A (en) Application update data processing system, application update data processing method, storage medium, and computer
CN112083939A (en) Batch upgrading method, device, system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant