dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/onomondo-eim/+/42881?usp=email )


Change subject: esipa_rest_utils: add support for PSMOs added in SGP.32 V.1.2
......................................................................

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, 113 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/81/42881/1

diff --git a/contrib/rest_api_resource_schema.json 
b/contrib/rest_api_resource_schema.json
index 1bc0fcf..21ce5d2 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)",
+                                                   "type": "string",
+                                                   "pattern": 
"^[0-9,A-F]{2,32}$"
+                                               }
+                                           },
+                                           "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 c36c6c7..5f09bc1 100644
--- a/contrib/rest_api_response_schema.json
+++ b/contrib/rest_api_response_schema.json
@@ -207,6 +207,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 2d2c7fe..936e6fa 100644
--- a/src/esipa_rest_utils.erl
+++ b/src/esipa_rest_utils.erl
@@ -136,6 +136,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 ->
@@ -169,6 +196,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
@@ -396,6 +429,12 @@
                 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 https://gerrit.osmocom.org/c/onomondo-eim/+/42881?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: onomondo-eim
Gerrit-Branch: master
Gerrit-Change-Id: I03cdd70065a83dfc611d614cf32d817c13fad347
Gerrit-Change-Number: 42881
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to