Versions Compared

Key

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

...

Code Block
languagejs
titleExample of JSON Schema for CPU custom features
linenumberstrue
collapsetrue
{
  "definitions": {
	"hypervisorConfiguration": {
		"type": "object",
		"properties": {
			"memoryCompaction": { "enum": [ "best", "worst", "optimal" ] },
			"kernelSamePageMerging": {"type": "boolean" }
		}
	}
  },
  
  "type": "object",
  
  "properties": {
	"simultaneousMultiThreading": {"type": "boolean"},
	"simultaneousThreads": {"type": "integer", "minimum": 1, "maximum": 4},
	"logicalCpuPinningPolicy": {"type": "string" },
    "hypervisorConfiguration": { "$ref": "#/definitions/hypervisorConfiguration" },
	"instructionSetExtensions": {
		"type": "array", 
		"items": {
			"type": "string",
			"enum": [ "aes", "sse", "avx", "cat", "cmt", "mbm", "ddio", "smt", "rdrand" ]
		}
	}
  }
}

The idea of using a schema document together with the custom_features text seems to be very powerful. For a demostration of how such a schema would work, please visit any of the JSON schema validators available online, for example, https://json-schema-validator.herokuapp.com/. Just copy and paste over there the above JSON schema and the value of the custom_feature field and check on the validation results.

TOSCA 1.2 allows using a JSON schema as a TOSCA constraint in parameter definition and node_filter clauses.