laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified jolly: Looks good to me, but someone else must approve
esipa_rest_utils: add support for PSMOs added in SGP.32 V.1.2

SGP.32 adds 3 additional PSMOs:
- setFallbackAttribute
- unsetFallbackAttribute
- setDefaultDpAddress

Change-Id: I03cdd70065a83dfc611d614cf32d817c13fad347
Related: SYS#8100
---
M contrib/rest_api_resource_schema.json
M contrib/rest_api_response_schema.json
M src/esipa_rest_utils.erl
3 files changed, 116 insertions(+), 0 deletions(-)

diff --git a/contrib/rest_api_resource_schema.json b/contrib/rest_api_resource_schema.json
index a2a6812..2e0d330 100644
--- a/contrib/rest_api_resource_schema.json
+++ b/contrib/rest_api_resource_schema.json
@@ -157,6 +157,44 @@
"immediateEnableFlag"
]
}
+ },
+ {
+ "unsetFallbackAttribute": {
+ "description": "order the execution of a setFallbackAttribute PSMO, see also GSMA SGP.32, section 3.4.6",
+ "type": "object",
+ "properties": {
+ "iccid": {
+ "description": "ICCID of the profile. (ICCID in nibble-swapped raw format, see also ETSI TS 102 221, section 13.2)",
+ "type": "string",
+ "pattern": "^[0-9A-F]{18,20}$"
+ }
+ },
+ "required": [
+ "iccid"
+ ]
+ }
+ },
+ {
+ "unsetFallbackAttribute": {
+ "description": "order the execution of a unsetFallbackAttribute PSMO, see also GSMA SGP.32, section 3.4.7",
+ "type": "object",
+ "properties": {}
+ }
+ },
+ {
+ "setDefaultDpAddress": {
+ "description": "order the execution of a setDefaultDpAddress PSMO, see also GSMA SGP.32, section 5.9.25",
+ "type": "object",
+ "properties": {
+ "defaultDpAddress": {
+ "description": "Address of the default SM-DP+",
+ "type": "string"
+ }
+ },
+ "required": [
+ "defaultDpAddress"
+ ]
+ }
}
]
}
diff --git a/contrib/rest_api_response_schema.json b/contrib/rest_api_response_schema.json
index 60330bd..7ec2735 100644
--- a/contrib/rest_api_response_schema.json
+++ b/contrib/rest_api_response_schema.json
@@ -215,6 +215,42 @@
}
},
{
+ "setFallbackAttributeResult": {
+ "description": "setFallbackAttributeResult PSMO result, see also SGP32Definitions.asn1",
+ "type": "string",
+ "enum": [
+ "ok",
+ "iccidOrAidNotFound",
+ "fallbackNotAllowed",
+ "fallbackProfileEnabled",
+ "undefinedError"
+ ]
+ }
+ },
+ {
+ "unsetFallbackAttributeResult": {
+ "description": "unsetFallbackAttributeResult PSMO result, see also SGP32Definitions.asn1",
+ "type": "string",
+ "enum": [
+ "ok",
+ "noFallbackAttribute",
+ "fallbackProfileEnabled",
+ "commandError",
+ "undefinedError"
+ ]
+ }
+ },
+ {
+ "setDefaultDpAddressResult": {
+ "description": "setDefaultDpAddressResult PSMO result, see also SGP32Definitions.asn1",
+ "type": "string",
+ "enum": [
+ "ok",
+ "undefinedError"
+ ]
+ }
+ },
+ {
"addEimResult": {
"description": "addEimResult eCO result",
"type": "object",
diff --git a/src/esipa_rest_utils.erl b/src/esipa_rest_utils.erl
index c5ff285..d026dc0 100644
--- a/src/esipa_rest_utils.erl
+++ b/src/esipa_rest_utils.erl
@@ -156,6 +156,33 @@
error
end.

+psmo_to_asn_setFallbackAttribute(Psmo) ->
+ case Psmo of
+ {[{<<"iccid">>, Iccid}]} ->
+ {setFallbackAttribute, #{iccid => utils:hex_to_binary(Iccid)}};
+ _ ->
+ logger:error("REST: order with bad setFallbackAttribute PSMO: ~p~n", [Psmo]),
+ error
+ end.
+
+psmo_to_asn_unsetFallbackAttribute(Psmo) ->
+ case Psmo of
+ {[]} ->
+ {unsetFallbackAttribute, #{}};
+ _ ->
+ logger:error("REST: order with bad unsetFallbackAttribute PSMO: ~p~n", [Psmo]),
+ error
+ end.
+
+psmo_to_asn_setDefaultDpAddress(Psmo) ->
+ case Psmo of
+ {[{<<"defaultDpAddress">>, DefaultDpAddress}]} ->
+ {setDefaultDpAddress, #{defaultDpAddress => DefaultDpAddress}};
+ _ ->
+ logger:error("REST: order with bad setDefaultDpAddress PSMO: ~p~n", [Psmo]),
+ error
+ end.
+
format_euicc_EuiccPackageSigned(EuiccPackage, EidValue, TransactionId) ->
case EuiccPackage of
error ->
@@ -189,6 +216,12 @@
psmo_to_asn_getRAT(Psmo);
{[{<<"configureImmediateEnable">>, Psmo}]} ->
psmo_to_asn_configureImmediateEnable(Psmo);
+ {[{<<"setFallbackAttribute">>, Psmo}]} ->
+ psmo_to_asn_setFallbackAttribute(Psmo);
+ {[{<<"unsetFallbackAttribute">>, Psmo}]} ->
+ psmo_to_asn_unsetFallbackAttribute(Psmo);
+ {[{<<"setDefaultDpAddress">>, Psmo}]} ->
+ psmo_to_asn_setDefaultDpAddress(Psmo);
_ ->
logger:error("REST: order with unknown/unsupported PSMO: ~p~n", [PsmoOrder]),
error
@@ -416,6 +449,15 @@
result_to_json_getRATResult(GetRATResult);
{configureImmediateEnableResult, ConfigureImmediateEnableResult} ->
{[{configureImmediateEnableResult, ConfigureImmediateEnableResult}]};
+ {setFallbackAttributeResult, SetFallbackAttributeResult} ->
+ {[{setFallbackAttributeResult, SetFallbackAttributeResult}]};
+ {unsetFallbackAttributeResult, UnsetFallbackAttributeResult} ->
+ {[{unsetFallbackAttributeResult, UnsetFallbackAttributeResult}]};
+ {setDefaultDpAddressResult, SetDefaultDpAddressResult} ->
+ {[
+ {setDefaultDpAddressResult,
+ maps:get(setDefaultDpAddressResult, SetDefaultDpAddressResult)}
+ ]};
{addEimResult, AddEimResult} ->
result_to_json_addEimResult(AddEimResult);
{deleteEimResult, DeleteEimResult} ->

To view, visit change 42881. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: onomondo-eim
Gerrit-Branch: master
Gerrit-Change-Id: I03cdd70065a83dfc611d614cf32d817c13fad347
Gerrit-Change-Number: 42881
Gerrit-PatchSet: 11
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>