Switch port resource allocation method and system, and robot

By collecting switch port information and device type, calculating the number of VLANs, generating configuration files, and optimizing load balancing, the problem of low efficiency in traditional switch port resource allocation is solved, and accurate matching of VLAN resources and improved network stability are achieved.

CN121644494APending Publication Date: 2026-03-10CHONGQING PHOENIX TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional switches suffer from inefficient and error-prone port resource allocation, and cannot adapt to real-time conditions, leading to resource waste, security risks, and configuration failures.

Method used

Collect switch port information, calculate the number of VLANs based on the total number of physical ports and device type, generate configuration files through preset isolation allocation rules, optimize load balancing by combining real-time traffic data, and ensure device time synchronization through Ethernet time synchronization protocol.

Benefits of technology

It enables precise matching and optimized utilization of VLAN resources, reduces the risk of configuration errors and failures, and improves network stability and operational efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644494A_ABST
    Figure CN121644494A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of switches, and discloses a switch port resource allocation method and system and a robot, and the method comprises the steps: collecting the port information of a target switch; calculating the number of effective VLAN port combinations based on the total physical number of each port to obtain the maximum number of VLANs; calculating according to the maximum VLAN number and the device type number, and determining the actual VLAN number; according to a preset isolation distribution rule, distributing an actual VLAN number to the access device according to the device type and the identification information, so as to generate a configuration file; and in response to the configuration file, enabling the target switch to allocate port resources based on the configuration file. According to the method, the device type number, the preset isolation rule and the physical port limitation are comprehensively considered, the VLAN number is ensured to meet the isolation requirement and not exceed the bearing capacity, optimal utilization of resources is achieved, and data interference and action delay caused by VLAN allocation errors are effectively avoided; and the VLAN resource planning precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of switches, and particularly relates to a switch port resource allocation method, system and robot. BACKGROUND

[0002] A switch is a network device for forwarding electrical signals or optical signals. In current large-scale network deployment and management practices, as a core data transmission device, the configuration efficiency and consistency of the switch are related to the stability and controllability of the entire network system. In typical scenarios such as enterprise campus networks, operator access networks and government special networks, a large number of switch devices often need to be initialized, configured, deployed and injected with security policies in a short period of time.

[0003] However, the traditional switch port configuration method, especially the division of virtual local area networks (VLAN) and the configuration of port aggregation (Link Aggregation), usually relies on manual operation by network administrators, which is low in efficiency and prone to errors, and cannot adapt to the current mode of the switch according to the real-time state. Therefore, an intelligent switch port resource allocation scheme is urgently needed. SUMMARY

[0004] Embodiments of the present application provide a switch port resource allocation method, system and robot to solve the problem of low efficiency and error-prone in switch port resource allocation in related technologies.

[0005] In a first aspect, the embodiments of the present application provide a switch port resource allocation method, comprising: collecting port information of a target switch, the port information comprising a total number of each port, a device type and identification information of an access device; calculating the number of effective VLAN port combinations based on the total number of each port to obtain a maximum VLAN quantity; calculating the actual VLAN quantity according to the maximum VLAN quantity and the number of device types; allocating the actual VLAN quantity to the access device according to the device type and the identification information according to a preset isolation allocation rule to generate a configuration file, wherein the preset isolation allocation rule represents that any specific type of access device needs to be allocated to different virtual local area networks; and responding to the received configuration file to make the target switch allocate port resources based on the configuration file.

[0006] In an embodiment of the present application, the access devices are allocated the actual VLAN quantity according to the preset isolation allocation rule based on the device type and the identification information, to generate a configuration file, including: if the device type of the access device is the same as the device type configured by the preset isolation allocation rule, the access devices of the same device type are preferentially processed according to the preset isolation allocation rule, the access devices are allocated to the actual VLAN quantity based on the identification information, and a first configuration file is generated; if the device type of the access device is different from the device type configured by the preset isolation allocation rule, the remaining access devices are re-allocated to the actual VLAN quantity according to the device type and the identification information based on the first configuration file, and a second configuration file is generated; wherein the first configuration file or the second configuration file is taken as the final configuration file.

[0007] In an embodiment of the present application, the access devices are allocated the actual VLAN quantity according to the preset isolation allocation rule based on the device type and the identification information, to generate a configuration file, further including: the access devices are allocated the actual VLAN quantity according to the preset isolation allocation rule based on the device type and the identification information, to generate a first configuration file; real-time traffic data of each port in the port information is determined, the access devices corresponding to multiple ports allocated to the same virtual local area network in the first configuration file are subjected to traffic aggregation based on the real-time traffic data of each port, and the traffic of each virtual local area network is optimized through load balancing, to generate a final configuration file.

[0008] In an embodiment of the present application, after the target switch allocates the port resources based on the configuration file, further including: the access devices preset in the configuration file are taken as master devices according to the device type, the master devices send time synchronization messages to slave devices through the master-slave mode; in response to the time synchronization messages, the time in the time synchronization message is selected as the switching time based on the Ethernet time synchronization protocol, to enable the slave devices to complete time synchronization.

[0009] In an embodiment of the present application, the effective VLAN port combination number is calculated based on the total number of each port, to obtain the maximum VLAN quantity; the actual VLAN quantity is determined according to the maximum VLAN quantity and the device type number, including: the maximum VLAN quantity is determined according to the total number of ports of the target switch and the preset VLAN allocation mechanism; the minimum value is calculated according to the device type number of the access devices in the target switch and the maximum VLAN quantity, and the calculated minimum value is taken as the actual VLAN quantity to be allocated.

[0010] In an embodiment of the present application, the number of preset isolation allocation rules is less than or equal to the device type number of the access devices, and the number of preset isolation allocation rules is less than or equal to the total number of ports.

[0011] In an embodiment of the present application, in response to the received configuration file, the target switch is caused to allocate port resources based on the configuration file, including: receiving the configuration file, restarting the target switch to initialize based on the configuration file, and allocating each access device to connect a VLAN port resource according to a configuration strategy in the configuration file.

[0012] In an embodiment of the present application, after the target switch is caused to allocate port resources based on the configuration file, the method further includes: reading a current port state of the target switch; determining whether the current port state is same as a preset port state in the configuration file; if the current port state is same as the preset port state in the configuration file, generating a network topology node relationship diagram and a first log containing a configuration success; and if the current port state is not same as the preset port state in the configuration file, generating a port error information and a second log containing a configuration failure, and recommending a new allocation rule.

[0013] In a second aspect, the embodiments of the present application further provide a switch port resource allocation system, including: a collection module configured to collect port information of a target switch, the port information including a total number of each port, a device type and identification information of an access device; a VLAN calculation module configured to calculate a number of effective VLAN port combinations based on the total number of each port to obtain a maximum VLAN quantity; and calculate according to the maximum VLAN quantity and a number of device types to determine an actual VLAN quantity; a file generation module configured to allocate the access device according to the device type and the identification information to the actual VLAN quantity according to a preset isolation allocation rule to generate a configuration file, wherein the preset isolation allocation rule represents that any specific type of access device needs to be allocated to different virtual local area networks; and a resource allocation module configured to cause the target switch to allocate port resources based on the configuration file in response to the received configuration file.

[0014] In a third aspect, the embodiments of the present application further provide a robot, which adopts the method of any one of the above embodiments.

[0015] In a fourth aspect, the embodiments of the present application further provide an electronic device, including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory, and the processor executes the computer program to adopt the method of any one of the above embodiments.

[0016] In a fifth aspect, the embodiments of the present application further provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of any one of the above embodiments.

[0017] In the scheme provided by the above exchange port resource allocation method, system and robot, the port information of the target switch is collected, the number of effective VLAN port combinations is calculated based on the total number of each port, to obtain the maximum VLAN number; the actual VLAN number is determined by calculating the maximum VLAN number and the number of device types; the access devices are allocated the actual VLAN number according to the preset isolation allocation rule according to the device type and the identification information, to generate a configuration file; and the target switch is caused to allocate port resources based on the configuration file in response to the configuration file. On the one hand, the number of device types, the number of preset isolation allocation rules and the physical port limit are comprehensively considered to ensure that the VLAN number allocated meets the isolation requirement and does not exceed the hardware carrying capacity, so that the optimized use of resources is realized, the data interference and action delay caused by VLAN allocation error are effectively avoided, the VLAN resource planning is more accurate, and the actual demand matching is more accurate; on the other hand, the preset isolation allocation rule is used for constraint to prevent unreasonable rule configuration from causing failure or configuration failure, so that the stability and reliability are enhanced. BRIEF DESCRIPTION OF DRAWINGS

[0018] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate one embodiment consistent with the present application and, together with the description, serve to explain the principles of the application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained from these drawings without creative labor for those skilled in the art.

[0019] In the drawings: Figure 1 An exemplary architecture schematic diagram of the exchange port resource allocation system provided by an embodiment of the present application is provided. Figure 2 A flow schematic diagram of the exchange port resource allocation method provided by an embodiment of the present application is provided. Figure 3 A complete flow schematic diagram of the exchange port resource allocation method provided by an embodiment of the present application is provided. Figure 4 A principle schematic diagram of the exchange port resource allocation system provided by an embodiment of the present application is provided. Figure 5 A structure schematic diagram of the exchange port resource allocation system provided by an embodiment of the present application is provided. Figure 6 A structure schematic diagram of the electronic device in an embodiment of the present application is provided. Figure 7 Another structure schematic diagram of the electronic device in an embodiment of the present application is provided. DETAILED DESCRIPTION

[0020] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0021] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0022] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.

[0023] Please see Figure 1 This application provides an exemplary architecture diagram of a switch port resource allocation system 100. The implementation environment includes target devices, which include, but are not limited to, storage devices 101, robots 102, laptops 103, vehicles 104, and servers 105. The target devices also include smart TVs, wearable devices, etc., and vehicles 104 include both new energy vehicles and gasoline vehicles.

[0024] This application provides a switch port resource allocation system, which can be applied to a target device, a server, or run on a robot 102 or software. In some embodiments, the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms; the software can be an application for switch port resource allocation, etc., but is not limited to the above forms.

[0025] In related technologies, the following technical defects exist in the VLAN configuration process of switches: First, due to the lack of a basis for calculating the number of VLANs and reliance on experience-based configuration, the maximum number of VLANs is easily mismatched with the physical port resources of the switch, resulting in resource waste or insufficient VLANs; Second, the isolation strategy between access devices is inaccurate and cannot achieve targeted isolation based on device type, posing a security risk due to similar devices being in the same VLAN; Third, the configuration process has a low degree of automation, requiring manual allocation of VLANs and generation of configuration files, which is inefficient, prone to human error, and unable to quickly respond to the switch's port resource allocation needs.

[0026] In summary, the switch port resource allocation method, system, and robot provided in this application overcome the aforementioned technical deficiencies. Please refer to [link / reference needed]. Figure 2 This is a flowchart illustrating a switch port resource allocation method provided in an embodiment of this application. Taking a target switch deployed in a robot or vehicle as an example, the method includes: Step S210: Collect port information of the target switch. The port information includes the total number of physical ports, the device type of the access device, and identification information. For example, the switch can obtain the device type of the access device by parsing the received protocol messages; the identification information of the access device is a unique identifier set when the device is manufactured or configured in the network, and a communication connection with the target switch is established through the network management protocol or command line interface supported by the switch; for example, sending port information obtains the number of all physical ports of the switch through the collection command; the device type of the access device on each port is identified by the port connection status detection, such as server, router, terminal PC, etc.; the unique identification information of the access device, such as MAC address, device serial number, IP address, and the collected total number of physical ports, device type, and identification information are stored to form a structured data set.

[0027] Step S220: Calculate the number of valid VLAN port combinations based on the total number of physical ports to obtain the maximum number of VLANs; calculate the actual number of VLANs based on the maximum number of VLANs and the number of device types. For example, based on the logical division of physical ports, the maximum number of VLANs is limited by the number of valid physical ports and the number of ports that can be bound to a single VLAN. The total number of valid ports determines the upper limit of physical resources that can be used to divide VLANs, and the number of ports in a single VLAN determines the amount of physical resources occupied by each VLAN. The maximum number of VLANs that valid port resources can support can be quantified by combining the numbers, ensuring that the maximum number of VLANs matches the physical port resources and avoiding resource overload or waste.

[0028] For example, filter valid physical ports, excluding faulty, disabled, and reserved ports, and count the total number of valid ports N; determine the maximum number of ports F(N) that a single VLAN can be bound to according to the switch VLAN configuration rules; calculate the number of valid VLAN port combinations using a combination mathematical formula: calculate the maximum number of available VLANs F(N), where each VLAN contains at least two physical ports; the formula for the maximum number of available VLANs is F(N) = 2. N -1-N; where, 2 N -1 represents the number of all non-empty port combinations. Subtracting the number of N single-port combinations yields the number of combinations that contain at least two ports. The calculated number of valid VLAN port combinations is taken as the maximum number of VLANs.

[0029] For example, in one implementation, the actual number of allocable VLAN IDs M is calculated based on the number of access device types K and the maximum number of available VLANs F(N). M = min(K, F(N)). The value of M cannot exceed F(N), and VLAN IDs are continuously allocated starting from a preset starting value (e.g., VLAN 10). In another implementation, the actual number of allocable VLAN IDs M is calculated based on the number of access device types K, the number of user-defined preset isolation allocation rules S, and the maximum number of available VLANs F(N); M = min(S + (KS), F(N)); where S is the number of VLANs required to satisfy the preset isolation allocation rules (each rule occupies at least one VLAN), and (KS) is the number of VLANs required for the remaining (KS) device types (each type can share one VLAN). The value of M cannot exceed F(N).

[0030] Step S230: According to the preset isolation allocation rules, the access devices are allocated the actual number of VLANs according to the device type and identification information to generate a configuration file. The preset isolation allocation rules indicate that any specific type of access device needs to be allocated to different virtual LANs. For example, the preset isolation allocation rules are set based on network security isolation requirements. Devices of the same type can be logically isolated by being assigned to different VLANs due to similar business scenarios, thereby reducing security risks. Device identification information ensures that the VLAN allocation of each device is unique and traceable, avoiding confusion. The generation of configuration files transforms the logical allocation rules into instructions that the switch can recognize.

[0031] Specifically, the system retrieves the preset isolation allocation rules and establishes a mapping relationship between device type and actual VLAN; it assigns a unique VLAN ID to each device based on the identification information of the access device; it generates a configuration file containing VLAN ID, port binding relationship, and isolation policy, and stores it in a specified path or pushes it directly to the configuration distribution interface.

[0032] Step S240: In response to the received configuration file, the target switch allocates port resources based on the configuration file.

[0033] For example, receiving and executing the configuration file is a key step in transforming logical configuration into physical port resource allocation for the switch. The switch's configuration verification mechanism ensures that the instructions are legal and valid, avoiding network failures caused by incorrect configuration. The response information and effect verification form a closed loop, ensuring that the port resource allocation meets the expected requirements and achieving the integrity of the configuration process.

[0034] Specifically, the generated configuration file is sent to the target switch via a secure transmission protocol; after receiving the configuration file, the switch performs syntax verification on the configuration content. If the verification passes, the instructions in the configuration file are executed; after the configuration is completed, the switch returns a response message indicating successful configuration; the port status detection verifies the port resource allocation effect to ensure that the access device can communicate normally through the allocated VLAN.

[0035] The above method solves the problem of unfounded VLAN quantity calculation. By combining physical port resources with device type requirements, it achieves a precise match between the maximum VLAN quantity and the actual VLAN quantity, avoiding waste of physical resources or insufficient VLAN quantity. Through dynamic balancing of the maximum VLAN quantity and the number of device types, the actual VLAN quantity is determined, satisfying service isolation requirements while avoiding resource overload and improving the rationality of VLAN configuration. This application achieves precise isolation of access devices, and VLAN allocation based on device type meets security requirements, reducing the risk of fault propagation between devices of the same type. It also improves the degree of configuration automation, requiring minimal manual intervention from information collection to port resource allocation, reducing human error. At the same time, closed-loop verification ensures configuration effectiveness, improving the efficiency and reliability of switch port resource allocation.

[0036] In related technologies, there are obvious defects in the adaptation of access device types and preset isolation allocation rules in VLAN configuration schemes for switches. First, when the access device type is inconsistent with the type configured in the preset isolation allocation rules, the lack of a VLAN allocation mechanism can easily lead to such devices being unable to access or being mixed into non-compliant VLANs, thus disrupting the network isolation logic. Second, the configuration file compatibility is insufficient, and the generated configuration files are prone to port resource conflicts or contradictions in isolation policies, making it impossible to achieve unified deployment.

[0037] Optionally, in some embodiments, the access devices are allocated an actual number of VLANs according to device type and identification information based on preset isolation allocation rules to generate a configuration file, including: If the device type of the access device is the same as the device type configured in the preset isolation allocation rule, the access devices with the same device type will be processed according to the preset isolation allocation rule first. The access devices will be allocated to the actual number of VLANs based on the identification information, and the first configuration file will be generated. If the device type of the access device is different from the device type configured in the preset isolation allocation rule, then based on the first configuration file, the remaining access devices are redistributed to the actual number of VLANs according to the device type and identification information to generate a second configuration file; wherein, the first configuration file or the second configuration file is used as the final configuration file.

[0038] For example, the preset isolation allocation rules are priority policies formulated based on the security requirements of core network services. Their isolation requirements directly affect network stability, and prioritizing these rules ensures the isolation security of core services. Since the identification information serves as a unique identifier for each device, binding it to a VLAN ID enables a one-to-one correspondence between devices and VLANs, avoiding communication interference caused by VLAN duplication within the same rule. The selection of configuration files is based on the actual composition of the access devices, ensuring a complete match between the configuration files and the device scenario. For devices outside the preset isolation allocation rules (i.e., the rules), if the first configuration file already meets all requirements, no redundant configuration is needed. If there are devices outside the rules, the second configuration file serves as the complete configuration, enabling a single deployment to cover all devices. Syntax compliance checks and version management prevent switch failures caused by invalid configuration distribution, while providing a traceability basis for configuration changes, thus improving configuration reliability.

[0039] The above approach resolves the issue of missing configurations for devices outside the preset rules. By prioritizing in-rule processing and incremental configuration outside the rules, VLAN coverage allocation is achieved for all access devices, preventing situations where devices cannot access or access them illegally. The second configuration file is generated by merging the first configuration file, eliminating resource conflicts and policy contradictions. It enables a single deployment to cover both in-rule and out-of-rule access devices, reducing the number of configuration operations and improving the compatibility and completeness of the configuration files. Priority is given to ensuring the isolation requirements of critical devices within the rules, while a flexible resource allocation strategy ensures reasonable access for devices outside the rules, balancing security and resource utilization.

[0040] In related technologies, existing VLAN configuration schemes for switches, which rely solely on static allocation based on device type and identification information, have significant technical flaws. First, there is an imbalance in traffic load within the VLAN. The first configuration file only meets isolation requirements and does not consider the real-time traffic differences between ports, which can easily lead to overload on some ports and idle traffic on others within the same VLAN, causing network latency, packet loss, and other performance issues. Second, traffic resource configuration is rigid. Static allocation cannot dynamically adapt to port traffic fluctuations, resulting in wasted or insufficient VLAN bandwidth resources. Third, there is a lack of traffic optimization loops. After the first configuration file is generated, it is not adjusted based on actual traffic feedback, making it impossible to achieve integrated configuration of isolation, traffic adaptation, and performance assurance, thus affecting the overall network operating efficiency.

[0041] In some embodiments, the actual number of VLANs is allocated to access devices according to device type and identification information based on preset isolation allocation rules to generate a configuration file, and the method further includes: Based on the preset isolation allocation rules, the access devices are allocated the actual number of VLANs according to their device type and identification information, and a first configuration file is generated. The real-time traffic data of each port in the port information is determined. Based on the real-time traffic data of each port, the traffic of the access devices corresponding to multiple ports allocated to the same virtual LAN in the first configuration file is aggregated. The traffic of each virtual LAN is optimized through load balancing to generate the final configuration file.

[0042] For example, the preset isolation allocation rules are formulated based on network security and service partitioning requirements. The device type determines the functional positioning of the VLAN. The identification information ensures a unique correspondence between the device and the VLAN, avoiding communication interference caused by VLAN overlap between devices of the same type. The actual number of VLANs provides a resource limit for allocation, ensuring that VLAN allocation does not exceed the hardware support range of the switch. The first configuration file acts as an isolation layer to achieve logical isolation of access devices, preventing traffic adjustment from disrupting the isolation logic. Real-time port traffic data reflects the VLAN operating status, and traffic aggregation can quantify the traffic distribution characteristics within the same VLAN and identify nodes with unbalanced loads. Load balancing is used to adjust the port-VLAN association or traffic allocation rules to make the traffic distribution of each VLAN more balanced, avoiding network bottlenecks caused by overload of a single port. By merging the incremental configuration and the first configuration file, traffic optimization can be achieved while retaining the isolation logic, ensuring the synergy between security isolation and performance assurance. Ultimately, the configuration file takes into account both isolation requirements and traffic adaptation requirements, improving network operational stability.

[0043] Specifically, the system periodically acquires traffic parameters of the physical ports corresponding to each VLAN in the first configuration file through the built-in traffic statistics module or network monitoring protocol of the switch. These parameters include ingress / egress bandwidth utilization, peak traffic, average traffic, and packet forwarding rate. The data is stored in the traffic database and marked with a collection timestamp. For multiple ports under the same VLAN, the system calculates the total traffic and traffic distribution variance of the VLAN. If the variance exceeds a preset threshold, the VLAN is determined to have traffic imbalance. For VLANs with traffic imbalance, two optimization strategies are adopted: one is port-VLAN mapping adjustment, which migrates high-traffic ports from the current VLAN to low-traffic VLANs under the same device type, ensuring that the traffic variance between the original VLAN and the target VLAN is reduced to within the threshold after migration; the other is traffic splitting configuration. If port mapping cannot be adjusted, a traffic policy is configured on the switch to aggregate some of the traffic from high-traffic ports to low-traffic ports in the same VLAN to achieve traffic sharing. Incremental configuration instructions are generated based on the optimization strategies. The incremental instructions are merged with the first configuration file. The configuration verification tool checks for VLAN ID conflicts, duplicate port bindings, and other issues. After verification, the final configuration file is generated and pushed to the switch configuration execution interface.

[0044] The above methods solve the problem of traffic load imbalance within VLANs. Through real-time traffic collection and load balancing optimization, the traffic variance of each port within the same VLAN is reduced to within a preset threshold, avoiding latency and packet loss caused by high-traffic port overload, and improving network transmission performance. Dynamic adaptation of traffic resources is achieved, breaking the rigidity of static configuration. VLAN configurations can be adjusted according to port traffic fluctuations, keeping VLAN bandwidth utilization within a reasonable range and reducing resource waste. A closed-loop mechanism of isolation configuration, traffic feedback, and optimization adjustment is formed, balancing network security isolation and operational efficiency, ensuring that access devices obtain stable bandwidth resources while meeting isolation requirements. Network operation and maintenance costs are reduced. Through automated traffic collection, optimization, and configuration generation, manual intervention is reduced, configuration errors caused by manual VLAN adjustments are avoided, and operation and maintenance efficiency is improved.

[0045] Optionally, in some embodiments, the number of preset isolation allocation rules is less than or equal to the number of device types of the access devices, and the number of preset isolation allocation rules is less than or equal to the total number of physical ports.

[0046] By adopting the above approach, differentiated isolation strategies are formulated for the security needs of different types of access devices. This ensures that each preset isolation allocation rule has a corresponding device type, avoiding redundant rules without corresponding device types. At the same time, it ensures that at least all device types can be covered by the rules or that core types can obtain exclusive rules, avoiding the inability of certain types of devices to obtain targeted isolation strategies due to insufficient rules. This solves the technical problem of mismatch between isolation strategies and device types from the source.

[0047] Furthermore, if the number of preset isolation allocation rules exceeds the number of device types, multiple rules may be applied to the same device type. Since different rules may set conflicting isolation requirements for the same type of device, policy conflicts may occur during switch configuration, preventing effective isolation. If the number of preset isolation allocation rules exceeds the total number of physical ports, forced reuse scenarios may occur where multiple rules share the same port: the same port needs to be bound to multiple VLANs, leading to overlapping port traffic, blurred isolation boundaries, and increased port bandwidth pressure and failure risk. By limiting the number of rules to no more than the total number of ports, it ensures that each rule's corresponding VLAN has at least one dedicated port, balancing port resource utilization and isolation security, and avoiding resource waste or overload.

[0048] In related technologies, existing access device time synchronization solutions have the following defects: First, the selection of the master device lacks rationality. The master device is not selected based on the stability, clock accuracy and other characteristics of the device type. It is easy to use temporary low-reliability devices as time sources, resulting in unstable synchronization reference. Second, the time synchronization protocol has poor adaptability. Traditional synchronization methods based on non-Ethernet protocols have problems such as large transmission delay and weak anti-interference ability in local area network scenarios, which cannot meet the needs of services with high time accuracy requirements.

[0049] In some embodiments, after the target switch allocates port resources based on a configuration file, the method further includes: Based on the device type, the access device preset in the configuration file is designated as the master device, and the master device sends time synchronization messages to the slave device in master-slave mode; In response to the time synchronization message, the time in the time synchronization message is selected as the switching time based on the Ethernet time synchronization protocol so that each slave device can complete time synchronization.

[0050] For example, by using the pre-defined access device in the configuration file as the master device based on the device type, a continuous and accurate time reference can be provided. The master-slave mode adopts a one-to-many communication architecture, which can reduce synchronization conflicts between multiple devices, avoid multiple master devices sending conflicting time messages, and reduce network bandwidth consumption. The nanosecond-level timestamp and device identifier carried in the time synchronization message provide a time reference and verification basis for the slave device, ensuring the validity of the synchronized data and avoiding the receipt of false synchronization messages sent by illegal devices. The Ethernet time synchronization protocol is designed for local area networks. Through hardware timestamps and delay measurement mechanisms, the transmission delay can be controlled at the microsecond level, which significantly improves the synchronization accuracy. The time switching selection mechanism avoids the interference of real-time time jumps on services. If the time is updated directly in real time, it may cause time rollback of logs that depend on timestamps and disordered data transmission timing. Transmission delay correction can offset the transmission time of messages in the Ethernet link, ensuring that the reference time obtained by the slave device is consistent with the real time of the master device, reducing synchronization deviation.

[0051] The above methods solve the problem of disordered master device selection. By filtering by device type and attributes, it ensures that the master device has high clock accuracy and low load rate, providing a stable benchmark for time synchronization and avoiding synchronization failures caused by low-reliability devices. It improves time synchronization accuracy and anti-interference capability. Based on the delay correction and hardware adaptation of the Ethernet time synchronization protocol, it controls the time deviation of slave devices to the microsecond level. It eliminates the impact of time switching on services. Through the switching time selection mechanism, it avoids data timing disorder and abnormal event recording caused by time jumps, ensuring service continuity. In addition, this application achieves high-precision and high-reliability time synchronization between access devices, reducing the probability of service failures caused by time deviations.

[0052] Optionally, in one embodiment, the number of valid VLAN port combinations is calculated based on the total physical number of each port to obtain the maximum number of VLANs; the actual number of VLANs is determined by calculating the maximum number of VLANs and the number of device types, including: Determine the maximum number of VLANs based on the total number of physical ports on the target switch and the preset VLAN allocation mechanism; The minimum value is calculated based on the number of device types and the maximum number of VLANs in the target switch, and the calculated minimum value is used as the actual number of VLANs to be allocated.

[0053] By employing the above method and through the collaborative calculation of the total physical number of ports and the preset VLAN allocation mechanism, the maximum number of VLANs is ensured to meet both port carrying capacity and VLAN allocation logic. This avoids resource overload or idleness caused by traditional experience-based configuration and solves the problem of the maximum number of VLANs being disconnected from hardware resources. It ensures that the maximum number of VLANs does not exceed the hardware resource limit while meeting core isolation requirements, thus addressing the dual pain points of configuration failure due to excessive demand and waste due to excessive resources. This application supports different port binding modes and different device types, and can adapt to special requirements such as heterogeneous ports and core business protection through alternative solutions. At the same time, the calculation process is automated, improving the adaptability and efficiency of VLAN configuration. From hardware resources (total number of ports) to logical rules (allocation mechanism), and then to isolation requirements (number of types), the calculation gradually converges to the actual number of VLANs, ensuring that the entire process of VLAN configuration from design to implementation is controllable and reducing the probability of network failures due to improper configuration.

[0054] In some embodiments, in response to a received configuration file, the target switch is configured to allocate port resources based on the configuration file, including: Upon receiving the configuration file, the target switch is restarted and initialized based on the configuration file. The switch then allocates VLAN port resources to each access device according to the configuration policy in the configuration file.

[0055] For example, syntax validation eliminates initialization failures caused by instruction errors, while integrity validation prevents abnormal file transfers or malicious tampering. Backing up the current configuration addresses extreme scenarios where the configuration to be executed is invalid, ensuring the switch can recover to normal operation when configuration implementation fails, thus avoiding network interruption. It ensures that new configuration instructions take full effect; without a restart, conflicts between the old and new configurations in hardware registers can lead to abnormal resource allocation. Pre-processing and backup mechanisms before restarting reduce the risk of network interruption and the difficulty of fault recovery, while post-initialization validation promptly detects and corrects configuration execution deviations, ensuring the initialization result meets expectations. Based on pre-defined resource allocation criteria for business needs, high-bandwidth, low-latency port resources are prioritized to ensure business performance. Standardized protocols achieve precise matching of device attributes and policies, avoiding mismatches and ensuring that devices can access VLANs normally after resource allocation, preventing invalid configurations that are successfully allocated but unusable.

[0056] By employing the above methods, the issues of incomplete configuration activation and conflicts are resolved, ensuring that configuration files are fully activated without conflicts, improving the rate of clearing old configuration remnants, and avoiding VLAN port allocation anomalies caused by inconsistencies between old and new configurations. The risk of configuration deployment failures is reduced by implementing legality verification upon receiving configuration files, a backup mechanism before restarts, and a rollback strategy after initialization failures. This ensures accurate and reasonable resource allocation, and the priority allocation mechanism based on configuration policies avoids service performance bottlenecks caused by resource mismatches. A closed-loop process of configuration reception, activation, allocation, and verification is formed, improving the success rate of configuration deployment, reducing manual intervention costs, and enhancing network operation and maintenance efficiency.

[0057] In some embodiments, after the target switch allocates port resources based on a configuration file, the method further includes: Read the current port status of the target switch; Determine whether the current port status is the same as the preset port status in the configuration file; If the current port status is the same as the preset port status in the configuration file, a network topology node relationship diagram is generated, and the first log containing the configuration success is generated. If the current port status is the same as the preset port status in the configuration file, a port error message is generated, along with a second log containing configuration failure information and a recommended new allocation rule. The actual access status of each access device is checked based on the error message and the second log to generate the new allocation rule.

[0058] For example, physical status reflects port connectivity, VLAN binding information reflects whether the configuration logic is effective, error frame statistics reflect port operational stability, and access device association information reflects the actual correspondence between devices and ports. Standardized protocol collection ensures data compatibility, and real-time storage and preprocessing avoid interference from invalid data. Through a one-to-one comparison of actual and preset parameters, the specific port and reason for configuration failure can be accurately located, such as VLAN binding errors or port physical faults. This ensures not only that the configuration is implemented but also that the port is operating normally, preventing the hidden problem of configuration effectiveness but port failure from being overlooked. The network topology node relationship diagram transforms the abstract port-device-VLAN relationship into an intuitive graphic, reducing the understanding cost for maintenance personnel and facilitating quick location of node positions and relationships. The first log records key information about successful configuration in a standardized format, providing a basis for traceability and auditing. Simultaneously, it is linked to the topology map path to achieve log-topology linkage query, improving maintenance convenience. Port error messages accurately pinpoint the specific port and cause of configuration failure, avoiding blind troubleshooting by maintenance personnel; the second log fully records the details of the fault; and the actual status check of the access device can eliminate interference factors that cause the device to malfunction even though the configuration is correct. This ensures that the new allocation rules target the root cause of the problem, achieving precise matching between fault and repair, and preventing the recurrence of similar problems.

[0059] The above methods solve the problem of unverifiable configuration validity. By comparing the actual and preset port status, the accuracy of determining whether the configuration is effective is improved, and false positives are avoided. The visualized topology map reduces the cost of understanding node relationships, decreases the time for maintenance personnel to locate node faults, and improves network maintenance efficiency. By building a closed-loop repair mechanism for configuration failures, the efficiency of fault location of error messages and secondary logs is improved, and the fault repair cycle is shortened.

[0060] Please see Figure 4 The diagram below illustrates the principle of the switch port resource allocation system provided in this application embodiment, including: Software modules can be designed based on switch hardware modules that configure port VLANs and aggregation and time synchronization functions, and can also provide interfaces for modifying internal parameters.

[0061] The switch software module consists of a user interaction module and a resource intelligent allocation module. The user interaction module allows users to customize and modify internal switch parameters and network allocation rules, and supports users to manually personalize switch network parameters. The resource intelligent allocation module can autonomously realize intelligent monitoring of port network status, traffic aggregation, VLAN allocation, time synchronization, and configuration management.

[0062] This is a switch hardware module for switches with N physical ports. It supports VLAN segmentation (compliant with 802.1Q protocol), link aggregation (compliant with LACP protocol), time synchronization PTP (compliant with IEEE 1588-2019 protocol) and GPTP (compliant with IEEE 802.1AS-2020 protocol), traffic statistics, and network management protocols. The default VLAN ID=1 is configured as a dedicated debugging VLAN, bound to a specified debugging port. This VLAN and port do not participate in the automatic allocation process.

[0063] The port status monitoring module is used to monitor and collect the physical status switch (UP / DOWN), identification information of access devices, device type information (such as sensor type S1, S2, ..., Sk) of each port of the switch, as well as the real-time traffic data and time synchronization message parsing of each port.

[0064] The rules engine module stores preset isolation allocation rules and user-defined allocation rules. Each rule includes triggering conditions and execution actions. There are S preset isolation allocation rules, each requiring all devices of a specific type to be assigned to different VLANs. A constraint is imposed on S: S≤N and S≤K, where K is the number of access device types. If the user configures S outside this range, an error will occur, and the user will be prompted to reconfigure S.

[0065] The resource allocation module includes intelligent VLAN allocation and traffic aggregation allocation. Intelligent VLAN allocation receives collected device information and calculates the actual number of VLANs, M. It then allocates access devices to M VLAN IDs according to preset isolation allocation rules. Traffic aggregation allocation allows for enabling or disabling traffic aggregation for multiple ports assigned to the same VLAN, based on preset policies (such as traffic thresholds) or user configuration. By default, aggregation is disabled.

[0066] VLAN intelligent allocation: Perform the following calculations: a. Calculate the maximum number of usable VLANs F(N) based on the total number of physical ports N of the switch, where each VLAN contains at least two physical ports. The formula is: F(N) = 2 N -1-N. Where, 2 N -1 represents the number of all non-empty port combinations. Subtracting the number of N single-port combinations gives the number of combinations that contain at least two ports.

[0067] b. Calculate the actual number of VLAN IDs M that can be allocated based on the number of access device types K, the number of user-defined preset isolation allocation rules S, and the maximum number of available VLANs F(N). M = min(S + (KS), F(N)); where S is the number of VLANs required to satisfy the preset isolation allocation rules (each rule occupies at least one VLAN), and (KS) is the number of VLANs required for the remaining (KS) device types (each type can share one VLAN); the value of M cannot exceed F(N), and VLAN IDs are continuously allocated starting from the preset starting value.

[0068] The configuration management module is used to convert the decisions of the resource allocation module into configuration instructions that can be executed by the switch, generate configuration files, back up the current configuration, restore historical configurations, record configuration logs, and verify the effectiveness of the configuration. For intelligently adapted configurations, the switch system will be actively soft-rebooted after saving to check whether the configuration has taken effect. If it has not taken effect, resources will be intelligently reallocated.

[0069] The time synchronization module intelligently adapts and selects time synchronization parameters based on the port time synchronization message information read from the monitoring module. These parameters include physical port master-slave clock switching (only one master clock is allowed to connect), Ethernet time synchronization protocol selection (GPTP or PTP), clock selection (transparent clock or boundary clock), and delay measurement mechanism (end-to-end delay measurement E2E and hop-by-hop delay measurement P2P). The module allows for free combination of these modes to calculate the minimum delay error and selects the combination with the smallest time synchronization error. It also supports user-defined rules, prioritizing matching modes based on user-defined rules.

[0070] Please see Figure 3 The following is a complete flowchart illustrating the switch port resource allocation method provided in this application embodiment, detailed below: After the switch powers on, it initializes and starts the intelligent allocation system to obtain the total number of physical ports N. The VLAN count calculation module calculates the maximum number of available VLANs F(N) = 2. N -1-N. VLAN1 is the default debug port, and its configuration remains unchanged.

[0071] Configure S preset isolation allocation rules through the rules engine module; verify whether S satisfies S≤N and S≤K (K is the number of current or expected device types); if not satisfied, report an error and wait for the user to adjust the rules.

[0072] By collecting real-time data on the physical status of each port on the switch and information on connected devices, including device type, the system generates statistics on the number of connected device types (K), MAC address statistics, and real-time port traffic statistics. For example, if abnormal changes in port data occur during normal use, such as a sudden loss of a large amount of data frames, an error message will be sent to the user module and logged. Users can view the logs and the actual status of device access at any time via a webpage or remote SSH login, and can also add or delete custom rules.

[0073] VLANs are assigned based on the M value and rules in the rule engine. For multiple ports assigned to the same VLAN, whether to enable aggregation is determined based on preset policies or user configuration. M is calculated as min(S+(KS),F(N)) based on K, S, and F(N), where S is the device type. If the M value is greater than the preset upper limit, then M is equal to the preset upper limit. VLAN IDs are assigned starting from 10.

[0074] Based on user rules, or automatically obtain the time synchronization message parsing protocol content of each port to determine master-slave mode and clock mode.

[0075] Generate a new switch configuration file based on the resource allocation results, and back up the currently effective configuration file.

[0076] The newly generated configuration file is sent to the switch, and a hot configuration method that triggers a soft restart of the switch is used to make the configuration effective. After restarting, the port status is read to see if it is consistent with the preset rules. If they are inconsistent, an error is reported to the user module and the second log, and a reconfiguration is attempted. If they are consistent, a corresponding network topology node relationship diagram is generated, which includes detailed information on network device MAC addresses and time synchronization modes, and the configuration is recorded as successful in the first log.

[0077] In practical applications, by transmitting the locked signal of the current switch configuration to the robot dog controller, other functions can be debugged.

[0078] In some embodiments, the maximum number of available VLANs is calculated assuming the switch has N = 3 physical ports; according to the formula F(N) = 2 N -1-N, calculate F(3)=8-1-3=4. The four valid VLAN port combinations are: {1,2},{1,3},{2,3},{1,2,3}; on a 3-port switch, a maximum of four VLANs that meet the constraint that "each VLAN contains at least two devices" can be created.

[0079] Based on the above embodiment, the calculation and allocation of the actual number of VLANs M to be allocated continues from the previous example, with N=3 and F(3)=4. VLAN IDs are allocated starting from 10, and the maximum VLAN ID is 2000.

[0080] Rule configuration and validation: The user has configured S=2 preset isolation allocation rules: R1: All S1 type sensors must be assigned to different VLANs.

[0081] R2: All S2 type sensors must be assigned to different VLANs.

[0082] The verification passes if S=2≤N=3 and S=2≤K, assuming the current or expected K≥2.

[0083] Equipment information collection: Device A (S1), Device B (S1), Device C (S2), Device D (S3); therefore, the number of types of devices currently connected is K=3(S1,S2,S3).

[0084] Calculate M: M=min(S+(KS),F(N))=min(2+(3-2),4)=min(3,4)=3 Therefore, starting with VLAN 10, three VLAN IDs will be assigned: 10, 11, and 12.

[0085] VLAN allocation: Based on rule R1, devices of type S1 (A, B) are required to be assigned to different VLANs. Assuming device A is assigned to VLAN 10 (port 1), then device B is assigned to VLAN 11 (port 2).

[0086] Based on rule R2, it is required that S2 type devices (C) be assigned a separate VLAN, and C is assigned to VLAN12 (port 3).

[0087] S3 type device (D) has no preset isolation allocation rules. It can be assigned to any existing VLAN (10, 11, 12). However, in this example, all N=3 physical ports are already occupied by devices A, B, and C; to more clearly illustrate the allocation of D, we adjust N=4, that is, F(4)=16-1-4=11, and device D accesses port 4. At this time, D is assigned to VLAN 12 (ports 3 and 4).

[0088] The adjusted allocation results are as follows: VLAN 10: Device A (port 1); VLAN 11: Device B (port 2); VLAN 12: Device C (port 3), Device D (port 4).

[0089] For VLAN 12 (including port 3 and port 4), aggregation is not enabled by default; if aggregation is enabled for the ports of VLAN 12 in the rules, an aggregation configuration command will be generated to bind port 3 and port 4 into an aggregation group.

[0090] In some embodiments, switch VLAN configuration, port aggregation, and time synchronization all require manual configuration by the administrator, lacking dynamic adaptability. When new devices are added or the network topology changes, manual intervention is needed to adjust the configuration. For robot dog cluster network deployments and dynamically changing network environments in different scenarios, the switch, as the core communication hub, needs to connect the robot dog itself (including motion controllers, vision sensors, and radar sensors), data storage devices, robotic arms, pan-tilt units, and other extended devices. These scenarios involve diverse types of robot dog extended devices, dynamically changing access status (e.g., robot dog movement operations, temporary additions or removals of extended devices), high real-time data transmission requirements (e.g., motion control command latency ≤10ms), and security sensitivity (e.g., data leakage prevention in specific process scenarios). Manual configuration checks and modifications not only incur high management costs but also increase the risk of configuration errors. This application provides a technical solution for automatic VLAN allocation, bandwidth optimization, time synchronization, and intelligent configuration of port aggregation on switch ports, offering the following technical advantages: First, VLAN resource planning is more precise, and actual needs are matched more accurately. It comprehensively considers the number of device types, the number of preset isolation allocation rules, and physical port limitations, ensuring that the number of allocated VLANs meets the isolation requirements without exceeding the hardware capacity. This achieves optimized resource utilization and effectively avoids interference with the robot dog's visual perception data and action delays caused by incorrect VLAN allocation.

[0091] Second, the number of preset isolation allocation rules is constrained, and an error reporting mechanism is provided to prevent system failures or configuration failures caused by unreasonable rule configurations, thereby enhancing stability and reliability.

[0092] Third, it provides intelligent resource allocation VLAN, aggregation, and time synchronization functions, and also supports users to customize and delete personalized rules, which enhances the flexibility of configuration and the controllability of users, making it easy to adjust according to actual network needs.

[0093] Fourth, existing switches lack device type identification capabilities, making it easy for machine dog process programs to be stolen after a device connects. By using MAC and IP dual binding and device type identification, if an unfamiliar device is detected, an isolated VLAN is immediately assigned and bandwidth is limited, while triggering an alarm on the host computer, which can reduce the risk of machine dog process data leakage; the whitelist mechanism of VLAN1 debugging port prevents unauthorized personnel from modifying the switch configuration through the machine dog port.

[0094] Fifth, it has corresponding fault tolerance mechanisms to address common issues in robot dog scenarios such as IP conflicts and loose ports. It monitors IP conflict detection and temporary allocation, port status monitoring and configuration file backup, which greatly improves the automatic fault repair rate and reduces the frequency of manual intervention.

[0095] This application aims to overcome the shortcomings of existing technologies in VLAN configuration of switch ports in terms of refined resource planning, rule constraint processing, and dynamic adaptability; to calculate the maximum number of available VLANs for a given number of physical ports; to determine the actual number of VLAN IDs that can be allocated by comprehensively considering the number of device types, the number of user-defined isolation rules, and the number of physical ports; and to provide timely alarms and handling when the number of rules or traffic bandwidth exceeds the carrying capacity of physical ports by effectively limiting the number of preset isolation allocation rules and implementing a conflict detection mechanism.

[0096] Custom-developed for robot dog scenarios, this application employs combinatorial mathematics-based VLAN resource quantification calculation. By dynamically balancing the maximum number of VLANs with the number of device types, the actual number of VLANs is determined. This satisfies service isolation requirements while avoiding resource overload, improving the rationality of VLAN configuration and enabling refined planning and on-demand allocation of VLAN resources. This ensures the effectiveness of VLAN configuration and optimized resource utilization. The application also features a rule engine that supports user-defined preset isolation allocation rules, imposing constraints S≤N and S≤K on the number of rules to ensure rule feasibility. The resource allocation module automatically completes VLAN allocation based on the rules, prioritizing mandatory isolation requirements. The entire process, from device information collection, rule configuration, VLAN calculation, allocation decision, configuration distribution to status verification, is fully automated, reducing manual intervention, improving configuration efficiency and accuracy, and ensuring stable operation through status monitoring. Furthermore, it supports intelligently enabling or disabling link aggregation for multiple ports within the same VLAN based on traffic demand or user configuration, improving network link bandwidth and reliability.

[0097] In some embodiments, a switch port resource allocation system is provided, which is used to execute the switch port resource allocation method provided in any of the above embodiments. Please refer to Figure 5 Figure 1 is a schematic diagram of a switch port resource allocation system provided in an embodiment of this application. As shown in the figure, the switch port resource allocation system includes: The acquisition module 510 is used to acquire port information of the target switch. The port information includes the total number of physical ports, the device type of the access device, and identification information. The VLAN calculation module 520 calculates the number of valid VLAN port combinations based on the total number of physical ports to obtain the maximum number of VLANs; and determines the actual number of VLANs based on the maximum number of VLANs and the number of device types. The file generation module 530 is used to allocate the actual number of VLANs to the access devices according to the device type and identification information based on the preset isolation allocation rules in order to generate a configuration file. The preset isolation allocation rules indicate that any specific type of access device needs to be allocated to different virtual local area networks. Resource allocation module 530 is used to respond to the received configuration file so that the target switch allocates port resources based on the configuration file.

[0098] Through the above method, the switch port resource allocation system of this application collects the port information of the target switch, calculates the effective VLAN port combination number based on the total physical number of each port to obtain the maximum number of VLANs; calculates the actual number of VLANs based on the maximum number of VLANs and the number of device types; allocates the actual number of VLANs to the access devices according to the device type and identification information according to the preset isolation allocation rules to generate a configuration file; and responds to the configuration file to enable the target switch to allocate port resources based on the configuration file. On the one hand, this application comprehensively considers the number of device types, the number of preset isolation allocation rules, and physical port limitations to ensure that the number of allocated VLANs meets the isolation requirements without exceeding the hardware carrying capacity, thereby achieving optimized resource utilization and effectively avoiding data interference and action delays caused by VLAN allocation errors; VLAN resource planning is more accurate, and the matching of actual needs is more precise; on the other hand, this application uses preset isolation allocation rules to constrain and prevent failures or configuration failures caused by unreasonable rule configurations, thereby enhancing stability and reliability.

[0099] Specific limitations regarding the switch port resource allocation system can be found in the limitations on the switch port resource allocation method described above, and will not be repeated here. Each module in the aforementioned switch port resource allocation system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the electronic device, or stored in the memory of the electronic device in software form, so that the processor can call and execute the corresponding operations of each module.

[0100] In this embodiment, the switch port resource allocation system is essentially configured with multiple modules to execute the switch port resource allocation method in any of the above embodiments. The specific functions and technical effects can be referred to the above embodiments, and will not be repeated here.

[0101] In one embodiment, an electronic device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6As shown, the electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. The computer program is executed by the processor to implement the functions or steps of the server-side method described above.

[0102] In one embodiment, an electronic device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 7 As shown, the electronic device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with an external server via a network connection. The computer program is executed by the processor to implement the functions or steps of the server-side method described above.

[0103] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0104] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0105] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or electronic device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0106] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), direct memory bus RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above-described device or system can be divided into different functional units or modules to complete all or part of the functions described above.

[0108] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A method for allocating switch port resources, characterized in that, The method comprises the following steps: Collecting port information of a target switch, wherein the port information comprises a total number of physical ports, a device type of an access device, and identification information; Calculating a number of effective VLAN port combinations based on the total number of physical ports to obtain a maximum VLAN quantity; determining an actual VLAN quantity based on a calculation of the maximum VLAN quantity and a number of device types; Allocating the actual VLAN quantity to the access devices according to the device type and the identification information according to a preset isolation allocation rule to generate a configuration file, wherein the preset isolation allocation rule indicates that any specific type of the access device needs to be allocated to different virtual local area networks (VLANs); Responding to the received configuration file to enable the target switch to allocate port resources based on the configuration file.

2. The method of claim 1, wherein, Allocating the actual VLAN quantity to the access devices according to the device type and the identification information according to a preset isolation allocation rule to generate a configuration file, comprising: If the device type of the access device is the same as the device type configured by the preset isolation allocation rule, the access devices of the same device type are preferentially processed according to the preset isolation allocation rule, the access devices are allocated to the actual VLAN quantity based on the identification information, and a first configuration file is generated; If the device type of the access device is different from the device type configured by the preset isolation allocation rule, the remaining access devices are re-allocated to the actual VLAN quantity according to the device type and the identification information based on the first configuration file, and a second configuration file is generated; wherein the first configuration file or the second configuration file is taken as a final configuration file.

3. The method of claim 1, wherein, Allocating the actual VLAN quantity to the access devices according to the device type and the identification information according to a preset isolation allocation rule to generate a configuration file, further comprising: Allocating the actual VLAN quantity to the access devices according to the device type and the identification information according to a preset isolation allocation rule to generate a first configuration file; Determining real-time traffic data of each port in the port information, and performing traffic aggregation on the access devices corresponding to multiple ports allocated to the same virtual local area network (VLAN) in the first configuration file based on the real-time traffic data of each port, and optimizing the traffic of each VLAN through load balancing to generate a final configuration file.

4. The method of claim 1, wherein, After the target switch allocates port resources based on the configuration file, further comprising: Taking a preset access device in the configuration file as a master device according to the device type, and enabling the master device to send a time synchronization message to a slave device through a master-slave mode; In response to the time synchronization message, selecting a time in the time synchronization message as a switching time based on an Ethernet time synchronization protocol to enable each slave device to complete time synchronization.

5. The method of claim 1, wherein, Calculating a number of effective VLAN port combinations based on the total number of physical ports to obtain a maximum VLAN quantity; Determining an actual VLAN quantity based on a calculation of the maximum VLAN quantity and a number of device types, comprising: determining a maximum VLAN number according to the total number of ports and a preset VLAN allocation mechanism; performing minimum value calculation according to the number of device types of the access devices in the target switch and the maximum VLAN number, and taking the calculated minimum value as an actual VLAN number to be allocated.

6. The method of allocating switch port resources according to claim 2 or 3, wherein, The number of preset isolation allocation rules is less than or equal to the number of device types of the access devices, and the number of preset isolation allocation rules is less than or equal to the total number of ports.

7. The method of claim 1-5, wherein, In response to the received configuration file, the target switch is caused to allocate port resources based on the configuration file, including: The received configuration file is used to restart the target switch to initialize based on the configuration file, and each of the access devices is allocated to connect VLAN port resources according to the configuration strategy in the configuration file.

8. The method of claim 1 to 5, wherein, after the target switch is caused to allocate port resources based on the configuration file, further comprising: reading a port state of the target switch at the current time; determining whether the port state at the current time is the same as a preset port state in the configuration file; if the port state at the current time is the same as the preset port state in the configuration file, generating a network topology node relationship diagram and a first log containing configuration success; if the port state at the current time is not the same as the preset port state in the configuration file, generating port error information and a second log containing configuration failure, and recommending new allocation rules.

9. A switch port resource allocation system, characterized by, including: a collection module configured to collect port information of a target switch, the port information including a total number of ports, device types of access devices, and identification information; a VLAN calculation module configured to calculate an effective VLAN port combination number based on the total number of ports to obtain a maximum VLAN number; performing calculation according to the maximum VLAN number and the number of device types to determine an actual VLAN number; a file generation module configured to allocate the access devices according to the device types and the identification information to the actual VLAN number according to preset isolation allocation rules to generate a configuration file, wherein the preset isolation allocation rules represent that any specific type of the access devices needs to be allocated to different virtual local area networks; a resource allocation module configured to, in response to the received configuration file, cause the target switch to allocate port resources based on the configuration file.

10. A robot, characterized in that The robot adopts the method of any one of claims 1 to 8.