Machine Learning

Chapter 1: Configure OTM, IoT, and Oracle Storage Cloud Service

This section covers the steps required to set up an Oracle Storage Cloud Service, an Internet of Things (IoT) instance, and create Oracle Transportation Management (OTM) external services to the storage cloud and IoT instance.

Once you complete this chapter, you move on to the following:

Step 1: Setting up an Oracle Storage Cloud Service

To set up the Oracle Storage Cloud Service, complete the following:

  1. Create a compartment or use an existing compartment. For example, you can create a compartment of OTM Machine Learning Compartment.
  2. Create a bucket (for example, OTM_Machine_Learning_Bucket). See the Oracle Cloud Infrastructure documentation for details. 
    1. Use all of the default settings.
    2. Save the bucket.

Note: Write down the bucket name. You will need it when setting up IoT

  1. Obtain the pre-authenticated URL:
    1. Select the bucket created above.
    2. Click Create Pre-Authenticated Request.
    3. Select an Access Type of Permit Object Writes.
    4. Set an Expiration Date. A date 1 year in the future is recommended.
    5. Click on Create Pre-Authenticated Request.
    6. Copy the Pre-Authenticated Request URL. This is the only time the this URL is displayed. Save it since it will be used in IoT and Oracle Transportation Management set up processes.
  2. Create a user.
    1. Select the User Type of IAM USER.
    2. Enter a User Name. For example OTM_Machine_Learning_Writer.
    3. Click Create.
    4. On the user detail page, copy the OCID and store it. This is the User OCID. You will need it when setting up IoT.
    5. Click API Keys and then Add API Key. You will create an API key from IoT and import the finger print here in Step 2.
  3. Create a group.
    1. Add a name for the user group. For example OTM_Machine_Learning_Group.
    2. Click Add User to Group.
    3. Add the user you created at the previous step.
  4. Create a policy. For example, OTM_Machine_Learning_Policy.
    1. Under Policy Builder, turn on show manual editor.
    2. Enter the following policy template. Remember to modify the relevant object names based on your settings above.

Allow group OTM_Machine_Learning_Group to read buckets in compartment OTM_Machine_Learning_Compartment ‘OTM_Machine_Learning_Bucket’

Allow group OTM_Machine_Learning_Group to manage objects in compartment OTM_Machine_Learning_Compartment where all {target.bucket.name = ‘OTM_Machine_Learning_Bucket’, any {request.permission = 'OBJECT_CREATE', request.permission = 'OBJECT_INSPECT', request.permission = 'OBJECT_OVERWRITE', request.permission = 'OBJECT_DELETE'}}

Allow group OTM_Machine_Learning_Group to manage buckets in compartment OTM_Machine_Learning_Compartment

Allow group OTM_Machine_Learning_Group to read objects in compartment OTM_Machine_Learning_Compartment where target.bucket.name =

  1. Save the policy.
  2. Obtain the Tenant OCID.
    1. Go to Governance & Administration > Tenacy Details.
    2. Note the Tenant name example "OTM_Machine_Learning_Compartment". This is the namespace. You will need it when setting up IoT.
    3. Copy the OCID here. This is the Tenant OCID. You will need it when setting up IoT.

Step 2: Setting up the IoT Instance

The next step is to set up the IoT instance as follows:

  1. Configure Your Cloud Account
  2. Access your IoT instance, for example, https://hostname/fm. The hostname can be found in the welcome email that you recieved from Oracle.
    1. Correct URL: “https://test.iot.ocs.oraclecloud.com/fm”
    2. Note: You must remove "services" from the URL.
  3. Create a user on the instance.
    1. Go to App Settings.
    2. Click Users.
    3. Enter the following:
      1. First name. For example OTM.
      2. Last name. For example Integration.
      3. User Name. For example OTMINTEGRATION.
    4. Provide the administrators email address.
    5. Save your changes.
    6. Check your email inbox where you should have a message from Oracle. 
    7. In the email, click on Active your Account.
    8. Enter your password.
  4. Add an Oracle Cloud Account

    Optional: Link to the IOT documentation (https://docs.oracle.com/en/cloud/saas/iot-fleet-cloud/iotfm/enable-transit-time-predictions-shipments.html#GUID-CF6F0361-313C-433F-AD26-00E2E64DAC92)
    1. In your IoT application, click Menu > Settings.
    2. Click Integrations.
    3. Click Add to add a new integration.
    4. In the Add Integration dialog box, select an Oracle Cloud Account and click Add. Tip: You can also search for an integration name in the list.

      A dialogue box called "Add Integration" showing several check boxes. The Oracle Cloud Account check box is selected.
      Oracle Cloud Account integration gets added to the Integrations page.
  5. Under Oracle Cloud Account, add your cloud account details:
    1. Enter your Tenant OCID.
      1. The tenancy details are available from the Oracle Cloud Infrastructure Console. You need to log in to your Oracle Cloud Infrastructure Console. From the Profile menu, click Tenancy: <YourTenancyName>
      2. The tenancy OCID is shown under Tenancy Information. Click Copy to copy it to your clipboard.

        A picture of a web interface, highlighting the OCID.
      3. Paste this value under Tenant OCID in your IoT application.
    2. Enter the User OCID.
      1. The user details are available from the Oracle Cloud Infrastructure Console. You need to log in to your Oracle Cloud Infrastructure Console. From the Profile menu, click User Settings
      2. The user OCID is shown under User Information. Click Copy to copy it to your clipboard.
      3. Paste this value under User OCID in your IoT application.
    3. Under Public Key, click Generate.
    4. Click Close.
  6. Set the public key in OCI Object Storage.
    1. On the Settings > Integration page of your IoT application, under Oracle Cloud Account, click Copy against Public Key to copy the public key that you generated earlier.
    2. Log in to your Oracle Cloud Infrastructure Console.
    3. Under the Profile menu, click User Settings.
    4. Click API Keys under Resources
    5. Click Add Public Key.

      Note: If three public keys are already listed under API Keys, you have to first delete one public key. An OCI Object Storage service user can't have more than three public keys.
    6. Select Paste Public Keys and paste the key that you copied from your IoT application.
    7. Click Add. The fingerprint for the added public key appears under API Keys. The fingerprint should be the same as that displayed on the Settings page of your IoT application.
  7. Connect to an OCI Object Storage Instance

    Optional: check the IoT documentation (https://docs.oracle.com/en/cloud/saas/iot-fleet-cloud/iotfm/enable-transit-time-predictions-shipments.html#GUID-CF6F0361-313C-433F-AD26-00E2E64DAC92)
    1. In your IoT application, click Menu and then click Settings.
    2. Click Integrations.
    3. Click Add to add a new integration.
    4. In the Add Integration dialog, select Oracle Object Storage Service and click Add.

      Tip: You can also search for an integration name in the list.

      Oracle Object Storage integration gets added to the Integrations page.
    5. On the Integrations page under Object Storage Service, click Connect.
    6. In the Oracle Object Storage dialog, provide your object storage connection details.
      1. Enter the Storage URL for your OCI Object Storage.

        For example, https://objectstorage.us-phoenix-1.oraclecloud.com.
      2. Enter the object storage Namespace for your tenancy.

        You can find the object storage namespace in your Oracle Cloud Infrastructure Console. You need to log in to your Oracle Cloud Infrastructure
      3. Console. From the Profile menu, click Tenancy: <YourTenancyName>
      4. Enter the Default Bucket name that stores the data.

        The bucket name must already exist in your OCI Object Storage instance, for example “OTM_Machine_Learning_Bucket”.
      5. Click Verify Connectivity to verify the connection details and bucket name.
      6. Click Save to save the OCI Object Storage connection details.
    7. To enable the connection on the Integrations page, click Edit Configuration under Oracle Object Storage.
    8. Toggle the Integration Status switch to ON and click Save.
  8. Enable Integration with Oracle Transportation Management Cloud
    1. Sign in to Oracle IoT Fleet Monitoring Cloud Service.
    2. From the menu bar, click App Settings > Settings.
    3. In the Integration section, for Transportation Management enable or enter the following values:
      1. Select the Enable Transportation Management check box.
      2. Object Storage Container: Enter the bucket name of OCI Object Storage that stores the shipment data from Oracle Transportation Management Cloud Service
    4. To save the changes, click Save and click Close.
  9. Create a mapping between IoT Org and OTM Domain as follows: 
    1. Go to Design Center > Organization.
    2. Click on Integration.
    3. Under Oracle Transportation Management, click OTM Configuration.
    4. Turn the Integration Status to Enabled.
    5. Save and Close.
    6. Under Oracle Transportation Management, click Add Integration.
    7. Under URL, enter the OTM URL. This URL should end with oraclecloud.com.
    8. Under Domain, enter the OTM Domain Name.
    9. Under User Name and Password, enter the OTM User Name and Password.
    10. Save the mapping.

 

Step 3: Setting up OTM

Next, you set up the OTM external systems.

Create an external system for OTM to send and receive data from IoT

Create an external system as follows:

  1. Enter the User Name and Password as provided by IoT IA.
  2. Select a Content Type of application/json.
  3. Select an Authentication Type of HTTP Authentication (Basic).
  4. Enter the URL:
    1. Enter the first part of the URL as provided by IoT IA.
    2. Add “fleetMonitoring/privateclientapi/v2/learning" to the end of the URL.
    3. Remove the word “services” from the URL

Example of URL:

Correct URL: https://testiot.iot.ocs.oraclecloud.com/fleetMonitoring/privateclientapi/v2/learning

Create an External System for OTM to send data to Oracle Storage Cloud Service

Create a second external system as follows:

  1. Enter an ID similar to ML_Obj_store.
  2. Under Authentication Type, select Pre-Authenticated Request.
  3. Under Pre-Authenticated URL, paste your Pre-authenticated URL from Step 1. Note: don’t include “o/” at the end of the URL

Related Topics