Configuring Model Files

Message instance

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

Parameter description

The content message is described as follows:

{
    "operation": "delete | update",
    "target": "all",
    "uuid": "bdf3242b-aec1-4100-af91-afa2b8fde88a",
    "modelfiles": [{
        "name": "module.om",
        "version": "1.0",
        "check_type": "sha256",
        "check_code": "XXXX",
        "size": "1024",
        "file_server": {
            "protocol": "https",
            "path": "GET https://FDAddr:port/models",
            "user_name": "userName",
            "password": "password"
        }
    }]
}

Level-1 Resource

Level-2 Resource

Level-3 Resource

Description

operation

-

-

Meaning: operation type

Type: string

Value:

  • delete: deletes a model file.
  • update: downloads the model file. If the model file already exists, the model file will be updated.

target

-

-

Meaning: model file to be operated

Type: string

Value:

  • all: If operation is set to delete, all model files of the pod are deleted. If operation is set to update, the value is fixed to all.
  • temp: deletes temporary files.
  • "" (empty string): deletes a single model file. Multiple model files can be deleted.

uuid

-

-

Meaning: service ID

Type: string

Value: UUID. The format complies with the regular expression ^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$.

modelfiles

-

-

Meaning: model file information

Type: list

Value: When operation is set to update, the length is 1. When operation is set to delete, the length ranges from 0 to 256.

-

name

-

Meaning: model file name

Type: string

Value: The value contains a maximum of 256 bytes. The format must comply with the regular expression ^[a-zA-Z0-9_.-]{1,256}$ and cannot contain two consecutive periods (..). Only .om, .tar.gz, and .zip files are supported.

-

version

-

Meaning: model file version

Type: string

Value: a string of 1 to 64 characters. Only lowercase letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. The value must start and end with a lowercase letter or digit. The format must comply with the regular expression ^[a-z0-9]([a-z0-9._-]{0,62}[a-z0-9]){0,1}$.

-

check_type

-

Meaning: model file verification type. This parameter is valid only when operation is set to update.

Type: string

Value: sha256 (Only sha256 is supported currently.)

-

check_code

-

Meaning: verification code of the model file. This parameter is valid only when operation is set to update.

Type: string

Value: 64 bytes (verification code generated by Sha256sum, in the regular expression ^[0-9a-f]{64}$, for example, 7e642fa557533508b589d7fcaef922b443ff4b5df16b2ad91581bd2b3d7c1fc3)

-

size

-

Meaning: model file size. This parameter is valid only when operation is set to update.

Type: string

Value range: 1–4294967296 (unit: byte)

-

file_server

-

Meaning: model file download information. This parameter is valid only when operation is set to update.

Type: dict

-

-

protocol

Meaning: download protocol. This parameter is valid only when operation is set to update.

Type: string

Value: https

-

-

path

Meaning: download path. This parameter is valid only when operation is set to update.

Type: string

Value: The value contains a maximum of 512 bytes. The HTTPS protocol is required. The request mode is GET. The value does not contain special characters \n!\|; $<>@`

NOTE:
  • If the path contains a domain name, it must be a valid domain name matching the regular expression pattern ^[a-zA-Z0-9][a-zA-Z0-9.-]{1,61}[a-zA-Z0-9]$. The value cannot be all digits, localhost or other domain names equivalent to localhost.
  • If the path contains an IP address, it must be a valid IPv4 address and cannot be a loopback address (127.0.0.1) or a local IP address.

-

-

user_name

Meaning: download user name. This parameter is valid only when operation is set to update.

Type: string

Value: a string of a maximum of 64 bytes in the regular expression ^[a-zA-Z0-9-_]{1,64}$

-

-

password

Meaning: download password. This parameter is valid only when operation is set to update.

Type: string

Value: a string of a maximum of 64 bytes matching the regular expression ^.{8,64}$

NOTE:
The password must meet the following requirements; otherwise, security risks may exist.
  • The password must contain at least eight characters.
  • The password must contain at least two types of the following characters:
    • Lowercase letters
    • Uppercase letters
    • Digits
    • Space or at least one of the following special characters: `~!@#$%^&*()-_=+\|[{}];:'",<.>/?
  • The password must be different from the username.

Result returned

{
    "header": {
        "id": "",
        "msg_id": "d489f75b-e558-407f-8abf-d8ce3faf1c62",
        "parentId": "",
        "parent_msg_id": "741aec66-99b2-4d97-aaf2-63d27f53bbc5",
        "version": "",
        "resourceversion": "",
        "timestamp": 1652168652358,
        "isSync": false,
        "sync": false,
        "nodeId": "",
        "peerInfo": {}
    },
    "router": {
        "source": "",
        "destination": "",
        "option": "",
        "resource": ""
    },
    "route": {
        "source": "controller",
        "group": "hardware",
        "operation": "REPORT",
        "resource": "websocket/modelfiles"
    },
    "content": "OK"
} {
    "header": {
        "id": "",
        "msg_id": "2739d41a-6ce9-425f-bedc-f8940c194353",
        "parentId": "",
        "parent_msg_id": "",
        "version": "",
        "resourceversion": "",
        "timestamp": 1693059477224,
        "isSync": false,
        "sync": false,
        "nodeId": "",
        "peerInfo": {}
    },
    "router": {
        "source": "",
        "destination": "",
        "option": "",
        "resource": ""
    },
    "route": {
        "source": "hardware",
        "group": "hub",
        "resource": "websocket/config_result",
        "operation": "update"
    },
    "content": "{\"topic\":\"websocket/modelfiles\",\"percentage\":\"100%\",\"result\":\"success\",\"reason\":\"\"}"
}