Skip to content
JackLivio edited this page Sep 10, 2015 · 20 revisions

Policy Table Lifecycle in SDL Core

To get a better understanding of the lifecycle and management of the policy table in SDL, please read section 3.1.10 Policy Detailed Design of the Software Detailed Design document found on the SDL Core README.

Preloaded Policy Table

Upon first start up of SDL Core, when the src/appMain/storage/policy.sqlite does not exist, SDL uses the preloaded policy table to create and populate a default policy table with information.

Debugging

To quickly update the policy table stored by SDL for debugging purposes there are two options.

  • Remove the policy.sqlite database, edit sdl_preloaded_pt.json, and re-run ./smartdevicelink
  • Directly edit the policy.sqlite database using sqlite3

Trigger a Policy Update

Checkout Correct Branches

git clone https://github.com/smartdevicelink/sdl_core.git
git checkout -b release/4.0.0 origin/release/4.0.0
git clone https://github.com/smartdevicelink/sdl_hmi.git
git checkout -b hotfix/policy_table_update origin/hotfix/policy_table_update
git clone https://github.com/smartdevicelink/sdl_server.git
git checkout -b rc_static_policy origin/rc_static_policy

Edit Custom Endpoint URL

  • Determine the IP of the machine running SDL Server

  • In your build folder, cd to src/appMain and open sdl_preloaded_pt.json in a text editor.

  • Set the 0x07 endpoint to similar to the code block below. Use IP address of machine running SDL Server

"0x07": {
     "default": ["http://Your.IP.Address.Here:3000/policies.json"]
}

If you have already started SDL Core before changing the endpoint, please be sure to delete policy.sqlite from src/appMain/storage so the database will update the endpoint the next time core is started.

View the sample policy table that will be passed from the server to SDL
Install an app to support the Policy Table Update

// TODO: Add instructions or link to downloading an application to Android or iOS that supports Policy Table Updates (ie any app whose proxy supports OnSystemRequest and SystemRequest)

Policy table decoding

Since the main HMI used during SDL development is web based, we are not able to read, write, and modify files on the client side. This is an issue because the Ford specific process for updating a policy file requires the HMI to decode/decrypt the incoming policy file, before returning the file back to core. To overcome this boundary for testing purposes, there are two possible ways to test policy table updates.

1) HMI returns a static policy table update to core.

In this process, when an OnReceivedPolicyUpdate is sent to the HMI with the new policy data, the HMI will return the file located in the HMI directory /IVSU/POLICY_UPDATE_TEST. This file is a static policy table update that will sent back to core in the final step of the policy update. Assume that this file is what the update from sdl server would have been decoded to.

2) Enable core to decode policy table update.

Alternatively, if you would like to see the actual policy table data sent from sdl server update core's policy data base without using the static policy file or relying on the HMI to decode the data, make these changes.

Remake sdl core with this flag turned on.

cmake -DENABLE_HMI_PTU_DECRYPTION=OFF ../sdl_core
make
make install

Change HMI OnReceivedPolicyUpdate message param at line 805

"policyfile": document.location.pathname.replace("index.html", "IVSU/POLICY_UPDATE_TEST")

to

"policyfile": policyfile

Trigger the update from SDL

  • Start SDL Server
  • Start SDL Core
  • Start HMI This HMI needs to be started manually. After starting SDL:
%cd [root of cloned sdl_hmi repo]
% chromium-browser index.html
  • Select setting on the hmi (gears icon)
  • Select 'Request GetUrls'
  • Leave default endpoint of '7' and click "Send GetUrls request"
  • Connect a mobile proxy app to IP of machine running SDL Core
  • Click the "System Request" button on browser HMI
  • Select "PROPRIETARY" from dropdown menu
  • Click the "Send OnSystemRequest" button
  • Server will send a policy table and SDL Core will update the SQL database

Policy Table Encryption

ToDo: Add description for policy table encryption/decryption process during an update.