Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PTU check for allow_unknown_rpc_passthrough #2187

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---------------------------------------------------------------------------------------------------
Jack-Byrne marked this conversation as resolved.
Show resolved Hide resolved
-- Precondition:
-- 1) Application with <appID> is registered on SDL.
-- 2) PTU is completed with <app1> permissions all_unknown_rpc_passthrough = true
--
-- Steps:
-- 1) HMI initiates PTU to deliver PT snapshot to mobile
--
-- Expected:
-- 1) PT Snapshot contains <app1> permissions all_unknown_rpc_passthrough = true
---------------------------------------------------------------------------------------------------

--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/AppServices/commonAppServices')

--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false

--[[ Local Functions ]]
local function PTUfunc(tbl)
tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID] = common.getAppServiceConsumerConfig(1);
tbl.policy_table.app_policies[common.getConfigAppParams(1).fullAppID]["allow_unknown_rpc_passthrough"] = true
end

local function verifyAllowUnknownRPCPassthrough()
local snp_tbl = common.GetPolicySnapshot()
local app_id = common.getConfigAppParams(1).fullAppID
local result = {}
result.allow_unknown_rpc_passthrough = snp_tbl.policy_table.app_policies[app_id].allow_unknown_rpc_passthrough
common.test_assert(result.allow_unknown_rpc_passthrough == true, "Incorrect result value")
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("RAI", common.registerApp)
runner.Step("PTU", common.policyTableUpdate, { PTUfunc })
runner.Step("Activate App", common.activateApp)

runner.Title("Test")
runner.Step("Request PTU", common.Request_PTU)
runner.Step("Validate PTU", verifyAllowUnknownRPCPassthrough)

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)

23 changes: 23 additions & 0 deletions test_scripts/AppServices/commonAppServices.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,27 @@ function commonAppServices.getRpcPassThroughTimeoutFromINI()
return tonumber(RpcPassThroughTimeout)
end

function commonAppServices:Request_PTU()
local is_test_fail = false
local hmi_app1_id = config.application1.registerAppInterfaceParams.appName
commonAppServices.getHMIConnection():SendNotification("SDL.OnPolicyUpdate", {} )
EXPECT_HMINOTIFICATION("SDL.OnStatusUpdate", {status = "UPDATE_NEEDED"})

EXPECT_HMICALL("BasicCommunication.PolicyUpdate",{ file = "/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json" })
:Do(function(_,data)
commonAppServices.getHMIConnection():SendResponse(data.id, data.method, "SUCCESS", {})
end)
end

function commonAppServices.GetPolicySnapshot()
return utils.jsonFileToTable("/tmp/fs/mp/images/ivsu_cache/sdl_snapshot.json")
end

function commonAppServices.test_assert(condition, msg)
if not condition then
test:FailTestCase(msg)
end
end


return commonAppServices