A method, device, electronic device and storage medium for creating a network resource

By developing parameter files for network elements in advance and using parameter call sub-statements to directly create network resources, the problem of large workload and high error rate caused by manual coding in existing technologies is solved, and an efficient and concise network resource creation process is achieved.

CN119862115BActive Publication Date: 2026-01-06CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411782586.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2026-01-06
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

In the process of creating network resources, existing technologies require manual writing of a large amount of repetitive code, resulting in a large workload, high cost, and a high risk of errors, especially since the creation of network elements in different testing scenarios has a lot of similarities.

Method used

By pre-developing parameter files for various types of network elements, including parameter names and default parameter values, the stored parameter files can be directly called using parameter call sub-statements, reducing manual coding and simplifying the creation process of network elements.

Benefits of technology

It reduces the workload of technical personnel, lowers labor costs, improves the efficiency of creating network resources, reduces code redundancy and error probability, is suitable for various testing scenarios, and reduces the workload of smoke testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862115B_ABST
    Figure CN119862115B_ABST
Patent Text Reader

Abstract

The application provides a method, device, electronic equipment and storage medium for creating a network resource. A parameter file of each type of network element is developed in advance, and the parameter file of one type of network element at least includes a parameter name of a parameter related to the network element and a default parameter value corresponding to the parameter name. The parameter file of the type of network element is called by a parameter calling sub-statement of the type of network element when a network element of the type needs to be created, so that the parameter name of the parameter related to the network element and the default parameter value corresponding to the parameter name are obtained, and then the network element of the type is created, and the network resource is created. Technical personnel no longer need to write codes of the parameter name of the parameter of the network element of the type and the corresponding parameter value in real time, so that the workload of the technical personnel can be reduced, the labor cost can be reduced, and the efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular to a method, apparatus, electronic device, and storage medium for creating network resources. Background Technology

[0002] To ensure that network resources are created correctly and behave as expected, mainstream smoke testing involves developing relevant business code for different scenarios, periodically creating network resources, verifying their availability, and then deleting them. Summary of the Invention

[0003] This application discloses a method, apparatus, electronic device, and storage medium for creating network resources.

[0004] In a first aspect, this application discloses a method for creating network resources, applied to an electronic device running a development environment, the method comprising:

[0005] Obtain the creation statement input in the development environment, wherein the creation statement includes: creation sub-statements corresponding to each type of network element in at least one type of network element involved in the network resource to be created;

[0006] The creation sub-statement corresponding to one type of network element includes: the type of the network element, the name of the network element, and the parameter call sub-statement of the network element.

[0007] The parameter call sub-statement for one of the network element types is used to call the stored parameter file for one of the network element types.

[0008] The parameter file for one type of network element was developed in advance;

[0009] The parameter file of one of the network element types shall include at least: the parameter name of the parameter involved in one of the network element types and the default parameter value corresponding to the parameter name;

[0010] Create network elements of each type according to the creation sub-statements corresponding to each type of network element in the creation statement;

[0011] Network resources are obtained by combining network elements of at least one type.

[0012] Secondly, this application discloses an apparatus for creating network resources, applied to an electronic device running a development environment, the apparatus comprising:

[0013] The acquisition module is used to acquire the creation statement input in the development environment. The creation statement includes: creation sub-statements corresponding to each type of network element in at least one type of network element involved in the network resource to be created.

[0014] The creation sub-statement corresponding to one type of network element includes: the type of the network element, the name of the network element, and the parameter call sub-statement of the network element.

[0015] The parameter call sub-statement for one of the network element types is used to call the stored parameter file for one of the network element types.

[0016] The parameter file for one type of network element was developed in advance;

[0017] The parameter file of one of the network element types shall include at least: the parameter name of the parameter involved in one of the network element types and the default parameter value corresponding to the parameter name;

[0018] The creation module is used to create network elements of various types according to the creation sub-statements corresponding to each type of network element in the creation statement.

[0019] The combination module is used to combine network elements of at least one type to obtain network resources.

[0020] Thirdly, this application discloses an electronic device comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to perform the method as described in any of the preceding aspects.

[0021] Fourthly, this application discloses a non-transitory computer-readable storage medium in which, when the instructions in the storage medium are executed by a processor of an electronic device, enable the electronic device to perform the methods described in any of the preceding aspects.

[0022] Fifthly, this application discloses a computer program product in which, when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the method described in any of the preceding aspects.

[0023] The technical solution provided in this application may include the following beneficial effects:

[0024] This application pre-develops parameter files for various types of network elements. Each parameter file for a network element type includes at least the parameter names and default values ​​of the parameters involved in that type of network element. This allows the stored parameter file to be accessed via a parameter call sub-statement when a network element of a certain type needs to be created. The parameter names and default values ​​of the parameters involved in that type of network element are then obtained, and the network element of that type is created based on these parameter names and default values, thereby creating the network resource.

[0025] In this way, when it is necessary to create a network element of a certain type, the parameter name and parameter value in the parameter file of the network element of that type can be directly called. There is no need for technicians to write code for "parameter name and corresponding parameter value of network element of this type" in real time. This can reduce the workload of technicians, reduce labor costs, and improve efficiency.

[0026] Secondly, it can also avoid redundancy in the statements (code) for creating network elements. For example, with the solution of this application, the sub-statement for creating a type of network element can have only a small amount of code, such as only 1-2 lines of code, or even only one line of code, making the statements (code) for creating network elements concise, easy to understand, and less prone to errors.

[0027] In addition, the solution proposed in this application is applicable to situations where network resources are developed for various test scenarios (developing network resources involves developing various types of network elements), thereby reducing the workload of smoke testing. Attached Figure Description

[0028] Figure 1 This is a flowchart illustrating the steps of a method for creating a network resource according to this application.

[0029] Figure 2 This is a structural block diagram of an apparatus for creating network resources according to this application.

[0030] Figure 3 This is a block diagram of an electronic device according to this application.

[0031] Figure 4 This is a block diagram of an electronic device according to this application. Detailed Implementation

[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0033] Smoke testing can be applied to cloud clusters, for example, by establishing a VPC (Virtual Private Cloud) in the cloud cluster, creating subnets within the VPC, binding network cards to the subnets, creating virtual machines within the subnets, and equipping the virtual machines with EIP (Elastic Internet Protocol) addresses, etc.

[0034] The smoke test can include scenarios such as whether virtual machines in two VPCs in a cloud cluster can communicate with each other, and whether virtual machines in a VPC in a cloud cluster can communicate with the external network.

[0035] For example, to test whether virtual machines in two VPCs in a cloud cluster can communicate with each other, it is necessary to create network resources, such as creating network resource 1 and creating network resource 2.

[0036] Creating network resource 1 may include: establishing VPC1 in the cloud cluster, establishing subnet 1 in VPC1, binding network interface card 1 to subnet 1, establishing virtual machine 1 in subnet 1, and equipping virtual machine 1 with EIP address 1.

[0037] Creating network resource 2 may include: establishing VPC2 in the cloud cluster, establishing subnet 2 in VPC2, binding network interface card 2 to subnet 2, establishing virtual machine 2 in subnet 2, and equipping virtual machine 2 with EIP address 2.

[0038] Then, based on network resource 1 and network resource 2, test whether virtual machine 1 in VPC1 and virtual machine 2 in VPC2 can communicate with each other.

[0039] For example, to test whether virtual machines in a VPC in a cloud cluster can communicate with the external network, it is necessary to create network resources, such as network resource 3.

[0040] Creating network resource 3 may include: establishing VPC3 in the cloud cluster, establishing subnet 3 in VPC3, binding network interface card 3 to subnet 3, establishing virtual machine 3 in subnet 3, and equipping virtual machine 3 with EIP address 3.

[0041] Then, based on network resource 3, test whether virtual machine 3 in VPC3 can communicate with the external network.

[0042] Currently, for different testing scenarios, developers manually write the creation code each time they create network resources, resulting in a large workload, high labor costs, and a high risk of errors.

[0043] However, the inventors discovered that the types of network elements involved in the network resources that need to be created for different test scenarios are very similar. It is evident that there is a lot of repetitive creation work for different test scenarios, resulting in a large amount of manual work, high labor costs, and a high risk of errors.

[0044] In view of this, in order to reduce manual workload, reduce labor costs and reduce error rate, the solution proposed in this application is proposed.

[0045] Before introducing the solution of this application, the technical terms that may be involved in this application will be explained.

[0046] Smoke test: Simulates user behavior by periodically creating and deleting a set of related network resources, and performs a simple connectivity check on the created resources. This ensures that network resources in each resource pool can be created correctly and that the behavior of various resources meets expectations.

[0047] Domain-Specific Language (DSL) is a computer language that focuses on a specific application domain.

[0048] Reference Figure 1 The diagram illustrates a flowchart of the steps of a method for creating a network resource according to this application, applied to an electronic device running a development environment, wherein the method includes:

[0049] In step S101, the creation statement entered in the development environment is obtained. The creation statement includes creation sub-statements corresponding to each type of network element in at least one type of network element involved in the network resource to be created.

[0050] The creation sub-statement corresponding to one type of network element includes: the type of the network element, the name of the network element, and the parameter call sub-statement of the network element.

[0051] The parameter call sub-statement for one of the network element types is used to call the stored parameter file for that network element type.

[0052] The parameter file for one type of network element is pre-developed and stored locally.

[0053] The parameter file for one of the network element types shall include at least: the parameter name of the parameters involved in one of the network element types and the default parameter value corresponding to the parameter name.

[0054] Creation statements can be entered by technicians in the development environment when they need to create network resources.

[0055] Network resources involve at least one type of network element, including: a VPC established in a cloud cluster, a subnet established in a VPC, a network interface card (NIC) bound to the subnet, a virtual machine established in the subnet, and an EIP address assigned to the virtual machine. VPC, subnet, NIC, virtual machine, and EIP are different types of network elements.

[0056] When there are multiple network elements of the same type, each network element has its own name to distinguish them. For example, VPC1 has the name VPC1, VPC2 has the name VPC2, and different network elements have different names.

[0057] For any type of network element, certain necessary parameters are required when creating that type of network element. In other words, only with these necessary parameters can the network element of that type be successfully created.

[0058] For example, when creating a VPC, at least the following parameters are required: CIDR (Classless Inter Domain Routing) and Ipv6Enabled (whether IPv6 is enabled). If CIDR and Ipv6Enabled are missing, the VPC cannot be created.

[0059] The same applies to other types of network elements, and examples will not be given one by one.

[0060] In one embodiment, the network element of one type often involves multiple parameters. Therefore, the parameter file of the network element of one type can include at least: the parameter names of the multiple parameters involved in the network element of one type and the default parameter values ​​corresponding to each parameter name.

[0061] The parameter names of the multiple parameters involved in one of the network element types can be: the parameter names of all or some of the multiple parameters required to create the network element of that type.

[0062] For example, in all scenarios, the parameter names required to create this type of network element are the same, and the parameter values ​​corresponding to the same parameter names required to create this type of network element are also the same (which can be regarded as default parameter values).

[0063] The parameter file of one type of network element may include the parameter names of all parameters in the parameter names that must be used to create the network element of that type. Alternatively, the parameter file of one type of network element may include the default parameter values ​​corresponding to the parameter names of all parameters in the parameter names that must be used to create the network element of that type.

[0064] In this case, when creating a network element of one of these types, you can generally call the parameter call sub-statement of the network element of that type to obtain the parameter names and corresponding parameter values ​​of all the parameters that the network element of that type must use.

[0065] For example, in different scenarios, the parameter names of the parameters required to create this type of network element are the same, and in different scenarios, the parameter values ​​corresponding to some of the same parameter names required to create this type of network element are also the same (which can be regarded as default parameter values).

[0066] If the parameter names of the other part required to create this type of network element have different corresponding parameter values ​​(then they are not considered as default parameter values).

[0067] The parameter names of the multiple parameters involved in the parameter file of one type of network element can be: the parameter names of the part of the parameter names that must be used to create the network element of that type. The parameter file of one type of network element can also include: the default parameter values ​​corresponding to the parameter names of the part of the parameter names that must be used by the network element of that type.

[0068] In this case, when creating one of the network elements of this type, generally, for the parameter names and corresponding parameter values ​​of the part of the parameters that must be used by the network element of this type, the parameter call sub-statement of the network element of this type can be called.

[0069] For this type of network element, the parameter names and corresponding parameter values ​​for another set of parameters that must be used need to be specified separately by the technical personnel in the creation statement.

[0070] In this application, for any type of network element, the filename of the parameter file of that type of network element that has been developed in advance can be defined as a variable.

[0071] Thus, in the creation sub-statement corresponding to a network element of this type, the variable can be introduced through inheritance, thereby enabling the calling of the parameter file of the pre-developed network element of this type and realizing the sharing of the parameter file of the pre-developed network element of this type.

[0072] In step S102, network elements of each type are created according to the creation sub-statements corresponding to each type of network element in the creation statement.

[0073] In one embodiment of this application, for any one type of network element among at least one type of network element, the network element of that type can be created in the following manner, and the same applies to each of the other types of network elements among at least one type of network element.

[0074] The specific process includes:

[0075] 1021. By calling the parameter call sub-statement of the network element of any type in the creation sub-statement corresponding to the network element of any type, the parameter file of the network element of any type is called, thereby obtaining the parameter name and the default parameter value of the parameters involved in the network element of any type.

[0076] 1022. Based on the parameter names and default parameter values ​​of the parameters involved in any type of network element, create a network element of that type.

[0077] In one embodiment of this application, the technician does not specifically specify the parameter value corresponding to the parameter name of any parameter involved in the network element of any type in the creation statement. Thus, it can be considered that the technician needs to use the parameter names of all parameters involved in the network element of any type in the parameter file of the network element of any type and the default parameter values ​​corresponding to each parameter name to create the network element of any type.

[0078] In this way, a network element of any type can be created based on the parameter file of the network element of any type, the parameter names of each parameter involved in the network element of any type, and the default parameter values ​​corresponding to each parameter name.

[0079] Alternatively, in another embodiment of this application, the technician may specifically specify the parameter value corresponding to the parameter name of a certain parameter involved in any type of network element in the creation statement.

[0080] For example, the creation sub-statement corresponding to any type of network element also includes: the parameter assignment sub-statement for any type of network element.

[0081] The parameter assignment sub-statement includes: the parameter name of the target parameter involved in the network element of any type, and the non-default parameter value corresponding to the target parameter name. The parameter name of the target parameter is located in the parameter file of the network element of any type. The parameter value corresponding to the parameter name of the target parameter in the parameter file of the network element of any type is the default parameter value.

[0082] The target parameter is a subset of all parameters involved in any type of network element. The parameter name of the target parameter may or may not overlap with the parameter names of each parameter involved in any type of network element in the parameter file of that type of network element.

[0083] Thus, when creating a network element of any type based on the parameter name and the default parameter value of the parameter involved in the network element of any type, the network element of any type can be created based on the parameter name of the target parameter involved in the network element of any type in the parameter assignment substatement, the non-default parameter value corresponding to the target parameter name, the parameter name of the non-target parameter in the parameter file of the network element of any type, and the default parameter value corresponding to the non-target parameter name.

[0084] In another embodiment of this application, creating a network element of a certain type requires the use of all the required parameters of that type of network element. Thus, this application supports the validation of the developed creation statement. For example, it can validate whether the parameters already available when creating a network element of a certain type include all the required parameters of that type of network element, and whether the parameter values ​​meet the requirements (e.g., the correctness of the parameter name and parameter value can be validated through the type definition).

[0085] For example, the creation statement also includes a substatement that invokes a verification file. This verification file is pre-developed and can be stored in the electronic device for later use.

[0086] The verification file includes the parameter configurations for each type of network element in at least one type of network element involved in the network resource.

[0087] The parameter configuration of one type of network element shall include at least the parameter name of the required parameter of that type of network element.

[0088] The method also includes:

[0089] Before creating a network element of any type, the parameter name of the target parameter, the non-default parameter value corresponding to the target parameter name, the parameter name of the non-target parameter in the parameter file of the network element of any type, and the default parameter value corresponding to the non-target parameter name are used in the parameter assignment sub-statement. The parameter configuration of the network element of any type is then called through the validation file call sub-statement in the creation statement to obtain the parameter name of the required parameter of the network element of any type.

[0090] This section lists the parameter names of the target parameters involved in any network element of that type within the parameter assignment sub-statement, as well as the parameter names of the non-target parameters in the parameter call sub-statement of any network element of that type.

[0091] Determine whether the names of the required parameters for any network element of that type are all located in the set of parameter names.

[0092] If the parameter names of all required parameters of any network element of any type are located in the parameter name set, then create the network element of any type based on the parameter name of the target parameter involved in the network element of any type in the parameter assignment sub-statement, the non-target parameter name corresponding to the target parameter name, the parameter name of the non-target parameter in the parameter file of the network element of any type, and the default parameter value corresponding to the non-target parameter name.

[0093] Alternatively, if the parameter names of the required parameters of any network element of a certain type are not all located in the parameter name set, a prompt message is output. The prompt message is used to indicate the parameter names of the required parameters of any network element of a certain type that are not located in the parameter name set, so that the technician can supplement the parameter names and corresponding parameter values ​​of the required parameters of any network element of a certain type that are not located in the parameter name set based on the prompt message.

[0094] This embodiment introduces parameter validity verification, allowing for early detection and handling of issues. This avoids discovering parameter validity problems only later when compiling statements (code) or testing network resources, thus improving the efficiency of parameter validity problem detection and enabling timely handling of such issues.

[0095] In the validation file of a network element of a certain type, there can also be required and optional attributes for each type of parameter. If a parameter is a required attribute, then the parameter must be used when creating a network element of that type and cannot be omitted. If a parameter is an optional attribute, then the parameter is not required when creating a network element of that type and can be omitted.

[0096] In step S103, network resources are obtained by combining network elements of at least one type.

[0097] Afterwards, you can test whether the network resources are available, and then delete them.

[0098] In one embodiment, the creation sub-statement corresponding to a network element of a certain type contains: the type of the network element, the name of the network element of that type following the type of the network element, and the parameter call sub-statement of the network element of that type following the name of the network element of that type.

[0099] If there is another parameter assignment sub-statement for a network element of that type, then the parameter assignment sub-statement for that type of network element is placed after the parameter call sub-statement for that type of network element.

[0100] If a validation file call sub-statement also exists, it can be placed at the beginning of the creation statement, for example, before the creation sub-statements corresponding to each type of network element.

[0101] The parameter assignment statement for a network element of a certain type includes: the parameter name of the parameter involved in the network element of that type, and the non-default parameter value corresponding to the parameter name.

[0102] In this application, VPC, subnet, network interface card, virtual machine, port, ACL (Access Control List), security cluster, and EIP are different types of network elements.

[0103] These network elements may have dependencies on each other. For example, a subnet depends on a VPC, a security cluster depends on a VPC, a port depends on both a subnet and a security cluster, and so on. Therefore, the names of each type of network element can be viewed as variables that can be referenced / called by other types of network elements.

[0104] For example, the parameter name in the parameter assignment substatement of a network element of this type can be the name of another network element that the network element of this type depends on.

[0105] In this way, by using the name of the network element in the creation sub-statement of a network element of a certain type and the parameter name in the parameter assignment sub-statement of a network element of that type, the dependency relationship between a network element of that type and other network elements can be clearly shown.

[0106] In one example, when creating a subnet, it is necessary to rely on an already created VPC. Using configuration files (such as json, yaml, or xml configuration files) makes it impossible to determine the parameters for creating the subnet before the VPC is created.

[0107] However, this application, by treating the names of various types of network elements as variables for reference / call by other types of network elements, allows the use of a variable VPC as a parameter for creating subnets, thereby representing the relationship between subnets and VPCs, such as dependencies. Such dependencies cannot be represented by other configuration files (e.g., json, yaml, or xml). Clearly demonstrating the dependencies between a type of network element and other network elements is an advantage of this application's solution.

[0108] In another embodiment of this application, the creation sub-statements corresponding to the various types of network elements involved in the network resource to be created in the creation statement have a sequential order. This sequential order is specified by the technician according to the actual situation (the sequential order can be determined according to the position of the creation sub-statement corresponding to each type of network element in the creation statement; the earlier the position, the higher the sequential order, and the later the position, the lower the sequential order). In this way, when creating the various types of network elements involved in the network resource, the various types of network elements can be created sequentially according to the sequential order of the creation sub-statements.

[0109] After verifying the network resources, if it is necessary to delete the network resources, delete each created network element involved in the network resources in reverse order to avoid network elements with dependencies being unable to be deleted.

[0110] This application pre-develops parameter files for various types of network elements. Each parameter file for a network element type includes at least the parameter names and default values ​​of the parameters involved in that type of network element. This allows the stored parameter file to be accessed via a parameter call sub-statement when a network element of a certain type needs to be created. The parameter names and default values ​​of the parameters involved in that type of network element are then obtained, and the network element of that type is created based on these parameter names and default values, thereby creating the network resource.

[0111] In this way, when it is necessary to create a network element of a certain type, the parameter name and parameter value in the parameter file of the network element of that type can be directly called. There is no need for technicians to write code for "parameter name and corresponding parameter value of network element of this type" in real time. This can reduce the workload of technicians, reduce labor costs, and improve efficiency.

[0112] Secondly, it can also avoid redundancy in the statements (code) for creating network elements. For example, with the solution of this application, the sub-statement for creating a type of network element can have only a small amount of code, such as only 1-2 lines of code, or even only one line of code, making the statements (code) for creating network elements concise, easy to understand, and less prone to errors.

[0113] In addition, the solution proposed in this application is applicable to situations where network resources are developed for various test scenarios (developing network resources involves developing various types of network elements), thereby reducing the workload of smoke testing.

[0114] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by this application.

[0115] Reference Figure 2 This application illustrates an apparatus for creating network resources, applied to an electronic device running a development environment. The apparatus includes:

[0116] The acquisition module 11 is used to acquire the creation statement input in the development environment, wherein the creation statement includes: creation sub-statements corresponding to each type of network element in at least one type of network element involved in the network resource to be created;

[0117] The creation sub-statement corresponding to one type of network element includes: the type of the network element, the name of the network element, and the parameter call sub-statement of the network element.

[0118] The parameter call sub-statement for one of the network element types is used to call the stored parameter file for one of the network element types.

[0119] The parameter file for one type of network element was developed in advance;

[0120] The parameter file of one of the network element types shall include at least: the parameter name of the parameter involved in one of the network element types and the default parameter value corresponding to the parameter name;

[0121] The creation module 12 is used to create network elements of various types according to the creation sub-statements corresponding to each type of network element in the creation statement;

[0122] Combination module 13 is used to combine network elements of at least one type to obtain network resources.

[0123] In one optional implementation, the creation module includes:

[0124] The calling unit is used to call the parameter file of any one type of network element in at least one type of network element, through the parameter calling sub-statement of the network element of any one type of network element in the creation sub-statement corresponding to the network element of any one type of network element, thereby obtaining the parameter name and the default parameter value of the parameter involved in the network element of any one type of network element.

[0125] A creation unit is used to create a network element of any type based on the parameter name of the parameters involved in the network element of any type and the default parameter value corresponding to the parameter name.

[0126] In an optional implementation, the creation sub-statement corresponding to any type of network element further includes: a parameter assignment sub-statement for any type of network element;

[0127] The parameter assignment sub-statement includes: the parameter name of the target parameter involved in any network element of the aforementioned type, and the non-default parameter value corresponding to the parameter name of the target parameter;

[0128] The parameter name of the target parameter is located in the parameter file of any type of network element; the parameter value corresponding to the parameter name of the target parameter in the parameter file of any type of network element is the default parameter value.

[0129] The creation unit includes:

[0130] Create a sub-unit to create a network element of any type based on the parameter name of the target parameter involved in the parameter assignment sub-statement, the non-default parameter value corresponding to the target parameter name, the parameter name of the non-target parameter in the parameter file of the network element of any type, and the default parameter value corresponding to the non-target parameter name.

[0131] In an optional implementation, the creation statement further includes a sub-statement that calls a verification file;

[0132] The verification file was developed in advance;

[0133] The verification file includes: parameter configurations for each type of network element in at least one type of network element involved in the network resource;

[0134] The parameter configuration of one type of network element includes at least: the parameter name of the required parameter of the one type of network element;

[0135] The creation unit further includes:

[0136] The calling subunit is used to, before creating a network element of any type, call the parameter configuration of any type in the verification file of the creation statement by using the verification file calling substatement in the creation statement to call the parameter configuration of any type in the verification file, thereby obtaining the parameter name of the required parameter of the network element of any type;

[0137] The statistics subunit is used to count the parameter names of the target parameters involved in any type of network element in the parameter assignment substatement and the parameter names of the non-target parameters in the parameter call substatement of any type of network element.

[0138] The sub-unit is used to determine whether the parameter names of the required parameters of any network element of the given type are all located in the parameter name set;

[0139] The creation subunit is further configured to: when the parameter names of the required parameters of any type of network element are all located in the parameter name set, create the network element of any type based on the parameter name of the target parameter involved in the network element of any type in the parameter assignment substatement, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of any type, and the default parameter value corresponding to the parameter name of the non-target parameter.

[0140] This application pre-develops parameter files for various types of network elements. Each parameter file for a network element type includes at least the parameter names and default values ​​of the parameters involved in that type of network element. This allows the stored parameter file to be accessed via a parameter call sub-statement when a network element of a certain type needs to be created. The parameter names and default values ​​of the parameters involved in that type of network element are then obtained, and the network element of that type is created based on these parameter names and default values, thereby creating the network resource.

[0141] In this way, when it is necessary to create a network element of a certain type, the parameter name and parameter value in the parameter file of the network element of that type can be directly called. There is no need for technicians to write code for "parameter name and corresponding parameter value of network element of this type" in real time. This can reduce the workload of technicians, reduce labor costs, and improve efficiency.

[0142] Secondly, it can also avoid redundancy in the statements (code) for creating network elements. For example, with the solution of this application, the sub-statement for creating a type of network element can have only a small amount of code, such as only 1-2 lines of code, or even only one line of code, making the statements (code) for creating network elements concise, easy to understand, and less prone to errors.

[0143] In addition, the solution proposed in this application is applicable to situations where network resources are developed for various test scenarios (developing network resources involves developing various types of network elements), thereby reducing the workload of smoke testing.

[0144] Optionally, this application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0145] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0146] Figure 3This is a block diagram illustrating an electronic device 800. For example, the electronic device 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0147] Reference Figure 3 The electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.

[0148] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.

[0149] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, images, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0150] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.

[0151] Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may not only sense the boundaries of touch or swipe actions but also monitor the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0152] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.

[0153] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0154] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800. For example, sensor assembly 814 may monitor the on / off state of device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or a component of electronic device 800, the presence or absence of user contact with electronic device 800, the orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0155] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast operation information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0156] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0157] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0158] Figure 4 This is a block diagram of an electronic device 1900 shown in this application. For example, the electronic device 1900 can be provided as a server.

[0159] Reference Figure 4 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0160] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output (I / O) interface 1958. Electronic device 1900 can operate on an operating system stored in memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

[0161] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0162] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0163] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0164] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0165] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0166] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0167] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0168] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0169] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0170] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method of creating a network resource, characterized by, The method is applied to an electronic device running a development environment, and comprises: obtaining a creation statement input in the development environment, the creation statement comprising: a creation sub-statement corresponding to each type of network element of at least one type of network element involved in a network resource to be created, each type of network element comprising: VPC, subnet, network card, virtual machine, port, access control table, security cluster, and EIP; the creation sub-statement corresponding to one type of network element comprising: the type of the one type of network element, the name of the one type of network element, and a parameter calling sub-statement of the one type of network element; the parameter calling sub-statement of the one type of network element being used to call a parameter file of the one type of network element that has been stored; the parameter file of the one type of network element being developed in advance; the parameter file of the one type of network element comprising at least: a parameter name of a parameter involved in the one type of network element and a default parameter value corresponding to the parameter name; creating each type of network element according to the creation sub-statement corresponding to each type of network element in the creation statement; combining at least one type of network element to obtain a network resource.

2. The method of claim 1, wherein, the creating each type of network element according to the creation sub-statement corresponding to each type of network element in the creation statement, comprising: for any one type of network element of the at least one type of network element, calling a parameter file of the any one type of network element through a parameter calling sub-statement of the any one type of network element in the creation sub-statement corresponding to the any one type of network element, so as to obtain a parameter name of a parameter involved in the any one type of network element and a default parameter value corresponding to the parameter name; creating the any one type of network element according to the parameter name of the parameter involved in the any one type of network element and the default parameter value corresponding to the parameter name.

3. The method of claim 2, wherein, the creation sub-statement corresponding to the any one type of network element further comprising: a parameter assignment sub-statement of the any one type of network element; the parameter assignment sub-statement comprising: a parameter name of a target parameter involved in the any one type of network element and a non-default parameter value corresponding to the parameter name of the target parameter; the parameter name of the target parameter being located in the parameter file of the any one type of network element; and the parameter value corresponding to the parameter name of the target parameter in the parameter file of the any one type of network element being the default parameter value; the creating the any one type of network element according to the parameter name of the parameter involved in the any one type of network element and the default parameter value corresponding to the parameter name, comprising: According to the parameter name of the target parameter involved by the network element of the arbitrary type in the parameter assignment sub-sentence, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of the arbitrary type, and the default parameter value corresponding to the parameter name of the non-target parameter, the network element of the arbitrary type is created.

4. The method of claim 3, wherein, The creation statement further comprises a verification file calling sub-sentence; The verification file is developed in advance; The verification file comprises parameter configurations of each type of network element of at least one type of network element involved by a network resource; The parameter configuration of one type of network element at least comprises the parameter name of the mandatory parameter of the one type of network element; The method further comprises: Before the network element of the arbitrary type is created according to the parameter name of the target parameter involved by the network element of the arbitrary type in the parameter assignment sub-sentence, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of the arbitrary type, and the default parameter value corresponding to the parameter name of the non-target parameter, the parameter configuration of the arbitrary type of network element in the verification file is obtained through the verification file calling sub-sentence in the creation statement, so as to obtain the parameter name of the mandatory parameter of the network element of the arbitrary type; The parameter name set of the parameter name of the target parameter involved by the network element of the arbitrary type in the parameter assignment sub-sentence and the parameter name of the non-target parameter in the parameter calling sub-sentence of the network element of the arbitrary type is counted; It is determined whether the parameter names of the mandatory parameters of the network element of the arbitrary type are all located in the parameter name set; In the case that the parameter names of the mandatory parameters of the network element of the arbitrary type are all located in the parameter name set, the network element of the arbitrary type is further created according to the parameter name of the target parameter involved by the network element of the arbitrary type in the parameter assignment sub-sentence, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of the arbitrary type, and the default parameter value corresponding to the parameter name of the non-target parameter.

5. An apparatus for creating a network resource, characterized by The electronic device runs a development environment, and the device comprises: The obtaining module is configured to obtain a creation statement input in the development environment, wherein the creation statement comprises: creation sub-statements respectively corresponding to each type of network element of at least one type of network element involved by a network resource to be created, and each type of network element comprises: VPC, subnet, network card, virtual machine, port, access control table, security cluster, and EIP; The creation sub-sentence corresponding to one type of network element comprises: the type of the one type of network element, the name of the one type of network element, and a parameter calling sub-sentence of the one type of network element; The parameter calling sub-statement of the one type of network element is used to call the stored parameter file of the one type of network element; The parameter file of the one type of network element is developed in advance; The parameter file of the one type of network element at least includes the parameter name of the parameter related to the one type of network element and the default parameter value corresponding to the parameter name; The creating module is used to create the network elements of each type according to the creating sub-statement corresponding to each type of network element in the creating statement respectively; The combining module is used to combine the network elements of at least one type to obtain the network resource.

6. The apparatus of claim 5, wherein, The creating module includes: The calling unit is used to call the parameter file of the arbitrary one type of network element through the parameter calling sub-statement of the arbitrary one type of network element in the creating sub-statement corresponding to the arbitrary one type of network element, so as to obtain the parameter name of the parameter related to the arbitrary one type of network element and the default parameter value corresponding to the parameter name; The creating unit is used to create the arbitrary one type of network element according to the parameter name of the parameter related to the arbitrary one type of network element and the default parameter value corresponding to the parameter name.

7. The apparatus of claim 6, wherein, The creating sub-statement corresponding to the arbitrary one type of network element further includes a parameter assigning sub-statement of the arbitrary one type of network element; The parameter assigning sub-statement includes the parameter name of the target parameter related to the arbitrary one type of network element and the non-default parameter value corresponding to the parameter name of the target parameter; The parameter name of the target parameter is located in the parameter file of the arbitrary one type of network element; and the parameter value corresponding to the parameter name of the target parameter in the parameter file of the arbitrary one type of network element is the default parameter value; The creating unit includes: The creating sub-unit is used to create the arbitrary one type of network element according to the parameter name of the target parameter related to the arbitrary one type of network element in the parameter assigning sub-statement, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the arbitrary one type of network element and the default parameter value corresponding to the parameter name of the non-target parameter.

8. The apparatus of claim 7, wherein, The creating statement further includes a calling verification file calling sub-statement; The verification file is developed in advance; The verification file includes the parameter configuration of each type of network element in at least one type of network element related to the network resource; The parameter configuration of one type of network element at least includes the parameter name of the optional parameter of the one type of network element; The creating unit further includes: The calling subunit is configured to call the parameter configuration of the network element of the type in the verification file through a verification file calling subunit in the creating statement before creating the network element of the type according to the parameter name of the target parameter involved by the network element of the type in the parameter assignment substatement, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of the type, and the default parameter value corresponding to the parameter name of the non-target parameter, so as to obtain the parameter name of the mandatory parameter of the network element of the type. The statistical subunit is configured to count a parameter name set of the parameter name of the target parameter involved by the network element of the type in the parameter assignment substatement and the parameter name of the non-target parameter in the parameter calling substatement of the network element of the type. The determining subunit is configured to determine whether the parameter names of the mandatory parameters of the network element of the type are all in the parameter name set. The creating subunit is further configured to, in a case where the parameter names of the mandatory parameters of the network element of the type are all in the parameter name set, create the network element of the type according to the parameter name of the target parameter involved by the network element of the type in the parameter assignment substatement, the non-default parameter value corresponding to the parameter name of the target parameter, the parameter name of the non-target parameter in the parameter file of the network element of the type, and the default parameter value corresponding to the parameter name of the non-target parameter.

9. An electronic device, comprising: The computer program is stored in the computer readable storage medium and is executed by the processor to implement the method for creating a network resource. The computer program is stored in the computer readable storage medium and is executed by the processor to implement the method for creating a network resource.

10. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Tenant-oriented network resource management method and device

    CN116321211A

  • Lightweight virtual machine creation method and device, electronic equipment and storage medium

    CN117193942A