已开启
【反合】【docs】合入630英文文档 #53
pengqq_31创建于 22 天前
【反合】【docs】合入630英文文档 #53
已开启
pengqq_31创建于 22 天前
165 个文件变更+21913-276
@@ -0,0 +1,262 @@
1+# OM SDK
2+ 
3+<!-- md-trans-meta sourceCommit=c8a811e639f648de541370af2e0c9651b018ac51 translatedAt=2026-07-17T02:58:30.396Z pushedAt=2026-07-31T00:31:05.963Z -->
4+ 
5+- [What's New](#whats-new)
6+ 
7+- [Overview](#overview)
8+ 
9+- [Directory Structure](#directory-structure)
10+ 
11+- [Release Notes](#release-notes)
12+ 
13+- [Compatibility Information](#compatibility-information)
14+ 
15+- [Environment Deployment](#environment-deployment)
16+ 
17+- [Build Process](#build-process)
18+ 
19+- [Quick Start](#quick-start)
20+ 
21+- [Feature Introduction](#feature-introduction)
22+ 
23+- [API Reference](#api-reference)
24+ 
25+- [Security Statement](#security-statement)
26+ 
27+- [Branch Maintenance Policy](#branch-maintenance-policy)
28+ 
29+- [Version Maintenance Policy](#version-maintenance-policy)
30+ 
31+- [Disclaimer](#disclaimer)
32+ 
33+- [License](#license)
34+ 
35+- [Contribution Statement](#contribution-statement)
36+ 
37+- [Suggestions and Feedback](#suggestions-and-feedback)
38+ 
39+## What's New
40+ 
41+- [2025.12.30]: 🚀 OM SDK open-source release
42+ 
43+## Overview
44+ 
45+As a development-phase component, the OM SDK enables third-party partners and helps you rapidly build intelligent edge device management platforms based on the Ascend AI processor, customize your device O&M systems, and simplify device O&M deployment.
46+ 
47+<div align="center">
48+ 
49+[![Zread](https://img.shields.io/badge/Zread-Ask_AI-_.svg?style=flat&color=0052D9&labelColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuOTYxNTYgMS42MDAxSDIuMjQxNTZDMS44ODgxIDEuNjAwMSAxLjYwMTU2IDEuODg2NjQgMS42MDE1NiAyLjI0MDFWNC45NjAxQzEuNjAxNTYgNS4zMTM1NiAxLjg4ODEgNS42MDAxIDIuMjQxNTYgNS42MDAxSDQuOTYxNTZDNS4zMTUwMiA1LjYwMDEgNS42MDE1NiA1LjMxMzU2IDUuNjAxNTYgNC45NjAxVjIuMjQwMUM1LjYwMTU2IDEuODg2NjQgNS4zMTUwMiAxLjYwMDEgNC45NjE1NiAxLjYwMDFaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00Ljk2MTU2IDEwLjM5OTlIMi4yNDE1NkMxLjg4ODEgMTAuMzk5OSAxLjYwMTU2IDEwLjY4NjQgMS42MDE1NiAxMS4wMzk5VjEzLjc1OTlDMS42MDE1NiAxNC4xMTM0IDEuODg4MSAxNC4zOTk5IDIuMjQxNTYgMTQuMzk5OUg0Ljk2MTU2QzUuMzE1MDIgMTQuMzk5OSA1LjYwMTU2IDE0LjExMzQgNS42MDE1NiAxMy43NTk5VjExLjAzOTlDNS42MDE1NiAxMC42ODY0IDUuMzE1MDIgMTAuMzk5OSA0Ljk2MTU2IDEwLjM5OTlaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik0xMy43NTg0IDEuNjAwMUgxMS4wMzg0QzEwLjY4NSAxLjYwMDEgMTAuMzk4NCAxLjg4NjY0IDEwLjM5ODQgMi4yNDAxVjQuOTYwMUMxMC4zOTg0IDUuMzEzNTYgMTAuNjg1IDUuNjAwMSAxMS4wMzg0IDUuNjAwMUgxMy43NTg0QzE0LjExMTkgNS42MDAxIDE0LjM5ODQgNS4zMTM1NiAxNC4zOTg0IDQuOTYwMVYyLjI0MDFDMTQuMzk4NCAxLjg4NjY0IDE0LjExMTkgMS42MDAxIDEzLjc1ODQgMS42MDAxWiIgZmlsbD0iI2ZmZiIvPgo8cGF0aCBkPSJNNCAxMkwxMiA0TDQgMTJaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00IDEyTDEyIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K&logoColor=ffffff)](https://zread.ai/Ascend/OMSDK)&nbsp;&nbsp;&nbsp;&nbsp;
50+[![DeepWiki](https://img.shields.io/badge/DeepWiki-Ask_AI-_.svg?style=flat&color=0052D9&labelColor=000000&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/Ascend/OMSDK)
51+ 
52+</div>
53+ 
54+## Directory Structure
55+ 
56+The key directories are listed below. For detailed directory descriptions, see [Project Directory](docs/en/dir_structure.md).
57+ 
58+ om-sdk # Project root directory
59+ ├── build # Build-related directory
60+ ├── docs # Documentation directory
61+ │ └── en # English documentation directory
62+ └── src # Source code directory
63+ ├── om # OM SDK component code
64+ └── om-web # OM Web frontend component code
65+ 
66+## Release Notes
67+ 
68+For details about OM SDK version compatibility, see [Release Information](docs/en/release_notes_OMSDK.md#release-information).
69+ 
70+## Compatibility Information
71+ 
72+Table 3 shows the products supported by OM SDK and the operating systems supported by these products.
73+ 
74+<table>
75+ <tr>
76+ <th>Product Name</th>
77+ <th>Operating System</th>
78+ </tr>
79+ <tr>
80+ <td>Atlas 200I A2 Accelerator Module (RC mode)</td>
81+ <td rowspan="2">OpenEuler 22.03<br>Ubuntu 22.04</td>
82+ </tr>
83+ <tr>
84+ <td>Atlas 200I DK A2 Developer Kit</td>
85+ </tr>
86+</table>
87+ 
88+## Environment Deployment
89+ 
90+Before installation and use, you must understand the pre-installation and environment setup requirements. For details, see [Installation and Deployment](docs/en/user_guide/installation_guide.md#installation-and-deployment).
91+ 
92+- [Obtaining the Software Package](./docs/en/user_guide/installation_guide.md#obtaining-the-software-package)
93+ 
94+- [Installation Environment Setup](./docs/en/user_guide/installation_guide.md#installation-environment-setup)
95+ 
96+- [Installation Through the Command Line](./docs/en/user_guide/installation_guide.md#installation-through-the-command-line)
97+ 
98+## Build Process
99+ 
100+### Dependency Preparation
101+ 
102+The OM SDK build process supports only ARM64 CPUs.
103+ 
104+This section uses Ubuntu 22.04 as an example to describe how to build the OM software package from the source code.
105+ 
106+Before building the OM SDK, verify that you have installed the necessary build tools and dependency libraries on your environment. The recommended installation commands are as follows:
107+ 
108+```shell
109+apt-get update && apt-get upgrade -y
110+apt-get install -y python3 python3-pip build-essential zip unzip dos2unix git cmake autoconf automake libtool curl
111+ 
112+# The default Node.js version in Ubuntu 22.04 is too old. Manually download and install Node.js.
113+# Download Node.js from a local mirror.
114+NODE_MIRROR_URL=https://huaweicloud.com
115+# The minimum required Node.js version for building the OM SDK is 16.0.
116+NODE_VERSION=v16.20.2
117+NODE_INSTALL_DIR=/usr/local/lib/nodejs
118+mkdir -p \$NODE_INSTALL_DIR
119+curl -sSL \(NODE_MIRROR_URL/\)NODE_VERSION/node-\(NODE_VERSION-linux-arm64.tar.gz \vert{} tar -zxvf - -C\)NODE_INSTALL_DIR
120+find \$NODE_INSTALL_DIR/node-\(NODE_VERSION-linux-arm64/bin -mindepth 1 -exec sh -c 'ln -s {} /usr/bin/\)(basename {})' \;
121+```
122+ 
123+### Build
124+ 
125+1. Pull the complete OM SDK source code, for example, to the `/home` directory.
126+ 
127+2. Run the following command to go to the `/home/OMSDK/build` directory:
128+ 
129+ ```shell
130+ cd /home/OMSDK/build
131+ ```
132+ 
133+3. Change the `om-sdk-version` field in the component version configuration file `service_config.ini` to your desired build version. The default value is as follows:
134+ 
135+ ```text
136+ om-sdk-version=7.3.0
137+ ```
138+ 
139+4. (Optional) Set your npm mirror address using the `NPM_REGISTRY_MIRROR` environment variable. You can change it to another npm mirror address as needed. The default value is as follows:
140+ 
141+ ```shell
142+ export NPM_REGISTRY_MIRROR=https://repo.huaweicloud.com/repository/npm
143+ ```
144+ 
145+5. Run the following commands to execute the build script:
146+ 
147+ ```shell
148+ dos2unix *.sh && chmod +x *.sh
149+ ./build_all.sh
150+ ```
151+ 
152+6. After the execution is complete, you can find the built software package in the `/home/OMSDK/output` directory.
153+ 
154+## Quick Start
155+ 
156+After installing the OM SDK, you can log in to the edge management system (EDS) for basic operations, system management, and data configuration. For details, see [Quick Start](docs/en/user_guide/usage.md#quick-start).
157+ 
158+- User Login
159+ 
160+- Basic Operations
161+ 
162+- Home
163+ 
164+- Management
165+ 
166+- Settings
167+ 
168+## Feature Introduction
169+ 
170+The EMS provides capabilities for initial edge device configuration, hardware monitoring, software installation, and system O&M. It also supports integration with SmartKit and Huawei FusionDirector management software for centralized O&M. For details, see [WebUI Features](docs/en/user_guide/usage.md#webui-features).
171+ 
172+**Table 4** EMS features
173+ 
174+| Feature Type | Description |
175+|:---|:---|
176+| Hardware Management | <ul><li>Queries hardware information</li><li>Detects hardware faults</li></ul> |
177+| Software Management | <ul><li>Upgrades the OS, drivers, and firmware</li><li>Queries software information</li><li>Supports quick deployment and software-free commissioning</li><li>Installs and upgrades the OM SDK</li></ul> |
178+| Time Management | <ul><li>Configures the system time zone and system time</li><li>Synchronizes the system time with an NTP server</li></ul> |
179+| Network Management | <ul><li>Configures multiple types of network devices, including Ethernet, Wi-Fi, and LTE</li><li>Manually configures the IP address, port, VLAN, gateway, and DNS settings of system network interfaces</li><li>Obtains the system IP address from a DHCP server</li></ul> |
180+| Storage Management | <ul><li>Queries and configures local storage</li><li>Queries system partitions, storage capacity, and partition health status</li><li>Configures and queries NFS storage systems, including NFS mounts, storage capacity, and connection health status</li></ul> |
181+| User Management | <ul><li>Configures and queries password validity periods, login rules, and weak password dictionaries, and supports password changes</li><li>Supports customizable security policies and customer trusted root certificate import</li><li>Imports WebUI certificates, queries certificate information, and checks certificate validity periods</li></ul> |
182+| System Monitoring | <ul><li>Supports alarm reporting, alarm masking, historical alarm queries, and current alarm display</li><li>Supports integrated display and management of alarms for user-added devices and key processes</li><li>Supports security logs, operation logs, runtime logs, and black box records, as well as log collection, log queries, and remote syslog</li></ul> |
183+| Northbound Interfaces | <ul><li>Supports the FusionDirector centralized management protocol and RESTful APIs that comply with the server northbound interface standard</li></ul> |
184+ 
185+## API Reference
186+ 
187+For details about the APIs, see [RESTful APIs](docs/en/secondary_development/api/RESTful_api.md) and [Cloud-Edge Collaboration APIs](docs/en/secondary_development/api/collaboration_api.md).
188+ 
189+## Security Statement
190+ 
191+- For details about system security hardening, see [Security Configuration and Hardening](docs/en/user_guide/security_hardening.md#security-configuration-and-hardening).
192+ 
193+- The security hardening recommendations provide only basic hardening measures. You must review and implement appropriate network security hardening measures for the entire system based on your business requirements.
194+ 
195+- Software code or programs downloaded from external sources may introduce security risks. You must ensure their security.
196+ 
197+- For details about public network addresses, see [Public Network Addresses](docs/en/user_guide/appendix.md#public-network-addresses).
198+ 
199+- For details about user account information, see [User Information List](docs/en/user_guide/appendix.md#user-information-list).
200+ 
201+## Branch Maintenance Policy
202+ 
203+The following table describes the maintenance phases of version branches.
204+ 
205+| Status | Duration | Description |
206+|---|---|---|
207+| Planning | 1–3 months | Plans features |
208+| Development | 3 months | Develops new features, fixes issues, and releases new versions periodically |
209+| Maintenance | 3–12 months | Maintains regular branches for 3 months, and Long-Term Support (LTS) branches for 12 months. Only critical bugs are fixed. No new features are merged. Patch releases are issued based on the impact of bugs. |
210+| End of Life (EOL) | N/A | The branch no longer accepts any modifications |
211+ 
212+## Version Maintenance Policy
213+ 
214+| Version | Maintenance Policy | Current Status | Release Date | Next Status | EOL Date |
215+|---|---|---|---|---|---|
216+| master | Long-Term Support | Development | Development branch, not released | - | - |
217+ 
218+## Disclaimer
219+ 
220+- This repository contains multiple development branches that may include unfinished, experimental, or untested features. Before an official release, you must not use these branches in production environments or projects that support business-critical services. Use only officially released versions to ensure software stability and security.
221+ 
222+ This project and its contributors assume no responsibility for any issues, losses, or data corruption resulting from your use of development branches.
223+ 
224+- For official releases, see the official release repository page at <https://gitcode.com/Ascend/OMSDK/releases>.
225+ 
226+## License
227+ 
228+The OM SDK is licensed under the Mulan PSL v2. For the license text, see [LICENSE](LICENSE.md). The documentation in the OM SDK repository is licensed under CC BY 4.0. For details, see [LICENSE](./docs/LICENSE.md).
229+ 
230+## Contribution Statement
231+ 
232+1. **Submitting bug reports.** If you discover a bug in the OM SDK that is **not** a security issue, first search the issues list in the OM SDK repository to avoid duplicate submissions. If no existing issue matches your bug, create a new issue. If you discover a security issue, **do not disclose it publicly**. Instead, follow the security issue handling procedure. Include complete information when submitting a bug report.
233+ 
234+2. **Handling security issues.** To report a security issue, notify the project maintainers by email as described in the security issue handling procedure.
235+ 
236+3. **Resolving existing issues.** Browse the repository Issues list to find issues that require attention and contribute by resolving one of them.
237+ 
238+4. **Proposing new features.** Use the **Feature** label when creating an issue. Feature requests are reviewed and evaluated on a regular basis.
239+ 
240+5. **Contribution process**:
241+ 
242+ - Fork this repository.
243+ 
244+ - Clone the repository to your local environment.
245+ 
246+ - Create your development branch.
247+ 
248+ - Run local tests before submitting your changes, and ensure that all unit tests pass, including any new unit tests added for the issue you are addressing.
249+ 
250+ - Commit and submit your code.
251+ 
252+ - Create a pull request (PR).
253+ 
254+ - Participate in the code review process. Update your code according to the review comments and resubmit it as needed. Multiple review iterations may be required.
255+ 
256+ - After your PR receives sufficient reviewer approvals, a committer performs the final review.
257+ 
258+ - After the review and testing are complete, the CI system merges your PR into the project's main branch.
259+ 
260+## Suggestions and Feedback
261+ 
262+We welcome your contributions to the community. If you have any questions or suggestions, you can submit [issues](https://gitcode.com/Ascend/OMSDK/issues), and we will respond as soon as possible. Thank you for your support.
@@ -0,0 +1,25 @@
1+# Welcome to OM SDK
2+ 
3+<div style="text-align: center; margin: 0.5rem 0 0.3rem 0; font-family: 'Avenir Next', 'Avenir', 'Century Gothic', 'Segoe UI', sans-serif;">
4+ <span style="font-size: 4.5rem; font-weight: 300; letter-spacing: 0.02em;">OM SDK</span>
5+</div>
6+ 
7+The OM SDK is a development component for edge device management in the Ascend AI ecosystem. It enables third-party Independent Software Vendors (ISVs) and helps you rapidly build hardware management platforms based on Ascend computing chips, simplify hardware device O&M deployment, and quickly develop custom device O&M systems. This documentation repository provides related guidance documentation for the OM SDK.
8+ 
9+| Folder | Document | Document Name | Description | Link |
10+|---|---|---|---|---|
11+| secondary_development | Product Introduction | introduction.md | Provides an overall introduction to the OM SDK, including its product overview and development process. | [Link](./secondary_development/introduction.md) |
12+| - | Developer Guide | developer_guide.md | Describes how to perform secondary development with the OM SDK. | [Link](./secondary_development/developer_guide.md) |
13+| - | API Reference | api (folder) | Provides RESTful APIs and cloud-edge collaboration APIs. | [Link](./secondary_development/api/) |
14+| - | Appendix | appendix.md | Provides examples of product specification configuration files and module specification configuration files, as well as the OM SDK-reserved alarm configurations. | [Link](./secondary_development/appendix.md) |
15+| - | Directory Structure | _menu_secondary_development.md | Provides the directory structure of the *Secondary Development* documentation. | [Link](./secondary_development/_menu_secondary_development.md) |
16+| user_guide | Product Introduction | introduction.md | Provides an overall introduction to the OM SDK and its supported product forms. | [Link](./user_guide/introduction.md) |
17+| - | Installation Guide | installation_guide.md | Describes how to install and maintain the OM SDK product. | [Link](./user_guide/installation_guide.md) |
18+| - | Usage Guide | usage.md | Describes how to use the OM SDK product. | [Link](./user_guide/usage.md) |
19+| - | Security Configuration and Hardening | security_hardening.md | Describes basic security configuration and hardening. | [Link](./user_guide/security_hardening.md) |
20+| - | Common Operations | common_operations.md | Describes common operations for the OM SDK, such as clearing drive space. | [Link](./user_guide/common_operations.md) |
21+| - | Appendix | appendix.md | Provides command references, public network addresses, user information lists, and acronyms. | [Link](./user_guide/appendix.md) |
22+| - | Directory Structure | _menu_user_guide.md | Provides the directory structure of the *User Guide* documentation. | [Link](./user_guide/_menu_user_guide.md) |
23+| figures | - | - | Provides references to images used in the documentation. | [Link](./figures/) |
24+| - | Project Directory | dir_structure.md | Provides the directory structure of the OM SDK repository. | [Link](./dir_structure.md) |
25+| - | Release Notes | release_notes_OMSDK.md | Provides a brief description of the updates in this release. | [Link](./release_notes_OMSDK.md) |
@@ -0,0 +1,39 @@
1+# Complete Directory Hierarchy
2+ 
3+The complete directory hierarchy of the project is described as follows:
4+ 
5+```text
6+om-sdk # Project root directory
7+├── build # Build directory
8+├── docs # Documentation directory
9+│ └── zh # Chinese documentation directory
10+└── src # Source code directory
11+ ├── om # OM SDK component code
12+ │ ├── build # Build subdirectory
13+ │ ├── config # Configuration directory
14+ │ ├── doc # Documentation directory
15+ │ ├── output # Output directory
16+ │ ├── platform # Platform module
17+ │ │ ├── cpp # C++ platform code
18+ │ │ └── MindXOM_SDK # MindXOM SDK subrepository
19+ │ ├── src # Source code directory
20+ │ │ └── app # Application directory
21+ │ └── test # Test directory
22+ │ └── python # Python test directory
23+ └── om-web # OM Web frontend component code
24+ ├── build # Build subdirectory
25+ ├── public # Public resources
26+ │ ├── config # Configuration files
27+ │ └── WhiteboxConfig # Whitebox configuration
28+ ├── src # Source code directory
29+ │ ├── api # APIs
30+ │ ├── assets # Static resources
31+ │ ├── components # Component directory
32+ │ ├── router # Routing configuration
33+ │ ├── utils # Utility functions
34+ │ └── views # View components
35+ └── test # Test directory
36+ ├── DT # DT tests
37+ ├── reports # Test reports
38+ └── src # Test source code
39+```
@@ -0,0 +1,80 @@
1+# Release Information<a name="ZH-CN_TOPIC_0000002492283802"></a>
2+ 
3+## Product Version Information<a name="ZH-CN_TOPIC_0000002524443499"></a>
4+ 
5+<a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108__Ref249955742"></a>
6+ 
7+<table><tbody><tr id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_row244mcpsimp"><th class="firstcol" valign="top" width="25%" id="mcps1.1.3.1.1"><p id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p246mcpsimp"><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p246mcpsimp"></a><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p246mcpsimp"></a>Product Name</p></th>
8+<td class="cellrowborder" valign="top" width="75%" headers="mcps1.1.3.1.1 "><p id="p1255152201212"><a name="p1255152201212"></a><a name="p1255152201212"></a><span id="ph17255172211125"><a name="ph17255172211125"></a><a name="ph17255172211125"></a>OM SDK</span></p></td>
9+</tr>
10+<tr id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_row255mcpsimp"><th class="firstcol" valign="top" width="25%" id="mcps1.1.3.2.1"><p id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p257mcpsimp"><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p257mcpsimp"></a><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p257mcpsimp"></a>Product Version</p></th>
11+<td class="cellrowborder" valign="top" width="75%" headers="mcps1.1.3.2.1 "><p id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p233mcpsimp"><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p233mcpsimp"></a><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p233mcpsimp"></a>26.0.0</p></td>
12+</tr>
13+<tr id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_row7259721105019"><th class="firstcol" valign="top" width="25%" id="mcps1.1.3.3.1"><p id="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p7260182135013"><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p7260182135013"></a><a name="zh-cn_topic_0000001938532254_zh-cn_topic_0000001935094108_p7260182135013"></a>Version Type</p></th>
14+<td class="cellrowborder" valign="top" width="75%" headers="mcps1.1.3.3.1 "><p id="zh-cn_topic_0000001935094108_p72606219501"><a name="zh-cn_topic_0000001935094108_p72606219501"></a><a name="zh-cn_topic_0000001935094108_p72606219501"></a>Release Version</p></td>
15+</tr>
16+</tbody>
17+</table>
18+ 
19+## Related Product Versions<a name="ZH-CN_TOPIC_0000002524443497"></a>
20+ 
21+|Product Name|Version|
22+|--|--|
23+|Ascend HDK|26.0.RC1|
24+|CANN|9.0.0|
25+ 
26+## Virus Scan Results<a name="ZH-CN_TOPIC_0000002524443501"></a>
27+ 
28+The virus scan passed.
29+ 
30+# Version Compatibility Notes<a name="ZH-CN_TOPIC_0000002524563471"></a>
31+ 
32+The initial open-source release does not involve version upgrades and is incompatible with the OM SDK version available on the Ascend community.
33+> [!NOTE]
34+> Software version compatibility means that when you upgrade the product software version, other related software that you use does not need to be upgraded or patched together and can continue to support the existing functions.
35+ 
36+# Version Usage Precautions<a name="ZH-CN_TOPIC_0000002492283798"></a>
37+ 
38+None
39+ 
40+# Updates<a name="ZH-CN_TOPIC_0000002524563475"></a>
41+ 
42+## New Features<a name="ZH-CN_TOPIC_0000002524563473"></a>
43+ 
44+1. Hardware management, software installation, system O&M, and user management capabilities for edge devices
45+ 
46+2. Northbound [RESTful APIs](./secondary_development/api/RESTful_api.md) and [Cloud-Edge Collaboration APIs](./secondary_development/api/collaboration_api.md).
47+ 
48+## Service API Changes<a name="ZH-CN_TOPIC_0000002492443768"></a>
49+ 
50+None
51+ 
52+## Key Feature Changes<a name="ZH-CN_TOPIC_0000002492443770"></a>
53+ 
54+None
55+ 
56+## Resolved Issues<a name="ZH-CN_TOPIC_0000002492283800"></a>
57+ 
58+None
59+ 
60+## Known Issues<a name="ZH-CN_TOPIC_0000002492283794"></a>
61+ 
62+None
63+ 
64+# Upgrade Impact<a name="ZH-CN_TOPIC_0000002524563469"></a>
65+ 
66+## Impact of the Upgrade Process on the Current System<a name="ZH-CN_TOPIC_0000002492283796"></a>
67+ 
68+None
69+ 
70+## Impact on the Current System After Upgrade<a name="ZH-CN_TOPIC_0000002492443766"></a>
71+ 
72+None
73+ 
74+# Version Documentation<a name="ZH-CN_TOPIC_0000002524443495"></a>
75+ 
76+None
77+ 
78+# Vulnerability Fixes<a name="ZH-CN_TOPIC_0000002492443764"></a>
79+ 
80+None
@@ -0,0 +1,15 @@
1+# OM SDK Secondary Development
2+ 
3+<!-- md-trans-meta sourceCommit=c8a811e639f648de541370af2e0c9651b018ac51 translatedAt=2026-07-17T02:57:44.057Z pushedAt=2026-08-05T08:26:13.921Z -->
4+ 
5+- [Product Introduction](./introduction.md)
6+ 
7+- [Developer Guide](./developer_guide.md)
8+ 
9+- [API Reference](./api/README.md)
10+ 
11+ - [RESTful APIs](./api/RESTful_api.md)
12+ 
13+ - [Cloud-Edge Collaboration APIs](./api/collaboration_api.md)
14+ 
15+- [Appendix](./appendix.md)
@@ -0,0 +1,5 @@
1+# API Reference
2+ 
3+- [RESTful APIs](./RESTful_api.md)
4+ 
5+- [Cloud-Edge Collaboration APIs](./collaboration_api.md)
@@ -0,0 +1,78 @@
1+# Product Introduction<a name="ZH-CN_TOPIC_0000001628490457"></a>
2+ 
3+## Overview<a name="ZH-CN_TOPIC_0000001618087672"></a>
4+ 
5+With the rise of edge computing, edge devices are evolving toward greater intelligence and platform-based architectures. As a development-phase component, the OM SDK enables third-party ISVs (Independent Software Vendors) and allows you to quickly build hardware management platforms based on Ascend computing chips. It simplifies hardware device O&M deployment and facilitates rapid development of customized device O&M systems.
6+ 
7+The OM SDK provides an edge management system development kit with basic functions, allowing you to perform secondary development based on the edge management system. The OM SDK provides in-depth guidance for Ascend module development, helping you quickly add extension support for and enable new hardware peripherals. For Huawei developers, it primarily supports native multi-product adaptation and extension. For third-party developers, it primarily supports access and extension development for private hardware devices.
8+ 
9+**Disclaimer<a name="section12468182293712"></a>**
10+ 
11+- The edge management system development kit and sample projects, hereinafter referred to as "this Product", are provided as reference designs only and do not constitute any warranty or commitment regarding the functionality, performance, security, compliance, or other aspects of any software products or services developed by third-party developers.
12+ 
13+- Third-party developers are solely responsible for the design, development, testing, release, operation, and maintenance of any software developed based on this Product, and shall bear full liability for any direct or indirect damages arising from the use of this Product. We do not commit to providing subsequent services or support for this Product, such as version upgrades, feature extensions, or vulnerability fixes. Third-party developers are fully aware of the foregoing risks, voluntarily use this Product, and fully agree to assume all possible risks and legal consequences.
14+ 
15+## Features<a name="ZH-CN_TOPIC_0000001628610461"></a>
16+ 
17+As a development-phase component, the OM SDK supports the following features:
18+ 
19+- Abstract management of device objects through configuration files
20+ 
21+- Management of Ascend products and rapid development of new hardware devices
22+ 
23+- Access to device driver objects using local northbound APIs
24+ 
25+- Management of Huawei-provided components in independent deployment and third-party integration scenarios
26+ 
27+- System maintenance capabilities such as alarm reporting and log management
28+ 
29+## Software Architecture<a name="ZH-CN_TOPIC_0000001578489772"></a>
30+ 
31+As an enabling component in the development phase, the development system primarily consists of the OM SDK, drivers, and user-customized components.
32+ 
33+- The OM SDK consists of three major parts: `omsdk_interface`, `omsdk_core`, and `DEVM` (DeviceManager). It provides RESTful APIs and cloud-edge collaboration APIs externally. RESTful APIs support Web and SmartKit access, while cloud-edge collaboration APIs support integration with FusionDirector. Internally, it enables drivers for built-in hardware and user-extension hardware through `DEVM` definitions.
34+ 
35+- Drivers include those bundled with the OM SDK and those used for extension. Bundled drivers include basic drivers such as NPU and system drivers. Extension drivers are primarily used to extend support for newly added external devices.
36+ 
37+- User-customized components mainly include the OS, product name, and other product-specific configurations. The OS supports openEuler 22.03 and Ubuntu 22.04. You can replace the OS through card flashing. The development phase provides product configuration capabilities.
38+ 
39+**Figure 1** Software architecture<a name="fig10567113832914"></a>
40+![](../figures/software_architecture_diagram.png "Software architecture")
41+ 
42+The details are as follows:
43+ 
44+- **omsdk_interface**: OM SDK API layer
45+ 
46+- **omsdk_core**: OM SDK implementation layer
47+ 
48+- **DEVM**: adaptation layer, which is the DeviceManager module that allows you to define and develop modules
49+ 
50+- **NPU**: neural processing unit, which primarily refers to Ascend AI processors
51+ 
52+- **System**: system resources
53+ 
54+- **Tool installation**: Prepare for the development environment, including tools required during the development process.
55+ 
56+- **Project configuration**: Perform basic development on the obtained open-source software package, including configuring the project and product names.
57+ 
58+- **extern_drv**: extension resources, primarily used for extension modules
59+ 
60+- **OS**: operating system
61+ 
62+# Development Flow Introduction<a name="ZH-CN_TOPIC_0000001577530672"></a>
63+ 
64+When developing the OM SDK software, follow the operation steps shown in [Figure 1 Development flow](#fig435041319391).
65+ 
66+**Figure 1** Development flow<a id="fig435041319391"></a>
67+![](../figures/development_flowchart.png "Development flow")
68+ 
69+**Development Flow Introduction<a name="section155951936142210"></a>**
70+ 
71+**Table 1** Development flow introduction
72+ 
73+| Step | Description | Operation reference |
74+|---|---|---|
75+| Obtaining the software package | Obtain the software package required for development from the official Huawei website | See [Obtaining the Software Package](./developer_guide.md#obtaining-the-software-package) |
76+| Setting up the development environment | Ensure that development tools or dependencies required in your development environment are available and work properly | See [Setting up the Development Environment](./developer_guide.md#setting-up-the-development-environment) |
77+| OM SDK development | Configure custom vendor information, custom alarms, module development, and API development | See [OM SDK Development](./developer_guide.md#om-sdk-development) |
78+| Building a software package | Package and build your developed source code into a new software package | See [Building a Software Package](./developer_guide.md#building-a-software-package) |
@@ -0,0 +1,13 @@
1+# OM SDK Usage
2+ 
3+- [Product Introduction](./introduction.md)
4+ 
5+- [Installation Guide](./installation_guide.md)
6+ 
7+- [Usage Guide](./usage.md)
8+ 
9+- [Security Configuration and Hardening](./security_hardening.md)
10+ 
11+- [Common Operations](./common_operations.md)
12+ 
13+- [Appendix](./appendix.md)
@@ -0,0 +1,385 @@
1+# Appendix<a name="ZH-CN_TOPIC_0000001578489824"></a>
2+ 
3+## Command Reference<a name="ZH-CN_TOPIC_0000001628610453"></a>
4+ 
5+### Command Description<a name="ZH-CN_TOPIC_0000001791845429"></a>
6+ 
7+This section provides maintenance commands for the OM SDK. For details, see [Table 1 Command description](#command-description-table).
8+ 
9+**Table 1** Command description<a id="command-description-table"></a>
10+ 
11+| Command Name | Command Function | Operation Reference |
12+|---|---|---|
13+| manual_kmc_update.sh | Updates the <code>KMC</code> master key and root key (reserved interface). | For details, see [manual_kmc_update](#manual_kmc_update). |
14+| update_alg.sh | Configures the encryption algorithm used for inter-process communication between OM SDK service processes (reserved interface). | For details, see [update_alg](#update_alg). |
15+| om_ability_policy.sh | Sets capability item switches. | For details, see [om_ability_policy.sh](#om_ability_policysh). |
16+| mount_white_path | Imports user-defined mount paths into the mount path allowlist. | For details, see [mount_white_path](#mount_white_path). |
17+| certs_manage.sh | Manages related certificates, including WebUI certificates and FusionDirector certificates. | For details, see [certs_manage.sh](#certs_managesh). |
18+| install.sh | Guides you through installing the OM SDK software. | For details, see [install.sh](#installsh). |
19+| uninstall.sh | Guides you through uninstalling the OM SDK software. | For details, see [uninstall.sh](#uninstallsh). |
20+ 
21+### manual_kmc_update<a id="manual_kmc_update"></a>
22+ 
23+**Command Function<a name="zh-cn_topic_0000001578761946_zh-cn_topic_0000001396921402_section392012387229"></a>**
24+ 
25+Manually updates the `KMC` master key and root key.
26+ 
27+**Command Format<a name="zh-cn_topic_0000001578761946_zh-cn_topic_0000001396921402_section1946125634619"></a>**
28+ 
29+**manual_kmc_update.sh**
30+ 
31+**Usage Guide<a name="zh-cn_topic_0000001578761946_zh-cn_topic_0000001396921402_section2959155684618"></a>**
32+ 
33+To update the master key and root key used for KMC component encryption, you can use this command to perform the update.
34+ 
35+**Usage Example<a name="zh-cn_topic_0000001578761946_zh-cn_topic_0000001396921402_section1421313419471"></a>**
36+ 
37+Go to the `/usr/local/mindx/MindXOM/tools/` directory and run the following command to update the `KMC` root key and master key.
38+ 
39+```bash
40+./manual_kmc_update.sh
41+```
42+ 
43+> [!NOTE]
44+>
45+> - The minimum interval between key updates is 60 seconds.
46+> - If the output contains the warning text `su: warning: cannot change directory to /home/MindXOM: No such file or directory`, this is a normal phenomenon and does not affect command execution.
47+> - The functions of `manual_kmc_update.sh` have been reduced. This command is provided as a reserved interface, and you must implement the underlying functions on your own.
48+ 
49+### update_alg<a id="update_alg"></a>
50+ 
51+**Command Function**<a name="zh-cn_topic_0000001578921370_zh-cn_topic_0000001549174733_section392012387229"></a>
52+ 
53+Configures the encryption algorithms used for inter-process communication between EMS service processes.
54+ 
55+**Command Format**<a name="zh-cn_topic_0000001578921370_zh-cn_topic_0000001549174733_section1946125634619"></a>
56+ 
57+**update_alg.sh -s [sdp_alg_id] -h [hmac_alg_id]**
58+ 
59+**Usage Guide<a name="zh-cn_topic_0000001578921370_zh-cn_topic_0000001549174733_section2959155684618"></a>**
60+ 
61+The encryption algorithm configuration contains two items: the data encryption algorithm and the integrity protection algorithm. If you do not specify the corresponding configurations, the default configurations are used. You can use this command to modify the default configurations based on actual requirements.
62+ 
63+**Usage Example<a name="zh-cn_topic_0000001578921370_zh-cn_topic_0000001549174733_section1421313419471"></a>**
64+ 
65+1. Run the following command to go to the directory where the script is located.
66+ 
67+ ```bash
68+ cd /usr/local/mindx/MindXOM/tools
69+ ```
70+ 
71+2. Run the following command to modify the encryption algorithm parameters.
72+ 
73+ ```bash
74+ ./update_alg.sh -s 9 -h 2054
75+ ```
76+ 
77+ > [!NOTE]
78+ > Before running the script, ensure that the specified target file exists and is readable and writable.
79+ > This command changes the value of the `sdp_alg_id` parameter in the specified configuration file to `9` and the value of the `hmac_alg_id` parameter to `2054`.
80+ 
81+ **Table 1** Command-line options
82+ 
83+ | Option | Description |
84+ |---|---|
85+ | -s | Specifies the data encryption algorithm. The value must be <code>8</code> or <code>9</code>, corresponding to <code>AES_GCM_128</code> and <code>AES_GCM_256</code>, respectively. |
86+ | -h | Specifies the integrity protection algorithm. The value must be <code>2053</code> or <code>2054</code>, corresponding to <code>SHA384</code> and <code>SHA512</code>, respectively. |
87+ 
88+> [!NOTE]
89+> The functions of `update_alg.sh` have been reduced. This command is provided as a reserved interface, and you must implement the underlying functions on your own.
90+ 
91+### om_ability_policy.sh<a id="om_ability_policysh"></a>
92+ 
93+**Command Function<a name="zh-cn_topic_0000001495038116_zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section54612047124317"></a>**
94+ 
95+Sets capability item switches.
96+ 
97+When you perform operations through the WebUI, you can only use enabled capability items. If a required capability item is not enabled, add it using this command and restart the system to make the service configuration take effect.
98+ 
99+**Capability Item List<a name="zh-cn_topic_0000001495038116_zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section6547202513147"></a>**
100+ 
101+Container application management capability item. This capability item is enabled by default. To perform other configurations, refer to this section.
102+ 
103+**Command Format<a name="zh-cn_topic_0000001495038116_zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section89802574437"></a>**
104+ 
105+1. Run the following command to go to the directory where the script is located: `cd /usr/local/mindx/MindXOM/tools`.
106+ 
107+2. Run the following commands as needed:
108+ 
109+ - `./om_ability_policy.sh disable_all --on` disables the master switch for capability items, thereby disabling all capability items.
110+ 
111+ - `./om_ability_policy.sh allow op` enables a capability item. For details about the subcommand parameter, see [Table 1 Parameter for the allow subcommand](#parameter-for-the-allow-subcommand).
112+ 
113+ - `./om_ability_policy.sh -h` (or `--h`, `-help`, `--help`) displays the help information for the main command.
114+ 
115+ - `./om_ability_policy.sh disable_all -h` (or `--help`) displays the help information for the `disable_all` subcommand.
116+ 
117+ - `./om_ability_policy.sh allow -h` (or `--help`) displays the help information for the `allow` subcommand.
118+ 
119+ **Table 1** Parameter for the allow subcommand<a id="parameter-for-the-allow-subcommand"></a>
120+ 
121+ | Parameter | Description |
122+ |---|---|
123+ | --mef_config | Enables the container application management integration capability item. |
124+ 
125+**Usage Guide<a name="zh-cn_topic_0000001495038116_zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section6323125112440"></a>**
126+ 
127+None
128+ 
129+**Usage Example<a name="zh-cn_topic_0000001495038116_zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section52840564514"></a>**
130+ 
131+Run the following command to go to the directory where the script is located: `cd /usr/local/mindx/MindXOM/tools`.
132+ 
133+- Example 1: Disable all capability items.
134+ 
135+ ```text
136+ $ Euler1:/usr/local/mindx/MindXOM/tools # ./om_ability_policy.sh disable_all --on
137+ ```
138+ 
139+ Output example:
140+ 
141+ ```text
142+ Write to config file success
143+ {
144+ "disable_all": true,
145+ "allow": {
146+ "mef_config": false
147+ }
148+ }
149+ ```
150+ 
151+ Run the `reboot` command to make the configuration take effect.
152+ 
153+- Example 2: Enable the container application management integration capability item.
154+ 
155+ ```text
156+ Euler1:/usr/local/mindx/MindXOM/tools # ./om_ability_policy.sh allow --mef_config
157+ ```
158+ 
159+ Output example:
160+ 
161+ ```text
162+ Write to config file success
163+ {
164+ "disable_all": false,
165+ "allow": {
166+ "mef_config": true
167+ }
168+ }
169+ ```
170+ 
171+ Run the `reboot` command to make the configuration take effect.
172+ 
173+### mount_white_path<a id="mount_white_path"></a>
174+ 
175+**Command Function<a name="zh-cn_topic_0000001507647805_section494485624615"></a>**
176+ 
177+Imports user-defined mount paths into the mount path allowlist.
178+ 
179+When mounting drives through the WebUI, you can mount directories only to paths that already exist in the allowlist. If the required path is not in the allowlist, add it by using this command.
180+ 
181+**Command Format<a name="zh-cn_topic_0000001507647805_section1946125634619"></a>**
182+ 
183+1. Run the following command to go to the directory where the script is located: `cd /usr/local/mindx/MindXOM/tools`.
184+ 
185+2. Run the following commands as needed:
186+ 
187+ - `./mount_white_path add Absolute_Path` adds a path to the allowlist. Up to 64 absolute paths can be added in a single operation. If any path fails to be added when multiple paths are specified, the remaining paths are not added.
188+ 
189+ - `./mount_white_path delete Absolute_Path` deletes a path from the allowlist. Only one path can be deleted in a single operation. A mounted path cannot be deleted from the allowlist.
190+ 
191+ - `./mount_white_path display` displays all paths currently in the allowlist.
192+ 
193+ - `./mount_white_path check Absolute_Path` verifies whether a path is in the allowlist. Only one path can be checked in a single operation.
194+ 
195+ - `./mount_white_path -h` (`--h`, `-help`, or `--help`) displays the help information.
196+ 
197+> [!NOTE]
198+>
199+> - Paths in the allowlist can be used directly for drive mounting.
200+> - The default allowlist paths are `/opt/mount/` and `/var/lib/docker`.
201+> - No two paths in the allowlist can have a parent-child directory relationship.
202+> - The allowlist supports a maximum of 64 absolute paths.
203+> - Allowlist paths must be subdirectories of `/home` or `/opt`, or be `/var/lib/docker`. They cannot be `/home/data/cert_backup`, `/home/data/`, `/home/log/`, `/home/admin/`, `/home/AppUser/`, `/home/MindXOM/`, `/home/MEFEdge/`, `/home/package/`, `/home/HwHiAiUser/`, or any subdirectories of these paths.
204+ 
205+**Parameter Description<a name="zh-cn_topic_0000001507647805_section39511656144617"></a>**
206+ 
207+| Parameter | Description | Value |
208+|---|---|---|
209+| Absolute_Path | Absolute path to be added to the allowlist. | An absolute path with up to 255 characters |
210+ 
211+**Usage Guide<a name="zh-cn_topic_0000001507647805_section2959155684618"></a>**
212+ 
213+None
214+ 
215+**Usage Example<a name="zh-cn_topic_0000001507647805_section3959115612466"></a>**
216+ 
217+Run the following command to go to the directory where the script is located: `cd /usr/local/mindx/MindXOM/tools`.
218+ 
219+- Example 1: Add an allowlist path.
220+ 
221+ ```text
222+ Euler:/usr/local/mindx/MindXOM/tools # ./mount_white_path add /home/test/
223+ ```
224+ 
225+ Output example:
226+ 
227+ ```text
228+ /home/test/ added successfully
229+ ```
230+ 
231+- Example 2: Delete an allowlist path.
232+ 
233+ ```text
234+ Euler:/usr/local/mindx/MindXOM/tools # ./mount_white_path delete /home/test/
235+ ```
236+ 
237+ Output example:
238+ 
239+ ```text
240+ /home/test/ deleted successfully
241+ ```
242+ 
243+- Example 3: View all paths in the current allowlist.
244+ 
245+ ```text
246+ Euler:/usr/local/mindx/MindXOM/tools # ./mount_white_path display
247+ ```
248+ 
249+ Output example:
250+ 
251+ ```text
252+ /opt/mount/
253+ ```
254+ 
255+- Example 4: Check whether a path is in the allowlist.
256+ 
257+ ```text
258+ Euler:/usr/local/mindx/MindXOM/tools # ./mount_white_path check /home/test/
259+ ```
260+ 
261+ Output example:
262+ 
263+ ```text
264+ /home/test/ does not exist in the list
265+ ```
266+ 
267+### certs_manage.sh<a id="certs_manage.sh"></a>
268+ 
269+**Command Function<a name="zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section54612047124317"></a>**
270+ 
271+Manages certificates, including WebUI certificates and FusionDirector certificates. You can use this command to query and delete unused certificates, or restore the previous certificate.
272+ 
273+**Command Format<a name="zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section89802574437"></a>**
274+ 
275+**certs_manage.sh** _[ACTION] [COMPONENT] [OPTION]_
276+ 
277+**Table 1** Subcommand parameters
278+ 
279+| Parameter | Mandatory (Yes/No) | Description |
280+|---|---|---|
281+| ACTION | Yes | Specifies the certificate operation. Valid values:<br><li>`getunusedcert`: queries unused certificates.</li><li>`deletecert`: deletes unused certificates.</li><li>`restorecert`: restores the previous certificate.</li><br><div class="note"><span class="notetitle">[!NOTE]</span><div class="notebody"><ul><li>When deleting a FusionDirector certificate, you must specify the certificate name. If the previous certificate and a currently unused certificate have the same name, the currently unused certificate is deleted first.</li><li>When deleting a certificate, you must enter <code>yes</code> or <code>no</code> to confirm the deletion.</li><li>Restoring a WebUI certificate forcibly replaces the current certificate with the previous certificate. For a FusionDirector certificate, the restoration fails if the certificate is currently in use or already exists in the current certificate list.</li></ul></div></div> |
282+| COMPONENT | Yes | Specifies the certificate type. Valid values:<br><li>`fd-ccae`: FusionDirector certificate or CCAE certificate</li><li>`web`: WebUI certificate</li> |
283+| [OPTION] | No | When deleting a FusionDirector certificate, specifies the certificate name. The value is a string of 4 to 64 characters. It can contain digits, uppercase and lowercase letters, underscores (`_`), and periods (`.`), but must not contain `..`. |
284+ 
285+**Usage Guide<a name="zh-cn_topic_0000001389273124_zh-cn_topic_0000001263081386_section6323125112440"></a>**
286+ 
287+You must run the `certs_manage.sh` command as the `root` user.
288+ 
289+**Usage Example<a name="section0170143175412"></a>**
290+ 
291+1. Run the following command to go to the directory where the script is located: `cd /usr/local/mindx/MindXOM/tools`.
292+ 
293+ ```bash
294+ cd /usr/local/mindx/MindXOM/tools
295+ ```
296+ 
297+2. Manage certificates as required. The following examples use FusionDirector certificates.
298+ 
299+ - Query unused certificates.
300+ 
301+ ```bash
302+ ./certs_manage.sh getunusedcert web
303+ ```
304+ 
305+ - Delete unused certificates.
306+ 
307+ ```bash
308+ ./certs_manage.sh deletecert fd-ccae a200_fd.crt
309+ ```
310+ 
311+ - Restore the previous certificate.
312+ 
313+ ```bash
314+ ./certs_manage.sh restorecert fd-ccae
315+ ```
316+ 
317+### install.sh<a id="installsh"></a>
318+ 
319+**Command Function<a name="zh-cn_topic_0000001527210329_zh-cn_topic_0000001472609157_section392012387229"></a>**
320+ 
321+Guides you through installing the OM SDK software.
322+ 
323+Some OM SDK processes run under a non-root account named `MindXOM`, with both the default group ID and user ID set to `1224`. If the group ID or user ID is already in use, the IDs are incremented sequentially. The OM SDK creates the required runtime account during the installation process.
324+ 
325+**Command Format<a name="zh-cn_topic_0000001527210329_zh-cn_topic_0000001472609157_section1946125634619"></a>**
326+ 
327+**install.sh**
328+ 
329+**Parameter Description<a name="zh-cn_topic_0000001527210329_zh-cn_topic_0000001472609157_section39511656144617"></a>**
330+ 
331+This command requires no additional parameters.
332+ 
333+**Usage Guide<a name="zh-cn_topic_0000001527210329_zh-cn_topic_0000001472609157_section120252875011"></a>**
334+ 
335+Running this command installs the OM SDK software in the `/usr/local/mindx` directory. This directory must have `root` group permissions.
336+ 
337+**Usage Example<a name="section13412589527a"></a>**
338+ 
339+None. For details, see [Installation Through the Command Line](./installation_guide.md#installation-through-the-command-line).
340+ 
341+### uninstall.sh<a id="uninstallsh"></a>
342+ 
343+**Command Function<a name="zh-cn_topic_0000001476250784_zh-cn_topic_0000001472288941_section392012387229"></a>**
344+ 
345+Guides you through uninstalling the OM SDK software.
346+ 
347+**Command Format<a name="zh-cn_topic_0000001476250784_zh-cn_topic_0000001472288941_section1946125634619"></a>**
348+ 
349+**uninstall\.sh**
350+ 
351+**Parameter Description<a name="zh-cn_topic_0000001476250784_zh-cn_topic_0000001472288941_section39511656144617"></a>**
352+ 
353+This command requires no additional parameters.
354+ 
355+**Usage Example<a name="section9690143315315"></a>**
356+ 
357+None. For details, see [Uninstallation](./installation_guide.md#uninstallation).
358+ 
359+## Public Network Addresses<a name="ZH-CN_TOPIC_0000001586797856"></a>
360+ 
361+Public network addresses contained in the open-source code.
362+ 
363+## User Information List<a name="ZH-CN_TOPIC_0000001628849881"></a>
364+ 
365+**Table 1** User information list
366+ 
367+| Username | Description | Initial Password | Password Change Method |
368+|---|---|---|---|
369+| root | User for logging in to the Atlas 200I A2 accelerator module | For the default password, see chapter **Atlas 200I A2 Accelerator Module** in [Atlas Hardware Product Account List](https://support.huawei.com/enterprise/en/doc/EDOC1100235194/cba8feb2/atlas-200-ai-accelerator-module?idPath=23710424). | Run the `passwd <username>` command as the `root` user to change the password. |
370+| admin | User for logging in to the EMS WebUI or CLI | `Edge@12#$` | This default password is only used for the first login. After successful login, the system forces you to change the default password. After changing the password successfully, use the new password to log in. You can change the password using either of the following methods.<br><li>Log in as the `admin` user and run the `passwd` command to change the password.</li><li>Log in to the EMS WebUI, click **Change Password** in the upper-right corner of the page, and set a new user password.</li><br><div class="note"><span class="notetitle">[!NOTE]</span><div class="notebody">The `admin` users for the CLI and WebUI are independent. Changing the password of one user does not affect the other user.</div></div> |
371+| nobody | Anonymous account. No special permissions are required when the nobody account is assigned to software processes | No initial password | - |
372+| MindXOM | User for EMS service and management processes | No initial password | - |
373+ 
374+## Acronyms and Abbreviations<a name="ZH-CN_TOPIC_0000001578449880"></a>
375+ 
376+**Table 1** Acronyms and abbreviations
377+ 
378+| Acronym/Abbreviation | Full Name | Meaning |
379+|---|---|---|
380+| ISV | Independent Software Vendor | Independent software vendor |
381+| DEVM | DeviceManager | Device management module that supports custom modules during secondary development |
382+| NPU | Neural-network Processing Unit | Neural-network processor, primarily referring to Ascend AI processors |
383+| PAM | Pluggable Authentication Modules | A system security tool that allows system administrators to configure authentication policies |
384+| TLV | Type-Length-Value | A simple and practical data transmission scheme |
385+| KMC | key management CBB | Key management component that implements basic functions such as encrypted storage, encryption, and decryption of keys |
@@ -0,0 +1,9 @@
1+# Common Operations<a name="ZH-CN_TOPIC_0000001578449896"></a>
2+ 
3+## Clearing Drive Space<a id="ZH-CN_TOPIC_0000001584799760"></a>
4+ 
5+If you encounter an insufficient drive space issue during the upgrade process, refer to this section to clear drive space.
6+ 
7+**Procedure<a name="section18953192317292"></a>**
8+ 
9+Log in to the backend environment as the `root` user and clear user-related directories and files in the following directories: `/run/upgrade`, `/run/web/`, and `/home/data`.
@@ -0,0 +1,209 @@
1+# Installation and Deployment<a name="ZH-CN_TOPIC_0000001577530696"></a>
2+ 
3+## Obtaining the Software Package<a name="ZH-CN_TOPIC_0000001633390689"></a>
4+ 
5+**Table 1** Software package download
6+ 
7+|Package Name|Description|Download Link|
8+|--|--|--|
9+|Ascend-mindxedge-omsdk_{version}_linux-aarch64.zip|Software package of the Edge Management System (EMS).|[Link](https://gitcode.com/Ascend/OMSDK/releases)|
10+ 
11+## Installation Environment Setup<a name="ZH-CN_TOPIC_0000001632751317"></a>
12+ 
13+The OM SDK provides an installation script. Run the `install.sh` command to install the software package.
14+ 
15+**Prerequisites<a name="section3824145117349"></a>**
16+ 
17+- The installation software package has been obtained.
18+ 
19+- You have logged in to the edge device where the software package is to be installed.
20+ 
21+- The drive has sufficient available space, which must be at least twice the size of the installation package.
22+ 
23+- The edge device is running properly.
24+ 
25+**Dependencies<a name="section143281824192813"></a>**
26+ 
27+Before installing the software, prepare for the installation by referring to <a href="#dependencies">Table 1 Dependencies</a>.
28+ 
29+**Table 1** Dependencies<a id="dependencies"></a>
30+ 
31+| Dependency | Description | Installation Command or Steps |
32+|---|---|---|
33+| <code>net-tools</code> | Tool for configuring management network functions | Run the following commands to install <code>net-tools</code>.<br><li><code>openEuler</code><br><code>dnf install net-tools -y</code></li><li><code>Ubuntu</code><br><code>apt-get install net-tools -y</code></li> |
34+| <code>ntp</code> | Protocol-based server that synchronizes time between distributed time servers and clients to align computer clocks across the network with `UTC` | Run the following commands to install <code>ntp</code>.<br><li><code>openEuler</code><br><code>dnf install ntp -y</code></li><li><code>Ubuntu</code><br><code>apt-get install ntp -y</code></li> |
35+| <code>smartmontools</code> | Open-source drive control and monitoring toolset | Run the following commands to install <code>smartmontools</code>.<br><li><code>openEuler</code><br><code>dnf install smartmontools -y</code></li><li><code>Ubuntu</code><br><code>apt-get install smartmontools -y</code></li> |
36+| <code>nfs</code> | Network file system that allows computers on a network to share resources | Run the following commands to install <code>nfs</code>.<br><li><code>openEuler</code><br><code>dnf install nfs-utils -y</code></li><li><code>Ubuntu</code><br><code>apt-get install nfs-common -y</code></li> |
37+| <code>ethtool</code> | Command used to query and configure NIC parameters | Run the following commands to install <code>ethtool</code>.<br><li><code>openEuler</code><br><code>dnf install ethtool -y</code></li><li><code>Ubuntu</code><br><code>apt-get install ethtool -y</code></li> |
38+| <code>parted</code> | Tool for partitioning hard drives or resizing partitions | Run the following commands to install <code>parted</code>.<br><li><code>openEuler</code><br><code>dnf install parted -y</code></li><li><code>Ubuntu</code><br><code>apt-get install parted -y</code></li> |
39+| <code>arping</code> | Tool used to send ARP request packets | Run the following commands to install <code>arping</code>.<br><li><code>openEuler</code><br><code>dnf install arping -y</code></li><li><code>Ubuntu</code><br><code>apt-get install arping -y</code></li><br><div class="note"><span class="notetitle">[!NOTE]</span><div class="notebody">You must ensure that the installed arping version is 2.19 or later</div></div> |
40+| <code>inotify-tools</code> | Toolset for monitoring file system events to automatically execute specified commands or scripts when files or directories change | Run the following commands to install <code>inotify-tools</code>.<br><li><code>openEuler</code><br><code>dnf install inotify-tools -y</code></li><li><code>Ubuntu</code><br><code>apt-get install inotify-tools -y</code></li> |
41+ 
42+## Installation Through the Command Line<a id="ZH-CN_TOPIC_0000001582431578"></a>
43+ 
44+**Before You Start<a name="section1309123514117"></a>**
45+ 
46+- Do not power off the device during the installation. Otherwise, the device may be damaged.
47+ 
48+- Do not perform service configuration or other maintenance operations on the OM SDK during the installation process. Otherwise, the user data and configuration will be lost or the installation will fail.
49+ 
50+- If you want the EMS to listen on a NIC with DHCP enabled, you must configure the DHCP function on eth0 (network port 0), or leave eth0 disconnected and enable the DHCP function on eth1 (network ports 1 to 4).
51+ 
52+**Installation Through the Command Line<a name="section7621141414618"></a>**
53+ 
54+1. Upload the software package to any directory in the environment, such as `/home`.
55+ 
56+2. In the software package directory, run the following command to create the temporary directory `om_install`.
57+ 
58+ ```bash
59+ mkdir om_install
60+ ```
61+ 
62+3. Run the following commands to decompress the OM SDK software package.
63+ 
64+ ```bash
65+ unzip Ascend-mindxedge-omsdk_{version}_linux-aarch64.zip
66+ tar -zxf Ascend-mindxedge-omsdk_{version}_linux-aarch64.tar.gz -C om_install
67+ ```
68+ 
69+4. Run the following command to grant executable permissions to the installation script.
70+ 
71+ ```bash
72+ chmod +x om_install/install.sh
73+ ```
74+ 
75+5. Run the following command to install the software package.
76+ 
77+ ```bash
78+ om_install/install.sh
79+ ```
80+ 
81+The following example output indicates that the installation is complete.
82+ 
83+ ```text
84+ check install environment success
85+ prepare service file success
86+ executing install success
87+ start service success
88+ Install MindXOM success, MindXOM service is ready.
89+ ```
90+ 
91+ > [!NOTE]
92+ > - After the first successful login, you must change the `admin` account settings.
93+ > - You can view the runtime log of the installation operation by running the `tail -f /var/plog/upgrade.log` command.
94+ > - For details about the `install.sh` command specifications, see [install.sh](./appendix.md#installsh).
95+ 
96+# Update<a name="ZH-CN_TOPIC_0000001634859225"></a>
97+ 
98+## Before You Start<a name="ZH-CN_TOPIC_0000001634738585"></a>
99+ 
100+**Update Impact<a name="section289964514262"></a>**
101+ 
102+- Impact on services: The update process involves a system restart. You can choose when to restart the system. The restart interrupts your services for approximately 5 minutes.
103+ 
104+- Impact on network communication: The connection between FusionDirector and the EMS is interrupted for approximately 5 minutes.
105+ 
106+**Precautions<a name="section24641058112720"></a>**
107+ 
108+- Before performing the update, read this document carefully to ensure that you fully understand all content. If you have any comments or suggestions about this document, contact Huawei technical support.
109+ 
110+- Do not perform other maintenance operations during the update process. The update takes approximately 15 minutes.
111+ 
112+- To minimize the impact on the system, perform the version update during off-peak hours.
113+ 
114+- If the current update environment has insufficient space, see [Clearing Drive Space](./common_operations.md#clearing-drive-space) to clear drive space.
115+ 
116+**Update Process<a name="section1838323114914"></a>**
117+ 
118+1. Obtain the software package.
119+ 
120+ > [!NOTE]
121+ > If you want to update the driver of the Atlas 200I A2 accelerator module, see section "Updating the Driver" in the [Atlas 200I A2 Accelerator Module Driver Development Guide](https://support.huawei.com/enterprise/en/doc/EDOC1100541055/426cffd9?idPath=23710424|251366513|22892968|252309141|254411267).
122+ 
123+2. Update the firmware. You can update the firmware through the EMS WebUI or FusionDirector.
124+ 
125+3. Perform a post-update check. Check whether the update is successful.
126+ 
127+**Pre-Update Check<a name="section1176972311510"></a>**
128+ 
129+1. Check the software version.
130+ 
131+ Log in to the EMS WebUI, choose **Management** > **System Information** from the main menu, and view the current firmware version.
132+ 
133+2. Check the IP address function in the wired network.
134+ 
135+ - If an IP address with the `web` function exists in the wired network, you can perform the update directly.
136+ 
137+ - If no IP address with the `web` function exists in the wired network, set an IP address with the `web` purpose before performing the update. Otherwise, your update operation will fail.
138+ 
139+## Update Scenarios<a name="ZH-CN_TOPIC_0000001584637368"></a>
140+ 
141+### Updating Through the EMS<a name="ZH-CN_TOPIC_0000001584299540"></a>
142+ 
143+**Pre-Update Preparation<a name="section131331915189"></a>**
144+ 
145+- You have logged in to the EMS WebUI
146+ 
147+- There are no minor, major, or critical alarms in the EMS
148+ 
149+**Procedure<a name="section186434362417"></a>**
150+ 
151+For details, see <a href="./usage.md#system-update">System Update</a>.
152+ 
153+<strong>Post-Update Check<a name="section1092321532713"></a></strong>
154+ 
155+Log in to the EMS WebUI and choose **Management** > **System Information** from the main menu to check whether the current firmware version is the updated version.
156+ 
157+### Updating Through FusionDirector<a name="ZH-CN_TOPIC_0000001584618736"></a>
158+ 
159+**Pre-Update Preparation<a name="section3824145117349"></a>**
160+ 
161+- You have purchased the FusionDirector management software
162+ 
163+- You have logged in to the FusionDirector WebUI
164+ 
165+- There are no minor, major, or critical alarms in the FusionDirector system
166+ 
167+**Procedure<a name="section169701747193914"></a>**
168+ 
169+For operational guidance on the overall update process, see the **Update Management** > **Firmware/Driver Update** section in [FusionDirector Operation Guide](https://support.huawei.com/enterprise/en/doc/EDOC1100317180/426cffd9/about-this-document?idPath=23710424|251364417|251364851|252309137|23015464).
170+ 
171+> [!NOTE]
172+> The firmware update process through FusionDirector includes downloading the firmware package. The firmware package download supports resumable downloads. If a network interruption or exception occurs during the download, your download fails. If you perform the update operation again, the firmware package download resumes from the point where it failed instead of starting over, saving download time.
173+ 
174+**Post-Update Check<a name="section1092321532713"></a>**
175+ 
176+Log in to the EMS WebUI and choose **Management** > **System Information** from the main menu to check whether the current firmware version is the updated version.
177+ 
178+# Uninstallation<a id="ZH-CN_TOPIC_0000001628849833"></a>
179+ 
180+Uninstalling the OM SDK software clears related files, user data, and configurations. If your uninstallation operation fails, residual files may remain on the system.
181+ 
182+**Uninstallation Through the Command Line<a name="section4882716123316"></a>**
183+ 
184+1. Log in to the backend environment of the edge device as the `root` user.
185+ 
186+2. Run the following command to navigate to the directory where the EMS software is installed.
187+ 
188+ ```bash
189+ cd /usr/local/mindx/MindXOM
190+ ```
191+ 
192+3. Run the following command to uninstall the EMS software.
193+ 
194+ ```bash
195+ ./uninstall.sh
196+ ```
197+ 
198+If the system displays the following output, the uninstallation is complete.
199+ 
200+ ```text
201+ Uninstall MindXOM start.
202+ ...
203+ Clear config task success.
204+ Uninstall MindXOM success.
205+ ```
206+ 
207+ > [!NOTE]
208+ > - You can view the uninstallation runtime log by running the `tail -f /var/plog/upgrade.log` command
209+ > - For details about the `uninstall.sh` command, see [uninstall.sh](./appendix.md#uninstallsh)
@@ -0,0 +1,87 @@
1+# Product Introduction<a name="ZH-CN_TOPIC_0000001628849853"></a>
2+ 
3+With the rise of edge computing, edge devices are evolving toward greater intelligence and platform-based architectures. As a development-phase component, the OM SDK enables third-party independent software vendors (ISVs) or allows you to quickly build hardware management platforms based on Ascend computing chips. It simplifies hardware device O&M deployment and facilitates rapid development of customized device O&M systems.
4+ 
5+**Features<a name="section76204641111"></a>**
6+ 
7+The edge management system supports features such as initial device configuration, hardware monitoring, software installation, and system O&M for edge devices. It also supports integration with SmartKit and Huawei FusionDirector management software to implement centralized O&M management.
8+ 
9+**Table 1** Edge management system features
10+ 
11+<table><thead align="left"><tr id="row145994344815"><th class="cellrowborder" valign="top" width="31.130000000000003%" id="mcps1.2.3.1.1"><p id="p6599193420819"><a name="p6599193420819"></a><a name="p6599193420819"></a>Feature Type</p>
12+</th>
13+<th class="cellrowborder" valign="top" width="68.87%" id="mcps1.2.3.1.2"><p id="p18599634388"><a name="p18599634388"></a><a name="p18599634388"></a>Detailed Feature Description</p>
14+</th>
15+</tr>
16+</thead>
17+<tbody><tr id="row135991334589"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p6180119141713"><a name="p6180119141713"></a><a name="p6180119141713"></a>Hardware management</p>
18+</td>
19+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul976875262312"></a><a name="ul976875262312"></a><ul id="ul976875262312"><li>Hardware information query<a name="ul1441253114459"></a><a name="ul1441253114459"></a><ul id="ul1441253114459"><li>Query the hardware version, model, and health status of the entire device</li><li>Query the software and hardware versions, model, and health status of modules</li><li>Query voltage, temperature, power consumption, and other information</li></ul>
20+</li><li>Hardware fault detection</li></ul>
21+</td>
22+</tr>
23+<tr id="row1560023417819"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p518121921715"><a name="p518121921715"></a><a name="p518121921715"></a>Software management</p>
24+</td>
25+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul10866183304810"></a><a name="ul10866183304810"></a><ul id="ul10866183304810"><li>System OS, driver, and firmware upgrade<a name="ul17761114517486"></a><a name="ul17761114517486"></a><ul id="ul17761114517486"><li>Pre-upgrade check</li><li>Rollback after system firmware upgrade</li></ul>
26+</li><li>Software information query<p id="p1896885724514"><a name="p1896885724514"></a><a name="p1896885724514"></a>Query software version, computing power, and memory usage</p>
27+</li><li>Quick deployment and commissioning without software debugging</li><li><span id="ph158731853192117"><a name="ph158731853192117"></a><a name="ph158731853192117"></a>OM SDK</span> installation and upgrade</li></ul>
28+</td>
29+</tr>
30+<tr id="row2060015341681"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p19181161961718"><a name="p19181161961718"></a><a name="p19181161961718"></a>Time management</p>
31+</td>
32+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul79401216105210"></a><a name="ul79401216105210"></a><ul id="ul79401216105210"><li>System time zone and system time configuration</li><li>Support for time synchronization from an NTP server</li></ul>
33+</td>
34+</tr>
35+<tr id="row3600434183"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p01811419161718"><a name="p01811419161718"></a><a name="p01811419161718"></a>Network management</p>
36+</td>
37+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul4842151635312"></a><a name="ul4842151635312"></a><ul id="ul4842151635312"><li>Support for configuration of multiple network devices such as ETH, WiFi, and LTE</li><li>Support for manual configuration of system network port IP address, port, VLAN, gateway, and DNS</li><li>Support for DHCP to obtain the system IP address from the server</li></ul>
38+</td>
39+</tr>
40+<tr id="row47247100172"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p2018101921715"><a name="p2018101921715"></a><a name="p2018101921715"></a>Storage management</p>
41+</td>
42+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul25631334569"></a><a name="ul25631334569"></a><ul id="ul25631334569"><li>Support for querying and configuring local storage<p id="p15710737115616"><a name="p15710737115616"></a><a name="p15710737115616"></a>Query system partitions, storage capacity, and partition health status</p>
43+</li><li>Support for configuring and querying NFS storage systems, such as NFS mounting, capacity display, and connection health status</li></ul>
44+</td>
45+</tr>
46+<tr id="row253191310176"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p1618161919177"><a name="p1618161919177"></a><a name="p1618161919177"></a>User management</p>
47+</td>
48+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul11294189131110"></a><a name="ul11294189131110"></a><ul id="ul11294189131110"><li>Support for password expiration, login rules, weak password configuration and query, and user password modification</li><li>Support for customizable user security policies and import of customer trusted roots</li><li>Support for WebUI certificate import, query, and expiration check</li></ul>
49+</td>
50+</tr>
51+<tr id="row4319115131719"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p918171961711"><a name="p918171961711"></a><a name="p918171961711"></a>System monitoring</p>
52+</td>
53+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><a name="ul67551119151119"></a><a name="ul67551119151119"></a><ul id="ul67551119151119"><li>Support for alarm reporting, alarm masking, historical alarm query, and current alarm display</li><li>Support for integrated alarm display and management for customer-added devices and critical processes</li><li>Support for security logs, operation logs, run logs, and black box records, as well as log collection, query, and remote syslog</li></ul>
54+</td>
55+</tr>
56+<tr id="row8462201741712"><td class="cellrowborder" valign="top" width="31.130000000000003%" headers="mcps1.2.3.1.1 "><p id="p1518111941710"><a name="p1518111941710"></a><a name="p1518111941710"></a>Northbound API</p>
57+</td>
58+<td class="cellrowborder" valign="top" width="68.87%" headers="mcps1.2.3.1.2 "><p id="p3181121991718"><a name="p3181121991718"></a><a name="p3181121991718"></a>The system functions support the <span id="ph135441743969"><a name="ph135441743969"></a><a name="ph135441743969"></a>FusionDirector</span> centralized management protocol and RESTful open APIs. The RESTful APIs comply with the server northbound API standard.</p>
59+</td>
60+</tr>
61+</tbody>
62+</table>
63+ 
64+**Disclaimer<a name="section5760134553519"></a>**
65+ 
66+- The Edge Management system is provided only as a reference design. It does not constitute any guarantee or commitment regarding the functionality, performance, security, or compliance of any software products or services developed by third-party developers.
67+ 
68+- Third-party developers shall bear full responsibility for the design, development, testing, release, and operational maintenance of any software developed based on this product, and shall independently assume liability for any direct or indirect damages arising from the use of this product. We make no commitment to provide subsequent services or support such as version upgrades, feature expansions, or vulnerability fixes for this product in the future. Third-party developers have been fully informed of the foregoing risks, voluntarily use this product, and expressly agree to assume all possible risks and legal consequences.
69+ 
70+# Supported Products<a name="ZH-CN_TOPIC_0000001577530708"></a>
71+ 
72+[Table 2 Product information](#product-information) shows the products supported by the OM SDK and their corresponding operating systems.
73+ 
74+**Table 2** Product information<a id="product-information"></a>
75+ 
76+<table><thead align="left"><tr id="row838305110198"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p63832051141918"><a name="p63832051141918"></a><a name="p63832051141918"></a>Product Name</p></th>
77+<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p8383125111914"><a name="p8383125111914"></a><a name="p8383125111914"></a>Operating System</p></th>
78+</tr>
79+</thead>
80+<tbody><tr id="row1383125191912"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p0383115141917"><a name="p0383115141917"></a><a name="p0383115141917"></a><span id="ph1269314183209"><a name="ph1269314183209"></a><a name="ph1269314183209"></a>Atlas 200I A2 Accelerator Module</span> (RC mode)</p></td>
81+<td class="cellrowborder" rowspan="2" valign="top" width="50%" headers="mcps1.2.3.1.2 "><a name="ul12559155942210"></a><a name="ul12559155942210"></a><ul id="ul12559155942210"><li><span id="ph266450145110"><a name="ph266450145110"></a><a name="ph266450145110"></a>openEuler</span> 22.03</li><li><span id="ph1052114212228"><a name="ph1052114212228"></a><a name="ph1052114212228"></a>Ubuntu</span> 22.04</li></ul>
82+<p id="p11383145131911"><a name="p11383145131911"></a><a name="p11383145131911"></a></p></td>
83+</tr>
84+<tr id="row738365113196"><td class="cellrowborder" valign="top" headers="mcps1.2.3.1.1 "><p id="p138325116198"><a name="p138325116198"></a><a name="p138325116198"></a><span id="ph218252310208"><a name="ph218252310208"></a><a name="ph218252310208"></a>Atlas 200I DK A2 Developer Kit</span></p></td>
85+</tr>
86+</tbody>
87+</table>
@@ -0,0 +1,58 @@
1+# Security Configuration and Hardening<a name="ZH-CN_TOPIC_0000001578489796"></a>
2+ 
3+## System Capability Configuration<a name="ZH-CN_TOPIC_0000001628849865"></a>
4+ 
5+**System Capability Item Configuration on the WebUI<a name="section1881753116512"></a>**
6+ 
7+To configure system capability items on the WebUI, see [Security Policy](./usage.md#security-policy).
8+ 
9+**Capability Items<a name="zh-cn_topic_0000001447161177_section182160324717"></a>**
10+ 
11+When Nginx runs as the low-privilege `nobody` user, it must bind to port 443. Therefore, the required Nginx capability must be configured. For details, see [Table 1](#capability-configuration).
12+ 
13+**Table 1** Capability configuration<a id="capability-configuration"></a>
14+ 
15+|Capability|Description|Reason for Use|
16+|--|--|--|
17+|cap_net_bind_service|Allows Nginx to bind to ports below 1024.|Nginx must use port 443. Therefore, the capability to bind to port 443 must be configured.|
18+ 
19+> [!NOTE]
20+>
21+>- The Nginx installation path is `<OMSDK_installation_path>/MindXOM/software/nginx/sbin/nginx`.
22+ 
23+## Nginx IP Listening List<a name="ZH-CN_TOPIC_0000001578449864"></a>
24+ 
25+- When the edge management system starts the Nginx process, it retrieves the purpose attribute from the IP configuration and adds only IP addresses whose purpose is `web` to the Nginx IP listening list.
26+ 
27+- Listening on floating IP addresses, such as those of wireless networks and WiFi, is not supported.
28+ 
29+**IP-Related Configuration Files<a name="zh-cn_topic_0000001447161121_section174321318217"></a>**
30+ 
31+- IPv4 address configuration files:
32+ 
33+ - openEuler: /etc/sysconfig/network-scripts/ifcfg-_xxx_ (<i>xxx</i> represents eth0, eth1)
34+ 
35+ - Ubuntu: /etc/netplan/01-netcfg.yaml
36+ 
37+- IPv4 purpose configuration file: `/home/data/ies/tag.ini`
38+ 
39+> [!NOTE]
40+>
41+> - The IP configuration file paths support the following operating systems by default.
42+> - <code>openEuler 22.03</code>
43+> - <code>Ubuntu 22.04</code>
44+> - IP addresses support only local management.
45+> - IPv6 addresses are used for SmartKit device self-discovery.
46+> - The IPv4 address and IPv6 address listened on by Nginx must belong to the same network adapter. If the network adapter associated with the listened IPv4 address does not have an IPv6 address, Nginx does not listen on an IPv6 address.
47+> - Ensure that Nginx listens on at most one IPv4 address and one IPv6 address at a time. If multiple IP addresses are configured with the `web` purpose, the system selects one IP address based on the network adapter connection status, giving priority to the network adapter with the highest priority in the following order: network port 0 > network ports 1–4.
48+ 
49+## Critical Service Resource Limits<a name="ZH-CN_TOPIC_0000001651243070"></a>
50+ 
51+- Resource limits are applied to critical system services to monitor their memory usage. When memory usage exceeds the configured threshold, the service is automatically restarted.
52+ 
53+- The maximum CPU usage of critical services is limited so that a service does not continuously exceed the configured CPU usage threshold, ensuring that sufficient CPU resources remain available for other service processes.
54+ 
55+> [!NOTE]
56+>
57+>- Memory and CPU resource limits for critical services are configured by default. They take effect after the `oom-killer` mechanism is enabled.
58+>- The `oom-killer` mechanism is disabled by default. Run the `echo 1 > /proc/sys/vm/enable_oom_killer` command to enable this mechanism.
@@ -16,7 +16,8 @@ om-sdk.tar.gz需要从Atlas 500 A2 智能小站的Firmware固件包中解压获
16|--|--|--|16|--|--|--|
17|om-sdk.tar.gz|边缘管理系统软件包。|[获取链接](https://support.huawei.com/enterprise/zh/ascend-computing/atlas-500-a2-pid-254412305/software/261455669?idAbsPath=fixnode01%7C23710424%7C251366513%7C22892968%7C252309141%7C254412305)|17|om-sdk.tar.gz|边缘管理系统软件包。|[获取链接](https://support.huawei.com/enterprise/zh/ascend-computing/atlas-500-a2-pid-254412305/software/261455669?idAbsPath=fixnode01%7C23710424%7C251366513%7C22892968%7C252309141%7C254412305)|
18 18 
19-> [!NOTE] 19+> [!NOTE]
20+>
20> 边缘管理系统软件包可以直接使用,关于边缘管理系统的安装、使用、升级和卸载的指导请参见[user_guide](../user_guide)。21> 边缘管理系统软件包可以直接使用,关于边缘管理系统的安装、使用、升级和卸载的指导请参见[user_guide](../user_guide)。
21 22 
22## 准备开发环境<a id="ZH-CN_TOPIC_0000001577810552"></a>23## 准备开发环境<a id="ZH-CN_TOPIC_0000001577810552"></a>
@@ -74,7 +75,8 @@ om-sdk.tar.gz需要从Atlas 500 A2 智能小站的Firmware固件包中解压获
74 75 
75**配置文件说明<a name="section18171114533217"></a>**76**配置文件说明<a name="section18171114533217"></a>**
76 77 
77-> [!NOTE] 78+> [!NOTE]
79+>
78> OM SDK开发涉及到的project\_dir参数为项目工程目录,开发者需要根据自己的项目工程目录进行替换。80> OM SDK开发涉及到的project\_dir参数为项目工程目录,开发者需要根据自己的项目工程目录进行替换。
79 81 
80配置文件路径需要在“<i>{project_dir}</i>/config/project_cfg/project.conf”,该配置文件的\_Vendor字段说明如下。开发者在进行相应开发前,需要将配置文件的功能开关打开。82配置文件路径需要在“<i>{project_dir}</i>/config/project_cfg/project.conf”,该配置文件的\_Vendor字段说明如下。开发者在进行相应开发前,需要将配置文件的功能开关打开。
@@ -113,7 +115,7 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
113|RESTful接口开发|支持开发者开发RESTful接口,扩展边缘管理系统已有功能。|115|RESTful接口开发|支持开发者开发RESTful接口,扩展边缘管理系统已有功能。|
114|云边协同接口开发|支持开发者开发云边协同接口,帮助FusionDirector和边缘管理系统之间进行数据传输和通信,实现数据的实时处理和分析。|116|云边协同接口开发|支持开发者开发云边协同接口,帮助FusionDirector和边缘管理系统之间进行数据传输和通信,实现数据的实时处理和分析。|
115 117 
116-> [!NOTE] 118+> [!NOTE]
117> 只要进行过上述功能的开发,都需要参考[构建软件包](#构建软件包)章节重新构建软件包,再通过[user_guide](../user_guide)中的“installation_guide”章节安装边缘管理系统。119> 只要进行过上述功能的开发,都需要参考[构建软件包](#构建软件包)章节重新构建软件包,再通过[user_guide](../user_guide)中的“installation_guide”章节安装边缘管理系统。
118 120 
119## 自定义厂商信息<a name="ZH-CN_TOPIC_0000001628729953"></a>121## 自定义厂商信息<a name="ZH-CN_TOPIC_0000001628729953"></a>
@@ -177,19 +179,20 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
177 179 
178以上自定义厂商信息在边缘管理系统的Web页面上的显示位置如以下各图所示:180以上自定义厂商信息在边缘管理系统的Web页面上的显示位置如以下各图所示:
179 181 
180-> [!NOTE] 182+> [!NOTE]
183+>
181> “model”字段内容将不在Web界面展示,而是会体现在用户导出的日志压缩包名称中。184> “model”字段内容将不在Web界面展示,而是会体现在用户导出的日志压缩包名称中。
182 185 
183-**图 1** systemName<a name="fig14777152620281"></a> 186+**图 1** systemName<a name="fig14777152620281"></a>
184![](../figures/systemName.png "systemName")187![](../figures/systemName.png "systemName")
185 188 
186-**图 2** websiteTitle<a name="fig1738355014910"></a> 189+**图 2** websiteTitle<a name="fig1738355014910"></a>
187![](../figures/websiteTitle.png "websiteTitle")190![](../figures/websiteTitle.png "websiteTitle")
188 191 
189-**图 3** userGuide<a name="fig850411813518"></a> 192+**图 3** userGuide<a name="fig850411813518"></a>
190![](../figures/userGuide.png "userGuide")193![](../figures/userGuide.png "userGuide")
191 194 
192-**图 4** copyRight<a name="fig18962144425120"></a> 195+**图 4** copyRight<a name="fig18962144425120"></a>
193![](../figures/copyRight.png "copyRight")196![](../figures/copyRight.png "copyRight")
194 197 
195### 自定义图片<a name="ZH-CN_TOPIC_0000001637475461"></a>198### 自定义图片<a name="ZH-CN_TOPIC_0000001637475461"></a>
@@ -207,24 +210,25 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
207|login.png|3840px × 2160px|png|210|login.png|3840px × 2160px|png|
208|logo.png|32px × 32px|png|211|logo.png|32px × 32px|png|
209 212 
210-> [!NOTE] 213+> [!NOTE]
214+>
211> device.png和device-en.png的区别在于边缘管理系统切换语言时会显示对应的图片,系统语言为“简体中文”时显示的图片为device.png,系统语言为“English”时显示的图片为device-en.png。215> device.png和device-en.png的区别在于边缘管理系统切换语言时会显示对应的图片,系统语言为“简体中文”时显示的图片为device.png,系统语言为“English”时显示的图片为device-en.png。
212 216 
213以上图片在边缘管理系统的Web页面上的显示位置如以下各图所示。217以上图片在边缘管理系统的Web页面上的显示位置如以下各图所示。
214 218 
215-**图 1** device.png<a name="zh-cn_topic_0000001397241130_fig657133213141"></a> 219+**图 1** device.png<a name="zh-cn_topic_0000001397241130_fig657133213141"></a>
216![](../figures/device-png.png "device-png")220![](../figures/device-png.png "device-png")
217 221 
218-**图 2** model.svg<a name="zh-cn_topic_0000001397241130_fig373116512196"></a> 222+**图 2** model.svg<a name="zh-cn_topic_0000001397241130_fig373116512196"></a>
219![](../figures/model-svg.png "model-svg")223![](../figures/model-svg.png "model-svg")
220 224 
221-**图 3** favicon.ico<a name="zh-cn_topic_0000001397241130_fig286011326468"></a> 225+**图 3** favicon.ico<a name="zh-cn_topic_0000001397241130_fig286011326468"></a>
222![](../figures/favicon-ico.png "favicon-ico")226![](../figures/favicon-ico.png "favicon-ico")
223 227 
224-**图 4** login.png<a name="zh-cn_topic_0000001397241130_fig19844191614720"></a> 228+**图 4** login.png<a name="zh-cn_topic_0000001397241130_fig19844191614720"></a>
225![](../figures/login-png.png "login-png")229![](../figures/login-png.png "login-png")
226 230 
227-**图 5** logo.png<a name="zh-cn_topic_0000001397241130_fig595442916291"></a> 231+**图 5** logo.png<a name="zh-cn_topic_0000001397241130_fig595442916291"></a>
228![](../figures/logo-png.png "logo-png")232![](../figures/logo-png.png "logo-png")
229 233 
230### 开发示例<a name="ZH-CN_TOPIC_0000001637970781"></a>234### 开发示例<a name="ZH-CN_TOPIC_0000001637970781"></a>
@@ -247,34 +251,34 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
247 WEB_MANAGER_PATH=""251 WEB_MANAGER_PATH=""
248 IMG_DIR="WhiteboxConfig/img"252 IMG_DIR="WhiteboxConfig/img"
249 IMG_LIST=("${IMG_DIR}/device.png" "${IMG_DIR}/device-en.png" "${IMG_DIR}/favicon.ico" "${IMG_DIR}/model.svg" "${IMG_DIR}/logo.png" "${IMG_DIR}/login.png")253 IMG_LIST=("${IMG_DIR}/device.png" "${IMG_DIR}/device-en.png" "${IMG_DIR}/favicon.ico" "${IMG_DIR}/model.svg" "${IMG_DIR}/logo.png" "${IMG_DIR}/login.png")
250- 254+ 
251 JSON_DIR="WhiteboxConfig/json"255 JSON_DIR="WhiteboxConfig/json"
252 CONFIG_JSON_PATH="${JSON_DIR}/config.json"256 CONFIG_JSON_PATH="${JSON_DIR}/config.json"
253 OS_NAME=$(< "/etc/os-release" grep "^NAME=" | awk -F "=" '{print $2}' | tr -d '"')257 OS_NAME=$(< "/etc/os-release" grep "^NAME=" | awk -F "=" '{print $2}' | tr -d '"')
254- 258+ 
255 function check_img()259 function check_img()
256 {260 {
257 local image_path="$1"261 local image_path="$1"
258 local img_suffix=""262 local img_suffix=""
259 local img_max_size="10485760" # 最大10M263 local img_max_size="10485760" # 最大10M
260- 264+ 
261 img_suffix="$(basename "${image_path}" | awk -F "." '{print $2}')"265 img_suffix="$(basename "${image_path}" | awk -F "." '{print $2}')"
262 if [[ ! -f "${image_path}" ]]; then266 if [[ ! -f "${image_path}" ]]; then
263 echo "${img_suffix} image ${image_path} file not exist"267 echo "${img_suffix} image ${image_path} file not exist"
264 return 1268 return 1
265 fi269 fi
266- 270+ 
267 # 检查文件大小271 # 检查文件大小
268 if [[ $(stat -c %s "${image_path}") -gt "${img_max_size}" ]]; then272 if [[ $(stat -c %s "${image_path}") -gt "${img_max_size}" ]]; then
269 echo "${img_suffix} image ${image_path} is too large"273 echo "${img_suffix} image ${image_path} is too large"
270 return 1274 return 1
271 fi275 fi
272- 276+ 
273 echo "check ${img_suffix} image ${image_path} success"277 echo "check ${img_suffix} image ${image_path} success"
274 return 0278 return 0
275 }279 }
276- 280+ 
277- 281+ 
278 function check_config_json()282 function check_config_json()
279 {283 {
280 if [[ "${OS_NAME}" != "Ubuntu" ]]; then284 if [[ "${OS_NAME}" != "Ubuntu" ]]; then
@@ -283,105 +287,105 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
283 return 1287 return 1
284 fi288 fi
285 fi289 fi
286- 290+ 
287 if ! python3 -m json.tool "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then291 if ! python3 -m json.tool "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
288 echo "Invalid json ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}"292 echo "Invalid json ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}"
289 return 1293 return 1
290 fi294 fi
291- 295+ 
292 if ! grep -P '^\s*"model"\s*:\s*"[a-zA-Z0-9()\ ]{1,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then296 if ! grep -P '^\s*"model"\s*:\s*"[a-zA-Z0-9()\ ]{1,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
293 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <model> field"297 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <model> field"
294 return 1298 return 1
295 fi299 fi
296- 300+ 
297 if ! grep -P '^\s*"systemName"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then301 if ! grep -P '^\s*"systemName"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
298 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <systemName> field"302 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <systemName> field"
299 return 1303 return 1
300 fi304 fi
301- 305+ 
302 if ! grep -P '^\s*"websiteTitle"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then306 if ! grep -P '^\s*"websiteTitle"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
303 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <websiteTitle> field"307 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <websiteTitle> field"
304 return 1308 return 1
305 fi309 fi
306- 310+ 
307 if ! grep -P '^\s*"userGuide"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then311 if ! grep -P '^\s*"userGuide"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
308 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <userGuide> field"312 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <userGuide> field"
309 return 1313 return 1
310 fi314 fi
311- 315+ 
312 if ! grep -P '^\s*"copyRight"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then316 if ! grep -P '^\s*"copyRight"\s*:\s*{' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" &> /dev/null; then
313 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <copyRight> field"317 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, please check <copyRight> field"
314 return 1318 return 1
315 fi319 fi
316- 320+ 
317 if [[ $(grep -cP '^\s*"zh"\s*:\s*"[a-zA-Z0-9()x{4e00}-\x{9fa5}() ]{0,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}") -ne "4" ]]; then321 if [[ $(grep -cP '^\s*"zh"\s*:\s*"[a-zA-Z0-9()x{4e00}-\x{9fa5}() ]{0,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}") -ne "4" ]]; then
318 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, missing <zh> field, please check "322 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, missing <zh> field, please check "
319 return 1323 return 1
320 fi324 fi
321- 325+ 
322 if [[ $(grep -cP '^\s*"en"\s*:\s*"[a-zA-Z0-9()., ]{0,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}") -ne "4" ]]; then326 if [[ $(grep -cP '^\s*"en"\s*:\s*"[a-zA-Z0-9()., ]{0,128}"' "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}") -ne "4" ]]; then
323 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, missing <en> field, please check "327 echo "check ${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH} failed, missing <en> field, please check "
324 return 1328 return 1
325 fi329 fi
326- 330+ 
327 return 0331 return 0
328 }332 }
329- 333+ 
330- 334+ 
331 function check_assets()335 function check_assets()
332 {336 {
333 if [[ ! -f "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device-en.png" ]]; then337 if [[ ! -f "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device-en.png" ]]; then
334 cp "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device.png" "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device-en.png"338 cp "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device.png" "${VENDOR_CONFIG_PATH}/${IMG_DIR}/device-en.png"
335 fi339 fi
336- 340+ 
337 for (( i= 0; i < "${#IMG_LIST[@]}"; i++)); do341 for (( i= 0; i < "${#IMG_LIST[@]}"; i++)); do
338 if ! check_img "${VENDOR_CONFIG_PATH}/${IMG_LIST[i]}"; then342 if ! check_img "${VENDOR_CONFIG_PATH}/${IMG_LIST[i]}"; then
339 echo "check config img failed, please check"343 echo "check config img failed, please check"
340 return 1344 return 1
341 fi345 fi
342 done346 done
343- 347+ 
344 if ! check_config_json; then348 if ! check_config_json; then
345 echo "check config json failed, please check"349 echo "check config json failed, please check"
346 return 1350 return 1
347 fi351 fi
348- 352+ 
349 return 0353 return 0
350 }354 }
351- 355+ 
352 function copy_config_and_assets()356 function copy_config_and_assets()
353 {357 {
354 # 拷贝json配置358 # 拷贝json配置
355 if [[ ! -d "${WEB_MANAGER_PATH}/${JSON_DIR}" ]]; then359 if [[ ! -d "${WEB_MANAGER_PATH}/${JSON_DIR}" ]]; then
356 mkdir -p "${WEB_MANAGER_PATH}/${JSON_DIR}"360 mkdir -p "${WEB_MANAGER_PATH}/${JSON_DIR}"
357 fi361 fi
358- 362+ 
359 if ! cp -rf "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" "${WEB_MANAGER_PATH}/${CONFIG_JSON_PATH}"; then363 if ! cp -rf "${VENDOR_CONFIG_PATH}/${CONFIG_JSON_PATH}" "${WEB_MANAGER_PATH}/${CONFIG_JSON_PATH}"; then
360 echo "cp ${CONFIG_JSON_PATH} failed, please check"364 echo "cp ${CONFIG_JSON_PATH} failed, please check"
361 return 1365 return 1
362 fi366 fi
363- 367+ 
364 # 拷贝图片配置368 # 拷贝图片配置
365 if [[ ! -d "${WEB_MANAGER_PATH}/${IMG_DIR}" ]]; then369 if [[ ! -d "${WEB_MANAGER_PATH}/${IMG_DIR}" ]]; then
366 mkdir -p "${WEB_MANAGER_PATH}/${IMG_DIR}"370 mkdir -p "${WEB_MANAGER_PATH}/${IMG_DIR}"
367 fi371 fi
368- 372+ 
369 for (( i= 0; i < "${#IMG_LIST[@]}"; i++)); do373 for (( i= 0; i < "${#IMG_LIST[@]}"; i++)); do
370 if ! cp -f "${VENDOR_CONFIG_PATH}/${IMG_LIST[i]}" "${WEB_MANAGER_PATH}/${IMG_LIST[i]}"; then374 if ! cp -f "${VENDOR_CONFIG_PATH}/${IMG_LIST[i]}" "${WEB_MANAGER_PATH}/${IMG_LIST[i]}"; then
371 echo "cp ${IMG_LIST[i]} failed, please check"375 echo "cp ${IMG_LIST[i]} failed, please check"
372 return 1376 return 1
373 fi377 fi
374 done378 done
375- 379+ 
376 if [[ "${OS_NAME}" = "Ubuntu" ]]; then380 if [[ "${OS_NAME}" = "Ubuntu" ]]; then
377 chown -R nobody:nogroup "${WEB_MANAGER_PATH}"381 chown -R nobody:nogroup "${WEB_MANAGER_PATH}"
378 else382 else
379 chown -R nobody:nobody "${WEB_MANAGER_PATH}"383 chown -R nobody:nobody "${WEB_MANAGER_PATH}"
380 fi384 fi
381- 385+ 
382 return 0386 return 0
383 }387 }
384- 388+ 
385 function main()389 function main()
386 {390 {
387 # 校验 web manager 路径391 # 校验 web manager 路径
@@ -391,27 +395,27 @@ OM SDK支持开发者基于边缘管理系统开发包进行二次开发,可
391 if [[ ! -d "${WEB_MANAGER_PATH}" ]]; then395 if [[ ! -d "${WEB_MANAGER_PATH}" ]]; then
392 mkdir -p "${WEB_MANAGER_PATH}"396 mkdir -p "${WEB_MANAGER_PATH}"
393 fi397 fi
394- 398+ 
395 # 检查静态文件399 # 检查静态文件
396 if ! check_assets; then400 if ! check_assets; then
397 echo "check asset files failed."401 echo "check asset files failed."
398 return 1402 return 1
399 fi403 fi
400- 404+ 
401 echo "check environment and assets successfully, start copy assets to web project directory...."405 echo "check environment and assets successfully, start copy assets to web project directory...."
402- 406+ 
403- 407+ 
404 if ! copy_config_and_assets; then408 if ! copy_config_and_assets; then
405 echo "cp asset files to web project directory failed, please check"409 echo "cp asset files to web project directory failed, please check"
406 return 1410 return 1
407 fi411 fi
408- 412+ 
409 echo "The customized configuration files has been copied."413 echo "The customized configuration files has been copied."
410- 414+ 
411 return 0415 return 0
412 }416 }
413- 417+ 
414- 418+ 
415 echo -e "\n####################### begin to copy customized configuration files #####################################\n"419 echo -e "\n####################### begin to copy customized configuration files #####################################\n"
416 main "$@"420 main "$@"
417 RESULT=$?421 RESULT=$?
@@ -471,26 +475,26 @@ OM SDK预置的告警配置包括温度告警、电源告警、存储告警、NF
471 475 
472OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管理系统在初始化故障检测组件时,会调用/usr/local/mindx/MindXOM/lib/libcustomized\_alarm.so(需要由用户实现)文件里的自定义故障检测接口(drv\_fault\_check\_init)和回调函数注册接口(drv\_fault\_check\_register\_callback),用于拉起自定义告警检测组件。当检测到告警时,由注册的回调函数将告警信息写入OM SDK提供的告警文件里。476OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管理系统在初始化故障检测组件时,会调用/usr/local/mindx/MindXOM/lib/libcustomized\_alarm.so(需要由用户实现)文件里的自定义故障检测接口(drv\_fault\_check\_init)和回调函数注册接口(drv\_fault\_check\_register\_callback),用于拉起自定义告警检测组件。当检测到告警时,由注册的回调函数将告警信息写入OM SDK提供的告警文件里。
473 477 
474-> [!NOTE] 478+> [!NOTE]
475-> 479+>
476> - drv\_fault\_check\_init接口用于初始化和启动自定义告警,检测逻辑需要由用户自行实现。480> - drv\_fault\_check\_init接口用于初始化和启动自定义告警,检测逻辑需要由用户自行实现。
477> - drv\_fault\_check\_register\_callback用于将OM SDK的回调函数注册到自定义告警组件里,当发生告警时,调用注册的回调函数,将告警信息写入告警文件里。481> - drv\_fault\_check\_register\_callback用于将OM SDK的回调函数注册到自定义告警组件里,当发生告警时,调用注册的回调函数,将告警信息写入告警文件里。
478 482 
479**自定义告警检测初始化流程<a name="section19426659105714"></a>**483**自定义告警检测初始化流程<a name="section19426659105714"></a>**
480 484 
481-**图 1** 检测流程图<a name="fig12611161011016"></a> 485+**图 1** 检测流程图<a name="fig12611161011016"></a>
482![](../figures/检测流程图.png "检测流程图")486![](../figures/检测流程图.png "检测流程图")
483 487 
484**告警上报流程<a name="section8303172751111"></a>**488**告警上报流程<a name="section8303172751111"></a>**
485 489 
486- 上报到边缘管理系统的Web界面490- 上报到边缘管理系统的Web界面
487 491 
488- **图 2** 上报告警流程图<a name="fig945245321612"></a> 492+ **图 2** 上报告警流程图<a name="fig945245321612"></a>
489 ![](../figures/上报告警流程图.png "上报告警流程图")493 ![](../figures/上报告警流程图.png "上报告警流程图")
490 494 
491- 上报到FusionDirector495- 上报到FusionDirector
492 496 
493- **图 3** 上报告警流程图<a name="fig2277191602620"></a> 497+ **图 3** 上报告警流程图<a name="fig2277191602620"></a>
494 ![](../figures/上报告警流程图-0.png "上报告警流程图-0")498 ![](../figures/上报告警流程图-0.png "上报告警流程图-0")
495 499 
496### 新增自定义告警操作说明<a name="ZH-CN_TOPIC_0000001681725797"></a>500### 新增自定义告警操作说明<a name="ZH-CN_TOPIC_0000001681725797"></a>
@@ -507,13 +511,13 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
507 3. 拷贝alarm\_info\_en.json文件,在其中写入新增的告警配置,用于上报告警到FusionDirector。511 3. 拷贝alarm\_info\_en.json文件,在其中写入新增的告警配置,用于上报告警到FusionDirector。
508 4. 拷贝all\_alarm\_for\_manager.json文件,在其中写入新增的告警屏蔽规则,用于创建告警屏蔽规则时,校验新建的告警屏蔽规则是否合法。512 4. 拷贝all\_alarm\_for\_manager.json文件,在其中写入新增的告警屏蔽规则,用于创建告警屏蔽规则时,校验新建的告警屏蔽规则是否合法。
509 513 
510- > [!NOTE] 514+ > [!NOTE]
511 > 用户需要按照配置文件现有的格式,新增相关的告警配置信息。515 > 用户需要按照配置文件现有的格式,新增相关的告警配置信息。
512 516 
5135. <a name="li13597122685615"></a>调用校验脚本validate\_alarm\_config.py,验证修改后的告警配置文件是否配置正确。5175. <a name="li13597122685615"></a>调用校验脚本validate\_alarm\_config.py,验证修改后的告警配置文件是否配置正确。
5146. <a name="li47041937661"></a>将自定义告警模块编译成custom\_define\_alarm.so文件,放入“/usr/local/mindx/MindXOM/lib”路径下。用步骤[4](#li171719913620)中修改后配置文件,覆盖掉OM SDK原有的配置文件。5186. <a name="li47041937661"></a>将自定义告警模块编译成custom\_define\_alarm.so文件,放入“/usr/local/mindx/MindXOM/lib”路径下。用步骤[4](#li171719913620)中修改后配置文件,覆盖掉OM SDK原有的配置文件。
515 519 
516- > [!NOTE] 520+ > [!NOTE]
517 > 如果新增的自定义告警在OM SDK预置的告警配置范围内,则不用执行步骤[4](#li171719913620)、步骤[5](#li13597122685615)以及步骤[6](#li47041937661)中覆盖对应配置文件的操作。521 > 如果新增的自定义告警在OM SDK预置的告警配置范围内,则不用执行步骤[4](#li171719913620)、步骤[5](#li13597122685615)以及步骤[6](#li47041937661)中覆盖对应配置文件的操作。
518 522 
519### 开发示例<a name="ZH-CN_TOPIC_0000001681845833"></a>523### 开发示例<a name="ZH-CN_TOPIC_0000001681845833"></a>
@@ -591,7 +595,8 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
591 595 
5922. 在customized\_alarm\_check.h中定义告警初始化接口、回调函数注册接口以及相关结构体。5962. 在customized\_alarm\_check.h中定义告警初始化接口、回调函数注册接口以及相关结构体。
593 597 
594- > [!NOTE] 598+ > [!NOTE]
599+ >
595 >- 告警消息由两部分拼接组成,分别是消息头(FAULT\_MSG\_HEAD\_STRU,定义了消息长度、消息来源、告警数量)和消息体(FAULT\_ITEM\_STRU类型的数组,每个FAULT\_ITEM\_STRU表示一条告警)。FAULT\_MSG\_HEAD\_STRU和FAULT\_ITEM\_STRU必须按照下面样例里的结构定义,否则OM SDK解析告警信息将会失败。600 >- 告警消息由两部分拼接组成,分别是消息头(FAULT\_MSG\_HEAD\_STRU,定义了消息长度、消息来源、告警数量)和消息体(FAULT\_ITEM\_STRU类型的数组,每个FAULT\_ITEM\_STRU表示一条告警)。FAULT\_MSG\_HEAD\_STRU和FAULT\_ITEM\_STRU必须按照下面样例里的结构定义,否则OM SDK解析告警信息将会失败。
596 >- 消息头FAULT\_MSG\_HEAD\_STRU里的cmd字段必须设置为2,表明是自定义告警,如果设置为其他值,可能导致自定义告警功能失效或影响OM SDK已支持的告警。601 >- 消息头FAULT\_MSG\_HEAD\_STRU里的cmd字段必须设置为2,表明是自定义告警,如果设置为其他值,可能导致自定义告警功能失效或影响OM SDK已支持的告警。
597 >- 消息头FAULT\_ITEM\_STRU里的fault\_id和sub\_fault\_id字段的取值范围为0\~49,如果超过49,会导致告警上报失败;相同fault\_id的告警类型不能超过50。602 >- 消息头FAULT\_ITEM\_STRU里的fault\_id和sub\_fault\_id字段的取值范围为0\~49,如果超过49,会导致告警上报失败;相同fault\_id的告警类型不能超过50。
@@ -601,18 +606,18 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
601 ```c606 ```c
602 #ifndef CUSTOMIZED_ALARM_CHECK_H607 #ifndef CUSTOMIZED_ALARM_CHECK_H
603 #define CUSTOMIZED_ALARM_CHECK_H608 #define CUSTOMIZED_ALARM_CHECK_H
604- 609+ 
605 #define ALARM_INFO_MAX_SIZE 64 * 1024610 #define ALARM_INFO_MAX_SIZE 64 * 1024
606- 611+ 
607- 612+ 
608 typedef int (*CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN)(unsigned char *data, unsigned int data_len);613 typedef int (*CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN)(unsigned char *data, unsigned int data_len);
609- 614+ 
610 typedef struct {615 typedef struct {
611 unsigned int data_len; // 报文长度616 unsigned int data_len; // 报文长度
612 unsigned int cmd; // 赋值时,必须设置为2,表明是自定义告警,如果设置为其他值可能导致自定义告警功能失效或影响OM SDK已支持的告警617 unsigned int cmd; // 赋值时,必须设置为2,表明是自定义告警,如果设置为其他值可能导致自定义告警功能失效或影响OM SDK已支持的告警
613 unsigned int item_num; // 告警个数618 unsigned int item_num; // 告警个数
614 } FAULT_MSG_HEAD_STRU;619 } FAULT_MSG_HEAD_STRU;
615- 620+ 
616 typedef struct {621 typedef struct {
617 unsigned short fault_id; // 告警id622 unsigned short fault_id; // 告警id
618 unsigned short sub_fault_id; // 子告警id623 unsigned short sub_fault_id; // 子告警id
@@ -622,36 +627,36 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
622 char fault_name[64]; // 告警名称627 char fault_name[64]; // 告警名称
623 char resource[32]; // 告警实体628 char resource[32]; // 告警实体
624 } FAULT_ITEM_STRU;629 } FAULT_ITEM_STRU;
625- 630+ 
626- 631+ 
627 int drv_fault_check_init();632 int drv_fault_check_init();
628 void *customized_alarm_check(void *para);633 void *customized_alarm_check(void *para);
629 unsigned char *generate_customized_alarm();634 unsigned char *generate_customized_alarm();
630 int drv_fault_check_register_callback(CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN pfnRx);635 int drv_fault_check_register_callback(CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN pfnRx);
631- 636+ 
632 #endif637 #endif
633 ```638 ```
634 639 
6353. 在customized\_alarm\_check.c中实现自定义告警初始化接口和回调函数注册接口。6403. 在customized\_alarm\_check.c中实现自定义告警初始化接口和回调函数注册接口。
636 641 
637- > [!NOTE] 642+ > [!NOTE]
638 > 用户实现自定义告警检测初始化接口时,最好是通过新建线程实现,此处以打桩构造告警为例。643 > 用户实现自定义告警检测初始化接口时,最好是通过新建线程实现,此处以打桩构造告警为例。
639 644 
640 ```c645 ```c
641 /*646 /*
642 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.647 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
643 */648 */
644- 649+ 
645 #include "unistd.h"650 #include "unistd.h"
646 #include "stdlib.h"651 #include "stdlib.h"
647 #include "string.h"652 #include "string.h"
648 #include <time.h>653 #include <time.h>
649 #include "pthread.h"654 #include "pthread.h"
650 #include "customized_alarm_check.h"655 #include "customized_alarm_check.h"
651- 656+ 
652- 657+ 
653 CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN g_customized_alarm_check_rx_pfn = NULL;658 CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN g_customized_alarm_check_rx_pfn = NULL;
654- 659+ 
655 // 告警检测函数,此处是打桩构造自定义告警660 // 告警检测函数,此处是打桩构造自定义告警
656 void* customized_alarm_check(void *para)661 void* customized_alarm_check(void *para)
657 {662 {
@@ -677,16 +682,16 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
677 sleep(30);682 sleep(30);
678 free(alarmBuff);683 free(alarmBuff);
679 } while (1);684 } while (1);
680- 685+ 
681 return ((void *)0);686 return ((void *)0);
682 }687 }
683- 688+ 
684 // 生成告警信息689 // 生成告警信息
685 unsigned char *generate_customized_alarm()690 unsigned char *generate_customized_alarm()
686 {691 {
687 unsigned int head_size = sizeof(FAULT_MSG_HEAD_STRU);692 unsigned int head_size = sizeof(FAULT_MSG_HEAD_STRU);
688 unsigned int body_size = sizeof(FAULT_ITEM_STRU);693 unsigned int body_size = sizeof(FAULT_ITEM_STRU);
689- 694+ 
690 if (head_size + body_size > ALARM_INFO_MAX_SIZE) {695 if (head_size + body_size > ALARM_INFO_MAX_SIZE) {
691 return NULL;696 return NULL;
692 }697 }
@@ -695,17 +700,17 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
695 return NULL;700 return NULL;
696 }701 }
697 (void)memset_s(alarmBuff, head_size + body_size, 0, head_size + body_size);702 (void)memset_s(alarmBuff, head_size + body_size, 0, head_size + body_size);
698- 703+ 
699 FAULT_ITEM_STRU *item = (FAULT_ITEM_STRU *)(alarmBuff + head_size);704 FAULT_ITEM_STRU *item = (FAULT_ITEM_STRU *)(alarmBuff + head_size);
700 item->fault_id = 26; // 告警id705 item->fault_id = 26; // 告警id
701 item->fault_level = 1; // 告警级别 FAULT_LEVEL_ENUM :紧急告警 严重告警 轻微告警706 item->fault_level = 1; // 告警级别 FAULT_LEVEL_ENUM :紧急告警 严重告警 轻微告警
702 item->raise_time_stamp = time(NULL); // 告警时间戳(元年到告警产生的秒数)707 item->raise_time_stamp = time(NULL); // 告警时间戳(元年到告警产生的秒数)
703 (void)strncpy_s(item->fault_name, 64, "TEST_ERROR", strlen("TEST_ERROR")); // 告警名称708 (void)strncpy_s(item->fault_name, 64, "TEST_ERROR", strlen("TEST_ERROR")); // 告警名称
704 (void)strncpy_s(item->resource, 32, "TEST", strlen("TEST")); // 告警实体709 (void)strncpy_s(item->resource, 32, "TEST", strlen("TEST")); // 告警实体
705- 710+ 
706 return alarmBuff;711 return alarmBuff;
707 }712 }
708- 713+ 
709 // 自定义告警初始化,为避免初始化过程耗时过长,新建线程启动714 // 自定义告警初始化,为避免初始化过程耗时过长,新建线程启动
710 int drv_fault_check_init()715 int drv_fault_check_init()
711 {716 {
@@ -714,7 +719,7 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
714 ret = pthread_create(&customized_alarm_check_thread, NULL, customized_alarm_check, NULL);719 ret = pthread_create(&customized_alarm_check_thread, NULL, customized_alarm_check, NULL);
715 return ret;720 return ret;
716 }721 }
717- 722+ 
718 // 注册回调函数,将回调函数保存在全局变量中723 // 注册回调函数,将回调函数保存在全局变量中
719 int drv_fault_check_register_callback(CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN pfnRx)724 int drv_fault_check_register_callback(CUSTOMIZED_ALARM_CHECK_CALLBACK_PFN pfnRx)
720 {725 {
@@ -730,12 +735,14 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
730 - all\_alarm\_for\_manager.json:software/ibma/config/all\_alarm\_for\_manager.json735 - all\_alarm\_for\_manager.json:software/ibma/config/all\_alarm\_for\_manager.json
731 - all\_alarm\_for\_manager\_web.json:software/nginx/html/manager/config/all\_alarm\_for\_manager.json736 - all\_alarm\_for\_manager\_web.json:software/nginx/html/manager/config/all\_alarm\_for\_manager.json
732 737 
733- > [!NOTE] 738+ > [!NOTE]
739+ >
734 > OM SDK软件包中的告警屏蔽规则配置文件都叫all\_alarm\_for\_manager.json,为了区分,因此将前端使用的告警屏蔽规则配置文件命名为all\_alarm\_for\_manager\_web.json。740 > OM SDK软件包中的告警屏蔽规则配置文件都叫all\_alarm\_for\_manager.json,为了区分,因此将前端使用的告警屏蔽规则配置文件命名为all\_alarm\_for\_manager\_web.json。
735 741 
7365. 修改配置文件。此处以新增告警ID为001A0000为例,在对应配置文件中新增的告警信息。以下仅为配置示例,只做参考,不能直接复制使用。7425. 修改配置文件。此处以新增告警ID为001A0000为例,在对应配置文件中新增的告警信息。以下仅为配置示例,只做参考,不能直接复制使用。
737 743 
738- > [!NOTE] 744+ > [!NOTE]
745+ >
739 > 告警ID是由fault\_id左移十六位再加上sub\_fault\_id后,转为16进制得到的,如果转换后的数字不足八位,则补齐八位。以告警ID001A0000为例,fault\_id等于26,sub\_fault\_id等于0,26左移十六位后得到110100000000000000000,加上sub\_fault\_id后等于110100000000000000000,再将其转为16进制,等到数值1A0000,由于其不足八位,补齐八位得到告警ID为001A0000。746 > 告警ID是由fault\_id左移十六位再加上sub\_fault\_id后,转为16进制得到的,如果转换后的数字不足八位,则补齐八位。以告警ID001A0000为例,fault\_id等于26,sub\_fault\_id等于0,26左移十六位后得到110100000000000000000,加上sub\_fault\_id后等于110100000000000000000,再将其转为16进制,等到数值1A0000,由于其不足八位,补齐八位得到告警ID为001A0000。
740 747 
741 1. 在alarm\_info\_en.json中新增自定义告警信息。748 1. 在alarm\_info\_en.json中新增自定义告警信息。
@@ -882,12 +889,14 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
882 }889 }
883 ```890 ```
884 891 
885- > [!NOTE] 892+ > [!NOTE]
893+ >
886 > 如果用户新增的自定义告警,在OM SDK预留的告警配置项中,则不需要在相应的告警配置文件中新增告警信息,预留的告警信息请参见[表1 OM SDK预留的告警信息](./appendix.md#om-sdk预留的告警配置table)。894 > 如果用户新增的自定义告警,在OM SDK预留的告警配置项中,则不需要在相应的告警配置文件中新增告警信息,预留的告警信息请参见[表1 OM SDK预留的告警信息](./appendix.md#om-sdk预留的告警配置table)。
887 895 
8886. 校验配置文件是否配置正确。8966. 校验配置文件是否配置正确。
889 897 
890- > [!NOTE] 898+ > [!NOTE]
899+ >
891 > validate\_alarm\_config.py脚本会校验告警屏蔽配置文件(all\_alarm\_for\_manager.json和all\_alarm\_for\_manager\_web.json)和告警信息配置文件(alarm\_info\_en.json、alarm\_info\_solution\_en.json、alarm\_info\_solution\_zh.json)。对于告警屏蔽配置文件,校验内容包括是否存在重复的@innerid、是否存在重复的innerid、是否存在重复的id+AlarmInstance组合、配置文件格式是否正确以及字段是否有缺失或不在要求的范围内;对于告警信息配置文件,校验内容包括是否存在重复的ID、配置文件格式是否正确以及字段是否有缺失或不在要求的范围内。900 > validate\_alarm\_config.py脚本会校验告警屏蔽配置文件(all\_alarm\_for\_manager.json和all\_alarm\_for\_manager\_web.json)和告警信息配置文件(alarm\_info\_en.json、alarm\_info\_solution\_en.json、alarm\_info\_solution\_zh.json)。对于告警屏蔽配置文件,校验内容包括是否存在重复的@innerid、是否存在重复的innerid、是否存在重复的id+AlarmInstance组合、配置文件格式是否正确以及字段是否有缺失或不在要求的范围内;对于告警信息配置文件,校验内容包括是否存在重复的ID、配置文件格式是否正确以及字段是否有缺失或不在要求的范围内。
892 901 
893 1. 执行以下命令,进入配置文件所在路径。902 1. 执行以下命令,进入配置文件所在路径。
@@ -908,50 +917,50 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
908 import json917 import json
909 import os918 import os
910 import sys919 import sys
911- 920+ 
912 ALARM_INFO_CONFIG = ("alarm_info_en.json", "alarm_info_solution_en.json", "alarm_info_solution_zh.json")921 ALARM_INFO_CONFIG = ("alarm_info_en.json", "alarm_info_solution_en.json", "alarm_info_solution_zh.json")
913 ALARM_INFO_FIELDS = {"id", "name", "dealSuggestion", "detailedInformation", "reason", "impact"}922 ALARM_INFO_FIELDS = {"id", "name", "dealSuggestion", "detailedInformation", "reason", "impact"}
914 ALARM_SHIELD_FIELDS = {"@innerid", "id", "level", "AlarmInstance"}923 ALARM_SHIELD_FIELDS = {"@innerid", "id", "level", "AlarmInstance"}
915 ALARM_SHIELD_WEB_FIELDS = {"innerid", "id", "level", "AlarmInstance"}924 ALARM_SHIELD_WEB_FIELDS = {"innerid", "id", "level", "AlarmInstance"}
916- 925+ 
917- 926+ 
918 class Result:927 class Result:
919 def __init__(self, result: bool, err_msg: str = ""):928 def __init__(self, result: bool, err_msg: str = ""):
920 self._result = result929 self._result = result
921 self._err_msg = err_msg930 self._err_msg = err_msg
922- 931+ 
923 def __bool__(self):932 def __bool__(self):
924 return self._result933 return self._result
925- 934+ 
926 @property935 @property
927 def error(self) -> str:936 def error(self) -> str:
928 return self._err_msg937 return self._err_msg
929- 938+ 
930- 939+ 
931 def check_alarm_id(filename: str, alarm_id: str):940 def check_alarm_id(filename: str, alarm_id: str):
932 if len(alarm_id) != 8:941 if len(alarm_id) != 8:
933 raise Exception(f"{filename}: alarm id length wrong, should be 8")942 raise Exception(f"{filename}: alarm id length wrong, should be 8")
934- 943+ 
935 try:944 try:
936 int(alarm_id, base=16)945 int(alarm_id, base=16)
937 except Exception as err:946 except Exception as err:
938 raise Exception(f"{filename}: alarm id is invalid, reason: {err}")947 raise Exception(f"{filename}: alarm id is invalid, reason: {err}")
939- 948+ 
940- 949+ 
941 def check_alarm_field_range(alarms: list, filename: str, filed_range: set):950 def check_alarm_field_range(alarms: list, filename: str, filed_range: set):
942 for alarm in alarms:951 for alarm in alarms:
943 if not isinstance(alarm, dict):952 if not isinstance(alarm, dict):
944 raise Exception(f"{filename}: alarm info type is wrong, should be map")953 raise Exception(f"{filename}: alarm info type is wrong, should be map")
945- 954+ 
946 if len(alarm.keys()) != len(filed_range):955 if len(alarm.keys()) != len(filed_range):
947 raise Exception(f"{filename}: alarm info miss some fields")956 raise Exception(f"{filename}: alarm info miss some fields")
948- 957+ 
949 if not set(alarm.keys()).issubset(filed_range):958 if not set(alarm.keys()).issubset(filed_range):
950 raise Exception(f"{filename}: alarm info fields is not in range of {filed_range}")959 raise Exception(f"{filename}: alarm info fields is not in range of {filed_range}")
951- 960+ 
952 check_alarm_id(filename, alarm.get("id"))961 check_alarm_id(filename, alarm.get("id"))
953- 962+ 
954- 963+ 
955 def check_alarm_info_config(content: dict, filename: str) -> Result:964 def check_alarm_info_config(content: dict, filename: str) -> Result:
956 """965 """
957 检查告警信息配置文件是否配置正确,检测项包含:告警id是否重复、告警信息格式是否正确以及字段是否缺失或不在要求的字段范围内966 检查告警信息配置文件是否配置正确,检测项包含:告警id是否重复、告警信息格式是否正确以及字段是否缺失或不在要求的字段范围内
@@ -962,39 +971,39 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
962 alarms = content.get("EventSuggestion")971 alarms = content.get("EventSuggestion")
963 if not alarms:972 if not alarms:
964 return Result(False, f"{filename}: EventSuggestion is null")973 return Result(False, f"{filename}: EventSuggestion is null")
965- 974+ 
966 if not isinstance(alarms, list):975 if not isinstance(alarms, list):
967 return Result(False, f"{filename}: EventSuggestion type is wrong, should be list")976 return Result(False, f"{filename}: EventSuggestion type is wrong, should be list")
968- 977+ 
969 try:978 try:
970 check_alarm_field_range(alarms, filename, ALARM_INFO_FIELDS)979 check_alarm_field_range(alarms, filename, ALARM_INFO_FIELDS)
971 except Exception as err:980 except Exception as err:
972 return Result(False, f'{err}')981 return Result(False, f'{err}')
973- 982+ 
974 ids = [alarm.get("id") for alarm in alarms]983 ids = [alarm.get("id") for alarm in alarms]
975 if len(set(ids)) != len(alarms):984 if len(set(ids)) != len(alarms):
976 return Result(False, f"{filename}: have same id, please check")985 return Result(False, f"{filename}: have same id, please check")
977- 986+ 
978 return Result(True)987 return Result(True)
979- 988+ 
980- 989+ 
981 def check_alarm_shield(inner_id: str, alarm_shields: list, filename: str, filed_range: set) -> Result:990 def check_alarm_shield(inner_id: str, alarm_shields: list, filename: str, filed_range: set) -> Result:
982 try:991 try:
983 check_alarm_field_range(alarm_shields, filename, filed_range)992 check_alarm_field_range(alarm_shields, filename, filed_range)
984 except Exception as err:993 except Exception as err:
985 return Result(False, f'{err}')994 return Result(False, f'{err}')
986- 995+ 
987 ids = [alarm_shield.get(inner_id) for alarm_shield in alarm_shields]996 ids = [alarm_shield.get(inner_id) for alarm_shield in alarm_shields]
988 if len(set(ids)) != len(alarm_shields):997 if len(set(ids)) != len(alarm_shields):
989 return Result(False, f"{filename}: have same {inner_id}, please check")998 return Result(False, f"{filename}: have same {inner_id}, please check")
990- 999+ 
991 unique_keys = [f"{alarm_shield.get('id')}-{alarm_shield.get('AlarmInstance')}" for alarm_shield in alarm_shields]1000 unique_keys = [f"{alarm_shield.get('id')}-{alarm_shield.get('AlarmInstance')}" for alarm_shield in alarm_shields]
992 if len(set(unique_keys)) != len(alarm_shields):1001 if len(set(unique_keys)) != len(alarm_shields):
993 return Result(False, f"{filename}: have same unique_key(id-AlarmInstance), please check")1002 return Result(False, f"{filename}: have same unique_key(id-AlarmInstance), please check")
994- 1003+ 
995 return Result(True)1004 return Result(True)
996- 1005+ 
997- 1006+ 
998 def check_alarm_shield_config(content: dict, filename: str) -> Result:1007 def check_alarm_shield_config(content: dict, filename: str) -> Result:
999 """1008 """
1000 检查告警屏蔽配置文件是否正确,检查内容包括是否存在重复的innerid、是否存在重复的告警id+主体、告警屏蔽配置格式是否正确以及字段是否缺失和字段不在要求的字段范围内1009 检查告警屏蔽配置文件是否正确,检查内容包括是否存在重复的innerid、是否存在重复的告警id+主体、告警屏蔽配置格式是否正确以及字段是否缺失和字段不在要求的字段范围内
@@ -1005,23 +1014,23 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1005 lang = content.get("LANG")1014 lang = content.get("LANG")
1006 if not isinstance(lang, dict):1015 if not isinstance(lang, dict):
1007 return Result(False, f"{filename}: LANG type is wrong, should be map")1016 return Result(False, f"{filename}: LANG type is wrong, should be map")
1008- 1017+ 
1009 event_suggestion = lang.get("EventSuggestion")1018 event_suggestion = lang.get("EventSuggestion")
1010 if not event_suggestion:1019 if not event_suggestion:
1011 return Result(False, f"{filename}: EventSuggestion is null")1020 return Result(False, f"{filename}: EventSuggestion is null")
1012- 1021+ 
1013 if not isinstance(event_suggestion, dict):1022 if not isinstance(event_suggestion, dict):
1014 return Result(False, f"{filename}: EventSuggestion type is wrong, should be map")1023 return Result(False, f"{filename}: EventSuggestion type is wrong, should be map")
1015- 1024+ 
1016 alarm_shields = event_suggestion.get("item")1025 alarm_shields = event_suggestion.get("item")
1017 if not alarm_shields:1026 if not alarm_shields:
1018 return Result(False, f"{filename}: item is null")1027 return Result(False, f"{filename}: item is null")
1019 if not isinstance(alarm_shields, list):1028 if not isinstance(alarm_shields, list):
1020 return Result(False, f"{filename}: item type is wrong, should be list")1029 return Result(False, f"{filename}: item type is wrong, should be list")
1021- 1030+ 
1022 return check_alarm_shield("@innerid", alarm_shields, filename, ALARM_SHIELD_FIELDS)1031 return check_alarm_shield("@innerid", alarm_shields, filename, ALARM_SHIELD_FIELDS)
1023- 1032+ 
1024- 1033+ 
1025 def check_alarm_shield_web_config(content: dict, filename: str) -> Result:1034 def check_alarm_shield_web_config(content: dict, filename: str) -> Result:
1026 """1035 """
1027 检查前端告警屏蔽配置文件是否正确,检查内容包括是否存在重复的innerid、是否存在重复的告警id+主体、告警屏蔽配置格式是否正确以及字段是否缺失和字段不在要求的字段范围内1036 检查前端告警屏蔽配置文件是否正确,检查内容包括是否存在重复的innerid、是否存在重复的告警id+主体、告警屏蔽配置格式是否正确以及字段是否缺失和字段不在要求的字段范围内
@@ -1032,13 +1041,13 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1032 alarm_shields = content.get("EventSuggestion")1041 alarm_shields = content.get("EventSuggestion")
1033 if not alarm_shields:1042 if not alarm_shields:
1034 return Result(False, f"{filename}: EventSuggestion is null")1043 return Result(False, f"{filename}: EventSuggestion is null")
1035- 1044+ 
1036 if not isinstance(alarm_shields, list):1045 if not isinstance(alarm_shields, list):
1037 return Result(False, f"{filename}: EventSuggestion type is wrong, should be list")1046 return Result(False, f"{filename}: EventSuggestion type is wrong, should be list")
1038- 1047+ 
1039 return check_alarm_shield("innerid", alarm_shields, filename, ALARM_SHIELD_WEB_FIELDS)1048 return check_alarm_shield("innerid", alarm_shields, filename, ALARM_SHIELD_WEB_FIELDS)
1040- 1049+ 
1041- 1050+ 
1042 def check(config_file_dir: str):1051 def check(config_file_dir: str):
1043 """1052 """
1044 检查告警配置文件配置内容是否正确1053 检查告警配置文件配置内容是否正确
@@ -1054,7 +1063,7 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1054 except Exception as err:1063 except Exception as err:
1055 print(f"read file content of {filename} failed, reason: {err}")1064 print(f"read file content of {filename} failed, reason: {err}")
1056 return1065 return
1057- 1066+ 
1058 if filename in ALARM_INFO_CONFIG:1067 if filename in ALARM_INFO_CONFIG:
1059 ret = check_alarm_info_config(document, filename)1068 ret = check_alarm_info_config(document, filename)
1060 if not ret:1069 if not ret:
@@ -1072,27 +1081,28 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1072 return1081 return
1073 else:1082 else:
1074 raise AssertionError(f"Unknown file: {filename}")1083 raise AssertionError(f"Unknown file: {filename}")
1075- 1084+ 
1076 print(f"The collection of configurations in {config_file_dir} is correct. ")1085 print(f"The collection of configurations in {config_file_dir} is correct. ")
1077- 1086+ 
1078- 1087+ 
1079 if __name__ == "__main__":1088 if __name__ == "__main__":
1080 if len(sys.argv) == 2:1089 if len(sys.argv) == 2:
1081 check(sys.argv[1])1090 check(sys.argv[1])
1082 else:1091 else:
1083 print("The input argument should be the directory of the configuration files")1092 print("The input argument should be the directory of the configuration files")
1084- 1093+ 
1085 ```1094 ```
1086 1095 
10877. 在CMakeLists.txt中编写构建方式。10967. 在CMakeLists.txt中编写构建方式。
1088 1097 
1089- > [!NOTE] 1098+ > [!NOTE]
1099+ >
1090 > 生成的二进制文件名称必须是libcustomized\_alarm.so,否则可能导致OM SDK启动自定义告警组件失败。1100 > 生成的二进制文件名称必须是libcustomized\_alarm.so,否则可能导致OM SDK启动自定义告警组件失败。
1091 1101 
1092 ```cmake1102 ```cmake
1093 #设置CMake的最低版本1103 #设置CMake的最低版本
1094 cmake_minimum_required(VERSION 3.16)1104 cmake_minimum_required(VERSION 3.16)
1095- 1105+ 
1096 #交叉编译选项1106 #交叉编译选项
1097 if (CROSSCOMPILE_ENABLED)1107 if (CROSSCOMPILE_ENABLED)
1098 set(CMAKE_SYSTEM_NAME Linux)1108 set(CMAKE_SYSTEM_NAME Linux)
@@ -1106,7 +1116,7 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1106 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)1116 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
1107 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)1117 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
1108 endif()1118 endif()
1109- 1119+ 
1110 #添加构建的项目名称1120 #添加构建的项目名称
1111 project(customized_alarm)1121 project(customized_alarm)
1112 #将源文件生成名为libcustomized_alarm.so链接文件 STATIC:静态链接 SHARED:动态链接1122 #将源文件生成名为libcustomized_alarm.so链接文件 STATIC:静态链接 SHARED:动态链接
@@ -1117,9 +1127,9 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1117 1127 
1118 ```shell1128 ```shell
1119 #!/bin/bash1129 #!/bin/bash
1120- 1130+ 
1121 CUR_DIR=$(dirname "$(readlink -f "$0")")1131 CUR_DIR=$(dirname "$(readlink -f "$0")")
1122- 1132+ 
1123 function build_customized_alarm()1133 function build_customized_alarm()
1124 {1134 {
1125 echo "build customized alarm ..."1135 echo "build customized alarm ..."
@@ -1128,14 +1138,14 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1128 else1138 else
1129 rm -rf "${CUR_DIR}/build"/*1139 rm -rf "${CUR_DIR}/build"/*
1130 fi1140 fi
1131- 1141+ 
1132 cd "${CUR_DIR}/build"1142 cd "${CUR_DIR}/build"
1133 cmake -DCROSSCOMPILE_ENABLED=ON ..1143 cmake -DCROSSCOMPILE_ENABLED=ON ..
1134 make1144 make
1135 echo "build customized alarm success"1145 echo "build customized alarm success"
1136 return 01146 return 0
1137 }1147 }
1138- 1148+ 
1139 build_customized_alarm1149 build_customized_alarm
1140 RESULT=$?1150 RESULT=$?
1141 exit "${RESULT}"1151 exit "${RESULT}"
@@ -1149,7 +1159,7 @@ OM SDK支持用户进行二次开发,新增自定义告警信息。边缘管
1149 if ! bash "${TOP_DIR}/src/app/add_customized_alarm/build_customized_alarm.sh";then1159 if ! bash "${TOP_DIR}/src/app/add_customized_alarm/build_customized_alarm.sh";then
1150 return 11160 return 1
1151 fi1161 fi
1152- 1162+ 
1153 cp -rf ${TOP_DIR}/src/app/add_customized_alarm/build/libcustomized_alarm.so ${OMSDK_TAR_PATH}/lib/1163 cp -rf ${TOP_DIR}/src/app/add_customized_alarm/build/libcustomized_alarm.so ${OMSDK_TAR_PATH}/lib/
1154 # 覆盖OM SDK软件包中告警相关的配置文件1164 # 覆盖OM SDK软件包中告警相关的配置文件
1155 cp -rf ${TOP_DIR}/src/app/add_customized_alarm/alarm_info_en.json ${OMSDK_TAR_PATH}/config/alarm_info_en.json1165 cp -rf ${TOP_DIR}/src/app/add_customized_alarm/alarm_info_en.json ${OMSDK_TAR_PATH}/config/alarm_info_en.json
@@ -1244,26 +1254,26 @@ routesConfig.json文件内容格式如下,该配置文件参数为固定参数
1244 fi1254 fi
1245 return 01255 return 0
1246 }1256 }
1247- 1257+ 
1248 function copy_config_file() {1258 function copy_config_file() {
1249 if [[ ! -d "${WEB_MANAGER_PATH}/config" ]]; then1259 if [[ ! -d "${WEB_MANAGER_PATH}/config" ]]; then
1250 mkdir -p "${WEB_MANAGER_PATH}/config"1260 mkdir -p "${WEB_MANAGER_PATH}/config"
1251 fi1261 fi
1252- 1262+ 
1253 if ! cp "${CURR_PATH}/${CONFIG_FILENAME}" "${WEB_MANAGER_PATH}/config/${CONFIG_FILENAME}"; then1263 if ! cp "${CURR_PATH}/${CONFIG_FILENAME}" "${WEB_MANAGER_PATH}/config/${CONFIG_FILENAME}"; then
1254 echo "Copy ${CONFIG_FILENAME} failed, please check"1264 echo "Copy ${CONFIG_FILENAME} failed, please check"
1255 return 11265 return 1
1256 fi1266 fi
1257- 1267+ 
1258 if [[ "${OS_NAME}" = "Ubuntu" ]]; then1268 if [[ "${OS_NAME}" = "Ubuntu" ]]; then
1259 chown -R nobody:nogroup "${WEB_MANAGER_PATH}"1269 chown -R nobody:nogroup "${WEB_MANAGER_PATH}"
1260 else1270 else
1261 chown -R nobody:nobody "${WEB_MANAGER_PATH}"1271 chown -R nobody:nobody "${WEB_MANAGER_PATH}"
1262 fi1272 fi
1263- 1273+ 
1264 return 01274 return 0
1265 }1275 }
1266- 1276+ 
1267 function main() {1277 function main() {
1268 WEB_MANAGER_PATH="$1/platform/omsdk/software/nginx/html/manager"1278 WEB_MANAGER_PATH="$1/platform/omsdk/software/nginx/html/manager"
1269 CURR_PATH="$1/src/app/set_customized_web_nav"1279 CURR_PATH="$1/src/app/set_customized_web_nav"
@@ -1271,14 +1281,14 @@ routesConfig.json文件内容格式如下,该配置文件参数为固定参数
1271 echo "Check ${CONFIG_FILENAME} failed."1281 echo "Check ${CONFIG_FILENAME} failed."
1272 return 11282 return 1
1273 fi1283 fi
1274- 1284+ 
1275 if ! copy_config_file; then1285 if ! copy_config_file; then
1276 echo "Copy ${CONFIG_FILENAME} failed."1286 echo "Copy ${CONFIG_FILENAME} failed."
1277 return 11287 return 1
1278 fi1288 fi
1279 return 01289 return 0
1280 }1290 }
1281- 1291+ 
1282 echo -e "\n####################### begin to build customized web nav #####################################\n"1292 echo -e "\n####################### begin to build customized web nav #####################################\n"
1283 main "$@"1293 main "$@"
1284 RESULT=$?1294 RESULT=$?
@@ -1291,7 +1301,7 @@ routesConfig.json文件内容格式如下,该配置文件参数为固定参数
1291 import json1301 import json
1292 import os.path1302 import os.path
1293 import sys1303 import sys
1294- 1304+ 
1295 JSON_FILE = "routesConfig.json"1305 JSON_FILE = "routesConfig.json"
1296 def check_json(curr_path):1306 def check_json(curr_path):
1297 with open(os.path.join(curr_path, JSON_FILE), 'r') as fr:1307 with open(os.path.join(curr_path, JSON_FILE), 'r') as fr:
@@ -1300,24 +1310,24 @@ routesConfig.json文件内容格式如下,该配置文件参数为固定参数
1300 "manager": ("network", "time", "registration", "disk", "alarm", "journal", "update", "reload", "information", "extendModule"),1310 "manager": ("network", "time", "registration", "disk", "alarm", "journal", "update", "reload", "information", "extendModule"),
1301 "setting": ("safety",)1311 "setting": ("safety",)
1302 }1312 }
1303- 1313+ 
1304 for key in config_fields.keys():1314 for key in config_fields.keys():
1305 if key not in routes_config.keys():1315 if key not in routes_config.keys():
1306 print("Check %s failed, because [%s] not in %s" % (JSON_FILE, key, JSON_FILE))1316 print("Check %s failed, because [%s] not in %s" % (JSON_FILE, key, JSON_FILE))
1307 return False1317 return False
1308- 1318+ 
1309 for sub_key in config_fields[key]:1319 for sub_key in config_fields[key]:
1310 if sub_key not in routes_config[key]:1320 if sub_key not in routes_config[key]:
1311 print("Check %s failed, because [%s] not in %s" % (JSON_FILE, sub_key, key))1321 print("Check %s failed, because [%s] not in %s" % (JSON_FILE, sub_key, key))
1312 return False1322 return False
1313- 1323+ 
1314 if not isinstance(routes_config[key][sub_key], bool):1324 if not isinstance(routes_config[key][sub_key], bool):
1315 print("Check %s failed, because the type of [%s] is invalid" % (JSON_FILE, sub_key))1325 print("Check %s failed, because the type of [%s] is invalid" % (JSON_FILE, sub_key))
1316 return False1326 return False
1317- 1327+ 
1318 return True1328 return True
1319- 1329+ 
1320- 1330+ 
1321 if __name__ == "__main__":1331 if __name__ == "__main__":
1322 curr_path = sys.argv[1]1332 curr_path = sys.argv[1]
1323 if check_json(curr_path):1333 if check_json(curr_path):
@@ -1345,15 +1355,15 @@ routesConfig.json文件内容格式如下,该配置文件参数为固定参数
1345 1355 
1346默认情况下,边缘管理系统的Web界面的管理功能模块包括网络配置、时间配置、网管注册、存储配置、告警信息、日志收集、固件升级、复位控制和系统信息,如[图1](#fig1538525124413)所示;设置功能模块只有安全策略,如[图2](#fig11140735463)所示。1356默认情况下,边缘管理系统的Web界面的管理功能模块包括网络配置、时间配置、网管注册、存储配置、告警信息、日志收集、固件升级、复位控制和系统信息,如[图1](#fig1538525124413)所示;设置功能模块只有安全策略,如[图2](#fig11140735463)所示。
1347 1357 
1348-**图 1** 管理功能模块<a id="fig1538525124413"></a> 1358+**图 1** 管理功能模块<a id="fig1538525124413"></a>
1349![](..//figures/管理功能模块.png "管理功能模块")1359![](..//figures/管理功能模块.png "管理功能模块")
1350 1360 
1351-**图 2** 设置功能模块<a id="fig11140735463"></a> 1361+**图 2** 设置功能模块<a id="fig11140735463"></a>
1352![](../figures/设置功能模块.png "设置功能模块")1362![](../figures/设置功能模块.png "设置功能模块")
1353 1363 
1354通过自定义加载组件,并对routesConfig.json进行配置后,边缘管理系统的Web界面将不显示“时间配置”、“告警信息”和“复位控制”,如[图3](#fig17321410144911)所示。1364通过自定义加载组件,并对routesConfig.json进行配置后,边缘管理系统的Web界面将不显示“时间配置”、“告警信息”和“复位控制”,如[图3](#fig17321410144911)所示。
1355 1365 
1356-**图 3** 配置后显示图<a id="fig17321410144911"></a> 1366+**图 3** 配置后显示图<a id="fig17321410144911"></a>
1357![](../figures/配置后显示图.png "配置后显示图")1367![](../figures/配置后显示图.png "配置后显示图")
1358 1368 
1359routesConfig.json的配置示例如下。1369routesConfig.json的配置示例如下。
@@ -1529,12 +1539,12 @@ OM SDK定义了一组固定的驱动接口支持拓展模组的开发;开发
1529 1539 
1530TLV是一种可变格式:Type表示属性ID、Length表示属性长度、Value表示属性值。其中Type和Length的长度固定为4字节,Value的长度根据属性类别的不同,长度可变;具体解析方式如下图所示。1540TLV是一种可变格式:Type表示属性ID、Length表示属性长度、Value表示属性值。其中Type和Length的长度固定为4字节,Value的长度根据属性类别的不同,长度可变;具体解析方式如下图所示。
1531 1541 
1532-**图 1** TLV解析图<a name="fig1467318222143"></a> 1542+**图 1** TLV解析图<a name="fig1467318222143"></a>
1533![](../figures/TLV解析图.png "TLV解析图")1543![](../figures/TLV解析图.png "TLV解析图")
1534 1544 
1535JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子属性的TLV格式编码的大小;Value属性部分需要再次进行TLV解析,使用偏移量的方式,循环进行JSON子属性的TLV解析,直到Value部分解析完成。具体解析方式如下图所示。1545JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子属性的TLV格式编码的大小;Value属性部分需要再次进行TLV解析,使用偏移量的方式,循环进行JSON子属性的TLV解析,直到Value部分解析完成。具体解析方式如下图所示。
1536 1546 
1537-**图 2** JSON属性的二重TLV解析<a name="fig1868911580442"></a> 1547+**图 2** JSON属性的二重TLV解析<a name="fig1868911580442"></a>
1538![](../figures/JSON属性的二重TLV解析.png "JSON属性的二重TLV解析")1548![](../figures/JSON属性的二重TLV解析.png "JSON属性的二重TLV解析")
1539 1549 
1540#### set\_attribute<a name="ZH-CN_TOPIC_0000001628729901"></a>1550#### set\_attribute<a name="ZH-CN_TOPIC_0000001628729901"></a>
@@ -1622,7 +1632,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1622 1632 
1623按照指定的“device\_name\_len”参数长度,通过首地址偏移的方式,将设备名保存在buff的指定内存段中,具体实现如下图所示。确保设备名的长度不大于指定“device\_name\_len”的最大长度;确保buff的空间大于保存该模组的所有设备信息所用空间。1633按照指定的“device\_name\_len”参数长度,通过首地址偏移的方式,将设备名保存在buff的指定内存段中,具体实现如下图所示。确保设备名的长度不大于指定“device\_name\_len”的最大长度;确保buff的空间大于保存该模组的所有设备信息所用空间。
1624 1634 
1625-**图 1** buff解析图<a name="fig19130645647"></a> 1635+**图 1** buff解析图<a name="fig19130645647"></a>
1626![](../figures/buff解析图.png "buff解析图")1636![](../figures/buff解析图.png "buff解析图")
1627 1637 
1628### 开发示例<a name="ZH-CN_TOPIC_0000001578489832"></a>1638### 开发示例<a name="ZH-CN_TOPIC_0000001578489832"></a>
@@ -1660,16 +1670,16 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1660 import json1670 import json
1661 import os1671 import os
1662 import sys1672 import sys
1663- 1673+ 
1664- 1674+ 
1665 PRODUCT_NAME = 'product_specification.json'1675 PRODUCT_NAME = 'product_specification.json'
1666 MAX_ATTRIBUTE_LEVEL = 21676 MAX_ATTRIBUTE_LEVEL = 2
1667 MAX_ATTRIBUTE_NUMBER = 501677 MAX_ATTRIBUTE_NUMBER = 50
1668 MODULE_CATEGORY = ('internal', 'extend', 'addition')1678 MODULE_CATEGORY = ('internal', 'extend', 'addition')
1669 ATTRIBUTE_VALUE_TYPE = ('bool', 'float', 'int', 'json', 'long long', 'string')1679 ATTRIBUTE_VALUE_TYPE = ('bool', 'float', 'int', 'json', 'long long', 'string')
1670 ATTRIBUTE_ACCESS_MODE = ('Read', 'Write', 'ReadWrite','ReadHide', 'WriteHide', 'ReadWriteHide')1680 ATTRIBUTE_ACCESS_MODE = ('Read', 'Write', 'ReadWrite','ReadHide', 'WriteHide', 'ReadWriteHide')
1671- 1681+ 
1672- 1682+ 
1673 def check(config_file_dir: str):1683 def check(config_file_dir: str):
1674 """1684 """
1675 :param config_file_dir:1685 :param config_file_dir:
@@ -1679,20 +1689,20 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1679 for filename in os.listdir(config_file_dir):1689 for filename in os.listdir(config_file_dir):
1680 if not filename.endswith('json'):1690 if not filename.endswith('json'):
1681 continue1691 continue
1682- 1692+ 
1683 with open(os.path.join(config_file_dir, filename)) as stream:1693 with open(os.path.join(config_file_dir, filename)) as stream:
1684 document = json.load(stream)1694 document = json.load(stream)
1685- 1695+ 
1686 if filename == PRODUCT_NAME:1696 if filename == PRODUCT_NAME:
1687 check_product(document)1697 check_product(document)
1688 elif filename.startswith('module'):1698 elif filename.startswith('module'):
1689 check_module(document)1699 check_module(document)
1690 else:1700 else:
1691 raise AssertionError(f'Unknown file: "{filename}"')1701 raise AssertionError(f'Unknown file: "{filename}"')
1692- 1702+ 
1693 print(f'The collection of configurations in {config_file_dir} is correct. ')1703 print(f'The collection of configurations in {config_file_dir} is correct. ')
1694- 1704+ 
1695- 1705+ 
1696 def check_product(doc: dict) -> int:1706 def check_product(doc: dict) -> int:
1697 """1707 """
1698 :param doc: product specification1708 :param doc: product specification
@@ -1705,7 +1715,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1705 for module, module_spec in modules.items():1715 for module, module_spec in modules.items():
1706 assert isinstance(module, str), 'key in modules should be a string'1716 assert isinstance(module, str), 'key in modules should be a string'
1707 assert isinstance(module_spec, dict), 'value in modules should be a dict'1717 assert isinstance(module_spec, dict), 'value in modules should be a dict'
1708- 1718+ 
1709 devices = module_spec.get('devices')1719 devices = module_spec.get('devices')
1710 if devices is None:1720 if devices is None:
1711 raise AssertionError(f'devices not exist in module {module}')1721 raise AssertionError(f'devices not exist in module {module}')
@@ -1716,47 +1726,47 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1716 return len(modules)1726 return len(modules)
1717 else:1727 else:
1718 raise AssertionError('no modules found in product specification')1728 raise AssertionError('no modules found in product specification')
1719- 1729+ 
1720- 1730+ 
1721 def check_module(doc: dict) -> str:1731 def check_module(doc: dict) -> str:
1722 """1732 """
1723 :param doc: module specification1733 :param doc: module specification
1724 :return: module name1734 :return: module name
1725 """1735 """
1726 assert isinstance(doc, dict), 'module specification file structure error: outermost layer should be a map'1736 assert isinstance(doc, dict), 'module specification file structure error: outermost layer should be a map'
1727- 1737+ 
1728 module_name = doc.get('name')1738 module_name = doc.get('name')
1729 assert module_name is not None, f'no name in {doc}'1739 assert module_name is not None, f'no name in {doc}'
1730 assert isinstance(module_name, str), 'module name should be a string'1740 assert isinstance(module_name, str), 'module name should be a string'
1731- 1741+ 
1732 _id = doc.get('id')1742 _id = doc.get('id')
1733 assert _id is not None, f'no id in module {module_name}'1743 assert _id is not None, f'no id in module {module_name}'
1734 assert isinstance(_id, int), 'module id should be an integer'1744 assert isinstance(_id, int), 'module id should be an integer'
1735- 1745+ 
1736 category = doc.get('category')1746 category = doc.get('category')
1737 if category:1747 if category:
1738 assert isinstance(category, str), 'module category should be a string'1748 assert isinstance(category, str), 'module category should be a string'
1739 assert category in MODULE_CATEGORY, f'invalid category: {category}'1749 assert category in MODULE_CATEGORY, f'invalid category: {category}'
1740 else:1750 else:
1741 raise AssertionError(f'no category found in module {module_name}')1751 raise AssertionError(f'no category found in module {module_name}')
1742- 1752+ 
1743 driver = doc.get('driver')1753 driver = doc.get('driver')
1744 assert driver is not None, f'no driver found in module {module_name}'1754 assert driver is not None, f'no driver found in module {module_name}'
1745 assert isinstance(driver, str), 'module driver should be a string'1755 assert isinstance(driver, str), 'module driver should be a string'
1746- 1756+ 
1747 dynamic = doc.get('dynamic')1757 dynamic = doc.get('dynamic')
1748 assert dynamic is not None, f'no dynamic found in module {module_name}'1758 assert dynamic is not None, f'no dynamic found in module {module_name}'
1749 assert isinstance(dynamic, bool), 'dynamic should be a boolean value'1759 assert isinstance(dynamic, bool), 'dynamic should be a boolean value'
1750- 1760+ 
1751 attributes = doc.get('attributes')1761 attributes = doc.get('attributes')
1752 if attributes:1762 if attributes:
1753 check_attributes(attributes)1763 check_attributes(attributes)
1754 else:1764 else:
1755 raise AssertionError(f'no attributes found in module {module_name}')1765 raise AssertionError(f'no attributes found in module {module_name}')
1756- 1766+ 
1757 return module_name1767 return module_name
1758- 1768+ 
1759- 1769+ 
1760 def check_attributes(attributes: dict, level=1):1770 def check_attributes(attributes: dict, level=1):
1761 """1771 """
1762 :param attributes: a map whose keys are attribute names and values are attribute specifications1772 :param attributes: a map whose keys are attribute names and values are attribute specifications
@@ -1766,37 +1776,37 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1766 assert isinstance(attributes, dict), 'module specification file structure error: attributes should be a map'1776 assert isinstance(attributes, dict), 'module specification file structure error: attributes should be a map'
1767 assert len(attributes) <= MAX_ATTRIBUTE_NUMBER, f'number of attributes exceeds limit ({MAX_ATTRIBUTE_NUMBER})'1777 assert len(attributes) <= MAX_ATTRIBUTE_NUMBER, f'number of attributes exceeds limit ({MAX_ATTRIBUTE_NUMBER})'
1768 assert level <= MAX_ATTRIBUTE_LEVEL, 'recursive subAttributes level exceeds limit'1778 assert level <= MAX_ATTRIBUTE_LEVEL, 'recursive subAttributes level exceeds limit'
1769- 1779+ 
1770 for attr_name, doc in attributes.items():1780 for attr_name, doc in attributes.items():
1771 _id = doc.get('id')1781 _id = doc.get('id')
1772 assert _id is not None, f'no id in attribute {attr_name}'1782 assert _id is not None, f'no id in attribute {attr_name}'
1773 assert isinstance(_id, int), 'attribute id should be an integer'1783 assert isinstance(_id, int), 'attribute id should be an integer'
1774- 1784+ 
1775 value_type = doc.get('type')1785 value_type = doc.get('type')
1776 if value_type:1786 if value_type:
1777 assert isinstance(value_type, str), 'attribute value type should be a string'1787 assert isinstance(value_type, str), 'attribute value type should be a string'
1778 assert value_type in ATTRIBUTE_VALUE_TYPE, f'invalid value type {value_type}'1788 assert value_type in ATTRIBUTE_VALUE_TYPE, f'invalid value type {value_type}'
1779 else:1789 else:
1780 raise AssertionError(f'no type in attribute {attr_name}')1790 raise AssertionError(f'no type in attribute {attr_name}')
1781- 1791+ 
1782 access_mode = doc.get('accessMode')1792 access_mode = doc.get('accessMode')
1783 if access_mode:1793 if access_mode:
1784 assert isinstance(access_mode, str), 'attribute access mode should be a string'1794 assert isinstance(access_mode, str), 'attribute access mode should be a string'
1785 assert access_mode in ATTRIBUTE_ACCESS_MODE, f'invalid access mode {access_mode}'1795 assert access_mode in ATTRIBUTE_ACCESS_MODE, f'invalid access mode {access_mode}'
1786 else:1796 else:
1787 raise AssertionError(f'no accessMode in attribute {attr_name}')1797 raise AssertionError(f'no accessMode in attribute {attr_name}')
1788- 1798+ 
1789 attributes = doc.get('subAttributes')1799 attributes = doc.get('subAttributes')
1790 if attributes:1800 if attributes:
1791 check_attributes(attributes, level=level + 1)1801 check_attributes(attributes, level=level + 1)
1792- 1802+ 
1793- 1803+ 
1794 if __name__ == '__main__':1804 if __name__ == '__main__':
1795 if len(sys.argv) == 2:1805 if len(sys.argv) == 2:
1796 check(sys.argv[1])1806 check(sys.argv[1])
1797 else:1807 else:
1798 print('The input argument should be the directory of the configuration files')1808 print('The input argument should be the directory of the configuration files')
1799- 1809+ 
1800 ```1810 ```
1801 1811 
1802 检查内容包括:1812 检查内容包括:
@@ -1811,15 +1821,15 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1811 ```c1821 ```c
1812 #ifndef __DEMO_MODULE_H__1822 #ifndef __DEMO_MODULE_H__
1813 #define __DEMO_MODULE_H__1823 #define __DEMO_MODULE_H__
1814- 1824+ 
1815 #define DEVICE_MAP_MAX_LEN 2 /* 保存模组设备的最大个数 */1825 #define DEVICE_MAP_MAX_LEN 2 /* 保存模组设备的最大个数 */
1816 #define DEVICE_INFO_MAX_LEN 64 /* 保存模组信息的最大长度 */1826 #define DEVICE_INFO_MAX_LEN 64 /* 保存模组信息的最大长度 */
1817 #define TLV_HEADER_LENGTH 81827 #define TLV_HEADER_LENGTH 8
1818- 1828+ 
1819 /* 定义属性ID类型 0:基础通用属性 1:模组特有属性 */1829 /* 定义属性ID类型 0:基础通用属性 1:模组特有属性 */
1820 #define BASE_CLASS_ID 0x001830 #define BASE_CLASS_ID 0x00
1821 #define MODULE_CLASS_ID 0x011831 #define MODULE_CLASS_ID 0x01
1822- 1832+ 
1823 /* 定义模组管理的属性 */1833 /* 定义模组管理的属性 */
1824 typedef enum demo_attribute_id {1834 typedef enum demo_attribute_id {
1825 NAME = ((BASE_CLASS_ID) << 16) + 1, /* 名称 string */1835 NAME = ((BASE_CLASS_ID) << 16) + 1, /* 名称 string */
@@ -1832,25 +1842,25 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1832 VERSION = ((MODULE_CLASS_ID) << 16) + 6, /* 版本 string */1842 VERSION = ((MODULE_CLASS_ID) << 16) + 6, /* 版本 string */
1833 SIGNAL_INFO = ((MODULE_CLASS_ID) << 16) + 7 /* 信号信息 json */1843 SIGNAL_INFO = ((MODULE_CLASS_ID) << 16) + 7 /* 信号信息 json */
1834 } DEMO_ATTRIBUTE_ID;1844 } DEMO_ATTRIBUTE_ID;
1835- 1845+ 
1836 /* 定义json属性中的子属性ID */1846 /* 定义json属性中的子属性ID */
1837 typedef enum sub_attribute_id {1847 typedef enum sub_attribute_id {
1838 SUB_ATTRIBUTE1 = 1,1848 SUB_ATTRIBUTE1 = 1,
1839 SUB_ATTRIBUTE2 = 21849 SUB_ATTRIBUTE2 = 2
1840 } SUB_ATTRIBUTE_ID;1850 } SUB_ATTRIBUTE_ID;
1841- 1851+ 
1842 /* 定义模拟json属性的结构体 */1852 /* 定义模拟json属性的结构体 */
1843 typedef struct demo_signal_info {1853 typedef struct demo_signal_info {
1844 char signal_type[DEVICE_INFO_MAX_LEN]; /* 类型 string */1854 char signal_type[DEVICE_INFO_MAX_LEN]; /* 类型 string */
1845 char signal_strength[DEVICE_INFO_MAX_LEN]; /* 强度 string */1855 char signal_strength[DEVICE_INFO_MAX_LEN]; /* 强度 string */
1846 } DEMO_SIGNAL_INFO;1856 } DEMO_SIGNAL_INFO;
1847- 1857+ 
1848 /* 定义保存的设备 */1858 /* 定义保存的设备 */
1849 typedef struct demo_device_map {1859 typedef struct demo_device_map {
1850 char name[DEVICE_INFO_MAX_LEN];1860 char name[DEVICE_INFO_MAX_LEN];
1851 int fd;1861 int fd;
1852 } DEMO_DEVICE_MAP;1862 } DEMO_DEVICE_MAP;
1853- 1863+ 
1854 /* 定义设备各属性,用于模拟设备属性的获取和设置 */1864 /* 定义设备各属性,用于模拟设备属性的获取和设置 */
1855 typedef struct device {1865 typedef struct device {
1856 char name[DEVICE_INFO_MAX_LEN];1866 char name[DEVICE_INFO_MAX_LEN];
@@ -1863,19 +1873,19 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1863 char version[DEVICE_INFO_MAX_LEN];1873 char version[DEVICE_INFO_MAX_LEN];
1864 DEMO_SIGNAL_INFO* signal_info;1874 DEMO_SIGNAL_INFO* signal_info;
1865 } DEVICE;1875 } DEVICE;
1866- 1876+ 
1867 /* 定义保存的模组列表 */1877 /* 定义保存的模组列表 */
1868 typedef struct demo_device_ctl {1878 typedef struct demo_device_ctl {
1869 DEMO_DEVICE_MAP device_map[DEVICE_MAP_MAX_LEN];1879 DEMO_DEVICE_MAP device_map[DEVICE_MAP_MAX_LEN];
1870 } DEMO_DEVICE_CTRL;1880 } DEMO_DEVICE_CTRL;
1871- 1881+ 
1872 /* 定义TLV解析结构体 */1882 /* 定义TLV解析结构体 */
1873 typedef struct attr_tlv_struct {1883 typedef struct attr_tlv_struct {
1874 int type;1884 int type;
1875 int len;1885 int len;
1876 char value[0];1886 char value[0];
1877 } ATTR_TLV;1887 } ATTR_TLV;
1878- 1888+ 
1879 /* 定义驱动提供的对外接口 */1889 /* 定义驱动提供的对外接口 */
1880 int dev_load();1890 int dev_load();
1881 int dev_unload();1891 int dev_unload();
@@ -1886,7 +1896,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1886 int dev_read(int fd, unsigned int buffSize, unsigned char *buff);1896 int dev_read(int fd, unsigned int buffSize, unsigned char *buff);
1887 int dev_write(int fd, unsigned int buffSize, unsigned char *buff);1897 int dev_write(int fd, unsigned int buffSize, unsigned char *buff);
1888 int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len);1898 int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len);
1889- 1899+ 
1890 #endif1900 #endif
1891 ```1901 ```
1892 1902 
@@ -1896,35 +1906,35 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1896 #include <stdio.h>1906 #include <stdio.h>
1897 #include <stdlib.h>1907 #include <stdlib.h>
1898 #include <string.h>1908 #include <string.h>
1899- 1909+ 
1900 #include <dlfcn.h>1910 #include <dlfcn.h>
1901 #include <pthread.h>1911 #include <pthread.h>
1902 #include <unistd.h>1912 #include <unistd.h>
1903- 1913+ 
1904 #include "demo_module.h"1914 #include "demo_module.h"
1905- 1915+ 
1906 #ifdef __cplusplus1916 #ifdef __cplusplus
1907 #if __cplusplus1917 #if __cplusplus
1908 extern "C" {1918 extern "C" {
1909 #endif1919 #endif
1910 #endif1920 #endif
1911- 1921+ 
1912 /* 结构体指针g_demo_ctrl保存模组设备信息 */1922 /* 结构体指针g_demo_ctrl保存模组设备信息 */
1913 static DEMO_DEVICE_CTRL *g_demo_ctrl = NULL;1923 static DEMO_DEVICE_CTRL *g_demo_ctrl = NULL;
1914- 1924+ 
1915 /* 定义支持的设备名 */1925 /* 定义支持的设备名 */
1916 char* g_devices_name[DEVICE_MAP_MAX_LEN] = {1926 char* g_devices_name[DEVICE_MAP_MAX_LEN] = {
1917 "extend_device01",1927 "extend_device01",
1918 "extend_device02"1928 "extend_device02"
1919 };1929 };
1920- 1930+ 
1921 /* 定义支持的设备, 用于模拟模组各属性类型的获取与设置 */1931 /* 定义支持的设备, 用于模拟模组各属性类型的获取与设置 */
1922 DEMO_SIGNAL_INFO signal1 = {"4g", "strong"};1932 DEMO_SIGNAL_INFO signal1 = {"4g", "strong"};
1923 DEMO_SIGNAL_INFO signal2 = {"5g", "weak"};1933 DEMO_SIGNAL_INFO signal2 = {"5g", "weak"};
1924 DEVICE device1 = {"extend_name", "extend_class", 1, 52, 1.0, 0, 51200000, "extend 1.0", &signal1};1934 DEVICE device1 = {"extend_name", "extend_class", 1, 52, 1.0, 0, 51200000, "extend 1.0", &signal1};
1925 DEVICE device2 = {"extend_name", "extend_class", 1, 52, 1.0, 1, 51200000, "extend 1.0", &signal2};1935 DEVICE device2 = {"extend_name", "extend_class", 1, 52, 1.0, 1, 51200000, "extend 1.0", &signal2};
1926 DEVICE* g_devices[DEVICE_MAP_MAX_LEN] = {&device1, &device2};1936 DEVICE* g_devices[DEVICE_MAP_MAX_LEN] = {&device1, &device2};
1927- 1937+ 
1928 /* 驱动适配资源加载以及模组初始化接口 */1938 /* 驱动适配资源加载以及模组初始化接口 */
1929 int dev_load()1939 int dev_load()
1930 {1940 {
@@ -1933,7 +1943,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1933 if (g_demo_ctrl == NULL) {1943 if (g_demo_ctrl == NULL) {
1934 return -1;1944 return -1;
1935 }1945 }
1936- 1946+ 
1937 /* 初始化模组设备信息,生成区分设备的不同fd值以及 */1947 /* 初始化模组设备信息,生成区分设备的不同fd值以及 */
1938 for (int index = 0; index < DEVICE_MAP_MAX_LEN; index++) {1948 for (int index = 0; index < DEVICE_MAP_MAX_LEN; index++) {
1939 g_demo_ctrl->device_map[index].fd = index;1949 g_demo_ctrl->device_map[index].fd = index;
@@ -1945,7 +1955,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1945 }1955 }
1946 return 0;1956 return 0;
1947 }1957 }
1948- 1958+ 
1949 /* 驱动适配资源释放接口 */1959 /* 驱动适配资源释放接口 */
1950 int dev_unload()1960 int dev_unload()
1951 {1961 {
@@ -1956,7 +1966,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1956 g_demo_ctrl = NULL;1966 g_demo_ctrl = NULL;
1957 return 0;1967 return 0;
1958 }1968 }
1959- 1969+ 
1960 /* 驱动适配设备打开接口,根据输入的设备名name,返回得到设备标识符fd */1970 /* 驱动适配设备打开接口,根据输入的设备名name,返回得到设备标识符fd */
1961 int dev_open(char *name, int *fd)1971 int dev_open(char *name, int *fd)
1962 {1972 {
@@ -1973,7 +1983,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1973 }1983 }
1974 return -1;1984 return -1;
1975 }1985 }
1976- 1986+ 
1977 /* 驱动适配设备关闭接口,根据输入的fd设备标识符关闭对应设备 */1987 /* 驱动适配设备关闭接口,根据输入的fd设备标识符关闭对应设备 */
1978 int dev_close(int fd)1988 int dev_close(int fd)
1979 {1989 {
@@ -1988,7 +1998,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
1988 }1998 }
1989 return 0;1999 return 0;
1990 }2000 }
1991- 2001+ 
1992 /* json类型数据获取封装接口,将TLV编码解析的value进行TLV解析以完成json属性获取 */2002 /* json类型数据获取封装接口,将TLV编码解析的value进行TLV解析以完成json属性获取 */
1993 static int get_json_attribute(int buffSize, char *buff, DEVICE* device)2003 static int get_json_attribute(int buffSize, char *buff, DEVICE* device)
1994 {2004 {
@@ -2018,7 +2028,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2018 }2028 }
2019 return 0;2029 return 0;
2020 }2030 }
2021- 2031+ 
2022 /* 驱动适配属性获取接口,将模组属性保存到TLV编码解析的buff中 */2032 /* 驱动适配属性获取接口,将模组属性保存到TLV编码解析的buff中 */
2023 int get_attribute(int fd, unsigned int buffSize, unsigned char *buff)2033 int get_attribute(int fd, unsigned int buffSize, unsigned char *buff)
2024 {2034 {
@@ -2034,10 +2044,10 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2034 /* 若存在该设备,则根据TLV解析获取该设备属性,若不存在该设备,返回错误码 */2044 /* 若存在该设备,则根据TLV解析获取该设备属性,若不存在该设备,返回错误码 */
2035 return -1;2045 return -1;
2036 }2046 }
2037- 2047+ 
2038 /* 将输入的获取到模组属性的内存进行TLV转换进行解析 */2048 /* 将输入的获取到模组属性的内存进行TLV转换进行解析 */
2039 ATTR_TLV *demo_attr = (ATTR_TLV *)buff;2049 ATTR_TLV *demo_attr = (ATTR_TLV *)buff;
2040- 2050+ 
2041 /* 使用switch case方法确定需要获取的模组属性,并将对应模组属性保存在buff内存段中 */2051 /* 使用switch case方法确定需要获取的模组属性,并将对应模组属性保存在buff内存段中 */
2042 switch (demo_attr->type) {2052 switch (demo_attr->type) {
2043 /* case中模组属性ID与模组配置json文件保持一致 */2053 /* case中模组属性ID与模组配置json文件保持一致 */
@@ -2083,7 +2093,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2083 }2093 }
2084 return 0;2094 return 0;
2085 }2095 }
2086- 2096+ 
2087 /* json类型数据设置封装接口,将TLV编码解析的value进行TLV解析完成json属性设置 */2097 /* json类型数据设置封装接口,将TLV编码解析的value进行TLV解析完成json属性设置 */
2088 static int set_json_attribute(int buffSize, char *buff, DEVICE* device)2098 static int set_json_attribute(int buffSize, char *buff, DEVICE* device)
2089 {2099 {
@@ -2111,7 +2121,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2111 }2121 }
2112 return 0;2122 return 0;
2113 }2123 }
2114- 2124+ 
2115 /* 驱动适配属性设置接口,将TLV编码解析的buff中的属性值进行设置 */2125 /* 驱动适配属性设置接口,将TLV编码解析的buff中的属性值进行设置 */
2116 int set_attribute(int fd, unsigned int buffSize, unsigned char *buff)2126 int set_attribute(int fd, unsigned int buffSize, unsigned char *buff)
2117 {2127 {
@@ -2127,10 +2137,10 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2127 /* 若存在该设备,则根据TLV解析获取该设备属性,若不存在该设备,返回错误码 */2137 /* 若存在该设备,则根据TLV解析获取该设备属性,若不存在该设备,返回错误码 */
2128 return -1;2138 return -1;
2129 }2139 }
2130- 2140+ 
2131 /* 将输入的获取到模组属性的内存进行TLV转换进行解析 */2141 /* 将输入的获取到模组属性的内存进行TLV转换进行解析 */
2132 ATTR_TLV *demo_attr = (ATTR_TLV *)buff;2142 ATTR_TLV *demo_attr = (ATTR_TLV *)buff;
2133- 2143+ 
2134 /* 使用switch case方法确定需要设置的模组属性,并将buff内存段中对应的属性值保存在模组中 */2144 /* 使用switch case方法确定需要设置的模组属性,并将buff内存段中对应的属性值保存在模组中 */
2135 switch (demo_attr->type) {2145 switch (demo_attr->type) {
2136 /* case中模组属性ID与模组配置json文件保持一致 */2146 /* case中模组属性ID与模组配置json文件保持一致 */
@@ -2167,19 +2177,19 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2167 }2177 }
2168 return 0;2178 return 0;
2169 }2179 }
2170- 2180+ 
2171 /* 驱动适配预留读接口,暂不设计开发使用 */2181 /* 驱动适配预留读接口,暂不设计开发使用 */
2172 int dev_read(int fd, unsigned int buffSize, unsigned char *buff)2182 int dev_read(int fd, unsigned int buffSize, unsigned char *buff)
2173 {2183 {
2174 return 0;2184 return 0;
2175 }2185 }
2176- 2186+ 
2177 /* 驱动适配预留写接口,暂不设计开发使用 */2187 /* 驱动适配预留写接口,暂不设计开发使用 */
2178 int dev_write(int fd, unsigned int buffSize, unsigned char *buff)2188 int dev_write(int fd, unsigned int buffSize, unsigned char *buff)
2179 {2189 {
2180 return 0;2190 return 0;
2181 }2191 }
2182- 2192+ 
2183 /* 可热插拔设备的模组接口,用于获取指定设备类型的设备列表。当模组信息实时变化的情况下,使用此接口刷新模组设备信息 */2193 /* 可热插拔设备的模组接口,用于获取指定设备类型的设备列表。当模组信息实时变化的情况下,使用此接口刷新模组设备信息 */
2184 int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len)2194 int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len)
2185 {2195 {
@@ -2200,7 +2210,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2200 }2210 }
2201 return 0;2211 return 0;
2202 }2212 }
2203- 2213+ 
2204 #ifdef __cplusplus2214 #ifdef __cplusplus
2205 #if __cplusplus2215 #if __cplusplus
2206 }2216 }
@@ -2214,7 +2224,7 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2214 ```text2224 ```text
2215 #设置CMake的最低版本2225 #设置CMake的最低版本
2216 cmake_minimum_required(VERSION 3.16)2226 cmake_minimum_required(VERSION 3.16)
2217- 2227+ 
2218 #交叉编译选项2228 #交叉编译选项
2219 if (CROSSCOMPILE_ENABLED)2229 if (CROSSCOMPILE_ENABLED)
2220 set(CMAKE_SYSTEM_NAME Linux)2230 set(CMAKE_SYSTEM_NAME Linux)
@@ -2230,12 +2240,12 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2230 endif()2240 endif()
2231 #添加构建的项目名称2241 #添加构建的项目名称
2232 project(libdemo_adapter)2242 project(libdemo_adapter)
2233- 2243+ 
2234 set(TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)2244 set(TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
2235- 2245+ 
2236 #在目录中查找所有源文件2246 #在目录中查找所有源文件
2237 aux_source_directory(. SRC_LIST)2247 aux_source_directory(. SRC_LIST)
2238- 2248+ 
2239 #将源文件生成名为libdemo_adapter.so链接文件 STATIC:静态链接 SHARED:动态链接2249 #将源文件生成名为libdemo_adapter.so链接文件 STATIC:静态链接 SHARED:动态链接
2240 add_library(demo_adapter SHARED ${SRC_LIST})2250 add_library(demo_adapter SHARED ${SRC_LIST})
2241 ```2251 ```
@@ -2245,9 +2255,9 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
2245 2255 
2246 ```shell2256 ```shell
2247 #!/bin/bash2257 #!/bin/bash
2248- 2258+ 
2249 CUR_DIR=$(dirname "$(readlink -f "$0")")2259 CUR_DIR=$(dirname "$(readlink -f "$0")")
2250- 2260+ 
2251 function main()2261 function main()
2252 {2262 {
2253 echo "build demo adapter lib..."2263 echo "build demo adapter lib..."
@@ -2293,12 +2303,12 @@ JSON类型的属性存在多个子属性,JSON属性的Value大小为所有子
22931. 登录边缘管理系统的Web界面。23031. 登录边缘管理系统的Web界面。
22942. 在主菜单中选择“管理 \> 扩展模组”,进入“扩展模组”界面,查看扩展的模组、模组的设备和设备的属性,包括属性名、属性类型和属性值等信息。23042. 在主菜单中选择“管理 \> 扩展模组”,进入“扩展模组”界面,查看扩展的模组、模组的设备和设备的属性,包括属性名、属性类型和属性值等信息。
2295 2305 
2296- **图 1** 扩展模组<a name="fig159681655193519"></a> 2306+ **图 1** 扩展模组<a name="fig159681655193519"></a>
2297 ![](../figures/扩展模组.png "扩展模组")2307 ![](../figures/扩展模组.png "扩展模组")
2298 2308 
22993. 单击![](../figures/zh-cn_image_0000001657521845.png)可修改设备的属性。23093. 单击![](../figures/zh-cn_image_0000001657521845.png)可修改设备的属性。
2300 2310 
2301- **图 2** 修改属性值<a name="fig8965912183814"></a> 2311+ **图 2** 修改属性值<a name="fig8965912183814"></a>
2302 ![](../figures/修改属性值.png "修改属性值")2312 ![](../figures/修改属性值.png "修改属性值")
2303 2313 
23044. 单击“保存”,保存已修改的设备属性。23144. 单击“保存”,保存已修改的设备属性。
@@ -2419,7 +2429,7 @@ device\_config.json配置模板(参照Atlas 500 A2 智能小站配置)如下
2419 2429 
2420以上除了sata类型的存储盘,均能通过platform下的子目录名称关联出对应的物理设备,例如a5080000.hiusbc1关联了位置为usb2的插口,如[图1](#fig347265517342)所示,82010000.sdhci1关联了位置为SD卡插口。sata类型的需要根据盘的具体路径信息关联对应设备,即/sys/block/存储设备盘符名/device目录(软连接)指向的目录名,0:0:0:0表示M.2,1:0:0:0表示disk0,2:0:0:0表示disk1。2430以上除了sata类型的存储盘,均能通过platform下的子目录名称关联出对应的物理设备,例如a5080000.hiusbc1关联了位置为usb2的插口,如[图1](#fig347265517342)所示,82010000.sdhci1关联了位置为SD卡插口。sata类型的需要根据盘的具体路径信息关联对应设备,即/sys/block/存储设备盘符名/device目录(软连接)指向的目录名,0:0:0:0表示M.2,1:0:0:0表示disk0,2:0:0:0表示disk1。
2421 2431 
2422-**图 1** USB插口位置<a id="fig347265517342"></a> 2432+**图 1** USB插口位置<a id="fig347265517342"></a>
2423![](../figures/USB插口位置.png "USB插口位置")2433![](../figures/USB插口位置.png "USB插口位置")
2424 2434 
2425**扩展存储告警<a name="section82143611272"></a>**2435**扩展存储告警<a name="section82143611272"></a>**
@@ -2451,7 +2461,7 @@ OM SDK支持扩展存储设备的部分告警,包含硬盘温度过高、硬
2451 "platform": "a5080000.hiusbc1",2461 "platform": "a5080000.hiusbc1",
2452 "location": "usb2",2462 "location": "usb2",
2453 "name": "u-disk2"2463 "name": "u-disk2"
2454- }, 2464+ },
2455 {2465 {
2456 "platform": "a5100000.hiusbc2",2466 "platform": "a5100000.hiusbc2",
2457 "location": "usb1",2467 "location": "usb1",
@@ -2529,24 +2539,24 @@ OM SDK支持扩展存储设备的部分告警,包含硬盘温度过高、硬
2529 MAX_PARTITION_NUM = 162539 MAX_PARTITION_NUM = 16
2530 DEV_CLS = "eMMC", "u-disk", "ethnet", "DISK"2540 DEV_CLS = "eMMC", "u-disk", "ethnet", "DISK"
2531 NAME_PATTERN = r"^[a-zA-Z0-9\-\_\s\.]{2,64}$"2541 NAME_PATTERN = r"^[a-zA-Z0-9\-\_\s\.]{2,64}$"
2532- 2542+ 
2533- 2543+ 
2534 def validate():2544 def validate():
2535 assert CFG_FILE.stat().st_size < MAX_SIZE_BYTES, f"size of config should less than {MAX_SIZE_BYTES} bytes."2545 assert CFG_FILE.stat().st_size < MAX_SIZE_BYTES, f"size of config should less than {MAX_SIZE_BYTES} bytes."
2536 cfg = json.loads(CFG_FILE.read_text())2546 cfg = json.loads(CFG_FILE.read_text())
2537 assert isinstance(cfg, dict), "config must be json format."2547 assert isinstance(cfg, dict), "config must be json format."
2538 validate_primary_partitions(cfg)2548 validate_primary_partitions(cfg)
2539 validate_extend_info(cfg)2549 validate_extend_info(cfg)
2540- 2550+ 
2541- 2551+ 
2542 def validate_primary_partitions(cfg: dict):2552 def validate_primary_partitions(cfg: dict):
2543 parts = cfg.get("primary_partitions")2553 parts = cfg.get("primary_partitions")
2544 assert isinstance(parts, list), "primary_partitions must be a list."2554 assert isinstance(parts, list), "primary_partitions must be a list."
2545 assert 1 <= len(parts) <= MAX_PARTITION_NUM, f"number of partitions should be in range [1, {MAX_PARTITION_NUM}]."2555 assert 1 <= len(parts) <= MAX_PARTITION_NUM, f"number of partitions should be in range [1, {MAX_PARTITION_NUM}]."
2546 for part in parts:2556 for part in parts:
2547 assert isinstance(part, int), f"partition number {part} is not of int type."2557 assert isinstance(part, int), f"partition number {part} is not of int type."
2548- 2558+ 
2549- 2559+ 
2550 def validate_extend_info(cfg: dict):2560 def validate_extend_info(cfg: dict):
2551 extend_info = cfg.get("extend_info")2561 extend_info = cfg.get("extend_info")
2552 assert isinstance(extend_info, dict), "extend_info must be a dict."2562 assert isinstance(extend_info, dict), "extend_info must be a dict."
@@ -2556,15 +2566,15 @@ OM SDK支持扩展存储设备的部分告警,包含硬盘温度过高、硬
2556 assert isinstance(devices, list), f"the value of {cls} must be a list."2566 assert isinstance(devices, list), f"the value of {cls} must be a list."
2557 for index, device in enumerate(devices):2567 for index, device in enumerate(devices):
2558 assert isinstance(device, dict), f"{cls}.{index} is not a dict."2568 assert isinstance(device, dict), f"{cls}.{index} is not a dict."
2559- 2569+ 
2560 platform = device.get("platform")2570 platform = device.get("platform")
2561 assert isinstance(platform, str) and platform, f"{cls}.{index}.{platform} is not a valid string."2571 assert isinstance(platform, str) and platform, f"{cls}.{index}.{platform} is not a valid string."
2562- 2572+ 
2563 location = device.get("location")2573 location = device.get("location")
2564 assert isinstance(location, str) and location, f"{cls}.{index}.{location} is not a valid string."2574 assert isinstance(location, str) and location, f"{cls}.{index}.{location} is not a valid string."
2565 assert location not in locations, f"location of {location} is duplicated."2575 assert location not in locations, f"location of {location} is duplicated."
2566 locations.add(location)2576 locations.add(location)
2567- 2577+ 
2568 name = device.get("name")2578 name = device.get("name")
2569 find_iter = re.fullmatch(NAME_PATTERN, name)2579 find_iter = re.fullmatch(NAME_PATTERN, name)
2570 assert all((2580 assert all((
@@ -2572,8 +2582,8 @@ OM SDK支持扩展存储设备的部分告警,包含硬盘温度过高、硬
2572 2 <= len(name) <= 64,2582 2 <= len(name) <= 64,
2573 find_iter and find_iter.group(0) == name2583 find_iter and find_iter.group(0) == name
2574 )), rf"{cls}.{index}.{name} is invalid, just support 'A-Za-z0-9\-\_\.' and length in range [2, 64]"2584 )), rf"{cls}.{index}.{name} is invalid, just support 'A-Za-z0-9\-\_\.' and length in range [2, 64]"
2575- 2585+ 
2576- 2586+ 
2577 if __name__ == '__main__':2587 if __name__ == '__main__':
2578 validate()2588 validate()
2579 print("validate device config success.")2589 print("validate device config success.")
@@ -2593,7 +2603,7 @@ OM SDK除了提供默认的RESTful接口以外,还支持用户在OM SDK的基
2593 2603 
2594注册蓝图的流程如[图1](#fig2844162122813)所示,通过向Flask启动模组导入扩展接口配置文件中的蓝图函数路径后,在注册蓝图模组中实现已有蓝图和扩展蓝图的注册。2604注册蓝图的流程如[图1](#fig2844162122813)所示,通过向Flask启动模组导入扩展接口配置文件中的蓝图函数路径后,在注册蓝图模组中实现已有蓝图和扩展蓝图的注册。
2595 2605 
2596-**图 1** OM SDK注册蓝图流程<a id="fig2844162122813"></a> 2606+**图 1** OM SDK注册蓝图流程<a id="fig2844162122813"></a>
2597![](../figures/OM-SDK注册蓝图流程.png "OM-SDK注册蓝图流程")2607![](../figures/OM-SDK注册蓝图流程.png "OM-SDK注册蓝图流程")
2598 2608 
2599### 配置文件介绍<a name="ZH-CN_TOPIC_0000001577530732"></a>2609### 配置文件介绍<a name="ZH-CN_TOPIC_0000001577530732"></a>
@@ -2619,7 +2629,7 @@ EXTEND_RESTFUL_REGISTER_FUNCTIONS_PATH = ""
26194. 准备配置文件。26294. 准备配置文件。
26205. 编译。替换原有的OM SDK配置文件restful\_extend\_interfaces.py,并将新增接口相关代码打包。26305. 编译。替换原有的OM SDK配置文件restful\_extend\_interfaces.py,并将新增接口相关代码打包。
2621 2631 
2622-**图 1** 操作流程图<a name="fig6792122815523"></a> 2632+**图 1** 操作流程图<a name="fig6792122815523"></a>
2623![](../figures/操作流程图.png "操作流程图")2633![](../figures/操作流程图.png "操作流程图")
2624 2634 
2625### RESTful接口开发示例<a name="ZH-CN_TOPIC_0000001578449856"></a>2635### RESTful接口开发示例<a name="ZH-CN_TOPIC_0000001578449856"></a>
@@ -2654,8 +2664,8 @@ EXTEND_RESTFUL_REGISTER_FUNCTIONS_PATH = ""
2654 https_security_service_bp = Blueprint("SecurityService", __name__,2664 https_security_service_bp = Blueprint("SecurityService", __name__,
2655 url_prefix="/redfish/v1/Systems/SecurityService")2665 url_prefix="/redfish/v1/Systems/SecurityService")
2656 https_security_service_bp.add_url_rule("/DigitalWarranty", view_func=service_required, methods=["GET"])2666 https_security_service_bp.add_url_rule("/DigitalWarranty", view_func=service_required, methods=["GET"])
2657- 2667+ 
2658- 2668+ 
2659 @https_security_service_bp.before_request2669 @https_security_service_bp.before_request
2660 def set_endpoint_executing_log():2670 def set_endpoint_executing_log():
2661 """请求进入前先记录一条日志"""2671 """请求进入前先记录一条日志"""
@@ -2667,12 +2677,12 @@ EXTEND_RESTFUL_REGISTER_FUNCTIONS_PATH = ""
2667 2677 
2668 ```python2678 ```python
2669 from flask import request2679 from flask import request
2670- 2680+ 
2671- 2681+ 
2672 def get_life_time():2682 def get_life_time():
2673 return {"status": 200, "data": 100}2683 return {"status": 200, "data": 100}
2674- 2684+ 
2675- 2685+ 
2676 def service_required():2686 def service_required():
2677 """2687 """
2678 服务年限/服务起始时间/出产日期查询2688 服务年限/服务起始时间/出产日期查询
@@ -2685,7 +2695,7 @@ EXTEND_RESTFUL_REGISTER_FUNCTIONS_PATH = ""
2685 except Exception as err:2695 except Exception as err:
2686 ret_dict = {"status": 400, "data": input_err_info}2696 ret_dict = {"status": 400, "data": input_err_info}
2687 return ret_dict, "GeneralError"2697 return ret_dict, "GeneralError"
2688- 2698+ 
2689 return ret_dict, "Success"2699 return ret_dict, "Success"
2690 ```2700 ```
2691 2701 
@@ -2694,8 +2704,8 @@ EXTEND_RESTFUL_REGISTER_FUNCTIONS_PATH = ""
2694 ```python2704 ```python
2695 from flask import Flask2705 from flask import Flask
2696 from add_extend_restful_interface.security_blueprint import https_security_service_bp2706 from add_extend_restful_interface.security_blueprint import https_security_service_bp
2697- 2707+ 
2698- 2708+ 
2699 def register_new_blueprint(app: Flask):2709 def register_new_blueprint(app: Flask):
2700 """2710 """
2701 功能描述:注册蓝图2711 功能描述:注册蓝图
@@ -2758,7 +2768,7 @@ OM SDK支持与FusionDirector进行数据通信。OM SDK除了提供默认的云
2758 2768 
2759新增的云边协同接口的注册和消息处理流程如[图1](#fig164551117477)所示,该图中的字典存储了消息与处理函数映射关系。云边协同消息通过消息分发模块到达消息与Handler映射关系模块,通过该模块向接口配置文件导入扩展字典路径,实现已有的云边协同接口和新加的云边协同接口统一管理。2769新增的云边协同接口的注册和消息处理流程如[图1](#fig164551117477)所示,该图中的字典存储了消息与处理函数映射关系。云边协同消息通过消息分发模块到达消息与Handler映射关系模块,通过该模块向接口配置文件导入扩展字典路径,实现已有的云边协同接口和新加的云边协同接口统一管理。
2760 2770 
2761-**图 1** 云边协同接口处理流程<a id="fig164551117477"></a> 2771+**图 1** 云边协同接口处理流程<a id="fig164551117477"></a>
2762![](../figures/云边协同接口处理流程.png "云边协同接口处理流程")2772![](../figures/云边协同接口处理流程.png "云边协同接口处理流程")
2763 2773 
2764### 配置文件介绍<a name="ZH-CN_TOPIC_0000001628490521"></a>2774### 配置文件介绍<a name="ZH-CN_TOPIC_0000001628490521"></a>
@@ -2776,7 +2786,7 @@ OM SDK工程提供了扩展接口的配置文件“/software/RedfishServer/fd\_e
27765. 新增能力项。创建能力项配置文件,包含OM SDK已有能力项内容,将新增接口添加到能力项配置文件中。27865. 新增能力项。创建能力项配置文件,包含OM SDK已有能力项内容,将新增接口添加到能力项配置文件中。
27776. 编译。将新增代码编译打包。27876. 编译。将新增代码编译打包。
2778 2788 
2779-**图 1** 操作流程图<a name="fig1087818141546"></a> 2789+**图 1** 操作流程图<a name="fig1087818141546"></a>
2780![](../figures/操作流程图-1.png "操作流程图-1")2790![](../figures/操作流程图-1.png "操作流程图-1")
2781 2791 
2782### 云边协同接口开发示例<a name="ZH-CN_TOPIC_0000001628849897"></a>2792### 云边协同接口开发示例<a name="ZH-CN_TOPIC_0000001628849897"></a>
@@ -2817,7 +2827,7 @@ OM SDK工程提供了扩展接口的配置文件“/software/RedfishServer/fd\_e
2817 @staticmethod2827 @staticmethod
2818 def config_netmanager_dflc(payload):2828 def config_netmanager_dflc(payload):
2819 pass2829 pass
2820- 2830+ 
2821 @staticmethod2831 @staticmethod
2822 def handle_msg_config_dflc(msg):2832 def handle_msg_config_dflc(msg):
2823 NewFDMessageHandler.config_netmanager_dflc(msg.content)2833 NewFDMessageHandler.config_netmanager_dflc(msg.content)
@@ -2865,7 +2875,7 @@ OM SDK工程提供了扩展接口的配置文件“/software/RedfishServer/fd\_e
2865 "password_config",2875 "password_config",
2866 "password_validity_config",2876 "password_validity_config",
2867 "configuration_restore",2877 "configuration_restore",
2868- "digital_warranty", 2878+ "digital_warranty",
2869 "cert_mgmt",2879 "cert_mgmt",
2870 "lte_config",2880 "lte_config",
2871 "access_control",2881 "access_control",
@@ -2911,8 +2921,8 @@ OM SDK工程提供了扩展接口的配置文件“/software/RedfishServer/fd\_e
2911 fi2921 fi
2912 ```2922 ```
2913 2923 
2914-> [!NOTE] 2924+> [!NOTE]
2915-> 2925+>
2916> 配置文件里的关键字段说明如下。2926> 配置文件里的关键字段说明如下。
2917>2927>
2918>- restful\_extend\_interfaces.py中的EXTEND\_RESTFUL\_REGISTER\_FUNCTIONS\_PATH:用于扩展RESTful接口注册函数路径。2928>- restful\_extend\_interfaces.py中的EXTEND\_RESTFUL\_REGISTER\_FUNCTIONS\_PATH:用于扩展RESTful接口注册函数路径。
@@ -3041,9 +3051,9 @@ OM SDK支持用户按照相应的规格,为进行过二次开发的软件构
3041 <Package>3051 <Package>
3042 <FileName>omsdk.zip</FileName>3052 <FileName>omsdk.zip</FileName>
3043 <OutterName>MindXOM</OutterName>3053 <OutterName>MindXOM</OutterName>
3044- <Version>SDK-omsdk 1.0</Version> 3054+ <Version>SDK-omsdk 1.0</Version>
3045 <FileType>Firmware</FileType>3055 <FileType>Firmware</FileType>
3046- <Module>SDK-omsdk</Module> 3056+ <Module>SDK-omsdk</Module>
3047 <Vendor>Huawei Technologies Co., Ltd</Vendor>3057 <Vendor>Huawei Technologies Co., Ltd</Vendor>
3048 <MaxUpgradeTime>3600</MaxUpgradeTime>3058 <MaxUpgradeTime>3600</MaxUpgradeTime>
3049 <!--UpgradeTimeout:unit second-->3059 <!--UpgradeTimeout:unit second-->
@@ -3131,7 +3141,8 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3131 3141 
31322. 将omsdk-web.zip前端开源包放在“_\{project\_dir\}_/src/app/build\_customized\_web\_project”路径下。31422. 将omsdk-web.zip前端开源包放在“_\{project\_dir\}_/src/app/build\_customized\_web\_project”路径下。
3133 3143 
3134- > [!NOTE] 3144+ > [!NOTE]
3145+ >
3135 > 前端开源软件包名称必须以“omsdk-web”开头,且以“.zip”结尾。3146 > 前端开源软件包名称必须以“omsdk-web”开头,且以“.zip”结尾。
3136 3147 
31373. 在“_\{project\_dir\}_/src/app/build\_customized\_web\_project”目录下,实现编译脚本build\_customized\_web\_project.sh,参考示例如下。31483. 在“_\{project\_dir\}_/src/app/build\_customized\_web\_project”目录下,实现编译脚本build\_customized\_web\_project.sh,参考示例如下。
@@ -3198,7 +3209,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3198 3209 
3199开发者新增的前端功能,在经过编译且部署到环境上后,可在边缘管理系统的Web界面看到自定义开发的功能,如[图1](#fig8512184518429)所示。3210开发者新增的前端功能,在经过编译且部署到环境上后,可在边缘管理系统的Web界面看到自定义开发的功能,如[图1](#fig8512184518429)所示。
3200 3211 
3201-**图 1** 新增功能<a id="fig8512184518429"></a> 3212+**图 1** 新增功能<a id="fig8512184518429"></a>
3202![](../figures/新增功能.png "新增功能")3213![](../figures/新增功能.png "新增功能")
3203 3214 
3204## 新增自定义签名<a name="ZH-CN_TOPIC_0000001635848277"></a>3215## 新增自定义签名<a name="ZH-CN_TOPIC_0000001635848277"></a>
@@ -3238,7 +3249,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3238 function signature() {3249 function signature() {
3239 # 生成cms签名文件3250 # 生成cms签名文件
3240 echo "build cms file success"3251 echo "build cms file success"
3241- 3252+ 
3242 # 生成crl吊销列表文件3253 # 生成crl吊销列表文件
3243 echo "build crl file success"3254 echo "build crl file success"
3244 }3255 }
@@ -3287,18 +3298,18 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3287 # -*- coding: UTF-8 -*-3298 # -*- coding: UTF-8 -*-
3288 from enum import Enum3299 from enum import Enum
3289 from typing import Set3300 from typing import Set
3290- 3301+ 
3291- 3302+ 
3292 class ModuleType(Enum):3303 class ModuleType(Enum):
3293- 3304+ 
3294 # 默认支持OMSDK升级3305 # 默认支持OMSDK升级
3295 FIRMWARE = "MindXOM"3306 FIRMWARE = "MindXOM"
3296- 3307+ 
3297 # 该文件为OM SDK重要配置文件,为防止解析错误,其余地方禁止修改3308 # 该文件为OM SDK重要配置文件,为防止解析错误,其余地方禁止修改
3298 # 在此处可注册添加额外需要升级的固件类型3309 # 在此处可注册添加额外需要升级的固件类型
3299 # 固件类型需要与自定义升级包中的version.xml的Module字段值一致3310 # 固件类型需要与自定义升级包中的version.xml的Module字段值一致
3300 SDK_UPGRADE = "SDK-Upgrade"3311 SDK_UPGRADE = "SDK-Upgrade"
3301- 3312+ 
3302 @classmethod3313 @classmethod
3303 def values(cls) -> Set[str]:3314 def values(cls) -> Set[str]:
3304 return {elem.value for elem in cls}3315 return {elem.value for elem in cls}
@@ -3351,7 +3362,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3351 3362 
3352 ```shell3363 ```shell
3353 #!/bin/bash3364 #!/bin/bash
3354- 3365+ 
3355 CUR_DIR="$(dirname "$(readlink -f "$0")")"3366 CUR_DIR="$(dirname "$(readlink -f "$0")")"
3356 TOP_DIR="$(dirname "${CUR_DIR}")"3367 TOP_DIR="$(dirname "${CUR_DIR}")"
3357 PRODUCT_CFG_PATH="${TOP_DIR}/config/project_cfg/project.conf"3368 PRODUCT_CFG_PATH="${TOP_DIR}/config/project_cfg/project.conf"
@@ -3360,7 +3371,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3360 OMSDK_TAR_PATH="${PLATFORM_PATH}/omsdk"3371 OMSDK_TAR_PATH="${PLATFORM_PATH}/omsdk"
3361 PRODUCT_SCRIPT_PATH="${TOP_DIR}/src/app"3372 PRODUCT_SCRIPT_PATH="${TOP_DIR}/src/app"
3362 OUTPUT_PATH="${TOP_DIR}/output"3373 OUTPUT_PATH="${TOP_DIR}/output"
3363- 3374+ 
3364 function modify_version_xmlfile()3375 function modify_version_xmlfile()
3365 {3376 {
3366 local xml_version_file=$13377 local xml_version_file=$1
@@ -3368,14 +3379,14 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3368 echo "modify_version_xmlfile failed, ${xml_version_file} not exist"3379 echo "modify_version_xmlfile failed, ${xml_version_file} not exist"
3369 return 13380 return 1
3370 fi3381 fi
3371- 3382+ 
3372 # 修改版本信息3383 # 修改版本信息
3373 sed -i "s#{Version}#${_Version}#g" "${xml_version_file}"3384 sed -i "s#{Version}#${_Version}#g" "${xml_version_file}"
3374- 3385+ 
3375 # 修改软件包名称3386 # 修改软件包名称
3376 local omsdk_name="${_ProductName}_${_Version}_linux-aarch64.zip"3387 local omsdk_name="${_ProductName}_${_Version}_linux-aarch64.zip"
3377 sed -i "/<Package>/,/<\/Package>/ s|<FileName>.*|<FileName>${omsdk_name}</FileName>|g" "${xml_version_file}"3388 sed -i "/<Package>/,/<\/Package>/ s|<FileName>.*|<FileName>${omsdk_name}</FileName>|g" "${xml_version_file}"
3378- 3389+ 
3379 # 修改厂商信息3390 # 修改厂商信息
3380 sed -i "/<Package>/,/<\/Package>/ s|<Version>.*|<Version>${_Version}</Version>|g" "${xml_version_file}"3391 sed -i "/<Package>/,/<\/Package>/ s|<Version>.*|<Version>${_Version}</Version>|g" "${xml_version_file}"
3381 if [[ $(echo "${_Vendor}" | tr [:upper:] [:lower:]) == "huawei" ]]; then3392 if [[ $(echo "${_Vendor}" | tr [:upper:] [:lower:]) == "huawei" ]]; then
@@ -3403,12 +3414,12 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3403 if ! tar -zxf "${omsdk_tar_path}" -C "${OMSDK_TAR_PATH}"; then3414 if ! tar -zxf "${omsdk_tar_path}" -C "${OMSDK_TAR_PATH}"; then
3404 return 13415 return 1
3405 fi3416 fi
3406- 3417+ 
3407 # 修改version.xml中的可配置字段3418 # 修改version.xml中的可配置字段
3408 if ! modify_version_xmlfile "${OMSDK_TAR_PATH}/version.xml"; then3419 if ! modify_version_xmlfile "${OMSDK_TAR_PATH}/version.xml"; then
3409 return 13420 return 1
3410 fi3421 fi
3411- 3422+ 
3412 # 添加自定义告警检测3423 # 添加自定义告警检测
3413 if [[ "${_NeedCustomizedAlarmCheck}" == "yes" ]]; then3424 if [[ "${_NeedCustomizedAlarmCheck}" == "yes" ]]; then
3414 if ! bash "${TOP_DIR}/src/app/add_customized_alarm/build_customized_alarm.sh";then3425 if ! bash "${TOP_DIR}/src/app/add_customized_alarm/build_customized_alarm.sh";then
@@ -3422,7 +3433,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3422 cp -rf "${TOP_DIR}"/src/app/add_customized_alarm/alarm_info_solution_en.json "${OMSDK_TAR_PATH}"/software/nginx/html/manager/config/alarm_info_solution_en.json3433 cp -rf "${TOP_DIR}"/src/app/add_customized_alarm/alarm_info_solution_en.json "${OMSDK_TAR_PATH}"/software/nginx/html/manager/config/alarm_info_solution_en.json
3423 cp -rf "${TOP_DIR}"/src/app/add_customized_alarm/alarm_info_solution_zh.json "${OMSDK_TAR_PATH}"/software/nginx/html/manager/config/alarm_info_solution_zh.json3434 cp -rf "${TOP_DIR}"/src/app/add_customized_alarm/alarm_info_solution_zh.json "${OMSDK_TAR_PATH}"/software/nginx/html/manager/config/alarm_info_solution_zh.json
3424 fi3435 fi
3425- 3436+ 
3426 # 添加扩展模组驱动3437 # 添加扩展模组驱动
3427 if [[ "${_NeedAdditionalDriver}" == "yes" ]]; then3438 if [[ "${_NeedAdditionalDriver}" == "yes" ]]; then
3428 if ! bash "${TOP_DIR}"/src/app/add_extend_driver_adapter/build_extend_driver_adapter.sh;then3439 if ! bash "${TOP_DIR}"/src/app/add_extend_driver_adapter/build_extend_driver_adapter.sh;then
@@ -3432,10 +3443,10 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3432 # copy additional configurations3443 # copy additional configurations
3433 cp -rf "${TOP_DIR}"/config/module_def/*.json "${OMSDK_TAR_PATH}"/software/ibma/config/devm_configs/3444 cp -rf "${TOP_DIR}"/config/module_def/*.json "${OMSDK_TAR_PATH}"/software/ibma/config/devm_configs/
3434 fi3445 fi
3435- 3446+ 
3436 # 拷贝外设配置3447 # 拷贝外设配置
3437 cp -rf "${TOP_DIR}"/src/app/add_extend_device/device_config.json "${OMSDK_TAR_PATH}"/software/ibma/lib/Linux/config/device_config.json3448 cp -rf "${TOP_DIR}"/src/app/add_extend_device/device_config.json "${OMSDK_TAR_PATH}"/software/ibma/lib/Linux/config/device_config.json
3438- 3449+ 
3439 # 添加扩展restful接口3450 # 添加扩展restful接口
3440 # build_extend_restful_interface.sh具体实现可参考对应章节实现3451 # build_extend_restful_interface.sh具体实现可参考对应章节实现
3441 if [[ "${_NeedAddExtendRestfulInterface}" == "yes" ]]; then3452 if [[ "${_NeedAddExtendRestfulInterface}" == "yes" ]]; then
@@ -3443,7 +3454,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3443 return 13454 return 1
3444 fi3455 fi
3445 fi3456 fi
3446- 3457+ 
3447 # 添加扩展 fusion director 接口3458 # 添加扩展 fusion director 接口
3448 # build_extend_fusion_director_interface.sh具体实现可参考对应章节实现3459 # build_extend_fusion_director_interface.sh具体实现可参考对应章节实现
3449 if [[ "${_NeedAddExtendFusionDirectorInterface}" == "yes" ]]; then3460 if [[ "${_NeedAddExtendFusionDirectorInterface}" == "yes" ]]; then
@@ -3451,7 +3462,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3451 return 13462 return 1
3452 fi3463 fi
3453 fi3464 fi
3454- 3465+ 
3455 # 自定义前端编译功能3466 # 自定义前端编译功能
3456 # build_customized_web_project.sh 具体实现可参考对应章节实现,本段代码需放在“_NeedCustomizedWebNav”和“_NeedCustomizedWebAssets”功能代码之前3467 # build_customized_web_project.sh 具体实现可参考对应章节实现,本段代码需放在“_NeedCustomizedWebNav”和“_NeedCustomizedWebAssets”功能代码之前
3457 if [ "${_NeedBuildCustomizedWeb}" == "yes" ];then3468 if [ "${_NeedBuildCustomizedWeb}" == "yes" ];then
@@ -3461,7 +3472,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3461 return 13472 return 1
3462 fi3473 fi
3463 fi3474 fi
3464- 3475+ 
3465 # 配置自定义图片和厂商信息3476 # 配置自定义图片和厂商信息
3466 # build_customized_web_assets.sh具体实现可参考对应章节实现3477 # build_customized_web_assets.sh具体实现可参考对应章节实现
3467 if [ "${_NeedCustomizedWebAssets}" == "yes" ]; then3478 if [ "${_NeedCustomizedWebAssets}" == "yes" ]; then
@@ -3469,7 +3480,7 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3469 return 13480 return 1
3470 fi3481 fi
3471 fi3482 fi
3472- 3483+ 
3473 # 动态加载组件3484 # 动态加载组件
3474 # build_customized_web_nav.sh具体实现可参考对应章节实现3485 # build_customized_web_nav.sh具体实现可参考对应章节实现
3475 if [ "${_NeedCustomizedWebNav}" == "yes" ];then3486 if [ "${_NeedCustomizedWebNav}" == "yes" ];then
@@ -3570,5 +3581,6 @@ OM SDK提供的边缘管理系统前端开源代码,支持开发者在前端
3570 bash build.sh3581 bash build.sh
3571 ```3582 ```
3572 3583 
3573- > [!NOTE] 3584+ > [!NOTE]
3585+ >
3574 > 构建成功之后,在“<i>{project_dir}</i>/output”目录下生成软件包<i>{_ProductName}</i>\_<i>{_Version}</i>_linux-aarch64.zip。3586 > 构建成功之后,在“<i>{project_dir}</i>/output”目录下生成软件包<i>{_ProductName}</i>\_<i>{_Version}</i>_linux-aarch64.zip。
@@ -51,6 +51,7 @@
51|1680*1050|100%|90%|51|1680*1050|100%|90%|
52 52 
53> [!NOTE]53> [!NOTE]
54+>
54> “显示器分辨率”、“缩放与布局”可在Windows操作系统的“设置 \> 显示”中进行设置,“浏览器缩放百分比”可在Chrome浏览器中进行设置。55> “显示器分辨率”、“缩放与布局”可在Windows操作系统的“设置 \> 显示”中进行设置,“浏览器缩放百分比”可在Chrome浏览器中进行设置。
55 56 
56### 用户登录<a name="ZH-CN_TOPIC_0000001629924889"></a>57### 用户登录<a name="ZH-CN_TOPIC_0000001629924889"></a>
@@ -206,6 +207,7 @@
206 ![](../figures/检测网络.png "检测网络")207 ![](../figures/检测网络.png "检测网络")
207 208 
208 > [!NOTE]209 > [!NOTE]
210+ >
209 > “检测网络状态”后的“已连接1000Mb/s”为系统检测后的最新网络状态。211 > “检测网络状态”后的“已连接1000Mb/s”为系统检测后的最新网络状态。
210 212 
211**新增IP地址<a name="section1420419582918"></a>**213**新增IP地址<a name="section1420419582918"></a>**