Interface calling method and device of network element equipment, electronic equipment, readable storage medium and program product
By receiving interface calling parameters during API calls, determining the target protocol type and issuing instructions based on the network element device identification and API operation instruction type, the problem of low API call efficiency is solved, and the effect of simplifying the API call process and improving efficiency is achieved.
Patent Information
- Application Number
- CN202411637267.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-25
AI Technical Summary
In the prior art, users need to be familiar with various network element protocol interfaces, resulting in low API call efficiency for operating network element devices.
By receiving the interface calling parameters passed in when the API is called, including the identification of the network element device, the target protocol type is determined according to the identification and the operation instruction type of the API, and the instructions are issued to the network element device through the interface of the protocol type to realize the API call.
The user does not need to be familiar with the protocol interface of the network element device. The API can be called by simply passing in the interface call parameters, which reduces the learning cost and complexity of API calls and improves the API call efficiency.
Smart Images

Figure CN119697289A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, device, electronic device, computer-readable storage medium and computer program product for an interface calling of a network element device. Background Art
[0002] The API (Application Programming Interface) used to operate network element equipment in the telecommunications industry is mainly used for operational control capabilities such as service provisioning and network maintenance configuration of network elements.
[0003] In the related technology, due to the existence of various network element protocol interfaces, users need to be familiar with various network element protocol interfaces before they can call the API used to operate the network element equipment. This greatly increases the learning cost and complexity of the API used to operate the network element equipment, resulting in low efficiency in calling the API used to operate the network element equipment.
[0004] Therefore, there is a problem of low API calling efficiency in the related technology. Summary of the invention
[0005] Based on this, it is necessary to provide an interface calling method, device, electronic device, computer-readable storage medium and computer program product for a network element device that can improve the API calling efficiency in response to the above technical problems.
[0006] In a first aspect, the present application provides an interface calling method of a network element device, comprising:
[0007] Receiving interface call parameters passed in when an API for operating a network element device is called; the interface call parameters include a network element device identifier of the network element device;
[0008] Determine the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API;
[0009] An interface instruction is sent to the network element device through a protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to execute the operation indicated by the interface call parameter.
[0010] In one of the embodiments, determining the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API includes:
[0011] Determine, according to the network element device identifier, a candidate protocol type associated with a device manufacturer of the network element device; different candidate protocol types correspond to different operation instruction types;
[0012] Determine the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API;
[0013] The candidate protocol type that matches the operation instruction type corresponding to the API is used as the target protocol type.
[0014] In one of the embodiments, determining the candidate protocol type associated with the device manufacturer of the network element device according to the network element device identifier includes:
[0015] In the pre-built first relational database, query the device manufacturer identifier corresponding to the network element device identifier; the device manufacturer identifier indicates the device manufacturer of the network element device;
[0016] In a pre-constructed second relational database, the candidate protocol type corresponding to the device manufacturer identifier is queried to obtain the candidate protocol type associated with the device manufacturer of the network element device; the first relational database and the second relational database are different relational databases.
[0017] In one embodiment, sending an interface instruction to the network element device through a protocol interface corresponding to the target protocol type includes:
[0018] Obtain the protocol interface field corresponding to the target protocol type;
[0019] According to the protocol interface field, construct the interface instruction; the interface protocol adopted by the interface instruction matches the protocol interface;
[0020] Send the interface instruction to the network element device.
[0021] In one embodiment, the obtaining the protocol interface field corresponding to the target protocol type includes:
[0022] In the pre-built third relational database, the protocol interface field corresponding to the target protocol type is queried.
[0023] In one of the embodiments, after the step of receiving the interface call parameters passed in when the API for operating the network element device is called, the method further includes:
[0024] Collect the interface call parameters and pass them into the input parameter message generated by the API;
[0025] Parse the preset fields in the input parameter message to obtain the network element device identifier.
[0026] In one of the embodiments, after the step of sending an interface instruction to the network element device through the protocol interface corresponding to the target protocol type, the method further includes:
[0027] Receiving an output parameter message returned by the network element device; the output parameter message is a message output by the network element device in response to the interface instruction;
[0028] The output parameter message is parsed to generate an interface output parameter; the interface output parameter represents the execution result of the operation.
[0029] In a second aspect, the present application also provides an interface calling device of a network element device, including:
[0030] A receiving module, used to receive interface call parameters passed in when an API for operating a network element device is called; the interface call parameters include a network element device identifier of the network element device;
[0031] A determination module, configured to determine a target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API;
[0032] The sending module is used to send interface instructions to the network element device through the protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to execute the operation indicated by the interface call parameter.
[0033] In a third aspect, the present application further provides an electronic device, wherein the electronic device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of the above method are implemented.
[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0035] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0036] The interface calling method, apparatus, electronic device, computer-readable storage medium and computer program product of the above-mentioned network element device receive interface calling parameters passed in when the API for operating the network element device is called; the interface calling parameters include the network element device identifier of the network element device; according to the network element device identifier and the operation instruction type corresponding to the API, the target protocol type of the network element device is determined; through the protocol interface corresponding to the target protocol type, the interface instruction is sent to the network element device; the interface instruction is used to control the network element device to perform the operation indicated by the interface calling parameters.
[0037] In this way, the target protocol type that matches the network element device and the API can be determined through the network element device identifier in the interface call parameters passed in when the API for operating the network element device is called, and the API operation instruction type. Therefore, the interface instruction can be sent to the network element device through the protocol interface corresponding to the target protocol type to control the network element device to perform the operation indicated by the interface call parameters, thereby actively identifying the protocol interface that matches the API operation instruction type based on the network element device identifier in the passed in interface call parameters. The user does not need to be familiar with the protocol interface of the network element device, and can call the API by simply passing in the interface call parameters, which reduces the learning cost and complexity of API calls and effectively improves the API calling efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 An application environment diagram of an interface calling method for a network element device in an embodiment;
[0040] Figure 2 A schematic diagram of a flow chart of an interface calling method of a network element device in an embodiment;
[0041] Figure 3 A schematic diagram of a flow chart of issuing an instruction in an embodiment;
[0042] Figure 4 A logic diagram of an API call in one embodiment;
[0043] Figure 5 A schematic diagram of a flow chart of yet another method for calling an interface of a network element device in an embodiment;
[0044] Figure 6 A schematic diagram of a flow chart of an interface calling method of a network element device in another embodiment;
[0045] Figure 7 A structural block diagram of an interface calling device of a network element device in an embodiment;
[0046] Figure 8 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0049] The interface calling method of the network element device provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, when the interface caller has an API call requirement for operating a network element device, the interface caller can call the API for operating the network element device, and the electronic device 102 can receive the interface call parameters passed in when the API for operating the network element device is called; the interface call parameters include the network element device identifier of the network element device; the electronic device 102 determines the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API; the electronic device 102 sends the interface instruction to the network element device 104 through the protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device 104 to perform the operation indicated by the interface call parameter.
[0050] The electronic device 102 may be a terminal or a server. The server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The interface caller refers to a party that has an API call requirement for operating a network element device.
[0051] In an exemplary embodiment, Figure 2 As shown, a method for calling an interface of a network element device is provided, and the method is applied to Figure 1 Taking the electronic device 102 in the example as an example, the method includes the following steps S210 to S230. Among them:
[0052] Step S210: receiving interface call parameters passed in when an API for operating a network element device is called.
[0053] The interface calling parameters include the network element device identifier of the network element device.
[0054] The API for operating the network element device may refer to an API for operation control capabilities such as service provisioning and network maintenance configuration of the network element. In practical applications, the API for operating the network element device may be named RES (Resource) API.
[0055] Among them, in terms of network maintenance, the operation control RES API required to support network operation and maintenance can mainly support maintenance needs such as user information query, network parameter configuration, one-click isolation and recovery, network access acceptance, and network element inspection.
[0056] The interface call parameters may refer to parameters passed in when an API for operating a network element device is called.
[0057] The network element device identifier is used to identify the specific network element device to be operated.
[0058] In a specific implementation, when the interface caller calls an API for operating a network element device, the electronic device may receive interface call parameters passed in when the API for operating the network element device is called, and the interface call parameters include a network element device identifier of the network element device.
[0059] Step S220: Determine the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API.
[0060] Among them, the operation instruction type can refer to the type of operation instruction of the API. For example, if the operation instruction of the API is to query, modify, add, or delete user information on the network element device, then the corresponding operation instruction type is user information operation on the network element device. If the operation instruction of the API is to query or configure memory information on the network element device, then the corresponding operation instruction type is network element device query configuration. It can be seen that the operation instruction type corresponding to the API can be used to characterize the operation instruction function corresponding to the API. Different operation instruction types correspond to different operation instruction functions.
[0061] The target protocol type may be a protocol type (ProtocolType) that matches the network element device identified by the network element device identifier and the operation instruction type corresponding to the API. For example, the protocol type may include SSH (Secure Shell) of UDM (Unified Data Management) and RESTful protocol of PCF (Policy Control function).
[0062] In a specific implementation, a network element device may correspond to multiple protocol types, and the API may send different protocol types according to the corresponding operation instruction types. In this way, the electronic device may determine, according to the network element device identifier and the operation instruction type corresponding to the API, the protocol type corresponding to the network element device identified by the network element device identifier and the protocol type that the API can send, and the protocol type that matches the network element device identified by the network element device identifier and the operation instruction type corresponding to the API as the target protocol type.
[0063] Step S230: Send an interface instruction to the network element device through the protocol interface corresponding to the target protocol type.
[0064] The interface instruction is used to control the network element device to execute the operation indicated by the interface call parameter.
[0065] The operation indicated by the interface call parameter may be an operation that matches the operation instruction type of the API.
[0066] Among them, the same network element device has different protocol interfaces, and different services need to issue instructions through corresponding protocol interfaces. For example, network element device A has a restful protocol A-restful interface and an ssh protocol A-ssh interface. Instructions such as adding, deleting, modifying and checking user information on the network element are issued through the A-restful interface, and instructions such as querying the configuration of the network element device are issued through the A-ssh interface.
[0067] In a specific implementation, the electronic device can send an interface instruction to the network element device through the protocol interface corresponding to the target protocol type. The interface instruction is used to control the network element device to perform the operation indicated by the interface call parameter. The operation indicated by the interface call parameter is an operation that matches the operation instruction type of the API.
[0068] For example, if the API operation instruction type is user information operation on the network element device; the network element device identifier is A, then the operation indicated by the interface call parameters can specifically refer to the operation of querying user information on network element device A; if the API operation instruction type is network element device configuration query; the network element device identifier is B, then the operation indicated by the interface call parameters can specifically refer to the operation of querying the memory information of network element device B.
[0069] In the interface calling method of the above-mentioned network element device, the interface calling parameters passed in when the API used to operate the network element device is called are received; the interface calling parameters include the network element device identifier of the network element device; the target protocol type of the network element device is determined according to the network element device identifier and the operation instruction type corresponding to the API; the interface instruction is sent to the network element device through the protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to perform the operation indicated by the interface calling parameters.
[0070] In this way, the target protocol type that matches the network element device and the API can be determined through the network element device identifier in the interface call parameters passed in when the API for operating the network element device is called, and the API operation instruction type. Therefore, the interface instruction can be sent to the network element device through the protocol interface corresponding to the target protocol type to control the network element device to perform the operation indicated by the interface call parameters, thereby actively identifying the protocol interface that matches the API operation instruction type based on the network element device identifier in the passed in interface call parameters. The user does not need to be familiar with the protocol interface of the network element device, and can call the API by simply passing in the interface call parameters, which reduces the learning cost and complexity of API calls and effectively improves the API calling efficiency.
[0071] In one embodiment, the target protocol type of the network element device is determined based on the network element device identification and the operation instruction type corresponding to the API, including: determining the candidate protocol type associated with the equipment manufacturer of the network element device based on the network element device identification; different candidate protocol types correspond to different operation instruction types; determining the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API; and using the candidate protocol type that matches the operation instruction type corresponding to the API as the target protocol type.
[0072] The equipment manufacturer of the network element equipment is the manufacturer that produces the network element equipment.
[0073] In a specific implementation, in the process of determining the target protocol type of a network element device based on the network element device identification and the operation instruction type corresponding to the API, the electronic device can determine the candidate protocol type associated with the equipment manufacturer of the network element device based on the network element device identification, and different candidate protocol types can correspond to different operation instruction types. In this way, the electronic device can determine, from the candidate protocol types associated with the equipment manufacturer of the network element device, the candidate protocol type whose corresponding operation instruction type matches the operation instruction type corresponding to the API, and use the candidate protocol type as the target protocol type.
[0074] For example, if the candidate protocol types associated with the equipment manufacturer H of the network element device include the restful protocol and the ssh protocol, the corresponding operation instruction types are user information operation on the network element device and network element device query configuration respectively; if the operation instruction corresponding to the API is to query the user information on the network element device, then the corresponding operation instruction type of the API is user information operation on the network element device. Therefore, the candidate protocol type restful protocol associated with the equipment manufacturer H of the network element device is used as the target protocol type.
[0075] The technical solution of this embodiment is to determine the candidate protocol type associated with the equipment manufacturer of the network element device according to the network element device identification; different candidate protocol types correspond to different operation instruction types; determine the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API; and use the candidate protocol type that matches the operation instruction type corresponding to the API as the target protocol type. In this way, different candidate protocol types correspond to different operation instruction types, and the candidate protocol type that matches the operation instruction type corresponding to the API can be determined among the candidate protocol types associated with the equipment manufacturer of the network element device as the target protocol type that matches the network element device and the operation instruction type corresponding to the API, so that the API can issue interface instructions to the network element device based on the protocol interface corresponding to the target protocol type.
[0076] In one embodiment, based on the network element device identifier, the candidate protocol type associated with the equipment manufacturer of the network element device is determined, including: in a pre-constructed first relational database, querying the equipment manufacturer identifier corresponding to the network element device identifier; the equipment manufacturer identifier represents the equipment manufacturer of the network element device; in a pre-constructed second relational database, querying the candidate protocol type corresponding to the equipment manufacturer identifier, and obtaining the candidate protocol type associated with the equipment manufacturer of the network element device.
[0077] The first relational database and the second relational database are different relational databases.
[0078] The first relational database may record a mapping relationship between the network element device identifier and the device manufacturer identifier.
[0079] The second relational database may record a mapping relationship between device manufacturer identifiers and candidate protocol types.
[0080] In a specific implementation, when the electronic device determines the candidate protocol type associated with the equipment manufacturer (manufacturer) of the network element device based on the network element device identifier, the electronic device can query the equipment manufacturer identifier corresponding to the network element device identifier in a pre-constructed first relational database; the equipment manufacturer identifier represents the equipment manufacturer of the network element device; in a pre-constructed second relational database, query the candidate protocol type corresponding to the equipment manufacturer identifier to obtain the candidate protocol type associated with the equipment manufacturer of the network element device.
[0081] Furthermore, the pre-constructed second relational database also records the mapping relationship between the operation instruction type and the candidate protocol type; in this way, the electronic device can query the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API in the pre-constructed second relational database as the target protocol type.
[0082] The technical solution of this embodiment is to query the device manufacturer identifier corresponding to the network element device identifier in the pre-constructed first relational database; the device manufacturer identifier represents the device manufacturer of the network element device; query the candidate protocol type corresponding to the device manufacturer identifier in the pre-constructed second relational database, and obtain the candidate protocol type associated with the device manufacturer of the network element device; the first relational database and the second relational database are different relational databases. In this way, the device manufacturer identifier corresponding to the network element device identifier can be efficiently and accurately queried through the pre-constructed first relational database; and the candidate protocol type associated with the device manufacturer of the network element device can be efficiently and accurately queried through the pre-constructed second relational database.
[0083] In one embodiment, an interface instruction is sent to a network element device through a protocol interface corresponding to a target protocol type, including: obtaining a protocol interface field corresponding to the target protocol type; constructing an interface instruction according to the protocol interface field; and sending the interface instruction to the network element device.
[0084] Among them, the interface protocol adopted by the interface instruction matches the protocol interface.
[0085] In a specific implementation, when the electronic device sends an interface instruction to a network element device through a protocol interface corresponding to a target protocol type, the electronic device can obtain a protocol interface field corresponding to the target protocol type, and construct an interface instruction based on the protocol interface field; wherein the interface protocol used by the interface instruction matches the protocol interface; in this way, the electronic device can send an interface instruction to the network element device, thereby sending an interface instruction to the network element device through a protocol interface corresponding to the target protocol type.
[0086] In some embodiments, during the process of constructing an interface instruction, the electronic device may obtain an interface instruction template corresponding to the target protocol type, fill the protocol interface field into a specified field position, and generate an interface instruction to be sent to the network element device.
[0087] The technical solution of this embodiment is to obtain the protocol interface field corresponding to the target protocol type; construct an interface instruction according to the protocol interface field; match the interface protocol used by the interface instruction with the protocol interface; and send the interface instruction to the network element device. In this way, by obtaining the protocol interface field corresponding to the target protocol type, the interface instruction to be sent to the network element device is constructed to ensure that the interface protocol used by the interface instruction matches the protocol interface corresponding to the target protocol type of the network element device, thereby avoiding communication failures caused by protocol incompatibility and enhancing the reliability of the issuance of the interface instruction.
[0088] In one embodiment, obtaining the protocol interface field corresponding to the target protocol type includes: querying the protocol interface field corresponding to the target protocol type in a pre-built third relational database.
[0089] The pre-built third relationship library may record the mapping relationship between the candidate protocol types and the protocol interface fields.
[0090] In a specific implementation, when the electronic device is in the process of acquiring the protocol interface field corresponding to the target protocol type, the electronic device may query the protocol interface field corresponding to the target protocol type in a pre-constructed third relational database.
[0091] The technical solution of this embodiment is to query the protocol interface field corresponding to the target protocol type in the pre-constructed third relational database. In this way, the protocol interface field corresponding to the target protocol type of the network element device can be efficiently and accurately queried through the pre-constructed relational database, so that the user does not need to be familiar with various protocol interfaces, but only needs to pass in the interface call parameters containing the network element device identification, and the protocol interface matching the operation instruction type corresponding to the network element device and the API can be quickly determined through the pre-constructed relational database, so as to realize active identification of the protocol interface based on the network element device and improve the calling efficiency of the API.
[0092] In some embodiments, the encoded information of the API includes network element type information, data object information, and operation action information.
[0093] The network element type information may be information used to characterize the network element type.
[0094] Among them, the network element type (NETYPE) may include but is not limited to AMF (Access and Mobility Management Function), SMF (Session Management function), UDM, PCF and other network element types.
[0095] The data object information may be information used to characterize the data object.
[0096] The data object (DATAOBJECT) may include but is not limited to user information, CPU memory information, board information, memory information, etc.
[0097] The operation action information may be information used to characterize the operation action.
[0098] The operation action (ACTION) may include but is not limited to installation, disassembly, modification, and inspection.
[0099] The type of operation instruction corresponding to the API can be determined through the encoding information of the API.
[0100] In this way, by combining and encoding different data object information, operation action information and network element type information, APIs corresponding to different operation instruction types can be obtained.
[0101] In some embodiments, the API includes the following input parameter deviceCode.
[0102] The deviceCode is the unique identification code of the network element device, that is, the network element device identifier of the network element device.
[0103] In some embodiments, the first relational database can be named deviceCode relational database (network element device identification relational database), and the second relational database can be named API relational database; the third relational database can be the same relational database as the first relational database (ie, deviceCode relational database), that is, the mapping relationship between the network element device identification and the device manufacturer identification, and the mapping relationship between the candidate protocol type and the protocol interface field can be recorded in the same data table.
[0104] Among them, the construction of the deviceCode relational database is as follows:
[0105] Construct a mapping relationship between the network element device identifier (deviceCode), the device manufacturer identifier (vendor), the protocol interface (ProtocolInterface) and the protocol type (ProtocolType) of the network element device; determine all protocol types and protocol interfaces of the network element device.
[0106] Among them, the construction of the API relationship database is as follows:
[0107] Build the relationship between API, device vendor identifier (vendor), and protocol type (ProtocolType); determine all protocol types that can be issued by the API.
[0108] like Figure 3 As shown in the flowchart of command issuance for building a relational database mode, RES API builds and adds deviceCode, ProtocolInterface, ProtocolType, and API relational database modules, establishes the calling logic of "API" --- "database table" --- "actual command", and locates the network element device for which the API issues interface commands through vendor, ProtocolType, deviceCode, and ProtocolInterface.
[0109] In one embodiment, after the step of receiving interface call parameters passed in when an API for operating a network element device is called, the method also includes: collecting the input parameter message generated by the interface call parameters being passed into the API; parsing the preset fields in the input parameter message to obtain the network element device identifier.
[0110] In a specific implementation, after the electronic device receives the interface call parameters passed in when the API for operating the network element device is called, the electronic device can collect the input parameter message generated when the interface call parameters are passed into the API; and obtain the network element device identifier by parsing the preset fields in the input parameter message.
[0111] For example, the preset field name may be deviceCode, and the corresponding field value is obtained by parsing the deviceCode field in the input message. The field value corresponding to the deviceCode field is the network element device identifier of the network element device.
[0112] The technical solution of this embodiment, after the step of receiving the interface call parameters passed in when the API for operating the network element device is called, collects the input parameter message generated by the interface call parameters passed in the API; parses the preset fields in the input parameter message to obtain the network element device identifier. In this way, by parsing the preset fields in the input parameter message generated by the interface call parameters passed in the API, the network element device identifier in the passed interface call parameters can be accurately obtained.
[0113] In another embodiment, after the step of sending an interface instruction to a network element device through a protocol interface corresponding to the target protocol type, the method further includes: receiving an output parameter message returned by the network element device; the output parameter message is a message output by the network element device in response to the interface instruction; parsing the output parameter message to generate interface output parameters; the interface output parameters represent the execution result of the operation.
[0114] In a specific implementation, after the electronic device has sent an interface instruction to the network element device through the protocol interface corresponding to the target protocol type, the network element device outputs a message in response to the interface instruction, and the message is an output parameter message. In this way, the electronic device can receive the output parameter message returned by the network element device through the API, parse the output parameter message, and generate interface output parameters; the interface output parameters are used to indicate the execution result of the operation indicated by the interface call parameters executed by the network element device.
[0115] For example, if the operation indicated by the interface call parameter is to query the memory information on the specified UDM, the interface output parameter may include the total memory quota of the specified UDM, the amount of memory used by the specified UDM, and the percentage of memory used by the specified UDM.
[0116] The technical solution of this embodiment is to receive the parameter output message returned by the network element device; the parameter output message is the message output by the network element device in response to the interface instruction; the parameter output message is parsed to generate the interface output parameter; the interface output parameter represents the execution result of the operation. In this way, by parsing the parameter output message output by the network element device in response to the interface instruction, the execution result of the operation indicated by the interface call parameter executed by the network element device can be obtained more accurately, which effectively improves the accuracy of obtaining the execution result.
[0117] In order to facilitate understanding by those skilled in the art, Figure 4 Provides a logical diagram of API calls. Figure 5 A flowchart of another method for calling an interface of a network element device is provided. Figure 4 and Figure 5 As shown, the API calling logic is as follows:
[0118] 1. Call the API and fill in the corresponding input parameter deviceCode, etc.;
[0119] 2. Match the API vendor information according to the vendor information of deviceCode;
[0120] 3. The API relational database matches the ProtocolType according to the vendor, and matches the corresponding relationship of the deviceCode relational database through the ProtocolType:
[0121] (1) If the deviceCode does not exist in the deviceCode relational database, the API throws an error: "deviceCode error";
[0122] (2) If the ProtocolType field of deviceCode ≠ the ProtocolType field of API, API throws an error: "API is not compatible with {deviceCode} issued by this network element device";
[0123] (3) If the ProtocolType field of deviceCode = the ProtocolType field of API, extract the ProtocolInterfac field corresponding to the ProtocolType in the deviceCode relational database, route it to the network element interface (protocol interface) through protocolInterface, and issue the interface instruction. The network element device returns the output parameter message, and the API parses the output parameter message and returns the interface output parameter.
[0124] Taking querying UDM user information and memory information as an example, the construction and calling methods are analyzed:
[0125] API code: RES_UDM_User Information_Query_API, RES_UDM_Memory Information_Query_API;
[0126] deviceCode includes: GD-H-UDM1, GD-Z-UDM2;
[0127] vendor includes: H, Z;
[0128] ProtocolType includes:
[0129] H-UDM-ssh, H-UDM-restful, H-UDM-telnet, Z-UDM-ssh, Z-UDM-restful, Z-UDM-telnet;
[0130] ProtocolInterface:GD-H-UDM1-ssh, GD-H-UDM1-restful, GD-H-UDM1-telnet, GD-Z-UDM2-ssh, GD-Z-UDM2-restful, GD-Z-UDM2-telnet;
[0131] Relational database construction:
[0132] Table 1 DeviceCode relational database construction:
[0133]
[0134] Table 2 API relation database construction:
[0135]
[0136] The following example uses the query of memory information on the UDM to explain:
[0137] By parsing the preset fields of the input message generated by the interface call parameters passed into the API, the network element device identifier is obtained: {"deviceCode": "GD-H-UDM1"}.
[0138] The deviceCode relational database and the API relational database build an association relationship positioning protocol interface:
[0139] deviceCode : GD-H-UDM1;
[0140] API: RES_UDM_Memory_Information_Query_API;
[0141] vendor: H;
[0142] ProtocolType : H-UDM-ssh;
[0143] ProtocolInterface: GD-H-UDM1-ssh;
[0144] In this way, the interface command can be sent to the network element device identified by GD-H-UDM1 through the GD-H-UDM1-ssh protocol interface; the output parameter message returned by the network element device is received, the output parameter message is parsed, and the interface output parameter is generated; the interface output parameter represents the execution result of the operation. For example, the interface output parameter includes: total memory quota: 100; amount of memory used: 10; percentage of memory used: 10%.
[0145] Take the query of a number's user information on UDM as an example:
[0146] By parsing the preset fields of the input message generated by the API passed into the interface call parameters, the network element device identifier and number are obtained. Among them, the network element device identifier is: GD-H-UDM1;
[0147] The deviceCode relational database and the API relational database build an association relationship positioning protocol interface:
[0148] deviceCode : GD-H-UDM1;
[0149] API: RES_UDM_UserInformation_Query_API;
[0150] vendor: H;
[0151] ProtocolType: H-UDM-restful;
[0152] ProtocolInterface: GD-H-UDM1-restful;
[0153] In this way, the interface command can be sent to the network element device identified by GD-H-UDM1 through the GD-H-UDM1-restful protocol interface; the output parameter message returned by the network element device is received, the output parameter message is parsed, and the interface output parameter is generated; the interface output parameter represents the execution result of the operation. For example, the interface output parameter includes the tracking area identifier, the globally unique temporary identifier, the international mobile equipment identity code, the international mobile subscriber identity code, the integrated services digital network number, etc.
[0154] In another embodiment, Figure 6 As shown, a method for calling an interface of a network element device is provided, and the method is applied to an electronic device as an example for explanation, and includes the following steps:
[0155] Step S602: receiving interface call parameters passed in when an API for operating a network element device is called.
[0156] Step S604, the collection interface call parameters are passed into the input parameter message generated by the API.
[0157] Step S606, parse the preset fields in the input message to obtain the network element device identifier.
[0158] Step S608: In the pre-built first relational database, query the device manufacturer identifier corresponding to the network element device identifier.
[0159] Step S610: In the pre-built second relational database, query the candidate protocol type corresponding to the device manufacturer identifier to obtain the candidate protocol type associated with the device manufacturer of the network element device.
[0160] Step S612: Determine a candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API.
[0161] Step S614: taking the candidate protocol type that matches the operation instruction type corresponding to the API as the target protocol type.
[0162] Step S616: In the pre-built third relational database, query the protocol interface field corresponding to the target protocol type.
[0163] Step S618: construct an interface instruction according to the protocol interface field, and send the interface instruction to the network element device.
[0164] Step S620: receiving the output parameter message returned by the network element device, parsing the output parameter message, and generating interface output parameters.
[0165] It should be noted that the specific limitations of the above steps can refer to the specific limitations of the interface calling method of a network element device mentioned above.
[0166] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0167] Based on the same inventive concept, the embodiment of the present application also provides an interface calling device for a network element device for implementing the interface calling method for the network element device involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiment of the interface calling device for one or more network element devices provided below can refer to the limitations of the interface calling method for the network element device above, and will not be repeated here.
[0168] In an exemplary embodiment, Figure 7 As shown, a device for calling an interface of a network element device is provided, including: a receiving module 710, a determining module 720 and a sending module 730, wherein:
[0169] The receiving module 710 is used to receive interface call parameters passed in when an API for operating a network element device is called; the interface call parameters include a network element device identifier of the network element device.
[0170] The determination module 720 is used to determine the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API.
[0171] The sending module 730 is used to send interface instructions to the network element device through the protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to perform the operation indicated by the interface call parameter.
[0172] In one of the embodiments, the determination module 720 is specifically used to determine the candidate protocol type associated with the equipment manufacturer of the network element device based on the network element device identifier; different candidate protocol types correspond to different operation instruction types; determine the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API; and use the candidate protocol type that matches the operation instruction type corresponding to the API as the target protocol type.
[0173] In one of the embodiments, the determination module 720 is specifically used to query the device manufacturer identifier corresponding to the network element device identifier in a pre-constructed first relational database; the device manufacturer identifier represents the device manufacturer of the network element device; in a pre-constructed second relational database, query the candidate protocol type corresponding to the device manufacturer identifier to obtain the candidate protocol type associated with the device manufacturer of the network element device; the first relational database and the second relational database are different relational databases.
[0174] In one embodiment, the sending module 730 is specifically used to obtain the protocol interface field corresponding to the target protocol type; construct the interface instruction according to the protocol interface field; the interface protocol adopted by the interface instruction matches the protocol interface; and send the interface instruction to the network element device.
[0175] In one of the embodiments, the sending module 730 is specifically used to query the protocol interface field corresponding to the target protocol type in a pre-built third relational database.
[0176] In one of the embodiments, the device further includes: a parsing module, configured to collect the input parameter message generated by the interface call parameters being passed into the API; and parse the preset fields in the input parameter message to obtain the network element device identifier.
[0177] In one of the embodiments, the parsing module is also used to receive an output parameter message returned by the network element device; the output parameter message is a message output by the network element device in response to the interface instruction; the output parameter message is parsed to generate interface output parameters; the interface output parameters represent the execution result of the operation.
[0178] Each module in the interface calling device of the above network element device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0179] In an exemplary embodiment, an electronic device is provided. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The electronic device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the electronic device is used to exchange information between the processor and the external device. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a method for calling an interface of a network element device is implemented. The display unit of the electronic device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the electronic device casing, or an external keyboard, touchpad or mouse.
[0180] Those skilled in the art will understand that Figure 8 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0181] In one embodiment, an electronic device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0182] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0183] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0184] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0185] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0186] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0187] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for calling an interface of a network element device, characterized in that: The method comprises: Receiving interface call parameters passed in when an API for operating a network element device is called; the interface call parameters include a network element device identifier of the network element device; Determine the target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API; An interface instruction is sent to the network element device through a protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to execute the operation indicated by the interface call parameter.
2. The method according to claim 1, characterized in that The determining, according to the network element device identifier and the operation instruction type corresponding to the API, a target protocol type of the network element device, includes: Determine, according to the network element device identifier, a candidate protocol type associated with a device manufacturer of the network element device; different candidate protocol types correspond to different operation instruction types; Determine the candidate protocol type whose operation instruction type matches the operation instruction type corresponding to the API; The candidate protocol type that matches the operation instruction type corresponding to the API is used as the target protocol type.
3. The method according to claim 2, characterized in that The determining, according to the network element device identifier, a candidate protocol type associated with a device manufacturer of the network element device includes: In the pre-built first relational database, query the device manufacturer identifier corresponding to the network element device identifier; the device manufacturer identifier indicates the device manufacturer of the network element device; In a pre-constructed second relational database, the candidate protocol type corresponding to the device manufacturer identifier is queried to obtain the candidate protocol type associated with the device manufacturer of the network element device; the first relational database and the second relational database are different relational databases.
4. The method according to claim 1, characterized in that: The sending of an interface instruction to the network element device through a protocol interface corresponding to the target protocol type includes: Obtain the protocol interface field corresponding to the target protocol type; According to the protocol interface field, construct the interface instruction; the interface protocol adopted by the interface instruction matches the protocol interface; Send the interface instruction to the network element device.
5. The method according to claim 4, characterized in that The obtaining of the protocol interface field corresponding to the target protocol type includes: In the pre-built third relational database, the protocol interface field corresponding to the target protocol type is queried.
6. The method according to claim 1, characterized in that After the step of receiving the interface call parameters passed in when the API for operating the network element device is called, the method further includes: Collect the interface call parameters and pass them into the input parameter message generated by the API; Parse the preset fields in the input parameter message to obtain the network element device identifier.
7. The method according to claim 1, characterized in that After the step of sending an interface instruction to the network element device through the protocol interface corresponding to the target protocol type, the method further includes: Receiving an output parameter message returned by the network element device; the output parameter message is a message output by the network element device in response to the interface instruction; The output parameter message is parsed to generate an interface output parameter; the interface output parameter represents the execution result of the operation.
8. An interface calling device for a network element device, characterized in that: The device comprises: A receiving module, used to receive interface call parameters passed in when an API for operating a network element device is called; the interface call parameters include a network element device identifier of the network element device; A determination module, configured to determine a target protocol type of the network element device according to the network element device identifier and the operation instruction type corresponding to the API; The sending module is used to send interface instructions to the network element device through the protocol interface corresponding to the target protocol type; the interface instruction is used to control the network element device to execute the operation indicated by the interface call parameter.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
A transmission equipment management method and system
CN109861853A
Data processing method, related equipment and computer storage medium
CN111723036A
General control method and system based on single-device network element
CN112953752A
Business processing method, device and system and storage medium
CN113518348A
Message sending method, device and equipment and computer readable storage medium
CN116056109A