Method and device for creating network resources, electronic equipment and storage medium
By developing and storing the parameter files of network elements in advance, and automatically creating network resources using parameter call sub-statements, the problem of large labor and high cost when creating network resources in the existing technology is solved, and a more efficient network resource creation process is achieved.
Patent Information
- Application Number
- CN202411782586.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-12-05
AI Technical Summary
When creating network resources, the existing technology requires manual writing of creation code for different test scenarios, resulting in large labor, high cost and error-prone.
By developing parameter files of various types of network elements in advance, including parameter names and default parameter values, and calling these parameter files using parameter call substatements, thereby creating network resources.
Reduces workload and labor costs for technicians, improves efficiency, and avoids code redundancy for creating network elements, simplifying the creation process.
Smart Images

Figure CN119862115A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method, device, electronic device and storage medium for creating network resources. Background Art
[0002] To ensure that network resources can be created correctly and their behavior is as expected, mainstream smoke testing will develop relevant business codes for different scenarios, periodically create network resources, and verify whether the network resources are available. After the verification is completed, the network resources are deleted. Summary of the invention
[0003] The present application shows a method, device, electronic device and storage medium for creating network resources.
[0004] In a first aspect, the present application shows a method for creating a network resource, which is applied to an electronic device, wherein the electronic device runs a development environment, and the method includes:
[0005] Acquire a creation statement input in a 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 one type of network element, the name of the one type of network element and the parameter calling sub-statement of the one type of network element;
[0007] The parameter calling substatement of one type of network element is used to call the stored parameter file of one type of network element;
[0008] The parameter file of one type of network element is previously developed;
[0009] The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names;
[0010] Creating network elements of various types respectively according to the creation sub-statements corresponding to the network elements of various types in the creation statement;
[0011] At least one type of network elements is combined to obtain a network resource.
[0012] In a second aspect, the present application shows a device for creating a network resource, which is applied to an electronic device, wherein the electronic device runs a development environment, and the device includes:
[0013] An acquisition module, configured to acquire a creation statement input in a 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 a network resource to be created;
[0014] The creation sub-statement corresponding to one type of network element includes: the type of the one type of network element, the name of the one type of network element and the parameter calling sub-statement of the one type of network element;
[0015] The parameter calling substatement of one type of network element is used to call the stored parameter file of one type of network element;
[0016] The parameter file of one type of network element is previously developed;
[0017] The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names;
[0018] A creation module, used to create network elements of various types respectively according to the creation sub-statements corresponding to the network elements of various types in the creation statement;
[0019] The combining module is used to combine at least one type of network elements to obtain network resources.
[0020] In a third aspect, the present application shows an electronic device, which includes: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in any of the above aspects.
[0021] In a fourth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute a method as described in any of the above aspects.
[0022] In a fifth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method described in any of the above aspects.
[0023] The technical solution provided by this application may have the following beneficial effects:
[0024] The present application develops parameter files of various types of network elements in advance, and the parameter file of one type of network element at least includes: parameter names of parameters involved in the network element of this type and default parameter values corresponding to the parameter names, so that when a certain type of network element needs to be created later, the parameter file of the network element of this type that has been stored can be called through the parameter call sub-statement of the network element of this type, so as to obtain the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network element of this type is created according to the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network resources are created.
[0025] In this way, when it is necessary to create a type of network element, for the parameter names and parameter values in the parameter file of this type of network element, the stored parameter file of this type of network element can be directly called. There is no need for technicians to write the code of "parameter names and corresponding parameter values of parameters of this type of network element" in real time. This can reduce the workload of technicians, reduce labor costs and improve efficiency.
[0026] Secondly, redundancy of statements (codes) for creating network elements can also be avoided. For example, through the solution of the present application, the creation sub-statement of 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, so that the statement (code) for creating the network element is concise, easy to understand, and not prone to errors.
[0027] In addition, the solution of the present application is applicable to the situation of developing network resources for various test scenarios (developing network resources involves developing various types of network elements), thereby reducing the workload of smoke testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flowchart of the steps of a method for creating network resources in the present application.
[0029] Figure 2 This is a structural block diagram of a device for creating network resources in the present application.
[0030] Figure 3 It is a block diagram of an electronic device of the present application.
[0031] Figure 4 It is a block diagram of an electronic device of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] Smoke testing can be applied to cloud clusters. For example, establish a VPC (Virtual Private Cloud) in the cloud cluster, establish a subnet in the VPC, bind the network card to the subnet, establish a virtual machine in the subnet, and equip the virtual machine with an EIP (Elastic Internet Protocol) address.
[0034] The test scenarios involved in the smoke test may include: whether the virtual machines in two VPCs in the cloud cluster can communicate with each other, whether the virtual machines in the VPC in the cloud cluster can communicate with the external network, etc.
[0035] For example, in order to test whether virtual machines in two VPCs in a cloud cluster can communicate with each other, it is necessary to create network resources, for example, create network resource 1 and create network resource 2.
[0036] Creating network resource 1 may include: establishing VPC 1 in the cloud cluster, establishing subnet 1 in VPC 1, binding network card 1 to subnet 1, establishing virtual machine 1 in subnet 1, and configuring EIP address 1 for virtual machine 1.
[0037] Creating network resource 2 may include: establishing VPC 2 in the cloud cluster, establishing subnet 2 in VPC 2, binding network card 2 to subnet 2, establishing virtual machine 2 in subnet 2, and configuring EIP address 2 for virtual machine 2.
[0038] Then, based on network resources 1 and 2, test whether virtual machine 1 in VPC1 and virtual machine 2 in VPC2 are interconnected.
[0039] For another example, in order to test whether the virtual machines in the VPC in the cloud cluster can communicate with the external network, it is necessary to create network resources, for example, create network resource 3.
[0040] Creating network resource 3 may include: establishing VPC 3 in the cloud cluster, establishing subnet 3 in VPC 3, binding network card 3 to subnet 3, establishing virtual machine 3 in subnet 3, and configuring EIP address 3 for virtual machine 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 test scenarios, when creating network resources, developers manually write creation codes each time, resulting in a large amount of manual work, high labor costs, and prone to errors.
[0043] However, the inventors found that for different test scenarios, the types of network elements involved in the network resources that need to be created are very similar. It can be seen that for different test scenarios, there is a lot of repetitive creation work, which leads to a large amount of manual workload, high labor costs, and easy errors.
[0044] In view of this, in order to reduce manual workload, reduce labor costs, and reduce error rates, the solution of the present application is proposed.
[0045] Before introducing the solution of the present application, the technical terms that may be involved in the present application are first explained.
[0046] Smoke test: simulates user behavior to periodically create and delete a group of related network resources, and performs a simple connectivity check on the created resources to ensure that the network resources of each resource pool can be created correctly and the behavior of various resources meets expectations.
[0047] Domain Specific Language: Domain Specific Language, DSL, is a computer language that focuses on a certain application domain.
[0048] Reference Figure 1 , shows a flowchart of the steps of a method for creating a network resource of the present application, which is applied to an electronic device, and the electronic device runs a development environment, wherein the method includes:
[0049] In step S101, a creation statement input in a development environment is obtained, 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 a network resource to be created.
[0050] The creation sub-statement corresponding to one type of network element includes: the type of one type of network element, the name of one type of network element and the parameter calling sub-statement of one type of network element.
[0051] The parameter calling substatement of one of the types of network elements is used to call a stored parameter file of one of the types of network elements.
[0052] The parameter file for one type of network element is developed in advance and stored locally.
[0053] The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names.
[0054] The creation statement can be entered by a technician in a development environment when a network resource needs to be created.
[0055] The at least one type of network element involved in the network resources includes: VPC established in the cloud cluster, subnet established in the VPC, network card bound to the subnet, virtual machine established in the subnet, EIP address configured for the virtual machine, etc. VPC, subnet, network card, virtual machine and EIP are different types of network elements.
[0056] When there are multiple network elements of the same type, in order to distinguish different network elements of the same type, each network element has its own name. For example, VPC1 has the name of VPC1, and VPC2 has the name of VPC2. Different network elements have different names.
[0057] For any type of network element, when creating the network element of this type, some necessary parameters need to be used, that is, only with these necessary parameters can the network element of this type be successfully created.
[0058] For example, for a network element VPC, when creating a network element VPC, at least the parameters required are CIDR (Classless Inter Domain Routing) and Ipv6Enabled (whether Ipv6 is available). If CIDR and Ipv6Enabled are missing, the VPC cannot be created.
[0059] The same is true for other types of network elements, and no further examples are given.
[0060] In one embodiment, one of the types of network elements often involves multiple parameters. Thus, the parameter file of one of the types of network elements may include at least: parameter names of multiple parameters involved in one of the types of network elements and default parameter values corresponding to each parameter name.
[0061] The parameter names of the multiple parameters involved in one type of network element may be: parameter names of all parameters or parameter names of part of the multiple parameters that must be used to create the network element of this type.
[0062] For example, in each scenario, the parameter names of the parameters that must be used to create this type of network element are the same, and in each scenario, the parameter values corresponding to the parameter names of the same parameter that must be used to create this type of network element are also the same (which can be regarded as default parameter values).
[0063] Then the parameter names of multiple parameters involved in one of the types of network elements included in the parameter file of one of the types of network elements may be: the parameter names of all parameters among the parameter names of parameters that must be used to create this type of network elements; the parameter file of one of the types of network elements may also include: the default parameter values corresponding to the parameter names of all parameters among the parameter names of parameters that must be used by this type of network elements.
[0064] In this case, when creating one of the types of network elements, generally, the parameter call substatement of one of the types of network elements is called for the parameter names of all parameters that must be used by the type of network element and the parameter values corresponding to each parameter name.
[0065] For another example, in each scenario, the parameter names of the parameters that must be used to create this type of network element are the same, and in each scenario, the parameter values corresponding to the parameter names of some of the same parameters that must be used to create this type of network element are also the same (which can be regarded as default parameter values).
[0066] The parameter names of another part of the same parameter that must be used to create this type of network element correspond to different parameter values (they are not considered as default parameter values).
[0067] Then the parameter names of multiple parameters involved in one of the types of network elements included in the parameter file of one of the types of network elements may be: the parameter names of this part of the parameters in the parameter names of the parameters that must be used to create this type of network elements, and the parameter file of one of the types of network elements may also include: the default parameter values corresponding to the parameter names of this part of the parameters in the parameter names of the parameters that must be used by this type of network elements.
[0068] In this case, when creating one of the types of network elements, generally, the parameter call substatement of one of the types of network elements is called for the parameter names of the part of parameters that must be used by the type of network element and the parameter values corresponding to the parameter names.
[0069] The parameter names of the other parameters that must be used by this type of network element and the parameter values corresponding to the parameter names need to be separately specified by the technician in the creation statement.
[0070] In the present application, for any type of network element, the file name of a parameter file of the type of network element developed in advance can be defined as a variable.
[0071] In this way, in the creation substatement corresponding to the network element of this type, the variable can be introduced by inheritance, so as to call the parameter file of the network element of this type that has been developed in advance, and realize the sharing of the parameter file of the network element of this type that has been developed in advance.
[0072] In step S102, each type of network element is created according to the creation sub-statements corresponding to each type of network element in the creation statement.
[0073] In one embodiment of the present application, for any one type of network element among at least one type of network elements, the network element of the any one type can be created in the following manner, and the same is true for each other type of network element among the at least one type of network element.
[0074] The specific process includes:
[0075] 1021. Call the parameter file of the network element of any type through the parameter calling substatement of the network element of any type in the creation substatement corresponding to the network element of any type, so as to obtain the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names.
[0076] 1022. Create a network element of any type according to parameter names of parameters involved in the network element of any type and default parameter values corresponding to the parameter names.
[0077] In one embodiment of the present application, the technician does not specifically specify the parameter value corresponding to the parameter name of any parameter involved in the any type of network element in the creation statement. In this way, it can be considered that the technician needs to use the parameter names of all parameters involved in the any type of network element in the parameter file of the any type of network element and the default parameter values corresponding to each parameter name to create the any type of network element.
[0078] In this way, the network element of any type may be created according to the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names of the parameters in the parameter file of the network element of any type.
[0079] Alternatively, in another embodiment of the present application, the technician specifically specifies in the creation statement a parameter value corresponding to a parameter name of a certain parameter involved in any type of network element.
[0080] For example, the creation sub-statement corresponding to the network element of any type also includes: a parameter assignment sub-statement of the network element of any type.
[0081] The parameter assignment substatement 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 parameter name of the target parameter. 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 part of all parameters involved in the network element of any type. The parameter name of the target parameter may or may not have an intersection with the parameter names of the various parameters involved in the network element of any type in the parameter file of the network element of any type.
[0083] In this way, when creating any type of network element based on the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names, the network element of any type can be created based on the parameter names of the target parameters involved in the network element of any type in the parameter assignment substatement, the non-default parameter values corresponding to the parameter names of the target parameters, the parameter names of the non-target parameters in the parameter file of the network element of any type and the default parameter values corresponding to the parameter names of the non-target parameters.
[0084] In another embodiment of the present application, creating a type of network element requires the use of all required parameters of the type of network element. Thus, the present application supports verification of the developed creation statements, for example, verifying whether the parameters already available when creating a type of network element include all required parameters of the type of network element, and verifying whether the parameter values of the parameters meet the requirements (for example, the parameter name of the parameter and the correctness of the parameter value of the parameter can be verified through type definition), etc.
[0085] For example, the creation statement also includes a sub-statement for calling a verification file. The verification file is developed in advance and can be stored in the electronic device for later use.
[0086] The verification file includes: parameter configuration of 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 at least includes: parameter names of mandatory parameters of one type of network element.
[0088] The method further includes:
[0089] Before creating any type of network element based on the parameter name of the target parameter involved in the any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter, the parameter configuration of the any type in the verification file is called through the verification file calling substatement in the creation statement to obtain the parameter name of the required parameter of the any type of network element.
[0090] A parameter name set of the parameter names of the target parameters involved in the arbitrary type of network element in the parameter assignment substatement and the parameter names of the non-target parameters in the parameter call substatement of the arbitrary type of network element is counted.
[0091] It is determined whether the parameter names of the mandatory parameters of the network element of any type are all located in the parameter name set.
[0092] When the parameter names of the required parameters of the network element of any type are all in the parameter name set, the network element of any type is created according to 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.
[0093] Alternatively, when the parameter names of the mandatory parameters of the arbitrary type of network element are not all in the parameter name set, a prompt message is output, wherein the prompt message is used to prompt the parameter names of the mandatory parameters of the arbitrary type of network element that are not in the parameter name set, so that the technician can supplement the parameter names and corresponding parameter values of the mandatory parameters of the arbitrary type of network element that are not in the parameter name set according to the prompt message.
[0094] Through this embodiment, parameter validity verification is introduced to detect and handle problems in advance, avoiding the discovery of parameter validity problems when compiling statements (codes) or testing network resources later, thereby improving the efficiency of discovering parameter validity problems, so that parameter validity problems can be handled in a timely manner.
[0095] In the verification file of a type of network element, there may also be mandatory attributes and optional attributes for parameters of each type. If a parameter is a mandatory attribute, then the parameter must be used when creating a network element of this type and is indispensable. If a parameter is an optional attribute, then the parameter is not required when creating a network element of this type and can be omitted.
[0096] In step S103, at least one type of network elements is combined to obtain network resources.
[0097] You can then test whether the network resource is available, and after the test is complete, you can delete the network resource.
[0098] In one embodiment, the creation sub-statements corresponding to one type of network element respectively include: the type of the network element of that type, the name of the network element of that type followed by the type of network element, and the parameter calling sub-statement of the network element of that type followed by the name of the network element of that type.
[0099] If there is still a parameter assignment substatement for the network element of the one type, the parameter assignment substatement for the network element of the one type is located after the parameter call substatement for the network element of the one type.
[0100] If there is a verification file calling sub-statement, the verification file calling sub-statement may be located at the initial position of the creation statement, for example, before the creation sub-statements corresponding to each type of network element.
[0101] The parameter assignment sub-statement of a type of network element includes: the parameter name of the parameter involved in the network element of this type and the non-default parameter value corresponding to the parameter name of the parameter.
[0102] In this application, VPC, subnet, network card, virtual machine, port, ACL (Access Controls, access control list), security cluster and EIP are different types of network elements.
[0103] These network elements may have dependencies, for example, a subnet depends on a VPC, a security cluster depends on a VPC, a port depends on a subnet and a security cluster, etc. In this way, the name of each type of network element can also be regarded as a variable for reference / calling by other types of network elements.
[0104] For example, the parameter name in the parameter assignment substatement of the network element of the one type may include the names of other network elements that the network element of the one type depends on.
[0105] In this way, the dependency relationship between a type of network element and other network elements can be clearly reflected through the name of the network element in the creation sub-statement of the type of network element and the parameter name in the parameter assignment sub-statement of the type of network element.
[0106] In one example, when creating a subnet, it is necessary to rely on the created VPC. If a configuration file (such as a json, yaml or xml configuration file) is used, the parameters for creating the subnet cannot be determined before the VPC is created.
[0107] However, the present application makes it possible to use a variable VPC as a parameter for creating a subnet by "regarding the name of each type of network element as a variable for reference / calling by other types of network elements", thereby indicating the association between the subnet and VPC, such as dependency, etc. This dependency cannot be reflected through other configuration files (such as json, yaml or xml configuration files). Being able to clearly reflect the dependency between one type of network element and other network elements is also an advantage of the solution of the present application.
[0108] In another embodiment of the present application, there is a sequence of precedence between the creation sub-statements corresponding to each type of network element involved in the network resources to be created in the creation statement, and the sequence of precedence is specified by the technician according to actual conditions (the sequence of precedence can be determined according to the position of the creation sub-statements corresponding to each type of network element in the creation statement, the earlier the position, the earlier the sequence, and the later the position, the later the sequence). In this way, when creating each type of network element involved in the network resources, each type of network element can be created in sequence according to the sequence of precedence between the creation sub-statements.
[0109] After the network resources are verified, if the network resources need to be deleted, the created network elements involved in the network resources are deleted in sequence in the reverse order of the sequence to prevent the network elements with dependencies from being unable to be deleted.
[0110] The present application develops parameter files of various types of network elements in advance, and the parameter file of one type of network element at least includes: parameter names of parameters involved in the network element of this type and default parameter values corresponding to the parameter names, so that when a certain type of network element needs to be created later, the parameter file of the network element of this type that has been stored can be called through the parameter call sub-statement of the network element of this type, so as to obtain the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network element of this type is created according to the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network resources are created.
[0111] In this way, when it is necessary to create a type of network element, for the parameter names and parameter values in the parameter file of this type of network element, the stored parameter file of this type of network element can be directly called. There is no need for technicians to write the code of "parameter names and corresponding parameter values of parameters of this type of network element" in real time. This can reduce the workload of technicians, reduce labor costs and improve efficiency.
[0112] Secondly, redundancy of statements (codes) for creating network elements can also be avoided. For example, through the solution of the present application, the creation sub-statement of 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, so that the statement (code) for creating the network element is concise, easy to understand, and not prone to errors.
[0113] In addition, the solution of the present application is applicable to the situation of developing network resources 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 method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.
[0115] Reference Figure 2 , shows a device for creating network resources of the present application, which is applied to an electronic device, and the electronic device runs a development environment, and the device includes:
[0116] The acquisition module 11 is used to acquire a creation statement input in a 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 one type of network element, the name of the one type of network element and the parameter calling sub-statement of the one type of network element;
[0118] The parameter calling substatement of one type of network element is used to call the stored parameter file of one type of network element;
[0119] The parameter file of one type of network element is previously developed;
[0120] The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names;
[0121] A creation module 12, configured to create network elements of various types respectively according to the creation sub-statements corresponding to the network elements of various types in the creation statement;
[0122] The combining module 13 is used to combine at least one type of network elements to obtain network resources.
[0123] In an optional implementation, the creation module includes:
[0124] a calling unit, configured to call, for any one type of network element among at least one type of network elements, a parameter calling substatement of the network element of the any one type in a creation substatement corresponding to the network element of the any one type, a parameter file of the network element of the any one type, thereby obtaining parameter names of parameters involved in the network element of the any one type and default parameter values corresponding to the parameter names;
[0125] The creation unit is used to create the network element of any type according to the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names.
[0126] In an optional implementation, the creation sub-statement corresponding to the network element of any one type further includes: a parameter assignment sub-statement of the network element of any one type;
[0127] The parameter assignment sub-statement includes: the parameter name of the target parameter involved in any one type of network element 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 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 a default parameter value;
[0129] The creation unit comprises:
[0130] A creation subunit is used to create any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter.
[0131] In an optional implementation, the creation statement further includes a call verification file call sub-statement;
[0132] The verification file is developed in advance;
[0133] The verification file includes: parameter configuration of 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: parameter names of mandatory parameters of one type of network element;
[0135] The creation unit also includes:
[0136] A calling subunit, used for, before creating any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter, calling the parameter configuration of any type in the verification file through the verification file calling substatement in the creation statement, so as to obtain the parameter name of the mandatory parameter of the any type of network element;
[0137] a statistical subunit, configured to count parameter names of target parameters involved in the network element of any one type in the parameter assignment substatement and a parameter name set of parameter names of non-target parameters in the parameter call substatement of the network element of any one type;
[0138] A determination subunit, configured to determine whether parameter names of mandatory parameters of any type of network element are all located in the parameter name set;
[0139] The creation subunit is also used to: when the parameter names of the required parameters of the network elements of any type are all in the parameter name set, create the network elements of any type according to the parameter names of the target parameters involved in the network elements of any type in the parameter assignment substatement, the non-default parameter values corresponding to the parameter names of the target parameters, the parameter names of the non-target parameters in the parameter file of the network elements of any type, and the default parameter values corresponding to the parameter names of the non-target parameters.
[0140] The present application develops parameter files of various types of network elements in advance, and the parameter file of one type of network element at least includes: parameter names of parameters involved in the network element of this type and default parameter values corresponding to the parameter names, so that when a certain type of network element needs to be created later, the parameter file of the network element of this type that has been stored can be called through the parameter call sub-statement of the network element of this type, so as to obtain the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network element of this type is created according to the parameter names of the parameters involved in the network element of this type and the default parameter values corresponding to the parameter names, and then the network resources are created.
[0141] In this way, when it is necessary to create a type of network element, for the parameter names and parameter values in the parameter file of this type of network element, the stored parameter file of this type of network element can be directly called. There is no need for technicians to write the code of "parameter names and corresponding parameter values of parameters of this type of network element" in real time. This can reduce the workload of technicians, reduce labor costs and improve efficiency.
[0142] Secondly, redundancy of statements (codes) for creating network elements can also be avoided. For example, through the solution of the present application, the creation sub-statement of 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, so that the statement (code) for creating the network element is concise, easy to understand, and not prone to errors.
[0143] In addition, the solution of the present application is applicable to the situation of developing network resources for various test scenarios (developing network resources involves developing various types of network elements), thereby reducing the workload of smoke testing.
[0144] Optionally, an embodiment of the present application further provides an electronic device, comprising: 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, the various processes of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0145] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0146] Figure 3800 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a 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 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] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0149] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The 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 memory, flash memory, magnetic disk or optical disk.
[0150] The power supply component 806 provides power to the various components of the electronic device 800. The 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 the electronic device 800.
[0151] The 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 touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also monitor the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0152] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the 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 button, volume button, start button, and lock button.
[0154] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can monitor the open / closed state of the device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also monitor the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to monitor the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0155] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can 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 above methods.
[0157] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0158] Figure 4 1 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 may 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 a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0160] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0161] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0162] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0163] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0164] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0165] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0166] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0167] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0168] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0169] If the functions are implemented in the form of 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 the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0170] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for creating a network resource, characterized in that: Applied to an electronic device, the electronic device running a development environment, the method comprising: Acquire a creation statement input in a 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; The creation sub-statement corresponding to one type of network element includes: the type of the one type of network element, the name of the one type of network element and the parameter calling sub-statement of the one type of network element; The parameter calling substatement of one type of network element is used to call the stored parameter file of one type of network element; The parameter file of one type of network element is previously developed; The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names; Creating network elements of various types respectively according to the creation sub-statements corresponding to the network elements of various types in the creation statement; At least one type of network elements is combined to obtain a network resource.
2. The method according to claim 1, characterized in that The creating of each type of network element respectively according to the creation sub-statements corresponding to each type of network element in the creation statement includes: For any one type of network element among the at least one type of network elements, calling a parameter file of the network element of the any one type through a parameter calling substatement of the network element of the any one type in a creation substatement corresponding to the network element of the any one type, thereby obtaining parameter names of parameters involved in the network element of the any one type and default parameter values corresponding to the parameter names; The network element of any type is created according to the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names.
3. The method according to claim 2, characterized in that The creation sub-statement corresponding to the network element of any type also includes: a parameter assignment sub-statement of the network element of any type; The parameter assignment sub-statement includes: the parameter name of the target parameter involved in any 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 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 a default parameter value; The creating the network element of any type according to the parameter name of the parameter involved in the network element of any type and the default parameter value corresponding to the parameter name includes: Create any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element and the default parameter value corresponding to the parameter name of the non-target parameter.
4. The method according to claim 3, characterized in that The creation statement also includes a call verification file call sub-statement; The verification file is developed in advance; The verification file includes: parameter configuration of each type of network element in at least one type of network element involved in the network resource; The parameter configuration of one type of network element includes at least: parameter names of mandatory parameters of one type of network element; The method further comprises: Before creating any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter, calling the parameter configuration of any type in the verification file through the verification file calling substatement in the creation statement, so as to obtain the parameter name of the mandatory parameter of the any type of network element; Counting a parameter name set of the parameter names of the target parameters involved in the network element of any one type in the parameter assignment substatement and the parameter names of the non-target parameters in the parameter call substatement of the network element of any one type; Determining whether parameter names of mandatory parameters of any type of network element are all in the parameter name set; In the case that the parameter names of the mandatory parameters of any one type of network element are all in the parameter name set, the network element of any one type is created according to the parameter names of the target parameters involved in the network element of any one type in the parameter assignment substatement, the non-default parameter values corresponding to the parameter names of the target parameters, the parameter names of the non-target parameters in the parameter file of the network element of any one type, and the default parameter values corresponding to the parameter names of the non-target parameters.
5. A device for creating a network resource, characterized in that: Applied to an electronic device, the electronic device runs a development environment, and the device comprises: An acquisition module, configured to acquire a creation statement input in a 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 a network resource to be created; The creation sub-statement corresponding to one type of network element includes: the type of the one type of network element, the name of the one type of network element and the parameter calling sub-statement of the one type of network element; The parameter calling substatement of one type of network element is used to call the stored parameter file of one type of network element; The parameter file of one type of network element is previously developed; The parameter file of one type of network element at least includes: parameter names of parameters involved in one type of network element and default parameter values corresponding to the parameter names; A creation module, used to create network elements of various types respectively according to the creation sub-statements corresponding to the network elements of various types in the creation statement; The combining module is used to combine at least one type of network elements to obtain network resources.
6. The device according to claim 5, characterized in that The creation module includes: a calling unit, configured to call, for any one type of network element among at least one type of network elements, a parameter calling substatement of the network element of the any one type in a creation substatement corresponding to the network element of the any one type, a parameter file of the network element of the any one type, thereby obtaining parameter names of parameters involved in the network element of the any one type and default parameter values corresponding to the parameter names; The creation unit is used to create the network element of any type according to the parameter names of the parameters involved in the network element of any type and the default parameter values corresponding to the parameter names.
7. The device according to claim 6, characterized in that The creation sub-statement corresponding to the network element of any type also includes: a parameter assignment sub-statement of the network element of any type; The parameter assignment sub-statement includes: the parameter name of the target parameter involved in any 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 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 a default parameter value; The creation unit comprises: A creation subunit is used to create any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter.
8. The device according to claim 7, characterized in that The creation statement also includes a call verification file call sub-statement; The verification file is developed in advance; The verification file includes: parameter configuration of each type of network element in at least one type of network element involved in the network resource; The parameter configuration of one type of network element includes at least: parameter names of mandatory parameters of one type of network element; The creation unit also includes: A calling subunit, used for, before creating any type of network element according to the parameter name of the target parameter involved in any type of network element 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 any type of network element, and the default parameter value corresponding to the parameter name of the non-target parameter, calling the parameter configuration of any type in the verification file through the verification file calling substatement in the creation statement, so as to obtain the parameter name of the mandatory parameter of the any type of network element; a statistical subunit, configured to count parameter names of target parameters involved in the network element of any type in the parameter assignment substatement and a parameter name set of parameter names of non-target parameters in the parameter call substatement of the network element of any type; A determination subunit, configured to determine whether parameter names of mandatory parameters of any type of network element are all located in the parameter name set; The creation subunit is also used to: when the parameter names of the required parameters of the network elements of any type are all in the parameter name set, create the network elements of any type according to the parameter names of the target parameters involved in the network elements of any type in the parameter assignment substatement, the non-default parameter values corresponding to the parameter names of the target parameters, the parameter names of the non-target parameters in the parameter file of the network elements of any type, and the default parameter values corresponding to the parameter names of the non-target parameters.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method for creating network resources according to any one of claims 1 to 4 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for creating a network resource according to any one of claims 1 to 4 is implemented.
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
Systems and methods for dynamically connecting network elements to enable a service
US20170257439A1
Communication method and apparatus
WO2024032603A1