Configuration Importing

The configuration import function allows you to configure the NTP service, partition information, host name query, domain name resolution, account password expiration days, local access, session timeout interval, certificate expiry notification time, login rules, and wireless network.

Partition configuration affects services. You are advised to complete the configuration before service deployment. partitions, ntp_server, device_location are the configuration message field. where

  • If the file does not contain the partitions or ntp_server field, the original configuration is not modified.
  • If the file contains the partitions or ntp_server field and the array is empty, all the original configurations are deleted.
  • If the command output contains the partitions or ntp_server field and the array content is not empty, the original configuration is deleted and the new configuration is used.

The rules for configuring partitions are as follows:

  1. Identify the devices that need to be partitioned based on the device_location field. Delete the original user partition (the system partition cannot be deleted) from the devices specified by device_location. For devices that are not in the range specified by device_location, retain the original configuration.
  2. If the value of capacity_bytes is less than 512 MB, no partition is created, and this parameter is used only for deleting partitions in scenario 1. When capacity_bytes is set to 0, only capacity_bytes and device_location need to be set correctly, and other fields can be left empty.
  3. file_system supports only ext4.
  4. mount_path is the partition mount path. This field cannot be empty. Otherwise, the created partition does not have a mount path and cannot be used.
  5. If a failure occurs during the configuration, the completed configuration cannot be rolled back, and a failure message is returned.
  6. The /var/lib/docker path cannot be deleted but can be mounted again. If the partition mounting path does not contain /var/lib/docker, the partition mounted to /var/lib/docker is reserved no matter whether the device mounted to /var/lib/docker needs to be partitioned. If /var/lib/docker is remounted, the partition will be deleted no matter whether the original device mounted to /var/lib/docker is partitioned or not.

Message instance

{
    "header": {
        "msg_id": "741aec66-99b2-4d97-aaf2-63d27f53bbc5",
        "parent_msg_id": "",
        "timestamp": 1550107087319,
        "sync": false
    },
    "route": {
        "source": "controller",
        "group": "hardware",
        "operation": "update",
        "resource": "websocket/profile"
    },
    "content": {
    }
}

Parameter description

The content message is described as follows:

{
    "product": "Atlas 200I A2",
    "profile_name": "profile001",
    "config": {
        "ntp_server": {
            "service_enabled": true,
            "sync_net_manager": false,
            "preferred_server": "xx.xx.xx.xx",
            "alternate_server": "xx.xx.xx.xx"
        },
        "partitions": [{
            "capacity_bytes": 298999349248,
            "device": {
                "device_type": "SimpleStorage",
                "device_location": "HDD0"
            },
            "file_system": "ext4",
            "mount_path": "/home/data"
        }],
        "static_host_list": [{
            "ip_address": "xx.xx.xx.xx",
            "name": "fd.huawei.com"
        }],
        "name_server":[{
            "ip_address": "xx.xx.xx.xx"
        }],
        "security_policy":{
            "password_validity": "30",
            "web_access": true,
            "ssh_access": true,
            "session_timeout": 50,
            "cert_alarm_time": 20,
            "security_load": [{
                 "enable": "true",
                 "start_time": "00:00",
                 "end_time": "00:00",
                 "ip_addr": "xx.xx.xx.xx",
                 "mac_addr": "xx.xx.xx.xx.xx"
            }]
        },
        "lte_info": [
            {
                "apn_info": [
                    {
                        "apn_name": "123",
                        "apn_passwd": "",
                        "apn_user": "werfasew",
                        "auth_type": "2"
                    }
                ],
                "state_data": true,
                "state_lte": true
            }
        ]
    }
}

Elements are defined as follows:

Level-1 Resource

Level-2 Resource

Level-3 Resource

Level-4 Resource

Description

product

-

-

-

Meaning: product name

Type: string

Value: a string of 1 to 64 characters, including digits, uppercase letters, lowercase letters, hyphens (-), periods (.), underscores (_), and spaces. The value cannot contain two consecutive dots (..) and must start and end with a digit or letter.

profile_name

-

-

-

Meaning: profile name

Type: string

Value: a string of 1 to 32 characters, including digits, uppercase letters, lowercase letters, hyphens (-), periods (.), and underscores (_). The value cannot contain two consecutive dots (..) and must start and end with a digit or letter.

config

-

-

-

Meaning: configuration information

Type: dict

-

ntp_server

-

-

Meaning: NTP service configuration

Type: dict

-

-

service_enabled

-

Meaning: NTP enablement switch

Type: bool

Value: true or false

-

-

sync_net_manager

-

Meaning: whether to synchronize time with NMS

Type: bool

Value:

  • true: Synchronize time with NMS.
  • false: Do not synchronize time with NMS.

-

-

preferred_server

-

Meaning: preferred NTP server

Type: string

Value: only IPv4 addresses are supported.

  • If this field is left blank, the configuration is deleted.
  • This field can be configured only when service_enabled is set to true and sync_net_manager is set to false. In addition, the IP address cannot be the same as that of alternate_server.

-

-

alternate_server

-

Meaning: alternate NTP server

Type: string

Value: only IPv4 addresses are supported.

  • If this field is left blank, the configuration is deleted.
  • This field can be configured only when service_enabled is set to true and sync_net_manager is set to false, but cannot be set to the same IP address as preferred_server. This field can also be left empty.

-

partitions

-

-

Meaning: partition information

Value: a physical drive supports a maximum of 16 partitions.

-

-

capacity_bytes

-

Meaning: partition capacity

Type: int64

The value cannot exceed the maximum free space of the drive. The value must be an integer in MB.

-

-

device

-

Meaning: storage device

Type: dict

-

-

-

device_type

Meaning: drive type

Type: string

Value: only SimpleStrorage and Volume are supported.

-

-

-

device_location

Meaning: drive location

Type: string

Value:

  • If device_type is set to Volume, set this parameter to the volume name.
  • If device_type is set to SimpleStorage, set this field to the physical location of the drive.
  • The value can contain a maximum of 256 characters, including only digits, uppercase letters, lowercase letters, hyphens (-), underscores (_), and periods (.). It cannot contain two consecutive periods (..).

-

-

file_system

-

Meaning: file system type

Type: string

Value: Currently, only ext4 is supported. If this field is not specified, ext4 is used by default.

-

-

mount_path

-

Meaning: absolute mount path of the partition

Type: string

The value contains 256 bytes and must start with a slash (/) when it is not 0. Spaces are not allowed in the value.

-

static_host_list

-

-

Meaning: static table for host name query

Value: indicates the full configuration, which overwrites the existing configuration in the system.

A maximum of 128 records can be configured, excluding the built-in localhost and preset FusionDirector domain name (configurable, fd.fusiondirector.huawei.com by default). These two parts cannot be modified or configured.

Multiple IP addresses can correspond to the same domain name and one domain name can correspond to multiple IP addresses. There is no restriction on the FusionDirector and devices. Users need to ensure the correctness of the configuration.

-

-

ip_address

-

Meaning: IP address

Type: string

Value: IPv4 addresses are supported. The same IP address can point to different domain names or host names.

-

-

name

-

Meaning: domain name/host name

Type: string

Value: the domain name can contain a maximum of 253 bytes, including letters (case-insensitive), digits, hyphens (-), and periods (.). The host name and domain name are not distinguished.

The following values (case-insensitive) are reserved and cannot be configured: localhost, localhost.localdomain, localhost4, localhost4.localdomain4, localhost6, localhost6.localdomain6, and FusionDirector domain name (configurable, fd.fusiondirector.huawei.com by default).

-

name_server

-

-

Meaning: domain name server

Value: indicates the full configuration, which overwrites the existing configuration in the system. A maximum of three records are supported.

-

-

ip_address

-

Meaning: IP address

Type: string

Value: IPv4 addresses are supported.

-

security_policy

-

-

Number of days after which the account and password expire

-

-

password_validity

-

Meaning: number of days after which the account and password expire

Type: string

Value: 0 to 365 (digits only)

-

-

web_access

-

Meaning: whether to enable local web access. If this field is not passed, the configuration will not be changed.

Type: bool

Value: true or false

-

-

ssh_access

-

Meaning: whether to enable SSH local access. If this field is not passed, the configuration will not be changed.

Type: bool

Value: true or false

-

-

session_timeout

-

Meaning: session timeout interval, in minutes

Type: string

Value: 5 to 120

-

-

cert_alarm_time

-

Meaning: certificate expiry notification time, in days

Type: string

Value: 7 to 180

-

-

security_load

-

Meaning: login rule

Type: list

Value: a maximum of 30

-

-

-

enable

Meaning: whether to enable the login rule blocklist

Type: string

Value: true or false

-

-

-

start_time

Meaning: start time of the validity period of the login rule blocklist

Type: string

Value: valid time format

-

-

-

end_time

Meaning: end time of the validity period of the login rule blocklist

Type: string

Value: valid time format

-

-

-

ip_addr

Meaning: allowed IP address for login

Type: string

Value: a valid IPv4 address in the format of xxx.xxx.xxx.xxx (a single IP address) or xxx.xxx.xxx.xxx/mask (an IP address segment)

-

-

-

mac_addr

Meaning: allowed MAC address for login

Type: string

Value: a valid MAC address

-

lte_info

-

-

Meaning: wireless network configuration

Value: There is only one configuration.

-

-

state_lte

-

Meaning: whether to enable the wireless network

Type: bool

  • true: enable
  • false: disable

-

-

state_data

-

Meaning: whether to enable the mobile data

Type: bool

  • true: enable
  • false: disable

-

-

apn_info

-

Meaning: APN configuration information

Type: array

Value: A maximum of one configuration is supported.

-

-

apn_info[].apn_name

-

Meaning: APN name used for dial-up

Type: string

Value: a string of a maximum of 39 characters, including uppercase and lowercase letters (a to z and A to Z), digits (0 to 9), and special characters (_-.@).

-

-

apn_info[].apn_passwd

-

Meaning: APN password used for dial-up

Type: string

Value: a string of a maximum of 64 characters, including digits (0 to 9), uppercase and lowercase letters (a to z and A to Z), and special characters except commas (,) and quotation marks (").

-

-

apn_info[].apn_user

-

Meaning: APN user name used for dial-up

Type: string

Value: a string of a maximum of 64 characters, including uppercase and lowercase letters (a to z and A to Z), digits (0 to 9), and special characters (_-.@).

-

-

apn_info[].auth_type

-

Meaning: Authentication type

Type: string

Value:

  • 0: None
  • 1: PAP
  • 2: CHAP
  • 3: PAP or CHAP
NOTE:

The value of auth_type supported by the 4G module can be 0, 1, or 2. The value of auth_type supported by the 5G module can be 0, 1, 2, or 3.

Result returned

{
    "header":{
        "msg_id":"02bb6421-45b4-4f0c-914c-ef3183a37000",
        "parent_msg_id": "",
        "timestamp":1652278267211,
        "sync": false
    },
    "route":{
        "source":"hardware",
        "group":"hub",
        "operation":"update",
        "resource":"websocket/profile"
    },
    "content":"SUCCESS"|"FAILED: input param check failed"
}