Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

FiRE stands for Firebolt Ready API

What is a FiRe Thunder API?

  • A Thunder API method that has a direct mapping to one or more Firebolt APIs.
  • A Thunder API can map individual fields in a request, response, or event to a Firebolt API
  • A Thunder API message (request/response/event) can transform into a Firebolt API schema with a trivial JQ-based rule.


Rules Engine

What is jq programming language?

jq is a very high level, lexically scoped language used for json processing. There are many online tools available to test jq rules

Rule for Timezone API

Get Timezone

device.timezone: {alias: "org.rdk.System.getTimezoneDST",responseFilter: ".timezone"},


Set Timezone

device.setTimezone: {alias: "org.rdk.System.setTimezoneDST",requestFilter: "{ timezone : .value }",responseFilter: "if .success then null else {
code: -32100,
message: "couldnt set timezone" } end"}

Given Firebolt API allows error codes to be interpreted by the underlying implementation, operators can define their own errors and messages in the rule itself.

JQ support for Firebolt ready Plugin(s)

Existing Thunder to Firebolt JSON transformations performed by the Thunder extension for each API is captured in this worksheet

As part of the Ripple Gateway architecture, we are trying to leverage rules syntax like Jq to offer Firebolt translations.

The objective here is to make the Ripple rules engine more open-sourced and let operators configure their own rules for some of the adapters.

As part of the pre-request and post-result/event process, Ripple gateway will apply the rules defined in the filter to accomplish the support.


Here are examples of FiRe Thunder API





 localization.onCountryCodeChanged
Code Block
{
        "oldTerritory": "GBR",
        "newTerritory": "USA",
        "oldRegion": "GB-ENG",
        "newRegion": "US-NY"
    }



Code Block
US
 

if .newTerritory==\"ITA\" then \"IT\" else \"UK\" end

securestorage.get

Request

"params": {
"namespace": "appId",

"scope": "device",

"key": "someKey"

}

 

Request

"params": {

"scope": "device",

"key": "someKey"

}

{ namespace: \"$context.appId\", scope: .scope, key: .key, value: .value }

securestorage.set

Request

Code Block
{
"namespace": "appId",

"scope": "device",

"key": "someKey",

"value": "someToken"

}

Response


Code Block
{
"success": bool
}


Request

Code Block
{


"scope": "device",

"key": "someKey",

"value": "someValue"

}



Response null


"transform": {
"request": "{ namespace: \"$context.appId\", scope: .scope, key: .key, value: .value }",
"response": "if .success then \"null\" else { code: -32100, message: \"couldnt set timezone\" } end"
}

 


Ripple would require a filter in the configuration to support such an initiative

Code Block
"localization.onCountryCodeChanged": {
            "alias": "org.rdk.System.onTerritoryChanged",
            "transform": {
                "event": "if .newTerritory==\"ITA\" then \"IT\" else  \"UK\" end"
            }
        },
"securestorage.get": {
            "alias": "org.rdk.PersistentStore.1.getValue",
            "transform": {
                "request": "{ namespace: \"$context.appId\", scope: .scope, key: .key }",
                "response": ".value"
            }
        },
        "securestorage.set": {
            "alias": "org.rdk.PersistentStore.1.setValue",
            "transform": {
                "request": "{ namespace: \"$context.appId\", scope: .scope, key: .key, value: .value }",
                "response": "if .success then \"null\" else { code: -32100, message: \"couldnt set timezone\" } end"
            }
        }

...