Version: 1.0.0
Developed against Python 3.11.3
- Python 3.11+
- Register an Authorization Code Client and ensure that the registered client in Cds contains
http://localhost:5004/callback.html
in the list of RedirectUris. - When running the script you should log in with an account that has Tenant Administrator and Tenant Community Administrator Roles.
- Install required modules:
pip install -r requirements.txt
This sample creates a set of resources commonly used in AVEVA CONNECT data services for learning, development, and training purposes. It also provides an extensible framework for building custom demo systems. For a full list of resources created, please refer to the What the Script Creates section below.
This sample in run mode is intended to be run in an environment where the computer stays on and is consistently connected to the internet.
- Clone the GitHub repository
- Install required modules:
pip install -r requirements.txt
- Open the folder with your favorite IDE.
- Configure the sample using the file appsettings.placeholder.json. Before editing, rename this file to
appsettings.json
. This repository's.gitignore
rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised. - Update
appsettings.json
with your connection information and client credentials. - Run
program.py
, passing in one of the command line arguments:Setup
,Run
,SetupAndRun
, orCleanup
. For example,python program.py Setup
. For more information on these command line arguments see the next section, Sample Modes.
Sample Mode | Description |
---|---|
Setup | Creates the static resources listed below |
Run | Backfills data if possible and continuously sends new data for streams, reference data, and events |
SetupAndRun | Combination of the previous two Sample Modes |
Cleanup | Deletes all created resources |
The sample is configured by modifying the file appsettings.placeholder.json. Details on how to configure it can be found in the sections below. Before editing appsettings.placeholder.json, rename this file to appsettings.json. This repository's .gitignore rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised.
If multiple instances of this application are being run in the same AVEVA CONNECT data services instance there may be naming collisions. To avoid collisions with the client, the ClientName
label should be specified.
Parameter | Required | Type | Description |
---|---|---|---|
Tenants | Required | Endpoint List | Endpoint to send data to |
DataConfigurationPath | Required | String (Relative File Path) | Path to data configuration file |
Preview | Optional | Boolean | Whether to include preview features If preview features are not enabled in your account then this should be left false Default: False |
Labels | Optional | Labels | Labels used throughout the application for resource names |
ExcludedSetupResources | Optional | Resource List | Resources to not create when application run in Setup mode The application is not aware of dependent resources If, for example, Streams are disabled then created Assets will not have valid stream references |
ExcludedCleanupResources | Optional | Resource List | Resources to not delete when application run in Cleanup mode |
ExcludedDataTypes | Optional | Resource List | Data types not to send when application run in Run mode |
StreamBackfillStart | Optional | String (ISO 8601 Timestamp) | Backfill start time for stream data |
EventBackfillStart | Optional | String (ISO 8601 Timestamp) | Backfill start time for event data |
ReferenceDataBackfillStart | Optional | String (ISO 8601 Timestamp) | Backfill start time for referene data |
Parameter | Required | Type | Description |
---|---|---|---|
AuthenticationResource | Required | String (Uri) | Base URL being used |
NamespaceResource | Optional | String (Uri) | Region specific Namespace URL Automatically added when Setup mode is run |
ApiVersion | Required | String | API Version |
TenantId | Required | String | Tenant Id of Tenant being sent to |
NamespaceId | Required | String | Namespace Id of Namespace being sent to |
SetupCredentials | Required | Credentials | Authorization Code or Client Credentials Client used in Setup mode to create resources and Run If sending to multiple tenants use Client Credentials for each. Credentials |
RunCredentials | Optional | Credentials | Client Credentials used for sending OMF messages in both Setup and Run modes Automatically created when Setup mode is run. This cannot be an Authorization Code Credential |
Parameter | Required | Type | Description |
---|---|---|---|
ClientId | Required | String | Client Id for either a Client Credentials Client or an Authorization Code Client |
ClientSecret | Optional | String | Client Secret for when a Client Credentials Client is being used This should not be included if an Authorization Code Client is being used |
Data configurations contain the defintion of what resources to create and what data to send. This is done by specifying a heirarchy of Assets, associated resources like Asset Types, and optional stadalone resources that are not tied to the heirarchy. There are two data configurations included with this sample, which are documented in the table below.
Data Configuration | Relative Path | Description |
---|---|---|
test | data\test\data_configuration.json | Test data set to verify that sample is working |
windtopia | data\windtopia\data_configuration.json | Windtopia wind turbine data set Contains the Windtopia organization with 10 wind turbine Assets spread out across three sites |
Parameter | Required | Type | Description |
---|---|---|---|
CommunityName | Optional | String | Name of Community created in Setup mode Default: Setup Script Community |
CommunityDescription | Optional | String | Description of Community created in Setup mode Default: Setup Script Community |
CommunityContactEmail | Optional | String | Email of contact for Community created in Setup mode Default: null |
CustomAdministratorRoleName | Optional | String | Name of Custom Administrator Role created in Setup mode Default: Setup Administrator |
CustomAdministratorRoleDescription | Optional | String | Description of Custom Administrator Role created in Setup mode Default: Setup Administrator Role |
CustomContributorRoleName | Optional | String | Name of Custom Contributor Role created in Setup mode Default: Setup Contributor |
CustomContributorRoleDescription | Optional | String | Description of Custom Contributor Role created in Setup mode Default: Setup Contributor Role |
CustomViewerRoleName | Optional | String | Name of Custom Viewer Role created in Setup mode Default: Setup Viewer |
CustomViewerRoleDescription | Optional | String | Description of Custom Viewer Role created in Setup mode Default: Setup Viewer Role |
RoleDescription | Optional | String | Description of all custom Roles created in Setup mode Default: Setup Script Role |
ClientName | Optional | String | Name of Run mode Default: client created in Setup mode Default: Setup Script Client |
ClientSecretDescription | Optional | String | Description of Run mode Default: client created in Setup mode Default: Client Secret for Setup Script |
OMFConnectionName | Optional | String | Name of OMF connection created in Setup mode Default: Setup Script OMF Client |
OMFConnectionDescription | Optional | String | Description of OMF connection created in Setup mode Default: OMF Connection for Setup Script |
Property | Description |
---|---|
Community | Community |
Roles | Custom Roles |
Streams | Streams and Types |
Assets | Assets and Asset Types |
DataViews | Data Views |
Enumerations | Event Store Enumerations |
ReferenceDataTypes | Event Store Reference Data Types |
EventTypes | Event Store Event Types |
OMFConnection | OMF Connection |
Client | Client CredentialsClient |
- Community
- Roles
- Client Credential Client
- OMF Connection
- Stream Types
- Streams
- Asset Types
- Assets
- Data Views
- Authorization Tags
- Enumerations
- Reference Data Types
- Event Types
- Stream Data
- Reference Data
- Event Data
For the main AVEVA samples page ReadMe