From 2a407eb24c7ba9d9548f1dc010616633beef5253 Mon Sep 17 00:00:00 2001 From: Noureddine Date: Wed, 21 Sep 2022 12:52:41 +0100 Subject: [PATCH 1/2] schema changes --- schema/model_system.json | 15 ++++++++++++++ schema/model_system_hardware.json | 33 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 schema/model_system_hardware.json diff --git a/schema/model_system.json b/schema/model_system.json index b4e37a2d6f..dc18a4d4a8 100644 --- a/schema/model_system.json +++ b/schema/model_system.json @@ -43,6 +43,21 @@ "site" ] }, + "hardware": { + "$ref": "file:model_system_hardware.json" + }, + "software": { + "additionalProperties": false, + "description": "A collection of items which can be used to describe version of software running on a device", + "examples": ["firmware", "os", "driver"], + "type": "object", + "existingJavaType": "java.util.Map", + "patternProperties": { + "^[a-z_]+$": { + "type": "string" + } + } + }, "physical_tag": { "description": "Information used to print a physical QR code label.", "type": "object", diff --git a/schema/model_system_hardware.json b/schema/model_system_hardware.json new file mode 100644 index 0000000000..c0f40506d7 --- /dev/null +++ b/schema/model_system_hardware.json @@ -0,0 +1,33 @@ +{ + "title": "SystemHardware", + "description": "A collection of fields which describe the physical hardware of the device.", + "type": "object", + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "properties": { + "make": { + "description": "The manufacturer of the device", + "type": "string", + "examples": ["Google"] + }, + "model": { + "description": "The model of the device", + "examples" : ["Pixel 5", "Pixel 6", "Pixel 6 Pro"], + "type": "string" + }, + "sku": { + "description": "A stock keeping unit which identifies the unique composition of a device, for example those with different hardware configurations", + "type": "string", + "examples": ["GF5KQ", "4215612"] + }, + "rev": { + "description": "Hardware revision of the device", + "type": "string", + "examples": ["A", "B", "1"] + } + }, + "required": [ + "make", + "model" + ] + } From 371f59a1ceec4b05b03acc53491aec5022339cb9 Mon Sep 17 00:00:00 2001 From: Noureddine El Saidi Date: Wed, 21 Sep 2022 11:56:02 +0000 Subject: [PATCH 2/2] run gencodes --- .gencode_hash.txt | 9 +- gencode/docs/metadata.html | 362 ++++++++++++++++++ gencode/java/udmi/schema/SystemModel.java | 27 +- gencode/python/udmi/schema/__init__.py | 1 + gencode/python/udmi/schema/model_system.py | 9 + .../udmi/schema/model_system_hardware.py | 50 +++ 6 files changed, 451 insertions(+), 7 deletions(-) create mode 100644 gencode/python/udmi/schema/model_system_hardware.py diff --git a/.gencode_hash.txt b/.gencode_hash.txt index e7fed9847f..f03141fc59 100644 --- a/.gencode_hash.txt +++ b/.gencode_hash.txt @@ -12,7 +12,7 @@ a8800ab8384de3b846af0d72cf310acf01644842b557e42eec20b69a0bfa1868 gencode/docs/e 71fe25d3b17d1dc87b52c049a3235c20527f73e12ffa53fa4800a15e53f73732 gencode/docs/event_pointset.html 7adf725427f285539b37abdad0c15f32e76bd6e1ec7d775527491597aef32875 gencode/docs/event_system.html 43025f61381de050eae9680c3193a1d878a397d0b5515dd1063a1a993b0c41ea gencode/docs/event_validation.html -208956129b09bde2639068b0bb3282dce09b12edb5e775eeed0834fa4890a001 gencode/docs/metadata.html +9ae793a641f2e053c5af734bf813cd2637a675330acb8d9e903ef03b4286e007 gencode/docs/metadata.html 5d039d607af9ec75ee552dfe36b16c702687ea16f5663f41fc49b4533b86e00d gencode/docs/properties.html 162f8f3b8ca9491e7dc1d2569d4773acae51f93b07fa875a9ece218d9d4f8a89 gencode/docs/readme.md 690d56e96c4e180e49e0abcba358ab1842ea06dd3f693918852a9de370c994d5 gencode/docs/reflect_config.html @@ -88,7 +88,7 @@ b2274107ce0e4e663b2a35e2ca284e492ec683bd687f6b8d8b014d5f8be67233 gencode/java/u 7de481ba531ea915a57cb6c5b23278db4fac6588354683cf63613b20c522af24 gencode/java/udmi/schema/SystemDiscoveryEvent.java 247652dd11714452adc27ffa542e3d5915f8e9b7b255d181723d6fe1e897b565 gencode/java/udmi/schema/SystemEvent.java 2cf23174ef4e2876511fb471d3f9fcb5cefe2fde324db844c2d0d505fd2c8844 gencode/java/udmi/schema/SystemHardware.java -1c79bdb3da4c9127c75aa6660be0e62bfab1d1ee47c289637662fee2e37f1491 gencode/java/udmi/schema/SystemModel.java +ceacfb4a1d0a4b4f4110b0e0717e57f2bbfd80ef18599d24fab19ddf497f399e gencode/java/udmi/schema/SystemModel.java 64e5b9a2c5699a3ca3b13dc6cb0243ff5b4c90908a14e3f11c5298ae89c8b261 gencode/java/udmi/schema/SystemState.java 7d6dd13e368e7f073738fee69c15e18652a9b7d7ac63bde0a200f747e3aa1b1d gencode/java/udmi/schema/TargetTestingModel.java d3968b92497e83a63f18cc0e74484a9807f1bb92db0c92d556ec2caaa143d645 gencode/java/udmi/schema/TestingModel.java @@ -96,7 +96,7 @@ d3968b92497e83a63f18cc0e74484a9807f1bb92db0c92d556ec2caaa143d645 gencode/java/u ac6f8fd87c8986cce01e872460c15ff6fe71e3816f9bde610acfe25f7d38c8d4 gencode/java/udmi/schema/ValidationEvent.java f7d117dc8b9764acf0c95a13a2bfdfbdf31d1a8ec83a707448aa4d7391ef07e2 gencode/java/udmi/schema/ValidationState.java e007ddd1ceeae3603c85110c33e1bb4a418ff9c7a791ca0df25b7ea3caeafd36 gencode/java/udmi/schema/ValidationSummary.java -033a86846fb9362a37d148f9696d223a2aae2a368452487cb6042407a316225f gencode/python/udmi/schema/__init__.py +07125fcc743ca05483e52fcd806488e98eb3716413c1f928a5d1896ed7f52496 gencode/python/udmi/schema/__init__.py 4b25dd95f863059b761269f93adcae7049507924a1c6e74d6856849203c179db gencode/python/udmi/schema/ancillary_properties.py 5ecd6c542f33450cb4ce75d940a6dff4d3bd67d4b9de4aff5ee88abcc301dbff gencode/python/udmi/schema/building_config.py dab4f5fca272ec48c2881bca2b6bc43786ada47fa1f6dd935c35f7ce0eb6b0f6 gencode/python/udmi/schema/building_translation.py @@ -140,7 +140,8 @@ ae6a7bc93b520cdc90cd158f876a58e98a3e000402ebb1ca632f01ee492d408a gencode/python 4718368765cacc2cbf552a65346452a14690d0175e9cc921fc576a5c7691fa1d gencode/python/udmi/schema/model_localnet_family.py abe431dc7702c80992b2c9736ab924d80d1033493036976f0cefa8c2108227be gencode/python/udmi/schema/model_pointset.py 1ad65c005d865b9259bfa239b2dc4cd1cde13d312ecbc7843bb61cc31d6cabde gencode/python/udmi/schema/model_pointset_point.py -3e34bfb5279c51a0a048d723ed0d91ebf82a614c22873c6425e058d55ac58df3 gencode/python/udmi/schema/model_system.py +ee9c02c35438fb7d9aacb15a21ec7b35b533c1000d0bde044ec3923b1fdccca4 gencode/python/udmi/schema/model_system.py +15b349141ebae651c6c3c5c313b197d49c8b2b44e8ff1b0639848ad42e5c4e63 gencode/python/udmi/schema/model_system_hardware.py aafe6e70c281152db958adf77a024e3e9fab8293927106297c5ec48c11f54e27 gencode/python/udmi/schema/model_testing.py 5c50847e136a033ea511209238bb570499b43fbee6189dae06603132dcb9f01f gencode/python/udmi/schema/model_testing_target.py a10a7e593d8747ea46c56da2c24c7b0501c10b190c5b66119cab8e71d2bdc0e6 gencode/python/udmi/schema/options_pubber.py diff --git a/gencode/docs/metadata.html b/gencode/docs/metadata.html index 788f396617..f4301d54d5 100644 --- a/gencode/docs/metadata.html +++ b/gencode/docs/metadata.html @@ -707,6 +707,368 @@

+ + + + + + + + +
+
+
+

+ +

+
+ +
+
+ + Type: object
+

A collection of fields which describe the physical hardware of the device.

+
+ + No Additional Properties + + + + + + +
+
+
+

+ +

+
+ +
+
+ + Type: string
+

The manufacturer of the device

+
+ + + + + +
+
Example:
+
"Google"
+
+
+
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+

The model of the device

+
+ + + + + +
+
Examples:
+
"Pixel 5"
+
+
"Pixel 6"
+
+
"Pixel 6 Pro"
+
+
+
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+

A stock keeping unit which identifies the unique composition of a device, for example those with different hardware configurations

+
+ + + + + +
+
Examples:
+
"GF5KQ"
+
+
"4215612"
+
+
+
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: string
+

Hardware revision of the device

+
+ + + + + +
+
Examples:
+
"A"
+
+
"B"
+
+
"1"
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ +

+
+ +
+
+ + Type: object
+

A collection of items which can be used to describe version of software running on a device

+
No Additional Properties + + + + + +
+
Examples:
+
"firmware"
+
+
"os"
+
+
"driver"
+
+
+
+
+
+

+ +

+
+ +
+

+ +

+

All property whose name matches the following regular expression must respect the following conditions

+ Property name regular expression: ^[a-z_]+$ +
+ + Type: string
+ + + + + + +
diff --git a/gencode/java/udmi/schema/SystemModel.java b/gencode/java/udmi/schema/SystemModel.java index afdd1583f6..741cbfc692 100644 --- a/gencode/java/udmi/schema/SystemModel.java +++ b/gencode/java/udmi/schema/SystemModel.java @@ -1,6 +1,7 @@ package udmi.schema; +import java.util.Map; import javax.annotation.processing.Generated; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -17,6 +18,8 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "location", + "hardware", + "software", "physical_tag", "aux", "min_loglevel" @@ -32,6 +35,22 @@ public class SystemModel { @JsonProperty("location") @JsonPropertyDescription("Properties the expected physical location of the device.") public Location location; + /** + * SystemHardware + *

+ * A collection of fields which describe the physical hardware of the device. + * + */ + @JsonProperty("hardware") + @JsonPropertyDescription("A collection of fields which describe the physical hardware of the device.") + public SystemHardware hardware; + /** + * A collection of items which can be used to describe version of software running on a device + * + */ + @JsonProperty("software") + @JsonPropertyDescription("A collection of items which can be used to describe version of software running on a device") + public Map software; /** * Information used to print a physical QR code label. * (Required) @@ -53,10 +72,12 @@ public class SystemModel { @Override public int hashCode() { int result = 1; - result = ((result* 31)+((this.location == null)? 0 :this.location.hashCode())); - result = ((result* 31)+((this.physical_tag == null)? 0 :this.physical_tag.hashCode())); + result = ((result* 31)+((this.software == null)? 0 :this.software.hashCode())); result = ((result* 31)+((this.aux == null)? 0 :this.aux.hashCode())); result = ((result* 31)+((this.min_loglevel == null)? 0 :this.min_loglevel.hashCode())); + result = ((result* 31)+((this.location == null)? 0 :this.location.hashCode())); + result = ((result* 31)+((this.physical_tag == null)? 0 :this.physical_tag.hashCode())); + result = ((result* 31)+((this.hardware == null)? 0 :this.hardware.hashCode())); return result; } @@ -69,7 +90,7 @@ public boolean equals(Object other) { return false; } SystemModel rhs = ((SystemModel) other); - return (((((this.location == rhs.location)||((this.location!= null)&&this.location.equals(rhs.location)))&&((this.physical_tag == rhs.physical_tag)||((this.physical_tag!= null)&&this.physical_tag.equals(rhs.physical_tag))))&&((this.aux == rhs.aux)||((this.aux!= null)&&this.aux.equals(rhs.aux))))&&((this.min_loglevel == rhs.min_loglevel)||((this.min_loglevel!= null)&&this.min_loglevel.equals(rhs.min_loglevel)))); + return (((((((this.software == rhs.software)||((this.software!= null)&&this.software.equals(rhs.software)))&&((this.aux == rhs.aux)||((this.aux!= null)&&this.aux.equals(rhs.aux))))&&((this.min_loglevel == rhs.min_loglevel)||((this.min_loglevel!= null)&&this.min_loglevel.equals(rhs.min_loglevel))))&&((this.location == rhs.location)||((this.location!= null)&&this.location.equals(rhs.location))))&&((this.physical_tag == rhs.physical_tag)||((this.physical_tag!= null)&&this.physical_tag.equals(rhs.physical_tag))))&&((this.hardware == rhs.hardware)||((this.hardware!= null)&&this.hardware.equals(rhs.hardware)))); } } diff --git a/gencode/python/udmi/schema/__init__.py b/gencode/python/udmi/schema/__init__.py index f1a5c96927..40ade7efa9 100644 --- a/gencode/python/udmi/schema/__init__.py +++ b/gencode/python/udmi/schema/__init__.py @@ -42,6 +42,7 @@ from .model_pointset import PointsetModel from .model_pointset_point import PointPointsetModel from .model_system import SystemModel +from .model_system_hardware import SystemHardware from .model_testing import TestingModel from .model_testing_target import TargetTestingModel from .options_pubber import PubberOptions diff --git a/gencode/python/udmi/schema/model_system.py b/gencode/python/udmi/schema/model_system.py index 683a62c84b..ef554ac530 100644 --- a/gencode/python/udmi/schema/model_system.py +++ b/gencode/python/udmi/schema/model_system.py @@ -89,6 +89,7 @@ def to_dict(self): if self.position: result['position'] = self.position.to_dict() # 4 return result +from .model_system_hardware import SystemHardware class Object0EA01FC6: @@ -215,6 +216,8 @@ class SystemModel: def __init__(self): self.location = None + self.hardware = None + self.software = None self.physical_tag = None self.aux = None self.min_loglevel = None @@ -225,6 +228,8 @@ def from_dict(source): return None result = SystemModel() result.location = Object327C415D.from_dict(source.get('location')) + result.hardware = SystemHardware.from_dict(source.get('hardware')) + result.software = source.get('software') result.physical_tag = Object8FD736D9.from_dict(source.get('physical_tag')) result.aux = Object734A44BA.from_dict(source.get('aux')) result.min_loglevel = source.get('min_loglevel') @@ -250,6 +255,10 @@ def to_dict(self): result = {} if self.location: result['location'] = self.location.to_dict() # 4 + if self.hardware: + result['hardware'] = self.hardware.to_dict() # 4 + if self.software: + result['software'] = self.software # 1 if self.physical_tag: result['physical_tag'] = self.physical_tag.to_dict() # 4 if self.aux: diff --git a/gencode/python/udmi/schema/model_system_hardware.py b/gencode/python/udmi/schema/model_system_hardware.py new file mode 100644 index 0000000000..0ccacd4df3 --- /dev/null +++ b/gencode/python/udmi/schema/model_system_hardware.py @@ -0,0 +1,50 @@ +"""Generated class for model_system_hardware.json""" + + +class SystemHardware: + """Generated schema class""" + + def __init__(self): + self.make = None + self.model = None + self.sku = None + self.rev = None + + @staticmethod + def from_dict(source): + if not source: + return None + result = SystemHardware() + result.make = source.get('make') + result.model = source.get('model') + result.sku = source.get('sku') + result.rev = source.get('rev') + return result + + @staticmethod + def map_from(source): + if not source: + return None + result = {} + for key in source: + result[key] = SystemHardware.from_dict(source[key]) + return result + + @staticmethod + def expand_dict(input): + result = {} + for property in input: + result[property] = input[property].to_dict() if input[property] else {} + return result + + def to_dict(self): + result = {} + if self.make: + result['make'] = self.make # 5 + if self.model: + result['model'] = self.model # 5 + if self.sku: + result['sku'] = self.sku # 5 + if self.rev: + result['rev'] = self.rev # 5 + return result