Exporting and Importing Models


After creating a model, you may have to change its elements or add new elements as required. This task helps you manage existing models by exporting/importing EnOS-defined JSON files or Excel files to edit the existing model elements and is especially useful if you need to modify large numbers of elements for a model at one go.


The ability to export and import is also useful for copying or migrating models among different OUs or EnOS environments. You only need to export the model from the current OU and import the model together with its elements to the OU or environment.

Note

The model name must be globally unique in the same EnOS environment. If you are copying the model to another OU within the same EnOS environment, you need to give a new name when creating the empty model. Using a new name will not affect the import of the model elements.

Prerequisite

  • You need to have the proper permissions to view and manage models. Contact your OU administrator for access. For more information, see Policies, Roles, and Permissions.
  • Ensure that you have read the limitations for models. See Limitations.

Procedure

To edit your existing model, export the model first, then edit the downloaded file and import it to replace the existing model.

Note

When updating models via importing, the feature definition information in the file will totally overwrite the existing model, i.e., if the existing model has 3 attributes, and none in the import file, the model will have no attributes after importing.

Exporting Models

  1. In EnOS Management Console, go to Models > Batch Export.
  2. You can either export all of the models listed by clicking Export All, or export specific models by selecting the models you wish to export and click Export Selected.
  3. Select whether to export them to Excel or JSON. Click OK.
  4. Save the ZIP file to your local directory. The ZIP file will contain Excel or JSON files according to what you selected in the step before. Each file represents a model with the file name containing the model ID.

Importing Models

This function enables you to batch create new models or batch update existing models using Excel or JSON. Batch importing of existing models will update the existing information. If there are no existing models, new models will be created.


For the creating and updating of models, it is recommended to use the Excel method.

Note

Unmodifiable fields in feature definitions inherited from parent models or added from the standard feature library will be skipped during import.

By Excel

  1. In EnOS Management Console, go to Models.

  2. Click the Import button.

  3. A pop-up window will appear. Upload a ZIP File that contains one or multiple .xlsx files. For file size limitations, refer to the pop-up window. For other limitations, see Limitations.


    If you require a template, either click Download Blank Template or select one or multiple existing models from Template and click Generate Template to generate Excel templates based on the selected models. The templates will be inside a ZIP file. Edit the template once it’s downloaded, ZIP it up, and upload the file.


Excel Template Parameters - BasicInfo Worksheet
Name Mandatory/Optional Description
Organization ID Mandatory The OU ID of the OU that the model will be under.
Model ID Mandatory
  • For creating new models, enter an ID for the model. 1 - 64 characters. Supports English alphabets, numbers, and special characters “-“, “_”, and “.”. No spacing allowed.
  • For updating models, the Model ID must match the model’s model ID that you are updating. If it cannot be found, a new model will be created.
Model Name (Default) Mandatory The default name for the model which will be used when model names in other languages are not given. 1 - 64 characters. Does not support <>;@*%&\ characters.
Model Name (Internationalization) Optional The internationalization name of the model, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default model name will be used. 1 - 64 characters.
Description Optional The description of the model. Max 512 characters.
Category Optional The static extension info of the product, such as manufacturer and device model. 0 - 64 characters. Does not support <>;@*%&\ characters.
Tags Optional

The model tags in the form of key-value pairs. The format is in JSON and both key and value must be String.

Example: {“key”:”value”}

Parent Model

Depends on creating new or updating models.

See description for more information.

  • For creating new models, enter the model ID of the model to inherit its attributes, measurement points, services, and events.
  • For updating models, this will be ignored.
Owner N/A Only applicable when exporting, this field shows the person who created the model. For importing of models, this field will be ignored.
Created On N/A Only applicable when exporting, this field shows the time the model is created. For importing of models, this field will be ignored.
Modified By N/A Only applicable when exporting, this field shows the last person who modified the model. For importing of models, this field will be ignored.
Last Modified N/A Only applicable when exporting, this field shows the time when the model was last modified. For importing of models, this field will be ignored.


Excel Template Parameters - Attributes Worksheet
Name Mandatory/Optional Description
Identifier Mandatory The identifier of the attribute. 1 - 64 characters. Supports English alphabets, numbers, and special characters “-“, “_”, and “.”. No spacing allowed.
Name (Default) Mandatory The default name for the attribute which will be used when attribute names in other languages are not given. 1 - 64 characters.
Name (Internationalization) Optional The internationalization name of the attribute, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default attribute name will be used. 1 - 64 characters.
Data Type Mandatory The data type of the attribute. The max characters for string data type is 4,000. See the Readme worksheet for more information.
Data Definition Optional The data definition according to the data type. See the Readme worksheet for examples.
Default Value Optional The default value of the attribute. See the Readme worksheet for examples.
Unit Optional The unit of the attribute.
Required Optional
  • true: A value is required for this attribute when creating a device based on this model.
  • false: No value is required for this attribute when creating a device based on this model.
Description (Default) Optional The default description for the attribute which will be used when attribute descriptions in other languages are not given. Max 512 characters.
Description (Internationalization) Optional The internationalization description of the attribute, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default attribute description will be used. Max 512 characters.
Tags Optional

The attribute tags in the form of key-value pairs. The format is in JSON and both key and value must be String.

Example: {“key”:”value”}

Ranking Optional In application development, use ranking if you need to locate model elements fast. Ranking 0 indicates this attribute is created when you create the model. Attributes that you add to the existing model starts from 1 and increments by 1 for every attribute added hereafter. You can also give the attributes random non-negative integers as you see fit. The Ranking numbers can be discontinuous, non-sequenced, or duplicated.
Standard Element ID Optional

The URN of the standard attribute if this attribute is from the Model Feature Library.

Format: urn:enos:modelelement:std:<id>:<version>

<id> is the standard ID and <version> is the version of the attribute. Both <id> and <version> can be found in EnOS Management Console > Models > Model Details > Feature Definition > Edit > Add > Import from Standard Feature Library.

Example: urn:enos:modelelement:std:terminal_placement:1.0


Excel Template Parameters - MeasurementPoints Worksheet
Name Mandatory/Optional Description
Identifier Mandatory The identifier of the measurement point. 1 - 64 characters. Supports English alphabets, numbers, and special characters “-“, “_”, and “.”. No spacing allowed.
Name (Default) Mandatory The default name for the measurement point which will be used when measurement point names in other languages are not given. 1 - 64 characters.
Name (Internationalization) Optional The internationalization name of the measurement point, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default measurement point name will be used. 1 - 64 characters.
Point Type Mandatory The type of measurement point. For more information, see Adding Measurement Points.
Data Type Mandatory The data type of the selected Point Type. The max characters for string data type is 1,024. For more information, see Adding Measurement Points.
Quality Indicator Optional

Whether the measurement point is an indicator of data quality.

  • true: Has the quality indicator.
  • false: Does not have the quality indicator.
Data Definition Optional The data definition according to the data type. See the Readme worksheet for examples.
Unit Optional The unit of the measurement point.
Description (Default) Optional The default description for the measurement point which will be used when measurement point descriptions in other languages are not given. Max 512 characters.
Description (Internationalization) Optional The internationalization description of the measurement point, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default measurement point description will be used. Max 512 characters.
Tags Optional

The measurement point tags in the form of key-value pairs. The format is in JSON and both key and value must be String.

Example: {“key”:”value”}

Ranking Optional In application development, use ranking if you need to locate model elements fast. Ranking 0 indicates this measurement point is created when you create the model. Measurement points that you add to the existing model starts from 1 and increments by 1 for every measurement point added hereafter. You can also give the measurement points random non-negative integers as you see fit. The Ranking numbers can be discontinuous, non-sequenced, or duplicated.
Standard Element ID Optional

The URN of the standard measurement point if this measurement point is from the Model Feature Library.

Format: urn:enos:modelelement:std:<id>:<version>

<id> is the standard ID and <version> is the version of the measurement point. Both <id> and <version> can be found in EnOS Management Console > Models > Model Details > Feature Definition > Edit > Add > Import from Standard Feature Library.

Example: urn:enos:modelelement:std:nominal_voltage:1.0


Excel Template Parameters - Services Worksheet
Name Mandatory/Optional Description
Identifier Mandatory The identifier of the service. 1 - 64 characters. Supports English alphabets, numbers, and special characters “-“, “_”, and “.”. No spacing allowed.
Name (Default) Mandatory The default name for the service which will be used when service names in other languages are not given. 1 - 64 characters.
Name (Internationalization) Optional The internationalization name of the service, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default service name will be used. 1 - 64 characters.
Input Parameters Optional The input parameters for the service. For samples, see below.
Output Parameters Optional The output parameters for the service. For samples, see below.
Description (Default) Optional The default description for the service which will be used when service descriptions in other languages are not given. Max 512 characters.
Description (Internationalization) Optional The internationalization description of the service, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default service description will be used. Max 512 characters.
Tags Optional

The service tags in the form of key-value pairs. The format is in JSON and both key and value must be String.

Example: {“key”:”value”}

Ranking Optional In application development, use ranking if you need to locate model elements fast. Ranking 0 indicates this service is created when you create the model. Services that you add to the existing model starts from 1 and increments by 1 for every service added hereafter. You can also give the services random non-negative integers as you see fit. The Ranking numbers can be discontinuous, non-sequenced, or duplicated.
Standard Element ID Optional

The URN of the standard service if this service is from the Model Feature Library.

Format: urn:enos:modelelement:std:<id>:<version>

<id> is the standard ID and <version> is the version of the service. Both <id> and <version> can be found in EnOS Management Console > Models > Model Details > Feature Definition > Edit > Add > Import from Standard Feature Library.

Example: urn:enos:modelelement:std:opModConnect:1.0


Excel Template Parameters - Events Worksheet
Name Mandatory/Optional Description
Identifier Mandatory The identifier of the event. 1 - 64 characters. Supports English alphabets, numbers, and special characters “-“, “_”, and “.”. No spacing allowed.
Name (Default) Mandatory The default name for the event which will be used when event names in other languages are not given. 1 - 64 characters.
Name (Internationalization) Optional The internationalization name of the event, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default event name will be used. 1 - 64 characters.
Severity Optional The severity of the event. For more information, see Adding Event.
Output Parameters Optional The output parameters for the event. For samples, see below.
Description (Default) Optional The default description for the event which will be used when event descriptions in other languages are not given. Max 512 characters.
Description (Internationalization) Optional The internationalization description of the event, e.g. English(en_US) and Simplified Chinese(zh_CN). If not given, the default event description will be used. Max 512 characters.
Tags Optional

The event tags in the form of key-value pairs. The format is in JSON and both key and value must be String.

Example: {“key”:”value”}

Ranking Optional In application development, use ranking if you need to locate model elements fast. Ranking 0 indicates this event is created when you create the model. Events that you add to the existing model starts from 1 and increments by 1 for every event added hereafter. You can also give the events random non-negative integers as you see fit. The Ranking numbers can be discontinuous, non-sequenced, or duplicated.
Standard Element ID Optional

The URN of the standard event if this event is from the Model Feature Library.

Format: urn:enos:modelelement:std:<id>:<version>

<id> is the standard ID and <version> is the version of the event. Both <id> and <version> can be found in EnOS Management Console > Models > Model Details > Feature Definition > Edit > Add > Import from Standard Feature Library.

Example: urn:enos:modelelement:std:opModConnect:1.0


Note

  • Do not leave blank rows between the rows as the file may fail to import.
  • Each Excel file represents 1 model. Therefore, only the first row of data in the BasicInfo worksheet will be used; all subsequent rows will be ignored.


../../_images/model_batch_import.png


4. Click Import.

5. If invalid records exist, a pop-up window will show an error message and a Download Error File link. Click to download the file, check the cause of the error, rectify it, and upload the file again.

6. Once the models are successfully imported, the new models will appear in the list of models in Models.


Input/Output Parameters Samples


  • Input parameter sample
[
  {
    "required": "FALSE", //whether param is required when invoking service
    "identifier": "paramID",
    "name": {
      "defaultValue": "Param Name",
      "i18nValue": {}
    },
    "dataType": "string",
    "dataDefinition": "{\n  \"maxLength\": 64\n}"
  }
]


  • Output parameter sample
[
  {
    "required": "FALSE",//whether param is required when invoking service/reporting event
    "identifier": "paramOutput",
    "name": {
      "defaultValue": "Output Name",
      "i18nValue": {}
    },
    "dataType": "INT",
    "unit": "%"
  }
]

By JSON

  1. In EnOS Management Console, go to Models.

  2. Click the Import button.

  3. A pop-up window will appear. Upload a ZIP File that contains one or multiple .json files. For file size and feature definition limitations, refer to the pop-up window.


    If you require a template, either click Download Blank Template or select one or multiple existing models from Template and click Generate Template to generate JSON templates based on the selected devices. The templates will be inside a ZIP file. Edit the template once it’s downloaded, ZIP it up, and upload the file.

  4. Click Import.

  5. If invalid records exist, a pop-up window will show an error message and a Download Error File link. Click to download the file, check the cause of the error, rectify it, and upload the file again.

  6. Once the models are successfully imported, new models will appear in the list of models in Device Management > Device Assets.