bulkdata: added datamodel validation

This commit is contained in:
Vivek Kumar Dutta 2024-04-15 12:24:39 +05:30
parent c3f99c0914
commit bcd4ad4c24
3 changed files with 962 additions and 21 deletions

View file

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bulkdata
PKG_VERSION:=2.1.9
PKG_VERSION:=2.1.10
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
@ -46,14 +46,12 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/bulkdata
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
$(INSTALL_DATA) ./files/etc/config/bulkdata $(1)/etc/config/
$(INSTALL_BIN) ./files/etc/init.d/bulkdatad $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/uci-defaults/95-bulkdata-translation-options $(1)/etc/uci-defaults/
$(call BbfdmInstallPluginInMicroservice,$(1)/etc/bulkdata,$(PKG_BUILD_DIR)/bbf_plugin/bulkdata.json)
$(call BbfdmInstallMicroServiceInputFile,$(1),./files/etc/bulkdata/input.json)
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/bbf_plugin/bulkdata.json $(1) $(PKG_NAME)
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -0,0 +1,960 @@
{
"json_plugin_version": 2,
"Device.BulkData.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"name": "bulkdata"
},
"option": {
"name": "enable"
}
}
}
]
},
"Status": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"Enabled",
"Disabled",
"Error"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"name": "bulkdata"
},
"option": {
"name": "enable"
}
}
}
]
},
"MinReportingInterval": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "0",
"datatype": "unsignedInt",
"unit": "seconds"
},
"Protocols": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "HTTP",
"list": {
"datatype": "string",
"enumerations": [
"Streaming",
"File",
"HTTP",
"MQTT"
]
}
},
"EncodingTypes": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "JSON,CSV",
"list": {
"datatype": "string",
"enumerations": [
"XML",
"XDR",
"CSV",
"JSON"
]
}
},
"ParameterWildCardSupported": {
"type": "boolean",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "1",
"datatype": "boolean"
},
"MaxNumberOfProfiles": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "-1",
"datatype": "int",
"range": [
{
"min": -1
}
]
},
"MaxNumberOfParameterReferences": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "-1",
"datatype": "int",
"range": [
{
"min": -1
}
]
},
"ProfileNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.BulkData.Profile.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile"
},
"dmmapfile": "dmmap_bulkdata"
}
}
],
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "enable"
}
]
},
"Alias": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "Alias",
"range": [
{
"max": 64
}
],
"flags": [
"Unique"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "alias"
}
]
},
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 255
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"NumberOfRetainedFailedReports": {
"type": "int",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"range": [
{
"min": -1
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "nbre_of_retained_failed_reports"
}
]
},
"Protocol": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"Streaming",
"File",
"HTTP"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "protocol"
}
]
},
"EncodingType": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"XML",
"XDR",
"CSV",
"JSON"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "encoding_type"
}
]
},
"ReportingInterval": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"range": [
{
"min": 1
}
],
"unit": "seconds",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "reporting_interval"
}
]
},
"TimeReference": {
"type": "dateTime",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "dateTime",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "time_reference"
}
]
},
"ParameterNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile_parameter"
},
"option": {
"name": "@Count"
}
}
}
]
},
"Device.BulkData.Profile.{i}.Parameter.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile_parameter"
},
"dmmapfile": "dmmap_bulkdata"
}
}
],
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 64
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"Reference": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 256
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "reference"
}
]
}
},
"Device.BulkData.Profile.{i}.CSVEncoding.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"FieldSeparator": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "csv_encoding_field_separator"
}
]
},
"RowSeparator": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "csv_encoding_row_separator"
}
]
},
"EscapeCharacter": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "csv_encoding_escape_character"
}
]
},
"ReportFormat": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"ParameterPerRow",
"ParameterPerColumn"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "csv_encoding_report_format"
}
]
},
"RowTimestamp": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"Unix-Epoch",
"ISO-8601",
"None"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "csv_encoding_row_time_stamp"
}
]
}
},
"Device.BulkData.Profile.{i}.JSONEncoding.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"ReportFormat": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"ObjectHierarchy",
"NameValuePair"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "json_encoding_report_format"
}
]
},
"ReportTimestamp": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"Unix-Epoch",
"ISO-8601",
"None"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "json_encoding_report_time_stamp"
}
]
}
},
"Device.BulkData.Profile.{i}.HTTP.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": false,
"URL": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "URL",
"range": [
{
"max": 2048
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_url"
}
]
},
"Username": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 256
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_username"
}
]
},
"Password": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 256
}
],
"flags": [
"Secure"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_password"
}
]
},
"CompressionsSupported": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "GZIP",
"list": {
"datatype": "string",
"enumerations": [
"GZIP",
"Compress",
"Deflate"
]
}
},
"Compression": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"GZIP",
"Compress",
"Deflate"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_compression"
}
]
},
"MethodsSupported": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"default": "POST,PUT",
"list": {
"datatype": "string",
"enumerations": [
"POST",
"PUT"
]
}
},
"Method": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"enumerations": [
"POST",
"PUT"
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_method"
}
]
},
"UseDateHeader": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_use_date_header"
}
]
},
"RetryEnable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_retry_enable"
}
]
},
"RetryMinimumWaitInterval": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"range": [
{
"min": 1,
"max": 65535
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_retry_minimum_wait_interval"
}
]
},
"RetryIntervalMultiplier": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"range": [
{
"min": 1000,
"max": 65535
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_retry_interval_multiplier"
}
]
},
"RequestURIParameterNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile_http_request_uri_parameter"
},
"option": {
"name": "@Count"
}
}
}
]
},
"PersistAcrossReboot": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "http_persist_across_reboot"
}
]
},
"Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": [
{
"type": "uci",
"uci": {
"file": "bulkdata",
"section": {
"type": "profile_http_request_uri_parameter"
},
"dmmapfile": "dmmap_bulkdata"
}
}
],
"Name": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 64
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "name"
}
]
},
"Reference": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 256
}
],
"mapping": [
{
"data": "@Parent",
"type": "uci_sec",
"key": "reference"
}
]
}
}
}
}
}
}

View file

@ -1,17 +0,0 @@
{
"daemon": {
"config": {
"loglevel": "1"
},
"input": {
"type": "JSON",
"name": "/etc/bulkdata/bulkdata.json"
},
"output": {
"type": "UBUS",
"parent_dm": "Device.",
"object": "BulkData",
"root_obj": "bbfdm"
}
}
}