Blob Blame History Raw
{
  "$schema": "http://json-schema.org/draft-04/schema#",

  "title": "Common definitions",

  "uint": {
    "description": "Unsigned Integer",
    "type": "number",
    "multipleOf": 1.0,
    "minimum": 0
  },

  "uint_nonzero": {
    "description": "Unsigned Integer > 0",
    "type": "number",
    "multipleOf": 1.0,
    "minimum": 0,
    "exclusiveMinimum": true
  },

  "uint_uniq_nonempty_array": {
    "description": "Non-empty array of unique Unsigned Integers",
    "type": "array",
    "items": { "$ref": "#uint" },
    "uniqueItems": true,
    "minItems": 1,
    "maxItems": 512
  },

  "uint_uniq_array": {
    "description": "Array of unique Unsigned Integers",
    "type": "array",
    "items": { "$ref": "#uint" },
    "uniqueItems": true,
    "maxItems": 512
  },


  "string_nonempty": {
    "type": "string",
    "minLength": 1,
    "maxLength": 64
  },

  "string_hex" : {
    "type": [ "integer", "string" ],
    "pattern": "^0x[0-9a-fA-F]{1,32}$",
    "maxLength": 34
  },

  "app": {
    "description": "APP definition",
    "type": "object",
    "properties": {
      "name": {
        "description": "APP's name",
        "$ref": "#string_nonempty"
      },
      "cores": {
        "description": "Cores APP is pinned to",
        "$ref": "#uint_uniq_array"
      },
      "pids": {
        "description": "PIDs of APP",
        "$ref": "#uint_uniq_nonempty_array"
      }
    },
    "required": ["pids"]
  },

  "app_api_get": {
    "allOf": [
      { "$ref": "#app" },
      { "properties": {
          "id": {
            "description": "APP ID",
            "$ref": "#uint"
          }
        },
        "required": ["id"]
      }
    ]
  },

  "app_api_post": {
    "allOf": [
      { "$ref": "#app" },
      { "properties": {
          "pool_id": {
            "description": "Destination Pool ID",
            "$ref": "#uint"
          },
          "name": {},
          "cores": {},
          "pids": {}
        },
        "additionalProperties": false
      }
    ]
  },

  "app_api_put": {
    "type": "object",
    "properties": {
      "name": {
        "description": "APP's name",
        "$ref": "#string_nonempty"
      },
      "cores": {
        "description": "Cores APP is pinned to",
        "$ref": "#uint_uniq_array"
      },
      "pids": {
        "description": "PIDs of APP",
        "$ref": "#uint_uniq_nonempty_array"
      },
      "pool_id": {
        "description": "Destination Pool ID",
        "$ref": "#uint"
      }
    },
    "additionalProperties": false,
    "anyOf": [
      { "required": ["name"] },
      { "required": ["cores"] },
      { "required": ["pids"] },
      { "required": ["pool_id"] }
    ]
  },

  "power_profile" : {
    "description": "Power profile definition",
    "type": "object",
    "properties": {
      "id": {
        "description": "Power profile ID",
        "$ref": "#uint"
      },
      "min_freq": {
        "description": "Minimum frequency in MHz",
        "$ref": "#uint"
      },
      "max_freq": {
        "description": "Maximum frequency in MHz",
        "$ref": "#uint"
      },
      "epp" : {
        "description": "Energy Performance Preference",
        "$ref": "#string_nonempty"
      },
      "name" : {
        "description": "profile name",
        "$ref": "#string_nonempty"
      }
    },
    "additionalProperties": false,
    "anyOf": [
      { "required": ["min_freq"] },
      { "required": ["max_freq"] },
      { "required": ["epp"] },
      { "required": ["name"] }
    ]
  },

  "power_profile_cfg": {
    "allOf": [
      { "$ref": "#power_profile" },
      { "properties": {
          "id": {},
          "min_freq": {},
          "max_freq": {},
          "epp" : {},
          "name" : {}
        },
        "required": ["min_freq", "max_freq", "epp", "id"],
        "additionalProperties": false
      }
    ]
  },

  "power_api_get": {
    "allOf": [
      { "$ref": "#power_profile" }
    ]
  },

  "power_api_post": {
    "allOf": [
      { "$ref": "#power_profile" },
      { "properties": {
          "min_freq": {},
          "max_freq": {},
          "epp": {},
          "name": {}
        },
        "required": ["min_freq", "max_freq", "epp"],
        "additionalProperties": false
      }
    ]
  },

  "pool": {
    "description": "Definition of Pool of APPs",
    "type": "object",
    "properties": {
      "id": {
        "description": "Pool ID",
        "$ref": "#uint"
      },
      "name": {
        "description": "Pool's name",
        "$ref": "#string_nonempty"
      },
      "cbm": {
        "description": "L3 CAT cache bit mask",
        "$ref": "#string_hex"
      },
      "mba": {
        "description": "MBA rate",
        "$ref": "#uint"
      },
      "power_profile" : {
        "description": "Power profile ID",
        "$ref": "#uint"
      },
      "cores": {
        "description": "POOL cores",
        "$ref": "#uint_uniq_nonempty_array"
      },
      "apps": {
        "description": "APPs assigned to that pool",
        "$ref": "#uint_uniq_array"
      }
    },
    "required": ["cores"],
    "anyOf": [
      { "required": ["cbm"] },
      { "required": ["mba"] },
      { "required": ["power_profile"] }
    ]
  },

  "pool_cfg": {
    "allOf": [
      { "$ref": "#pool" },
      { "properties": {
          "name": {},
          "cores": {},
          "cbm": {},
          "mba": {},
          "id": {},
          "apps": {},
          "power_profile": {}
        },
        "required": ["cores", "id"],
        "additionalProperties": false
      }
    ]
  },

  "pool_api_get": {
    "allOf": [
      { "$ref": "#pool" }
    ]
  },

  "pool_api_post": {
    "allOf": [
      { "$ref": "#pool" },
      { "properties": {
          "name": {},
          "cores": {},
          "cbm": {},
          "mba": {},
          "power_profile" : {},
          "verify": {
              "description": "Power Profiles Admission Control",
              "type": "boolean"
          }
        },
        "required": ["cores"],
        "additionalProperties": false
      }
    ]
  }
}