Feat: configure audit fields and metrics for onix adapter and add local configuration for onix adapterZ

This commit is contained in:
Manendra Pal Singh
2026-02-23 16:08:44 +05:30
parent 2745047b27
commit ab89102711
29 changed files with 2167 additions and 441 deletions

View File

@@ -0,0 +1,221 @@
appName: "onix"
log:
level: debug
destinations:
- type: stdout
contextKeys:
- transaction_id
- message_id
- subscriber_id
- module_id
http:
port: 8080
timeout:
read: 30
write: 30
idle: 30
pluginManager:
root: ./plugins
remoteRoot: ""
modules:
- name: bapTxnReciever
path: /bap/reciever/
handler:
type: std
role: bap
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 10.81.192.4:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signValidator:
id: signvalidator
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bapTxnReciever-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bap
steps:
- validateSign
- addRoute
- validateSchema
- name: bapTxnCaller
path: /bap/caller/
handler:
type: std
role: bap
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 192.168.1.1:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signer:
id: signer
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bapTxnCaller-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bap
steps:
- validateSchema
- addRoute
- sign
- name: bppTxnReciever
path: /bpp/reciever/
handler:
type: std
role: bpp
subscriberId: bpp1
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 192.168.1.1:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signValidator:
id: signvalidator
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bppTxnReciever-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bpp
steps:
- validateSign
- addRoute
- validateSchema
- name: bppTxnCaller
path: /bpp/caller/
handler:
type: std
role: bpp
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 192.168.1.1:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signer:
id: signer
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bppTxnCaller-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bpp
steps:
- validateSchema
- addRoute
- sign

View File

@@ -1,4 +1,4 @@
appName: "onix"
appName: "onix-ev-charging"
log:
level: debug
destinations:
@@ -8,21 +8,49 @@ log:
- message_id
- subscriber_id
- module_id
- parent_id
# OpenTelemetry (OTLP) - metrics and traces sent to OTEL collector, then to Loki/backend
plugins:
otelsetup:
id: otelsetup
config:
serviceName: "onix-ev-charging-bap"
serviceVersion: "1.0.0"
environment: "development"
domain: "ev_charging"
otlpEndpoint: "otel-collector:4317"
enableMetrics: "true"
networkMetricsGranularity: "2min"
networkMetricsFrequency: "4min"
enableTracing: "true"
enableLogs: "true"
timeInterval: "5"
auditFieldsConfig: "/app/config/audit-fields.yaml"
# this is the port for the bap plugin where bap app can dump the requests to the plugin
http:
port: 8080
port: 8001
timeout:
read: 30
write: 30
idle: 30
pluginManager:
root: /app/plugins
remoteRoot: /mnt/gcs/plugins/plugins_bundle.zip
modules:
- name: bapTxnReciever
path: /bap/reciever/
# BAP Receiver - Receives callbacks from CDS (Phase 1) and BPPs (Phase 2+)
# Phase 1: Receives on_search from CDS with aggregated catalog
# Phase 2+: Receives callbacks from BPPs (on_select, on_init, on_confirm, etc.)
- name: bapTxnReceiver
path: /bap/receiver/
handler:
type: std
role: bap
subscriberId: ev-charging.sandbox1.com
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
@@ -32,47 +60,55 @@ modules:
registry:
id: registry
config:
url: http://localhost:8080/reg
url: http://mock-registry:3030
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
id: simplekeymanager
config:
projectID: ${projectID}
networkParticipant: example-bap.com
keyId: bap-key-1
signingPrivateKey: xnKF3BIg3Ei+ZEvxBtK0Mm4GRG1Mr0+K9IrxT6CnHEE=
signingPublicKey: MKA6fln8vmU2Qn80Y7dLzagpaPNqQWOlvGglMo5s0IU=
encrPrivateKey: xnKF3BIg3Ei+ZEvxBtK0Mm4GRG1Mr0+K9IrxT6CnHEE=
encrPublicKey: MKA6fln8vmU2Qn80Y7dLzagpaPNqQWOlvGglMo5s0IU=
cache:
id: redis
id: cache
config:
addr: 10.81.192.4:6379
addr: redis-bap:6379
schemaValidator:
id: schemavalidator
id: schemav2validator
config:
schemaDir: /mnt/gcs/configs/schemas
type: url
location: https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/api/beckn.yaml
cacheTTL: "3600"
signValidator:
id: signvalidator
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bapTxnReciever-routing.yaml
routingConfig: /app/config/bapTxnReciever-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
contextKeys: transaction_id,message_id,parent_id
role: bap
steps:
- validateSign
- addRoute
- validateSchema
# BAP Caller - Entry point for all requests from BAP
# Phase 1: Routes search to external CDS for aggregation
# Phase 2+: Routes other requests directly to BPP (bypasses CDS)
# Uses bpp_uri from context for dynamic routing in Phase 2+
- name: bapTxnCaller
path: /bap/caller/
handler:
type: std
role: bap
subscriberId: ev-charging.sandbox1.com
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
@@ -82,140 +118,42 @@ modules:
registry:
id: registry
config:
url: http://localhost:8080/reg
url: http://mock-registry:3030
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
id: simplekeymanager
config:
projectID: ${projectID}
networkParticipant: example-bap.com
keyId: bap-key-1
signingPrivateKey: xnKF3BIg3Ei+ZEvxBtK0Mm4GRG1Mr0+K9IrxT6CnHEE=
signingPublicKey: MKA6fln8vmU2Qn80Y7dLzagpaPNqQWOlvGglMo5s0IU=
encrPrivateKey: xnKF3BIg3Ei+ZEvxBtK0Mm4GRG1Mr0+K9IrxT6CnHEE=
encrPublicKey: MKA6fln8vmU2Qn80Y7dLzagpaPNqQWOlvGglMo5s0IU=
cache:
id: redis
id: cache
config:
addr: 192.168.1.1:6379
addr: redis-bap:6379
schemaValidator:
id: schemavalidator
id: schemav2validator
config:
schemaDir: /mnt/gcs/configs/schemas
signer:
id: signer
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
type: url
location: https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/api/beckn.yaml
cacheTTL: "3600"
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bapTxnCaller-routing.yaml
routingConfig: /app/config/bapTxnCaller-routing.yaml
signer:
id: signer
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
contextKeys: transaction_id,message_id,parent_id
role: bap
steps:
- validateSchema
- addRoute
- sign
- name: bppTxnReciever
path: /bpp/reciever/
handler:
type: std
role: bpp
subscriberId: bpp1
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 192.168.1.1:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signValidator:
id: signvalidator
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bppTxnReciever-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bpp
steps:
- validateSign
- addRoute
- validateSchema
- name: bppTxnCaller
path: /bpp/caller/
handler:
type: std
role: bpp
httpClientConfig:
maxIdleConns: 1000
maxIdleConnsPerHost: 200
idleConnTimeout: 300s
responseHeaderTimeout: 5s
plugins:
registry:
id: registry
config:
url: http://localhost:8080/reg
retry_max: 3
retry_wait_min: 100ms
retry_wait_max: 500ms
keyManager:
id: secretskeymanager
config:
projectID: ${projectID}
cache:
id: redis
config:
addr: 192.168.1.1:6379
schemaValidator:
id: schemavalidator
config:
schemaDir: /mnt/gcs/configs/schemas
signer:
id: signer
publisher:
id: publisher
config:
project: ${projectID}
topic: bapNetworkReciever
router:
id: router
config:
routingConfigPath: /mnt/gcs/configs/bppTxnCaller-routing.yaml
middleware:
- id: reqpreprocessor
config:
contextKeys: transaction_id,message_id
role: bpp
steps:
- validateSchema
- addRoute
- sign
- sign

View File

@@ -0,0 +1,24 @@
auditRules:
default:
- context.transaction_id
- context.message_id
- context.action
- context.domain
- context.bap_id
- context.bpp_id
search:
- context.transaction_id
- context.message_id
- context.action
- context.timestamp
- message.intent
select:
- context.transaction_id
- context.message_id
- context.action
- context.timestamp
- message.order.beckn:buyer.beckn:id
- message.order.beckn:orderItems.beckn:acceptedOffer.beckn:id

View File

@@ -1,25 +1,41 @@
# ONIX BAP Caller Routing Configuration
# Supports Phase 1 (Discover Aggregation) and Phase 2+ (Direct BPP Routing)
# Phase 1: Discover (Aggregation via CDS)
# Phase 2+: Other Requests (Direct to BPP, NO CDS involvement)
# These routes use bpp_uri from context (provided in on_discover aggregated response)
routingRules:
- domain: "ONDC:TRV10"
version: "2.0.0"
routingType: "bpp"
# Phase 1: Discover to CDS
- domain: ev_charging_network
version: "1.0.0"
targetType: url
target:
url: "https://gateway.example.com"
url: http://mock-cds:8082/csd
excludeAction: false
endpoints:
- search
- domain: "ONDC:TRV10"
version: "2.0.0"
routingType: "bpp"
- discover
# Phase 2+: Other actions to BPP (via context_endpoint)
- domain: ev_charging_network
version: "1.0.0"
targetType: bpp
target: {}
endpoints:
- select
- init
- confirm
- status
- track
- cancel
- domain: "ONDC:TRV12"
version: "2.0.0"
routingType: "bpp"
endpoints:
- select
- init
- confirm
- status
- update
- rating
- support

View File

@@ -1,20 +1,47 @@
# ONIX BAP Receiver Routing Configuration
# Supports Phase 1 (Discover Aggregation) and Phase 2+ (Direct BPP Callbacks)
# Phase 1: Discover Aggregation
# Phase 2+: Other Callbacks (Direct from BPPs to BAP, NO CDS involvement)
# These routes use bap_uri from context to route callbacks back to originating BAP
routingRules:
- domain: "ONDC:TRV10"
version: "2.0.0"
routingType: "url"
# Phase 1: on_discover callback to BAP (routed to mock-bap for testing)
- domain: ev_charging_network
version: "1.0.0"
targetType: url
target:
url: "https://services-backend/trv/v1"
url: http://mock-bap:9001
excludeAction: false
endpoints:
- on_discover
# Phase 2+: Other callbacks to BAP (routed to mock-bap for testing)
- domain: ev_charging_network
version: "1.0.0"
targetType: url
target:
url: http://mock-bap:9001
excludeAction: false
endpoints:
- on_select
- on_init
- on_confirm
- on_status
- on_update
- on_track
- on_cancel
- domain: "ONDC:TRV10"
version: "2.0.0"
routingType: "msgq"
target:
topic_id: "trv_topic_id1"
endpoints:
- on_search
- on_update
- on_rating
- on_support