From abd2b671c61e56936dcf4f18d7aeb5afa1755b3e Mon Sep 17 00:00:00 2001 From: "Mitch Harding (the weird one)" Date: Thu, 19 Sep 2024 14:26:19 -0400 Subject: [PATCH] CASMCMS-8557: Add convenience CLI options for BOS v2 components updates --- cray/modules/bos/cli.py | 97 +- cray/modules/bos/openapi.yaml | 7 +- cray/modules/bos/swagger3.json | 9345 ++++++++--------- cray/tests/test_modules/test_bos.py | 740 -- .../tests/test_modules/test_bos_components.py | 240 + cray/tests/test_modules/test_bos_sessions.py | 427 + .../test_modules/test_bos_sessiontemplates.py | 334 + 7 files changed, 5196 insertions(+), 5994 deletions(-) create mode 100644 cray/tests/test_modules/test_bos_components.py create mode 100644 cray/tests/test_modules/test_bos_sessions.py create mode 100644 cray/tests/test_modules/test_bos_sessiontemplates.py diff --git a/cray/modules/bos/cli.py b/cray/modules/bos/cli.py index 8d21d05..07c1276 100644 --- a/cray/modules/bos/cli.py +++ b/cray/modules/bos/cli.py @@ -96,10 +96,11 @@ def updatemany_data_handler(args): return "PATCH", path, data -def create_patch_shim(func): +def create_patch_shim_updatemany_components(func): """ Callback function to custom create our own payload """ - def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, **kwargs): + def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, clear_desired_state, + clear_staged_state, clear_pending_state, **kwargs): filter_ids = filter_ids["value"] filter_session = filter_session["value"] if not (filter_ids or filter_session): @@ -123,6 +124,23 @@ def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, **kwarg payload["patch"]["enabled"] = enabled["value"] if retry_policy["value"] is not None: payload["patch"]["retry_policy"] = retry_policy["value"] + empty_boot_artifacts = { + "initrd": "", + "kernel_parameters": "", + "kernel": "" } + if clear_pending_state["value"]: + clear_staged_state["value"] = True + clear_desired_state["value"] = True + if clear_staged_state["value"]: + payload["patch"]["staged_state"] = { + "session": "", + "configuration": "", + "boot_artifacts": empty_boot_artifacts } + if clear_desired_state["value"]: + payload["patch"]["desired_state"] = { + "bss_token": "", + "configuration": "", + "boot_artifacts": empty_boot_artifacts } # Hack to tell the CLI we are passing our own payload; don't generate kwargs[FROM_FILE_TAG] = {"value": payload, "name": FROM_FILE_TAG} return func(data_handler=updatemany_data_handler, **kwargs) @@ -132,13 +150,12 @@ def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, **kwarg def setup_components_patch(): """ Sets up an updatemany command for components """ - source_command = cli.commands['v2'].commands['components'].commands['list'] + source_command = cli.commands['v2'].commands['components'].commands.pop('create') command_type = type(source_command) new_command = command_type("updatemany") for key, value in source_command.__dict__.items(): setattr(new_command, key, value) - cli.commands['v2'].commands['components'].commands[ - 'updatemany'] = new_command + cli.commands['v2'].commands['components'].commands['updatemany'] = new_command new_command.params = [] default_params = [param for param in source_command.params if not param.expose_value] @@ -172,7 +189,7 @@ def setup_components_patch(): type=bool, default=None, metavar='BOOLEAN', - help="Shortcut for --patch '{\"enabled\":True/False}'" + help="Enable or disable the components" )(new_command) option( '--retry-policy', @@ -180,10 +197,72 @@ def setup_components_patch(): type=int, default=None, metavar='INT', - help="Shortcut for --patch '{\"retry_policy\":}'" + help="Set the retry policy for the components" + )(new_command) + option( + '--clear-desired-state', + is_flag=True, + callback=_opt_callback, + help='Clear all desired state fields for the components' + )(new_command) + option( + '--clear-staged-state', + is_flag=True, + callback=_opt_callback, + help='Clear all the staged state fields for the components' + )(new_command) + option( + '--clear-pending-state', + is_flag=True, + callback=_opt_callback, + help='Shortcut for --clear-desired-state --clear-staged-state' )(new_command) new_command.params += default_params - new_command.callback = create_patch_shim(new_command.callback) + new_command.callback = create_patch_shim_updatemany_components(new_command.callback) + +def create_patch_shim_update_components(func): + """ Callback function to custom create our own payload """ + + def _decorator(clear_desired_state, clear_staged_state, clear_pending_state, **kwargs): + if clear_pending_state["value"]: + clear_staged_state["value"] = True + clear_desired_state["value"] = True + if clear_staged_state["value"]: + for arg in kwargs.values(): + if arg["name"].find('staged_state') == 0: + arg["value"] = "" + if clear_desired_state["value"]: + for arg in kwargs.values(): + if arg["name"].find('desired_state') == 0: + arg["value"] = "" + return func(**kwargs) + + return _decorator + + +def modify_component_patch(): + """ Modifies update command for components """ + source_command = cli.commands['v2'].commands['components'].commands['update'] + option( + '--clear-desired-state', + is_flag=True, + callback=_opt_callback, + help='Clear all desired state fields for the component' + )(source_command) + option( + '--clear-staged-state', + is_flag=True, + callback=_opt_callback, + help='Clear all staged state fields for the component' + )(source_command) + option( + '--clear-pending-state', + is_flag=True, + callback=_opt_callback, + help='Shortcut for --clear-desired-state --clear-staged-state' + )(source_command) + source_command.params = source_command.params[-3:] + source_command.params[:-3] + source_command.callback = create_patch_shim_update_components(source_command.callback) def setup_v2_template_create(): @@ -209,3 +288,5 @@ def setup_v2_template_create(): ) setup_components_patch() + +modify_component_patch() diff --git a/cray/modules/bos/openapi.yaml b/cray/modules/bos/openapi.yaml index f8a2ccb..04a5eda 100644 --- a/cray/modules/bos/openapi.yaml +++ b/cray/modules/bos/openapi.yaml @@ -1094,9 +1094,7 @@ components: content: application/json: schema: - oneOf: - - $ref: '#/components/schemas/V2ComponentsUpdate' - - $ref: '#/components/schemas/V2ComponentArrayWithIds' + type: object V2optionsUpdateRequest: description: Service-wide options required: true @@ -1698,13 +1696,12 @@ paths: $ref: '#/components/responses/V2componentDetailsArray' 400: $ref: '#/components/responses/BadRequest' - patch: + post: summary: Update a collection of Components description: Update the state for a collection of Components in the BOS database tags: - v2 - components - - cli_ignore x-openapi-router-controller: bos.server.controllers.v2.components operationId: patch_v2_components requestBody: diff --git a/cray/modules/bos/swagger3.json b/cray/modules/bos/swagger3.json index 952b1d5..605d900 100644 --- a/cray/modules/bos/swagger3.json +++ b/cray/modules/bos/swagger3.json @@ -3751,804 +3751,443 @@ "content": { "application/json": { "schema": { - "oneOf": [ - { - "description": "Information for patching multiple Components.", + "type": "object" + } + } + } + }, + "V2optionsUpdateRequest": { + "description": "Service-wide options", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "Options for the Boot Orchestration Service.\n", + "type": "object", + "properties": { + "cleanup_completed_session_ttl": { + "type": "string", + "description": "Delete complete Sessions that are older than cleanup_completed_session_ttl (in minutes, hours, days, or weeks).\n0 disables cleanup behavior.\n", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 + }, + "clear_stage": { + "type": "boolean", + "description": "Allows a Component's staged information to be cleared when the requested staging action has been started. Defaults to false." + }, + "component_actual_state_ttl": { + "type": "string", + "description": "The maximum amount of time a Component's actual state is considered valid (in minutes, hours, days, or weeks).\n0 disables cleanup behavior for newly booted nodes and instructs bos-state-reporter to report once instead of periodically.\n", + "example": "6h", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 + }, + "disable_components_on_completion": { + "type": "boolean", + "description": "If true, when a Session has brought a Component to its desired state, that Component will be marked as disabled in BOS.\nIf false, BOS will continue to maintain the state of the nodes declaratively, even after a Session finishes.\n" + }, + "discovery_frequency": { + "type": "integer", + "description": "How frequently the BOS discovery agent syncs new Components from HSM (in seconds)", + "minimum": 0, + "maximum": 33554432 + }, + "logging_level": { + "type": "string", + "description": "The logging level for all BOS services", + "pattern": "^([dD][eE][bB][uU][gG]|[iI][nN][fF][oO]|[wW][aA][rR][nN][iI][nN][gG]|[eE][rR][rR][oO][rR]|[cC][rR][iI][tT][iI][cC][aA][lL])$" + }, + "max_boot_wait_time": { + "type": "integer", + "description": "How long BOS will wait for a node to boot into a usable state before rebooting it again (in seconds)", + "minimum": 0, + "maximum": 1048576 + }, + "max_power_on_wait_time": { + "type": "integer", + "description": "How long BOS will wait for a node to power on before calling power on again (in seconds)", + "minimum": 0, + "maximum": 1048576 + }, + "max_power_off_wait_time": { + "type": "integer", + "description": "How long BOS will wait for a node to power off before forcefully powering off (in seconds)", + "minimum": 0, + "maximum": 1048576 + }, + "polling_frequency": { + "type": "integer", + "description": "How frequently the BOS operators check Component state for needed actions (in seconds)", + "minimum": 0, + "maximum": 1048576 + }, + "default_retry_policy": { + "type": "integer", + "description": "The default maximum number attempts per node for failed actions.", + "example": 1, + "minimum": 0, + "maximum": 1048576 + }, + "max_component_batch_size": { + "type": "integer", + "description": "The maximum number of Components that a BOS operator will process at once. 0 means no limit.", + "example": 1000, + "minimum": 0, + "maximum": 131071 + }, + "reject_nids": { + "type": "boolean", + "description": "If true, then BOS will attempt to prevent Sessions and Session Templates that reference NIDs (which BOS does not support).\nSpecifically, if this option is true, then:\n- When creating a Session, if the Session limit or a Session Template node list appear to contain NID values, then Session creation will fail.\n- When creating a Session Template, if a node list appears to contain a NID value, then the Session Template creation will fail.\n- When validating an existing Session Template, if a node list appears to contain a NID value, then the validation will report an error.\n\nThis option does NOT have an effect on Sessions that were created prior to it being enabled (even if they have not yet started).\n" + }, + "session_limit_required": { + "type": "boolean", + "description": "If true, Sessions cannot be created without specifying the limit parameter." + } + }, + "additionalProperties": true, + "minProperties": 1, + "maxProperties": 1024 + } + } + } + }, + "V2sessionUpdateRequest": { + "description": "The state for a single Session", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "A Session update object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "status": { "type": "object", + "description": "Information on the status of a Session.\n", "properties": { - "patch": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", - "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } - }, - "additionalProperties": false - }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } - }, - "additionalProperties": false - }, - "status": { - "description": "Status information for the Component", - "type": "object", - "properties": { - "phase": { - "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 - }, - "status": { - "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true - }, - "status_override": { - "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 - } - }, - "additionalProperties": false - }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." - }, - "error": { - "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 - } - }, - "additionalProperties": false, - "minProperties": 1 + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 }, - "filters": { - "oneOf": [ - { - "description": "Information for patching multiple Components by listing their IDs.\n", - "type": "object", - "properties": { - "ids": { - "type": "string", - "description": "A comma-separated list of Component IDs.", - "minLength": 1, - "maxLength": 65535 - }, - "session": { - "type": "string", - "description": "An empty string value.", - "enum": [ - "" - ], - "nullable": true, - "maxLength": 0 - } - }, - "required": [ - "ids" - ], - "additionalProperties": false - }, - { - "description": "Information for patching multiple Components by Session name.\nAll Components part of this Session will be patched.\n", - "type": "object", - "properties": { - "ids": { - "type": "string", - "description": "An empty string value.", - "enum": [ - "" - ], - "nullable": true, - "maxLength": 0 - }, - "session": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - } - }, - "required": [ - "session" - ], - "additionalProperties": false - } - ] + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 + }, + "status": { + "type": "string", + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." + }, + "error": { + "type": "string", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", + "maxLength": 65536 } }, - "required": [ - "patch", - "filters" - ], "additionalProperties": false + } + }, + "additionalProperties": false + } + } + } + }, + "V2applyStagedRequest": { + "description": "A list of xnames that should have their staged Session applied.", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "A list of Components that should have their staged Session applied.\n", + "type": "object", + "properties": { + "xnames": { + "description": "A list of Component IDs (xnames)", + "type": "array", + "maxItems": 32768, + "items": { + "type": "string", + "description": "The Component's ID. (e.g. xname for hardware Components)", + "minLength": 1, + "maxLength": 127 + } + } + }, + "additionalProperties": false + } + } + } + } + }, + "responses": { + "ResourceDeleted": { + "description": "The resource was deleted." + }, + "ServiceHealth": { + "description": "Service Health information", + "content": { + "application/json": { + "schema": { + "description": "Service health status", + "type": "object", + "properties": { + "dbStatus": { + "type": "string" + }, + "apiStatus": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "Version": { + "description": "Get version details\nThe versioning system uses [semver](https://semver.org/).\n## Link Relationships\n* self : Link to itself\n* versions : Link back to the versions resource\n", + "content": { + "application/json": { + "schema": { + "description": "Version data", + "type": "object", + "properties": { + "major": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" + }, + "minor": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" }, - { - "description": "An array of Component states with associated Ids.", + "patch": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" + }, + "links": { + "description": "List of links to other resources", "type": "array", "items": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", + "description": "Link to other resources", "type": "object", "properties": { - "id": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + } + } + } + }, + "V2SessionTemplateDetails": { + "description": "Session Template details", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", "minLength": 1, - "maxLength": 127 + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { + "configuration": { "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 } }, "additionalProperties": false }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", - "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } - }, - "additionalProperties": false + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } - }, - "additionalProperties": false + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } }, - "status": { - "description": "Status information for the Component", - "type": "object", - "properties": { - "phase": { - "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 - }, - "status": { - "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true - }, - "status_override": { - "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 - } - }, - "additionalProperties": false + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } }, - "error": { + "arch": { "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] }, - "session": { + "rootfs_provider": { "type": "string", - "description": "Name of the Session or an empty string." + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 } }, "additionalProperties": false, "required": [ - "id" + "path", + "type" ] } - } - ] - } - } - } - }, - "V2optionsUpdateRequest": { - "description": "Service-wide options", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "Options for the Boot Orchestration Service.\n", - "type": "object", - "properties": { - "cleanup_completed_session_ttl": { - "type": "string", - "description": "Delete complete Sessions that are older than cleanup_completed_session_ttl (in minutes, hours, days, or weeks).\n0 disables cleanup behavior.\n", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "clear_stage": { - "type": "boolean", - "description": "Allows a Component's staged information to be cleared when the requested staging action has been started. Defaults to false." - }, - "component_actual_state_ttl": { - "type": "string", - "description": "The maximum amount of time a Component's actual state is considered valid (in minutes, hours, days, or weeks).\n0 disables cleanup behavior for newly booted nodes and instructs bos-state-reporter to report once instead of periodically.\n", - "example": "6h", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "disable_components_on_completion": { - "type": "boolean", - "description": "If true, when a Session has brought a Component to its desired state, that Component will be marked as disabled in BOS.\nIf false, BOS will continue to maintain the state of the nodes declaratively, even after a Session finishes.\n" - }, - "discovery_frequency": { - "type": "integer", - "description": "How frequently the BOS discovery agent syncs new Components from HSM (in seconds)", - "minimum": 0, - "maximum": 33554432 - }, - "logging_level": { - "type": "string", - "description": "The logging level for all BOS services", - "pattern": "^([dD][eE][bB][uU][gG]|[iI][nN][fF][oO]|[wW][aA][rR][nN][iI][nN][gG]|[eE][rR][rR][oO][rR]|[cC][rR][iI][tT][iI][cC][aA][lL])$" - }, - "max_boot_wait_time": { - "type": "integer", - "description": "How long BOS will wait for a node to boot into a usable state before rebooting it again (in seconds)", - "minimum": 0, - "maximum": 1048576 - }, - "max_power_on_wait_time": { - "type": "integer", - "description": "How long BOS will wait for a node to power on before calling power on again (in seconds)", - "minimum": 0, - "maximum": 1048576 - }, - "max_power_off_wait_time": { - "type": "integer", - "description": "How long BOS will wait for a node to power off before forcefully powering off (in seconds)", - "minimum": 0, - "maximum": 1048576 - }, - "polling_frequency": { - "type": "integer", - "description": "How frequently the BOS operators check Component state for needed actions (in seconds)", - "minimum": 0, - "maximum": 1048576 - }, - "default_retry_policy": { - "type": "integer", - "description": "The default maximum number attempts per node for failed actions.", - "example": 1, - "minimum": 0, - "maximum": 1048576 - }, - "max_component_batch_size": { - "type": "integer", - "description": "The maximum number of Components that a BOS operator will process at once. 0 means no limit.", - "example": 1000, - "minimum": 0, - "maximum": 131071 - }, - "reject_nids": { - "type": "boolean", - "description": "If true, then BOS will attempt to prevent Sessions and Session Templates that reference NIDs (which BOS does not support).\nSpecifically, if this option is true, then:\n- When creating a Session, if the Session limit or a Session Template node list appear to contain NID values, then Session creation will fail.\n- When creating a Session Template, if a node list appears to contain a NID value, then the Session Template creation will fail.\n- When validating an existing Session Template, if a node list appears to contain a NID value, then the validation will report an error.\n\nThis option does NOT have an effect on Sessions that were created prior to it being enabled (even if they have not yet started).\n" - }, - "session_limit_required": { - "type": "boolean", - "description": "If true, Sessions cannot be created without specifying the limit parameter." - } - }, - "additionalProperties": true, - "minProperties": 1, - "maxProperties": 1024 - } - } - } - }, - "V2sessionUpdateRequest": { - "description": "The state for a single Session", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "A Session update object\n\n## Link Relationships\n\n* self : The Session object\n", - "type": "object", - "properties": { - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 - }, - "status": { - "type": "object", - "description": "Information on the status of a Session.\n", - "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { - "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", - "maxLength": 127 - }, - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "error": { - "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - } - } - }, - "V2applyStagedRequest": { - "description": "A list of xnames that should have their staged Session applied.", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "A list of Components that should have their staged Session applied.\n", - "type": "object", - "properties": { - "xnames": { - "description": "A list of Component IDs (xnames)", - "type": "array", - "maxItems": 32768, - "items": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - } - } - }, - "additionalProperties": false - } - } - } - } - }, - "responses": { - "ResourceDeleted": { - "description": "The resource was deleted." - }, - "ServiceHealth": { - "description": "Service Health information", - "content": { - "application/json": { - "schema": { - "description": "Service health status", - "type": "object", - "properties": { - "dbStatus": { - "type": "string" - }, - "apiStatus": { - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "Version": { - "description": "Get version details\nThe versioning system uses [semver](https://semver.org/).\n## Link Relationships\n* self : Link to itself\n* versions : Link back to the versions resource\n", - "content": { - "application/json": { - "schema": { - "description": "Version data", - "type": "object", - "properties": { - "major": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "minor": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "patch": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" }, "links": { "description": "List of links to other resources", "type": "array", + "readOnly": true, "items": { "description": "Link to other resources", "type": "object", @@ -4564,223 +4203,16 @@ } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "boot_sets" + ] } } } }, - "V2SessionTemplateDetails": { - "description": "Session Template details", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] - } - } - } - }, - "V2SessionTemplateDetailsArray": { - "description": "Session Template details array", + "V2SessionTemplateDetailsArray": { + "description": "Session Template details array", "content": { "application/json": { "schema": { @@ -6023,1701 +5455,402 @@ }, "instance": { "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "BadRequestOrMultiTenancyNotSupported": { - "description": "Multi-tenancy is not supported for this request.\nIf no tenant was specified, then the request was bad for another reason.\n", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "MultiTenancyNotSupported": { - "description": "Multi-tenancy is not supported for this BOS request.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "ResourceNotFound": { - "description": "The resource was not found.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "UpdateConflict": { - "description": "The update was not allowed due to a conflict.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "ServiceUnavailable": { - "description": "Service Unavailable", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "InternalError": { - "description": "An Internal Server Error occurred handling the request.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - }, - "parameters": { - "TemplateIdPathParam": { - "name": "session_template_id", - "in": "path", - "description": "Session Template name", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - } - }, - "V2ComponentIdPathParam": { - "name": "component_id", - "in": "path", - "description": "Component ID. e.g. xname for hardware Components", - "required": true, - "schema": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - } - }, - "V2SessionIdPathParam": { - "name": "session_id", - "in": "path", - "description": "Session ID", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - } - }, - "V2SessionsMaxAgeQueryParam": { - "name": "max_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - "V2SessionsMinAgeQueryParam": { - "name": "min_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - "V2SessionsStatusQueryParam": { - "name": "status", - "schema": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "in": "query", - "description": "Only include Sessions with the given status." - }, - "V2TenantHeaderParam": { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - } - }, - "paths": { - "/": { - "get": { - "summary": "Get API versions", - "description": "Return list of versions currently running.", - "tags": [ - "version" - ], - "x-openapi-router-controller": "bos.server.controllers.base", - "operationId": "root_get", - "responses": { - "200": { - "description": "A collection of Versions", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "description": "Version data", - "type": "object", - "properties": { - "major": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "minor": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "patch": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false - } - } - } - } - }, - "500": { - "description": "An Internal Server Error occurred handling the request.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - } - }, - "/v2": { - "get": { - "summary": "Get API version", - "description": "Return the API version", - "tags": [ - "v2", - "version" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.base", - "operationId": "get_v2", - "responses": { - "200": { - "description": "Get version details\nThe versioning system uses [semver](https://semver.org/).\n## Link Relationships\n* self : Link to itself\n* versions : Link back to the versions resource\n", - "content": { - "application/json": { - "schema": { - "description": "Version data", - "type": "object", - "properties": { - "major": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "minor": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "patch": { - "type": "string", - "pattern": "^(0|[1-9][0-9]*)$" - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false - } - } - } - }, - "500": { - "description": "An Internal Server Error occurred handling the request.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - } - }, - "/v2/healthz": { - "get": { - "summary": "Get service health details", - "description": "Get BOS health details.", - "tags": [ - "v2", - "healthz" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.healthz", - "operationId": "get_v2_healthz", - "responses": { - "200": { - "description": "Service Health information", - "content": { - "application/json": { - "schema": { - "description": "Service health status", - "type": "object", - "properties": { - "dbStatus": { - "type": "string" - }, - "apiStatus": { - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "500": { - "description": "Bad Request", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - }, - "503": { - "description": "Service Unavailable", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - } - }, - "/v2/sessiontemplates": { - "parameters": [ - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], - "get": { - "summary": "List Session Templates", - "description": "List all Session Templates.", - "tags": [ - "v2", - "sessiontemplates" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "get_v2_sessiontemplates", - "responses": { - "200": { - "description": "Session Template details array", - "content": { - "application/json": { - "schema": { - "description": "An array of Session Templates.", - "type": "array", - "items": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] - } - } - } - } - } - } - } - }, - "/v2/sessiontemplatesvalid/{session_template_id}": { - "parameters": [ - { - "name": "session_template_id", - "in": "path", - "description": "Session Template name", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - } - }, - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], - "get": { - "summary": "Validate the Session Template by ID", - "description": "Validate Session Template by Session Template ID.\nThe Session Template ID corresponds to the *name*\nof the Session Template.\n", - "tags": [ - "v2", - "sessiontemplatess" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "validate_v2_sessiontemplate", - "responses": { - "200": { - "description": "Session Template validity details", - "content": { - "application/json": { - "schema": { - "description": "Message describing errors or incompleteness in a Session Template.\n", - "type": "string" - } - } - } - }, - "404": { - "description": "The resource was not found.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - } - }, - "/v2/sessiontemplates/{session_template_id}": { - "parameters": [ - { - "name": "session_template_id", - "in": "path", - "description": "Session Template name", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - } - }, - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], - "get": { - "summary": "Get Session Template by ID", - "description": "Get Session Template by Session Template ID.\nThe Session Template ID corresponds to the *name*\nof the Session Template.\n", - "tags": [ - "v2", - "sessiontemplatess" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "get_v2_sessiontemplate", - "responses": { - "200": { - "description": "Session Template details", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] - } - } - } - }, - "404": { - "description": "The resource was not found.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" } - } + }, + "additionalProperties": false } } } }, - "put": { - "summary": "Create Session Template", - "description": "Create a new Session Template.", - "tags": [ - "v2", - "sessiontemplates" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "put_v2_sessiontemplate", - "requestBody": { - "description": "A JSON object for creating a Session Template", - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } + "BadRequestOrMultiTenancyNotSupported": { + "description": "Multi-tenancy is not supported for this request.\nIf no tenant was specified, then the request was bad for another reason.\n", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "MultiTenancyNotSupported": { + "description": "Multi-tenancy is not supported for this BOS request.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] - } + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "ResourceNotFound": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "UpdateConflict": { + "description": "The update was not allowed due to a conflict.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "ServiceUnavailable": { + "description": "Service Unavailable", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "InternalError": { + "description": "An Internal Server Error occurred handling the request.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false } } + } + } + }, + "parameters": { + "TemplateIdPathParam": { + "name": "session_template_id", + "in": "path", + "description": "Session Template name", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + } + }, + "V2ComponentIdPathParam": { + "name": "component_id", + "in": "path", + "description": "Component ID. e.g. xname for hardware Components", + "required": true, + "schema": { + "type": "string", + "description": "The Component's ID. (e.g. xname for hardware Components)", + "minLength": 1, + "maxLength": 127 + } + }, + "V2SessionIdPathParam": { + "name": "session_id", + "in": "path", + "description": "Session ID", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + } + }, + "V2SessionsMaxAgeQueryParam": { + "name": "max_age", + "schema": { + "type": "string", + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 + }, + "in": "query", + "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" + }, + "V2SessionsMinAgeQueryParam": { + "name": "min_age", + "schema": { + "type": "string", + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 + }, + "in": "query", + "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" + }, + "V2SessionsStatusQueryParam": { + "name": "status", + "schema": { + "type": "string", + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, + "in": "query", + "description": "Only include Sessions with the given status." + }, + "V2TenantHeaderParam": { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + } + }, + "paths": { + "/": { + "get": { + "summary": "Get API versions", + "description": "Return list of versions currently running.", + "tags": [ + "version" + ], + "x-openapi-router-controller": "bos.server.controllers.base", + "operationId": "root_get", "responses": { "200": { - "description": "Session Template details", + "description": "A collection of Versions", "content": { "application/json": { "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } + "type": "array", + "items": { + "description": "Version data", + "type": "object", + "properties": { + "major": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } + "minor": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" + }, + "patch": { + "type": "string", + "pattern": "^(0|[1-9][0-9]*)$" + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" + "rel": { + "type": "string" + } }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false + "additionalProperties": false + } } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] + }, + "additionalProperties": false + } } } } }, - "400": { - "description": "Bad Request", + "500": { + "description": "An Internal Server Error occurred handling the request.", "content": { "application/problem+json": { "schema": { @@ -7732,438 +5865,65 @@ }, "title": { "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - }, - "patch": { - "summary": "Update a Session Template", - "description": "Update an existing Session Template.", - "tags": [ - "v2", - "sessiontemplates" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "patch_v2_sessiontemplate", - "requestBody": { - "description": "A JSON object for updating a Session Template", - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] + }, + "additionalProperties": false + } } } } - }, + } + } + }, + "/v2": { + "get": { + "summary": "Get API version", + "description": "Return the API version", + "tags": [ + "v2", + "version" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.base", + "operationId": "get_v2", "responses": { "200": { - "description": "Session Template details", + "description": "Get version details\nThe versioning system uses [semver](https://semver.org/).\n## Link Relationships\n* self : Link to itself\n* versions : Link back to the versions resource\n", "content": { "application/json": { "schema": { + "description": "Version data", "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", "properties": { - "name": { + "major": { "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" + "pattern": "^(0|[1-9][0-9]*)$" }, - "tenant": { + "minor": { "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 + "pattern": "^(0|[1-9][0-9]*)$" }, - "description": { + "patch": { "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } + "pattern": "^(0|[1-9][0-9]*)$" }, "links": { "description": "List of links to other resources", "type": "array", - "readOnly": true, "items": { "description": "Link to other resources", "type": "object", @@ -8179,16 +5939,13 @@ } } }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] + "additionalProperties": false } } } }, - "400": { - "description": "Bad Request", + "500": { + "description": "An Internal Server Error occurred handling the request.", "content": { "application/problem+json": { "schema": { @@ -8215,8 +5972,42 @@ "format": "uri", "type": "string" }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + } + }, + "/v2/healthz": { + "get": { + "summary": "Get service health details", + "description": "Get BOS health details.", + "tags": [ + "v2", + "healthz" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.healthz", + "operationId": "get_v2_healthz", + "responses": { + "200": { + "description": "Service Health information", + "content": { + "application/json": { + "schema": { + "description": "Service health status", + "type": "object", + "properties": { + "dbStatus": { + "type": "string" + }, + "apiStatus": { "type": "string" } }, @@ -8225,8 +6016,8 @@ } } }, - "404": { - "description": "The resource was not found.", + "500": { + "description": "Bad Request", "content": { "application/problem+json": { "schema": { @@ -8262,24 +6053,9 @@ } } } - } - } - }, - "delete": { - "summary": "Delete a Session Template", - "description": "Delete a Session Template.", - "tags": [ - "v2", - "sessiontemplates" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "delete_v2_sessiontemplate", - "responses": { - "204": { - "description": "The resource was deleted." }, - "404": { - "description": "The resource was not found.", + "503": { + "description": "Service Unavailable", "content": { "application/problem+json": { "schema": { @@ -8319,231 +6095,7 @@ } } }, - "/v2/sessiontemplatetemplate": { - "get": { - "summary": "Get an example Session Template.", - "description": "Returns a skeleton of a Session Template, which can be\nused as a starting point for users creating their own\nSession Templates.\n", - "tags": [ - "v2", - "sessiontemplates" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", - "operationId": "get_v2_sessiontemplatetemplate", - "responses": { - "200": { - "description": "Session Template details", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "readOnly": true, - "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "example": "cle-1.0.0" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "description": { - "type": "string", - "description": "An optional description for the Session Template.", - "minLength": 1, - "maxLength": 1023 - }, - "enable_cfs": { - "type": "boolean", - "description": "Whether to enable the Configuration Framework Service (CFS).\n", - "default": true - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "boot_sets": { - "type": "object", - "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "minProperties": 1, - "maxProperties": 127, - "additionalProperties": { - "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", - "example": "compute", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "writeOnly": true - }, - "path": { - "type": "string", - "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", - "minLength": 1, - "maxLength": 4095 - }, - "cfs": { - "type": "object", - "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", - "properties": { - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - } - }, - "additionalProperties": false - }, - "type": { - "type": "string", - "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", - "example": "s3", - "minLength": 1, - "maxLength": 127 - }, - "etag": { - "type": "string", - "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", - "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", - "maxLength": 65536 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "node_list": { - "type": "array", - "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", - "minItems": 1, - "maxItems": 65535, - "example": [ - "x3000c0s19b1n0", - "x3000c0s19b2n0" - ], - "items": { - "type": "string", - "description": "Hardware component name (xname).", - "example": "x3001c0s39b0n0", - "minLength": 1, - "maxLength": 127 - } - }, - "node_roles_groups": { - "type": "array", - "description": "Node role list. Allows actions against nodes with associated roles.", - "minItems": 1, - "maxItems": 1023, - "example": [ - "Compute", - "Application" - ], - "items": { - "type": "string", - "description": "Name of a role that is defined in the Hardware State Manager (HSM).", - "example": "Compute", - "minLength": 1, - "maxLength": 127 - } - }, - "node_groups": { - "type": "array", - "description": "Node group list. Allows actions against associated nodes by logical groupings.", - "minItems": 1, - "maxItems": 4095, - "items": { - "type": "string", - "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", - "minLength": 1, - "maxLength": 127 - } - }, - "arch": { - "type": "string", - "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", - "default": "X86", - "enum": [ - "X86", - "ARM", - "Other", - "Unknown" - ] - }, - "rootfs_provider": { - "type": "string", - "description": "The root file system provider.", - "example": "cpss3", - "minLength": 1, - "maxLength": 511 - }, - "rootfs_provider_passthrough": { - "type": "string", - "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", - "example": "dvs:api-gw-service-nmn.local:300:nmn0", - "maxLength": 4096 - } - }, - "additionalProperties": false, - "required": [ - "path", - "type" - ] - } - }, - "links": { - "description": "List of links to other resources", - "type": "array", - "readOnly": true, - "items": { - "description": "Link to other resources", - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "rel": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - "additionalProperties": false, - "required": [ - "boot_sets" - ] - } - } - } - } - } - } - }, - "/v2/sessions": { + "/v2/sessiontemplates": { "parameters": [ { "name": "Cray-Tenant-Name", @@ -8558,183 +6110,285 @@ } } ], - "post": { - "summary": "Create a Session", - "description": "The creation of a Session performs the operation\nspecified in the SessionCreateRequest\non the Boot Sets defined in the Session Template.\n", + "get": { + "summary": "List Session Templates", + "description": "List all Session Templates.", "tags": [ "v2", - "sessions" + "sessiontemplates" ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "post_v2_session", - "requestBody": { - "description": "The information to create a Session", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "A Session Creation object. A UUID name is generated if a name is not provided. The limit parameter is\nrequired if the session_limit_required option is true.\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - }, - "operation": { - "type": "string", - "enum": [ - "boot", - "reboot", - "shutdown" - ], - "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" - }, - "template_name": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - }, - "limit": { - "type": "string", - "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", - "maxLength": 524288, - "nullable": true, - "default": "" - }, - "stage": { - "type": "boolean", - "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n", - "default": false - }, - "include_disabled": { - "type": "boolean", - "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n", - "default": false + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "get_v2_sessiontemplates", + "responses": { + "200": { + "description": "Session Template details array", + "content": { + "application/json": { + "schema": { + "description": "An array of Session Templates.", + "type": "array", + "items": { + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } + }, + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ + "boot_sets" + ] } - }, - "required": [ - "operation", - "template_name" - ], - "additionalProperties": false + } } } } + } + } + }, + "/v2/sessiontemplatesvalid/{session_template_id}": { + "parameters": [ + { + "name": "session_template_id", + "in": "path", + "description": "Session Template name", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + } }, + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + ], + "get": { + "summary": "Validate the Session Template by ID", + "description": "Validate Session Template by Session Template ID.\nThe Session Template ID corresponds to the *name*\nof the Session Template.\n", + "tags": [ + "v2", + "sessiontemplatess" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "validate_v2_sessiontemplate", "responses": { - "201": { - "description": "Session details", + "200": { + "description": "Session Template validity details", "content": { "application/json": { "schema": { - "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "operation": { - "type": "string", - "enum": [ - "boot", - "reboot", - "shutdown" - ], - "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" - }, - "template_name": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - }, - "limit": { - "type": "string", - "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", - "maxLength": 524288, - "nullable": true, - "default": "" - }, - "stage": { - "type": "boolean", - "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" - }, - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 - }, - "include_disabled": { - "type": "boolean", - "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" - }, - "status": { - "type": "object", - "description": "Information on the status of a Session.\n", - "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { - "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", - "maxLength": 127 - }, - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "error": { - "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": [ - "name", - "operation", - "template_name" - ] + "description": "Message describing errors or incompleteness in a Session Template.\n", + "type": "string" } } } }, - "400": { - "description": "Bad Request", + "404": { + "description": "The resource was not found.", "content": { "application/problem+json": { "schema": { @@ -8772,226 +6426,259 @@ } } } - }, - "get": { - "summary": "List Sessions", - "parameters": [ - { - "name": "min_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - { - "name": "max_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - { - "name": "status", - "schema": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "in": "query", - "description": "Only include Sessions with the given status." + } + }, + "/v2/sessiontemplates/{session_template_id}": { + "parameters": [ + { + "name": "session_template_id", + "in": "path", + "description": "Session Template name", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" } - ], - "description": "List all Sessions, including those in progress and those complete.\n", + }, + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + ], + "get": { + "summary": "Get Session Template by ID", + "description": "Get Session Template by Session Template ID.\nThe Session Template ID corresponds to the *name*\nof the Session Template.\n", "tags": [ "v2", - "sessions" + "sessiontemplatess" ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "get_v2_sessions", + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "get_v2_sessiontemplate", "responses": { "200": { - "description": "Session details array", + "description": "Session Template details", "content": { "application/json": { "schema": { - "description": "An array of Sessions.", - "type": "array", - "items": { - "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - }, - "tenant": { - "type": "string", - "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", - "nullable": true, - "readOnly": true, - "maxLength": 127 - }, - "operation": { - "type": "string", - "enum": [ - "boot", - "reboot", - "shutdown" - ], - "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" - }, - "template_name": { - "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - }, - "limit": { - "type": "string", - "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", - "maxLength": 524288, - "nullable": true, - "default": "" - }, - "stage": { - "type": "boolean", - "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" - }, - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 - }, - "include_disabled": { - "type": "boolean", - "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } }, - "status": { + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", "type": "object", - "description": "Information on the status of a Session.\n", "properties": { - "start_time": { + "name": { "type": "string", - "description": "When the Session was created.", - "maxLength": 127 + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true }, - "end_time": { + "path": { "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, "maxLength": 127 }, - "status": { + "etag": { "type": "string", - "enum": [ - "pending", - "running", - "complete" + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" ], - "description": "The status of a Session." + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } }, - "error": { + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "path", + "type" + ] } }, - "additionalProperties": false, - "required": [ - "name", - "operation", - "template_name" - ] - } + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ + "boot_sets" + ] } } } - } - } - }, - "delete": { - "summary": "Delete multiple Sessions.", - "parameters": [ - { - "name": "min_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - { - "name": "max_age", - "schema": { - "type": "string", - "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", - "example": "3d", - "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", - "minLength": 1, - "maxLength": 8 - }, - "in": "query", - "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" - }, - { - "name": "status", - "schema": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "in": "query", - "description": "Only include Sessions with the given status." - } - ], - "description": "Delete multiple Sessions. If filters are provided, only Sessions matching\nall filters will be deleted. By default only completed Sessions will be deleted.\n", - "tags": [ - "v2", - "sessions" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "delete_v2_sessions", - "responses": { - "204": { - "description": "The resource was deleted." }, - "400": { - "description": "Bad Request", + "404": { + "description": "The resource was not found.", "content": { "application/problem+json": { "schema": { @@ -9023,68 +6710,250 @@ "type": "string" } }, - "additionalProperties": false - } + "additionalProperties": false + } + } + } + } + } + }, + "put": { + "summary": "Create Session Template", + "description": "Create a new Session Template.", + "tags": [ + "v2", + "sessiontemplates" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "put_v2_sessiontemplate", + "requestBody": { + "description": "A JSON object for creating a Session Template", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } + }, + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ + "boot_sets" + ] } } } - } - } - }, - "/v2/sessions/{session_id}": { - "parameters": [ - { - "name": "session_id", - "in": "path", - "description": "Session ID", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - } }, - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], - "get": { - "summary": "Get Session details by ID", - "description": "Get Session details by Session ID.", - "tags": [ - "v2", - "sessions" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "get_v2_session", "responses": { "200": { - "description": "Session details", + "description": "Session Template details", "content": { "application/json": { "schema": { - "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", "properties": { "name": { "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", "minLength": 1, "maxLength": 127, "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" }, "tenant": { "type": "string", @@ -9093,89 +6962,194 @@ "readOnly": true, "maxLength": 127 }, - "operation": { - "type": "string", - "enum": [ - "boot", - "reboot", - "shutdown" - ], - "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" - }, - "template_name": { + "description": { "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "description": "An optional description for the Session Template.", "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - }, - "limit": { - "type": "string", - "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", - "maxLength": 524288, - "nullable": true, - "default": "" - }, - "stage": { - "type": "boolean", - "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" - }, - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 + "maxLength": 1023 }, - "include_disabled": { + "enable_cfs": { "type": "boolean", - "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true }, - "status": { + "cfs": { "type": "object", - "description": "Information on the status of a Session.\n", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { + "configuration": { "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } }, - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } }, - "error": { - "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 - } - }, - "additionalProperties": false + "additionalProperties": false + } } }, "additionalProperties": false, "required": [ - "name", - "operation", - "template_name" + "boot_sets" ] } } } }, - "404": { - "description": "The resource was not found.", + "400": { + "description": "Bad Request", "content": { "application/problem+json": { "schema": { @@ -9207,92 +7181,250 @@ "type": "string" } }, - "additionalProperties": false - } - } - } - } - } - }, - "patch": { - "summary": "Update status of a single Session", - "description": "Update the state for a given Session in the BOS database.\nThis is intended only for internal use by the BOS service.\n", - "tags": [ - "v2", - "sessions", - "cli_ignore" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "patch_v2_session", - "requestBody": { - "description": "The state for a single Session", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "A Session update object\n\n## Link Relationships\n\n* self : The Session object\n", - "type": "object", - "properties": { - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 - }, - "status": { - "type": "object", - "description": "Information on the status of a Session.\n", - "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { - "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", - "maxLength": 127 - }, - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." + "additionalProperties": false + } + } + } + } + } + }, + "patch": { + "summary": "Update a Session Template", + "description": "Update an existing Session Template.", + "tags": [ + "v2", + "sessiontemplates" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "patch_v2_sessiontemplate", + "requestBody": { + "description": "A JSON object for updating a Session Template", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } + }, + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } }, - "error": { - "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 - } - }, - "additionalProperties": false + "additionalProperties": false + } } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "boot_sets" + ] } } } }, "responses": { "200": { - "description": "Session details", + "description": "Session Template details", "content": { "application/json": { "schema": { - "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", "properties": { "name": { "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", "minLength": 1, "maxLength": 127, "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" }, "tenant": { "type": "string", @@ -9301,82 +7433,187 @@ "readOnly": true, "maxLength": 127 }, - "operation": { - "type": "string", - "enum": [ - "boot", - "reboot", - "shutdown" - ], - "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" - }, - "template_name": { + "description": { "type": "string", - "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "description": "An optional description for the Session Template.", "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "cle-1.0.0" - }, - "limit": { - "type": "string", - "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", - "maxLength": 524288, - "nullable": true, - "default": "" - }, - "stage": { - "type": "boolean", - "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" - }, - "components": { - "type": "string", - "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", - "maxLength": 524288 + "maxLength": 1023 }, - "include_disabled": { + "enable_cfs": { "type": "boolean", - "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true }, - "status": { + "cfs": { "type": "object", - "description": "Information on the status of a Session.\n", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { + "configuration": { "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } }, - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } }, - "error": { - "type": "string", - "nullable": true, - "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", - "maxLength": 65536 - } - }, - "additionalProperties": false + "additionalProperties": false + } } }, "additionalProperties": false, "required": [ - "name", - "operation", - "template_name" + "boot_sets" ] } } @@ -9457,189 +7694,21 @@ } } } - } - } - }, - "delete": { - "summary": "Delete Session by ID", - "description": "Delete Session by Session ID.", - "tags": [ - "v2", - "sessions" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "delete_v2_session", - "responses": { - "204": { - "description": "The resource was deleted." - }, - "404": { - "description": "The resource was not found.", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" - }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" - }, - "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 - }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" - }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" - } - }, - "additionalProperties": false - } - } - } - } - } - } - }, - "/v2/sessions/{session_id}/status": { - "parameters": [ - { - "name": "session_id", - "in": "path", - "description": "Session ID", - "required": true, - "schema": { - "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" - } - }, - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], - "get": { - "summary": "Get Session extended status information by ID", - "description": "Get Session extended status information by ID", - "tags": [ - "v2", - "sessions" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "operationId": "get_v2_session_status", - "responses": { - "200": { - "description": "Session status details", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Detailed information on the status of a Session.\n", - "properties": { - "status": { - "type": "string", - "enum": [ - "pending", - "running", - "complete" - ], - "description": "The status of a Session." - }, - "managed_components_count": { - "type": "integer", - "description": "The count of Components currently managed by this Session\n" - }, - "phases": { - "type": "object", - "description": "Detailed information on the phases of a Session.\n", - "properties": { - "percent_complete": { - "type": "number", - "description": "The percent of Components currently in a completed/stable state\n" - }, - "percent_powering_on": { - "type": "number", - "description": "The percent of Components currently in the powering-on phase\n" - }, - "percent_powering_off": { - "type": "number", - "description": "The percent of Components currently in the powering-off phase\n" - }, - "percent_configuring": { - "type": "number", - "description": "The percent of Components currently in the configuring phase\n" - } - }, - "additionalProperties": false - }, - "percent_successful": { - "type": "number", - "description": "The percent of Components currently in a successful state\n" - }, - "percent_failed": { - "type": "number", - "description": "The percent of Components currently in a failed state\n" - }, - "percent_staged": { - "type": "number", - "description": "The percent of Components currently still staged for this Session\n" - }, - "error_summary": { - "type": "object", - "description": "A summary of the errors currently listed by all Components\n" - }, - "timing": { - "type": "object", - "description": "Detailed information on the timing of a Session.\n", - "properties": { - "start_time": { - "type": "string", - "description": "When the Session was created.", - "maxLength": 127 - }, - "end_time": { - "type": "string", - "nullable": true, - "description": "When the Session was completed. A null value means the Session has not ended.", - "maxLength": 127 - }, - "duration": { - "type": "string", - "description": "The current duration of the ongoing Session or final duration of the completed Session.\n" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - } - } + } + } + }, + "delete": { + "summary": "Delete a Session Template", + "description": "Delete a Session Template.", + "tags": [ + "v2", + "sessiontemplates" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "delete_v2_sessiontemplate", + "responses": { + "204": { + "description": "The resource was deleted." }, "404": { "description": "The resource was not found.", @@ -9680,19 +7749,319 @@ } } } - }, + } + }, + "/v2/sessiontemplatetemplate": { + "get": { + "summary": "Get an example Session Template.", + "description": "Returns a skeleton of a Session Template, which can be\nused as a starting point for users creating their own\nSession Templates.\n", + "tags": [ + "v2", + "sessiontemplates" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessiontemplates", + "operationId": "get_v2_sessiontemplatetemplate", + "responses": { + "200": { + "description": "Session Template details", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "A Session Template object represents a collection of resources and metadata.\nA Session Template is used to create a Session which applies the data to\ngroup of Components.\n\n## Link Relationships\n\n* self : The Session Template object\n", + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "readOnly": true, + "description": "Name of the Session Template.\n\nNames must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "example": "cle-1.0.0" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "description": { + "type": "string", + "description": "An optional description for the Session Template.", + "minLength": 1, + "maxLength": 1023 + }, + "enable_cfs": { + "type": "boolean", + "description": "Whether to enable the Configuration Framework Service (CFS).\n", + "default": true + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "boot_sets": { + "type": "object", + "description": "Mapping from Boot Set names to Boot Sets.\n\n* Boot Set names must be 1-127 characters in length.\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "minProperties": 1, + "maxProperties": 127, + "additionalProperties": { + "description": "A Boot Set is a collection of nodes defined by an explicit list, their functional\nrole, and their logical groupings. This collection of nodes is associated with one\nset of boot artifacts and optional additional records for configuration and root\nfilesystem provisioning.\n\nA boot set requires at least one of the following fields to be specified:\nnode_list, node_roles_groups, node_groups\n\nIf specified, the name field must match the key mapping to this boot set in the\nboot_sets field of the containing V2SessionTemplate.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The Boot Set name.\n\n* Boot Set names must use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Boot Set names must begin and end with a letter or digit.\n", + "example": "compute", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "writeOnly": true + }, + "path": { + "type": "string", + "description": "A path identifying the metadata describing the components of the boot image.\nThis could be a URI, URL, etc, depending on the type of the Boot Set.\n", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/manifest.json", + "minLength": 1, + "maxLength": 4095 + }, + "cfs": { + "type": "object", + "description": "This is the collection of parameters that are passed to the Configuration\nFramework Service when configuration is enabled. Can be set as the global value for\na Session Template, or individually within a Boot Set.\n", + "properties": { + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + } + }, + "additionalProperties": false + }, + "type": { + "type": "string", + "description": "The MIME type of the metadata describing the components of the boot image. This type controls how BOS processes the path attribute.\n", + "example": "s3", + "minLength": 1, + "maxLength": 127 + }, + "etag": { + "type": "string", + "description": "This is the 'entity tag'. It helps verify the version of metadata describing the components of the boot image we are working with.", + "example": "1cc4eef4f407bd8a62d7d66ee4b9e9c8", + "maxLength": 65536 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "node_list": { + "type": "array", + "description": "A node list that is required to have at least one node.\nNodes must be specified by component name (xname). NIDs are not supported.\nIf the reject_nids option is enabled, then Session Template creation or validation will fail if\nany of the boot sets contain a NodeList that appears to contain a NID.\n", + "minItems": 1, + "maxItems": 65535, + "example": [ + "x3000c0s19b1n0", + "x3000c0s19b2n0" + ], + "items": { + "type": "string", + "description": "Hardware component name (xname).", + "example": "x3001c0s39b0n0", + "minLength": 1, + "maxLength": 127 + } + }, + "node_roles_groups": { + "type": "array", + "description": "Node role list. Allows actions against nodes with associated roles.", + "minItems": 1, + "maxItems": 1023, + "example": [ + "Compute", + "Application" + ], + "items": { + "type": "string", + "description": "Name of a role that is defined in the Hardware State Manager (HSM).", + "example": "Compute", + "minLength": 1, + "maxLength": 127 + } + }, + "node_groups": { + "type": "array", + "description": "Node group list. Allows actions against associated nodes by logical groupings.", + "minItems": 1, + "maxItems": 4095, + "items": { + "type": "string", + "description": "Name of a user-defined logical group in the Hardware State Manager (HSM).", + "minLength": 1, + "maxLength": 127 + } + }, + "arch": { + "type": "string", + "description": "The node architecture to target. Filters nodes that are not part of matching architecture from being targeted by boot actions. This value should correspond to HSM component 'Arch' field exactly. For reasons of backwards compatibility, all HSM nodes that are of type Unknown are treated as being of type X86.\n", + "default": "X86", + "enum": [ + "X86", + "ARM", + "Other", + "Unknown" + ] + }, + "rootfs_provider": { + "type": "string", + "description": "The root file system provider.", + "example": "cpss3", + "minLength": 1, + "maxLength": 511 + }, + "rootfs_provider_passthrough": { + "type": "string", + "description": "The root file system provider passthrough.\nThese are additional kernel parameters that will be appended to\nthe 'rootfs=' kernel parameter\n", + "example": "dvs:api-gw-service-nmn.local:300:nmn0", + "maxLength": 4096 + } + }, + "additionalProperties": false, + "required": [ + "path", + "type" + ] + } + }, + "links": { + "description": "List of links to other resources", + "type": "array", + "readOnly": true, + "items": { + "description": "Link to other resources", + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "rel": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "required": [ + "boot_sets" + ] + } + } + } + } + } + } + }, + "/v2/sessions": { + "parameters": [ + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + ], "post": { - "summary": "Saves the current Session to database", + "summary": "Create a Session", + "description": "The creation of a Session performs the operation\nspecified in the SessionCreateRequest\non the Boot Sets defined in the Session Template.\n", "tags": [ "v2", - "sessions", - "cli_ignore" + "sessions" ], "x-openapi-router-controller": "bos.server.controllers.v2.sessions", - "description": "Saves the current Session to database. For use at Session completion.", - "operationId": "save_v2_session_status", + "operationId": "post_v2_session", + "requestBody": { + "description": "The information to create a Session", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "A Session Creation object. A UUID name is generated if a name is not provided. The limit parameter is\nrequired if the session_limit_required option is true.\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "operation": { + "type": "string", + "enum": [ + "boot", + "reboot", + "shutdown" + ], + "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" + }, + "template_name": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + }, + "limit": { + "type": "string", + "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", + "maxLength": 524288, + "nullable": true, + "default": "" + }, + "stage": { + "type": "boolean", + "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n", + "default": false + }, + "include_disabled": { + "type": "boolean", + "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n", + "default": false + } + }, + "required": [ + "operation", + "template_name" + ], + "additionalProperties": false + } + } + } + }, "responses": { - "200": { + "201": { "description": "Session details", "content": { "application/json": { @@ -9796,8 +8165,8 @@ } } }, - "404": { - "description": "The resource was not found.", + "400": { + "description": "Bad Request", "content": { "application/problem+json": { "schema": { @@ -9835,353 +8204,612 @@ } } } - } - }, - "/v2/components": { - "parameters": [ - { - "name": "Cray-Tenant-Name", - "in": "header", - "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", - "required": false, - "schema": { - "type": "string", - "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", - "example": "vcluster-my-tenant1", - "maxLength": 127 - } - } - ], + }, "get": { - "summary": "Retrieve the state of a collection of Components", + "summary": "List Sessions", "parameters": [ { - "name": "ids", + "name": "min_age", "schema": { "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", "minLength": 1, - "maxLength": 127 + "maxLength": 8 }, "in": "query", - "description": "Retrieve the Components with the given ID\n(e.g. xname for hardware Components). Can be chained\nfor selecting groups of Components." + "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" }, { - "name": "session", + "name": "max_age", "schema": { "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" + "maxLength": 8 }, "in": "query", - "description": "Retrieve the Components with the given Session ID." + "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" }, { - "name": "staged_session", + "name": "status", "schema": { "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, "in": "query", - "description": "Retrieve the Components with the given staged Session ID." - }, + "description": "Only include Sessions with the given status." + } + ], + "description": "List all Sessions, including those in progress and those complete.\n", + "tags": [ + "v2", + "sessions" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "get_v2_sessions", + "responses": { + "200": { + "description": "Session details array", + "content": { + "application/json": { + "schema": { + "description": "An array of Sessions.", + "type": "array", + "items": { + "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "operation": { + "type": "string", + "enum": [ + "boot", + "reboot", + "shutdown" + ], + "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" + }, + "template_name": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + }, + "limit": { + "type": "string", + "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", + "maxLength": 524288, + "nullable": true, + "default": "" + }, + "stage": { + "type": "boolean", + "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" + }, + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "include_disabled": { + "type": "boolean", + "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + }, + "status": { + "type": "object", + "description": "Information on the status of a Session.\n", + "properties": { + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 + }, + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 + }, + "status": { + "type": "string", + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." + }, + "error": { + "type": "string", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", + "maxLength": 65536 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "name", + "operation", + "template_name" + ] + } + } + } + } + } + } + }, + "delete": { + "summary": "Delete multiple Sessions.", + "parameters": [ { - "name": "enabled", + "name": "min_age", "schema": { - "type": "boolean" + "type": "string", + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 }, "in": "query", - "description": "Retrieve the Components with the \"enabled\" state." + "description": "Only include Sessions older than the given age. Age is given in the format \"1d\" or \"6h\"" }, { - "name": "phase", + "name": "max_age", "schema": { "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 + "description": "Age in minutes (e.g. \"3m\"), hours (e.g. \"5h\"), days (e.g. \"10d\"), or weeks (e.g. \"2w\").", + "example": "3d", + "pattern": "^(0|0[mMhHdDwW]|[1-9][0-9]*[mMhHdDwW])$", + "minLength": 1, + "maxLength": 8 }, "in": "query", - "description": "Retrieve the Components in the given phase." + "description": "Only include Sessions younger than the given age. Age is given in the format \"1d\" or \"6h\"" }, { "name": "status", "schema": { "type": "string", - "maxLength": 512 + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, "in": "query", - "description": "Retrieve the Components with the given status." + "description": "Only include Sessions with the given status." } ], - "description": "Retrieve the full collection of Components in the form of a\nComponentArray. Full results can also be filtered by query\nparameters. Only the first filter parameter of each type is\nused and the parameters are applied in an AND fashion.\nIf the collection is empty or the filters have no match, an\nempty array is returned.", + "description": "Delete multiple Sessions. If filters are provided, only Sessions matching\nall filters will be deleted. By default only completed Sessions will be deleted.\n", "tags": [ "v2", - "components" + "sessions" ], - "x-openapi-router-controller": "bos.server.controllers.v2.components", - "operationId": "get_v2_components", + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "delete_v2_sessions", "responses": { - "200": { - "description": "A collection of Component states", + "204": { + "description": "The resource was deleted." + }, + "400": { + "description": "Bad Request", "content": { - "application/json": { + "application/problem+json": { "schema": { - "description": "An array of Component states.", - "type": "array", - "items": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", - "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + } + }, + "/v2/sessions/{session_id}": { + "parameters": [ + { + "name": "session_id", + "in": "path", + "description": "Session ID", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + } + }, + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + ], + "get": { + "summary": "Get Session details by ID", + "description": "Get Session details by Session ID.", + "tags": [ + "v2", + "sessions" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "get_v2_session", + "responses": { + "200": { + "description": "Session details", + "content": { + "application/json": { + "schema": { + "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "operation": { + "type": "string", + "enum": [ + "boot", + "reboot", + "shutdown" + ], + "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" + }, + "template_name": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + }, + "limit": { + "type": "string", + "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", + "maxLength": 524288, + "nullable": true, + "default": "" + }, + "stage": { + "type": "boolean", + "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" + }, + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "include_disabled": { + "type": "boolean", + "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + }, + "status": { + "type": "object", + "description": "Information on the status of a Session.\n", + "properties": { + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 }, - "additionalProperties": false - }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 }, - "additionalProperties": false - }, - "status": { - "description": "Status information for the Component", - "type": "object", - "properties": { - "phase": { - "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 - }, - "status": { - "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true - }, - "status_override": { - "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 - } + "status": { + "type": "string", + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, - "additionalProperties": false + "error": { + "type": "string", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", + "maxLength": 65536 + } }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "name", + "operation", + "template_name" + ] + } + } + } + }, + "404": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + }, + "patch": { + "summary": "Update status of a single Session", + "description": "Update the state for a given Session in the BOS database.\nThis is intended only for internal use by the BOS service.\n", + "tags": [ + "v2", + "sessions", + "cli_ignore" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "patch_v2_session", + "requestBody": { + "description": "The state for a single Session", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "A Session update object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "status": { + "type": "object", + "description": "Information on the status of a Session.\n", + "properties": { + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 }, - "error": { + "end_time": { "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 }, - "session": { + "status": { "type": "string", - "description": "Name of the Session or an empty string." + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 + "error": { + "type": "string", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", + "maxLength": 65536 } }, - "additionalProperties": false, - "minProperties": 1 + "additionalProperties": false } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Session details", + "content": { + "application/json": { + "schema": { + "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "operation": { + "type": "string", + "enum": [ + "boot", + "reboot", + "shutdown" + ], + "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" + }, + "template_name": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + }, + "limit": { + "type": "string", + "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", + "maxLength": 524288, + "nullable": true, + "default": "" + }, + "stage": { + "type": "boolean", + "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" + }, + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "include_disabled": { + "type": "boolean", + "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" + }, + "status": { + "type": "object", + "description": "Information on the status of a Session.\n", + "properties": { + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 + }, + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 + }, + "status": { + "type": "string", + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." + }, + "error": { + "type": "string", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", + "maxLength": 65536 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "name", + "operation", + "template_name" + ] } } } @@ -10223,280 +8851,514 @@ } } } + }, + "404": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + }, + "delete": { + "summary": "Delete Session by ID", + "description": "Delete Session by Session ID.", + "tags": [ + "v2", + "sessions" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "delete_v2_session", + "responses": { + "204": { + "description": "The resource was deleted." + }, + "404": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + } + }, + "/v2/sessions/{session_id}/status": { + "parameters": [ + { + "name": "session_id", + "in": "path", + "description": "Session ID", + "required": true, + "schema": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + } + }, + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 } } - }, - "put": { - "summary": "Add or Replace a collection of Components", - "description": "Update the state for a collection of Components in the BOS database", + ], + "get": { + "summary": "Get Session extended status information by ID", + "description": "Get Session extended status information by ID", "tags": [ "v2", - "components", - "cli_ignore" + "sessions" ], - "x-openapi-router-controller": "bos.server.controllers.v2.components", - "operationId": "put_v2_components", - "requestBody": { - "description": "The state for an array of Components", - "required": true, - "content": { - "application/json": { - "schema": { - "description": "An array of Component states with associated Ids.", - "type": "array", - "items": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "operationId": "get_v2_session_status", + "responses": { + "200": { + "description": "Session status details", + "content": { + "application/json": { + "schema": { "type": "object", + "description": "Detailed information on the status of a Session.\n", "properties": { - "id": { + "status": { "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false + "managed_components_count": { + "type": "integer", + "description": "The count of Components currently managed by this Session\n" }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", + "phases": { "type": "object", + "description": "Detailed information on the phases of a Session.\n", "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false + "percent_complete": { + "type": "number", + "description": "The percent of Components currently in a completed/stable state\n" }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 + "percent_powering_on": { + "type": "number", + "description": "The percent of Components currently in the powering-on phase\n" }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 + "percent_powering_off": { + "type": "number", + "description": "The percent of Components currently in the powering-off phase\n" }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true + "percent_configuring": { + "type": "number", + "description": "The percent of Components currently in the configuring phase\n" } }, "additionalProperties": false }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false + "percent_successful": { + "type": "number", + "description": "The percent of Components currently in a successful state\n" }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", + "percent_failed": { + "type": "number", + "description": "The percent of Components currently in a failed state\n" + }, + "percent_staged": { + "type": "number", + "description": "The percent of Components currently still staged for this Session\n" + }, + "error_summary": { "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } - }, - "additionalProperties": false + "description": "A summary of the errors currently listed by all Components\n" }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", + "timing": { "type": "object", + "description": "Detailed information on the timing of a Session.\n", "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 + "start_time": { + "type": "string", + "description": "When the Session was created.", + "maxLength": 127 }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 + "duration": { + "type": "string", + "description": "The current duration of the ongoing Session or final duration of the completed Session.\n" } }, "additionalProperties": false + } + }, + "additionalProperties": false + } + } + } + }, + "404": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + }, + "post": { + "summary": "Saves the current Session to database", + "tags": [ + "v2", + "sessions", + "cli_ignore" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.sessions", + "description": "Saves the current Session to database. For use at Session completion.", + "operationId": "save_v2_session_status", + "responses": { + "200": { + "description": "Session details", + "content": { + "application/json": { + "schema": { + "description": "A Session object\n\n## Link Relationships\n\n* self : The Session object\n", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "tenant": { + "type": "string", + "description": "Name of the tenant that owns this resource. Only used in environments\nwith multi-tenancy enabled. An empty string or null value means the resource\nis not owned by a tenant. The absence of this field from a resource indicates\nthe same.\n", + "nullable": true, + "readOnly": true, + "maxLength": 127 + }, + "operation": { + "type": "string", + "enum": [ + "boot", + "reboot", + "shutdown" + ], + "description": "A Session represents a desired state that is being applied to a group\nof Components. Sessions run until all Components it manages have\neither been disabled due to completion, or until all Components are\nmanaged by other newer Sessions.\n\nOperation -- An operation to perform on Components in this Session.\n Boot Applies the Template to the Components and boots/reboots if necessary.\n Reboot Applies the Template to the Components; guarantees a reboot.\n Shutdown Power down Components that are on.\n" + }, + "template_name": { + "type": "string", + "description": "Name of the Session Template.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "cle-1.0.0" + }, + "limit": { + "type": "string", + "description": "A comma-separated list of nodes, groups, or roles to which the Session\nwill be limited. Components are treated as OR operations unless\npreceded by \"&\" for AND or \"!\" for NOT.\n\nAlternatively, the limit can be set to \"*\", which means no limit.\n\nAn empty string or null value is the same as specifying no limit.\n\nIf the reject_nids option is enabled, then Session creation will fail if its\nlimit appears to contain a NID value.\n", + "maxLength": 524288, + "nullable": true, + "default": "" + }, + "stage": { + "type": "boolean", + "description": "Set to stage a Session which will not immediately change the state of any Components.\nThe \"applystaged\" endpoint can be called at a later time to trigger the start of this Session.\n" + }, + "components": { + "type": "string", + "description": "A comma-separated list of nodes, representing the initial list of nodes\nthe Session should operate against. The list will remain even if\nother Sessions have taken over management of the nodes.\n", + "maxLength": 524288 + }, + "include_disabled": { + "type": "boolean", + "description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n" }, "status": { - "description": "Status information for the Component", "type": "object", + "description": "Information on the status of a Session.\n", "properties": { - "phase": { + "start_time": { "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 + "description": "When the Session was created.", + "maxLength": 127 + }, + "end_time": { + "type": "string", + "nullable": true, + "description": "When the Session was completed. A null value means the Session has not ended.", + "maxLength": 127 }, "status": { "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true + "enum": [ + "pending", + "running", + "complete" + ], + "description": "The status of a Session." }, - "status_override": { + "error": { "type": "string", - "description": "If set, this will override the status value.", + "nullable": true, + "description": "Error which prevented the Session from running.\nA null value means the Session has not encountered an error.\n", "maxLength": 65536 } }, "additionalProperties": false - }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." - }, - "error": { + } + }, + "additionalProperties": false, + "required": [ + "name", + "operation", + "template_name" + ] + } + } + } + }, + "404": { + "description": "The resource was not found.", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 + "format": "uri", + "default": "about:blank" }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" }, - "retry_policy": { + "status": { + "description": "HTTP status code", "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" } }, - "additionalProperties": false, - "required": [ - "id" - ] + "additionalProperties": false } } } } - }, + } + } + }, + "/v2/components": { + "parameters": [ + { + "name": "Cray-Tenant-Name", + "in": "header", + "description": "Tenant name.\n\nRequests with a non-empty tenant name will restict the context of the operation to Session Templates owned by that tenant.\n\nRequests with an empty tenant name, or that omit this parameter, will have no such context restrictions.\n", + "required": false, + "schema": { + "type": "string", + "description": "Name of a tenant. Used for multi-tenancy. An empty string means no tenant.", + "example": "vcluster-my-tenant1", + "maxLength": 127 + } + } + ], + "get": { + "summary": "Retrieve the state of a collection of Components", + "parameters": [ + { + "name": "ids", + "schema": { + "type": "string", + "description": "The Component's ID. (e.g. xname for hardware Components)", + "minLength": 1, + "maxLength": 127 + }, + "in": "query", + "description": "Retrieve the Components with the given ID\n(e.g. xname for hardware Components). Can be chained\nfor selecting groups of Components." + }, + { + "name": "session", + "schema": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "in": "query", + "description": "Retrieve the Components with the given Session ID." + }, + { + "name": "staged_session", + "schema": { + "type": "string", + "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", + "minLength": 1, + "maxLength": 127, + "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", + "example": "session-20190728032600" + }, + "in": "query", + "description": "Retrieve the Components with the given staged Session ID." + }, + { + "name": "enabled", + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "Retrieve the Components with the \"enabled\" state." + }, + { + "name": "phase", + "schema": { + "type": "string", + "description": "The current phase of the Component in the boot process.", + "maxLength": 128 + }, + "in": "query", + "description": "Retrieve the Components in the given phase." + }, + { + "name": "status", + "schema": { + "type": "string", + "maxLength": 512 + }, + "in": "query", + "description": "Retrieve the Components with the given status." + } + ], + "description": "Retrieve the full collection of Components in the form of a\nComponentArray. Full results can also be filtered by query\nparameters. Only the first filter parameter of each type is\nused and the parameters are applied in an AND fashion.\nIf the collection is empty or the filters have no match, an\nempty array is returned.", + "tags": [ + "v2", + "components" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.components", + "operationId": "get_v2_components", "responses": { "200": { "description": "A collection of Component states", @@ -10674,713 +9536,714 @@ "description": "A description of the most recent operator/action to impact the Component.", "maxLength": 1024 }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } + "failed": { + "type": "boolean", + "description": "Denotes if the last action failed to accomplish its task" + } + }, + "additionalProperties": false + }, + "event_stats": { + "description": "Information on the most recent attempt to return the node to its desired state.\n", + "type": "object", + "properties": { + "power_on_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_graceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_forceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + } + }, + "additionalProperties": false + }, + "status": { + "description": "Status information for the Component", + "type": "object", + "properties": { + "phase": { + "type": "string", + "description": "The current phase of the Component in the boot process.", + "maxLength": 128 + }, + "status": { + "type": "string", + "description": "The current status of the Component. More detailed than phase.", + "readOnly": true + }, + "status_override": { + "type": "string", + "description": "If set, this will override the status value.", + "maxLength": 65536 + } + }, + "additionalProperties": false + }, + "enabled": { + "type": "boolean", + "description": "A flag indicating if actions should be taken for this Component." + }, + "error": { + "type": "string", + "description": "A description of the most recent error to impact the Component.", + "maxLength": 65536 + }, + "session": { + "type": "string", + "description": "Name of the Session or an empty string." + }, + "retry_policy": { + "type": "integer", + "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", + "example": 1, + "minimum": 0, + "maximum": 1048576 + } + }, + "additionalProperties": false, + "minProperties": 1 + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + }, + "put": { + "summary": "Add or Replace a collection of Components", + "description": "Update the state for a collection of Components in the BOS database", + "tags": [ + "v2", + "components", + "cli_ignore" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.components", + "operationId": "put_v2_components", + "requestBody": { + "description": "The state for an array of Components", + "required": true, + "content": { + "application/json": { + "schema": { + "description": "An array of Component states with associated Ids.", + "type": "array", + "items": { + "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The Component's ID. (e.g. xname for hardware Components)", + "minLength": 1, + "maxLength": 127 + }, + "actual_state": { + "description": "The actual boot artifacts and configuration for a Component\n", + "type": "object", + "properties": { + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", + "type": "object", + "properties": { + "kernel": { + "type": "string", + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "initrd": { + "type": "string", + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 + } + }, + "additionalProperties": false + }, + "bss_token": { + "type": "string", + "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", + "maxLength": 65535 + }, + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + } + }, + "additionalProperties": false + }, + "desired_state": { + "description": "The desired boot artifacts and configuration for a Component\n", + "type": "object", + "properties": { + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", + "type": "object", + "properties": { + "kernel": { + "type": "string", + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "initrd": { + "type": "string", + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 + } + }, + "additionalProperties": false }, - "additionalProperties": false - }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 }, - "additionalProperties": false + "bss_token": { + "type": "string", + "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", + "maxLength": 65535 + }, + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + } }, - "status": { - "description": "Status information for the Component", - "type": "object", - "properties": { - "phase": { - "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 - }, - "status": { - "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true + "additionalProperties": false + }, + "staged_state": { + "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", + "type": "object", + "properties": { + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", + "type": "object", + "properties": { + "kernel": { + "type": "string", + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 + }, + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "initrd": { + "type": "string", + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 + } }, - "status_override": { - "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 - } + "additionalProperties": false }, - "additionalProperties": false - }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." - }, - "error": { - "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 + }, + "session": { + "type": "string", + "description": "Name of the Session or an empty string." + }, + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + } }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 - } + "additionalProperties": false }, - "additionalProperties": false, - "minProperties": 1 - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/problem+json": { - "schema": { - "description": "An error response for RFC 7807 problem details.", - "type": "object", - "properties": { - "type": { - "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", - "type": "string", - "format": "uri", - "default": "about:blank" + "last_action": { + "description": "Information on the most recent action taken against the node.\n", + "type": "object", + "properties": { + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + }, + "action": { + "type": "string", + "description": "A description of the most recent operator/action to impact the Component.", + "maxLength": 1024 + }, + "failed": { + "type": "boolean", + "description": "Denotes if the last action failed to accomplish its task" + } + }, + "additionalProperties": false }, - "title": { - "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", - "type": "string" + "event_stats": { + "description": "Information on the most recent attempt to return the node to its desired state.\n", + "type": "object", + "properties": { + "power_on_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_graceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_forceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + } + }, + "additionalProperties": false }, "status": { - "description": "HTTP status code", - "type": "integer", - "example": 400 + "description": "Status information for the Component", + "type": "object", + "properties": { + "phase": { + "type": "string", + "description": "The current phase of the Component in the boot process.", + "maxLength": 128 + }, + "status": { + "type": "string", + "description": "The current status of the Component. More detailed than phase.", + "readOnly": true + }, + "status_override": { + "type": "string", + "description": "If set, this will override the status value.", + "maxLength": 65536 + } + }, + "additionalProperties": false }, - "instance": { - "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", - "format": "uri", - "type": "string" + "enabled": { + "type": "boolean", + "description": "A flag indicating if actions should be taken for this Component." + }, + "error": { + "type": "string", + "description": "A description of the most recent error to impact the Component.", + "maxLength": 65536 }, - "detail": { - "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", - "type": "string" + "session": { + "type": "string", + "description": "Name of the Session or an empty string." + }, + "retry_policy": { + "type": "integer", + "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", + "example": 1, + "minimum": 0, + "maximum": 1048576 } }, - "additionalProperties": false + "additionalProperties": false, + "required": [ + "id" + ] } } } } - } - }, - "patch": { - "summary": "Update a collection of Components", - "description": "Update the state for a collection of Components in the BOS database", - "tags": [ - "v2", - "components", - "cli_ignore" - ], - "x-openapi-router-controller": "bos.server.controllers.v2.components", - "operationId": "patch_v2_components", - "requestBody": { - "description": "The state for an array of Components", - "required": true, - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "description": "Information for patching multiple Components.", + }, + "responses": { + "200": { + "description": "A collection of Component states", + "content": { + "application/json": { + "schema": { + "description": "An array of Component states.", + "type": "array", + "items": { + "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", "type": "object", "properties": { - "patch": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", + "id": { + "type": "string", + "description": "The Component's ID. (e.g. xname for hardware Components)", + "minLength": 1, + "maxLength": 127 + }, + "actual_state": { + "description": "The actual boot artifacts and configuration for a Component\n", "type": "object", "properties": { - "id": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } - }, - "additionalProperties": false - }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", - "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } - }, - "additionalProperties": false - }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } - }, - "additionalProperties": false - }, - "status": { - "description": "Status information for the Component", + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", "type": "object", "properties": { - "phase": { + "kernel": { "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 }, - "status": { + "kernel_parameters": { "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 }, - "status_override": { + "initrd": { "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 } }, "additionalProperties": false }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." - }, - "error": { + "bss_token": { "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 + "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", + "maxLength": 65535 }, - "session": { + "last_updated": { "type": "string", - "description": "Name of the Session or an empty string." - }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true } }, - "additionalProperties": false, - "minProperties": 1 + "additionalProperties": false }, - "filters": { - "oneOf": [ - { - "description": "Information for patching multiple Components by listing their IDs.\n", + "desired_state": { + "description": "The desired boot artifacts and configuration for a Component\n", + "type": "object", + "properties": { + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", "type": "object", "properties": { - "ids": { + "kernel": { "type": "string", - "description": "A comma-separated list of Component IDs.", - "minLength": 1, - "maxLength": 65535 + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 }, - "session": { - "type": "string", - "description": "An empty string value.", - "enum": [ - "" - ], - "nullable": true, - "maxLength": 0 - } - }, - "required": [ - "ids" - ], - "additionalProperties": false - }, - { - "description": "Information for patching multiple Components by Session name.\nAll Components part of this Session will be patched.\n", - "type": "object", - "properties": { - "ids": { + "kernel_parameters": { "type": "string", - "description": "An empty string value.", - "enum": [ - "" - ], - "nullable": true, - "maxLength": 0 + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 }, - "session": { + "initrd": { "type": "string", - "description": "Name of the Session.\n\nThe name must:\n* Use only letters, digits, periods (.), dashes (-), and underscores (_).\n* Begin and end with a letter or digit.\n", - "minLength": 1, - "maxLength": 127, - "pattern": "^[a-zA-Z0-9](?:[-._a-zA-Z0-9]{0,125}[a-zA-Z0-9])?$", - "example": "session-20190728032600" + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 } }, - "required": [ - "session" - ], "additionalProperties": false - } - ] - } - }, - "required": [ - "patch", - "filters" - ], - "additionalProperties": false - }, - { - "description": "An array of Component states with associated Ids.", - "type": "array", - "items": { - "description": "The current and desired artifacts state for a Component, and\nthe Session responsible for the Component's current state.\n", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The Component's ID. (e.g. xname for hardware Components)", - "minLength": 1, - "maxLength": 127 - }, - "actual_state": { - "description": "The actual boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } }, - "additionalProperties": false - }, - "desired_state": { - "description": "The desired boot artifacts and configuration for a Component\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } - }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "bss_token": { - "type": "string", - "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", - "maxLength": 65535 - }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 }, - "additionalProperties": false + "bss_token": { + "type": "string", + "description": "A token received from the node identifying the boot artifacts.\nFor BOS use-only, users should not set this field. It will be overwritten.\n", + "maxLength": 65535 + }, + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + } }, - "staged_state": { - "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", - "type": "object", - "properties": { - "boot_artifacts": { - "description": "A collection of boot artifacts.\n", - "type": "object", - "properties": { - "kernel": { - "type": "string", - "description": "A path to the kernel to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", - "maxLength": 4095 - }, - "kernel_parameters": { - "type": "string", - "description": "The kernel parameters to use to boot the nodes.", - "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", - "maxLength": 4096 - }, - "initrd": { - "type": "string", - "description": "A path to the initrd to use for booting.", - "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", - "maxLength": 4095 - } + "additionalProperties": false + }, + "staged_state": { + "description": "The staged boot artifacts and configuration for a Component. Optionally, a Session\nmay be set which can be triggered at a later time against this Component.\n", + "type": "object", + "properties": { + "boot_artifacts": { + "description": "A collection of boot artifacts.\n", + "type": "object", + "properties": { + "kernel": { + "type": "string", + "description": "A path to the kernel to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/kernel", + "maxLength": 4095 }, - "additionalProperties": false - }, - "configuration": { - "type": "string", - "description": "The name of configuration to be applied.", - "example": "compute-23.4.0", - "maxLength": 127 - }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." + "kernel_parameters": { + "type": "string", + "description": "The kernel parameters to use to boot the nodes.", + "example": "console=ttyS0,115200 bad_page=panic crashkernel=340M hugepagelist=2m-2g intel_iommu=off intel_pstate=disable iommu=pt ip=dhcp numa_interleave_omit=headless numa_zonelist_order=node oops=panic pageblock_order=14 pcie_ports=native printk.synchronous=y rd.neednet=1 rd.retry=10 rd.shell turbo_boost_limit=999 spire_join_token=${SPIRE_JOIN_TOKEN}", + "maxLength": 4096 + }, + "initrd": { + "type": "string", + "description": "A path to the initrd to use for booting.", + "example": "s3://boot-images/9e3c75e1-ac42-42c7-873c-e758048897d6/initrd", + "maxLength": 4095 + } }, - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - } + "additionalProperties": false }, - "additionalProperties": false - }, - "last_action": { - "description": "Information on the most recent action taken against the node.\n", - "type": "object", - "properties": { - "last_updated": { - "type": "string", - "description": "The date/time when the state was last updated in RFC 3339 format.", - "example": "2019-07-28T03:26:00Z", - "format": "date-time", - "readOnly": true - }, - "action": { - "type": "string", - "description": "A description of the most recent operator/action to impact the Component.", - "maxLength": 1024 - }, - "failed": { - "type": "boolean", - "description": "Denotes if the last action failed to accomplish its task" - } + "configuration": { + "type": "string", + "description": "The name of configuration to be applied.", + "example": "compute-23.4.0", + "maxLength": 127 }, - "additionalProperties": false - }, - "event_stats": { - "description": "Information on the most recent attempt to return the node to its desired state.\n", - "type": "object", - "properties": { - "power_on_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_graceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - }, - "power_off_forceful_attempts": { - "type": "integer", - "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", - "minimum": 0, - "maximum": 1048576 - } + "session": { + "type": "string", + "description": "Name of the Session or an empty string." }, - "additionalProperties": false + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true + } }, - "status": { - "description": "Status information for the Component", - "type": "object", - "properties": { - "phase": { - "type": "string", - "description": "The current phase of the Component in the boot process.", - "maxLength": 128 - }, - "status": { - "type": "string", - "description": "The current status of the Component. More detailed than phase.", - "readOnly": true - }, - "status_override": { - "type": "string", - "description": "If set, this will override the status value.", - "maxLength": 65536 - } + "additionalProperties": false + }, + "last_action": { + "description": "Information on the most recent action taken against the node.\n", + "type": "object", + "properties": { + "last_updated": { + "type": "string", + "description": "The date/time when the state was last updated in RFC 3339 format.", + "example": "2019-07-28T03:26:00Z", + "format": "date-time", + "readOnly": true }, - "additionalProperties": false - }, - "enabled": { - "type": "boolean", - "description": "A flag indicating if actions should be taken for this Component." + "action": { + "type": "string", + "description": "A description of the most recent operator/action to impact the Component.", + "maxLength": 1024 + }, + "failed": { + "type": "boolean", + "description": "Denotes if the last action failed to accomplish its task" + } }, - "error": { - "type": "string", - "description": "A description of the most recent error to impact the Component.", - "maxLength": 65536 + "additionalProperties": false + }, + "event_stats": { + "description": "Information on the most recent attempt to return the node to its desired state.\n", + "type": "object", + "properties": { + "power_on_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-on since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_graceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off gracefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + }, + "power_off_forceful_attempts": { + "type": "integer", + "description": "How many attempts have been made to power-off forcefully since the last time the node was in the desired state.", + "minimum": 0, + "maximum": 1048576 + } }, - "session": { - "type": "string", - "description": "Name of the Session or an empty string." + "additionalProperties": false + }, + "status": { + "description": "Status information for the Component", + "type": "object", + "properties": { + "phase": { + "type": "string", + "description": "The current phase of the Component in the boot process.", + "maxLength": 128 + }, + "status": { + "type": "string", + "description": "The current status of the Component. More detailed than phase.", + "readOnly": true + }, + "status_override": { + "type": "string", + "description": "If set, this will override the status value.", + "maxLength": 65536 + } }, - "retry_policy": { - "type": "integer", - "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", - "example": 1, - "minimum": 0, - "maximum": 1048576 - } + "additionalProperties": false }, - "additionalProperties": false, - "required": [ - "id" - ] - } + "enabled": { + "type": "boolean", + "description": "A flag indicating if actions should be taken for this Component." + }, + "error": { + "type": "string", + "description": "A description of the most recent error to impact the Component.", + "maxLength": 65536 + }, + "session": { + "type": "string", + "description": "Name of the Session or an empty string." + }, + "retry_policy": { + "type": "integer", + "description": "The maximum number attempts per action when actions fail.\nDefaults to the global default_retry_policy if not set\n", + "example": 1, + "minimum": 0, + "maximum": 1048576 + } + }, + "additionalProperties": false, + "minProperties": 1 } - ] + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/problem+json": { + "schema": { + "description": "An error response for RFC 7807 problem details.", + "type": "object", + "properties": { + "type": { + "description": "Relative URI reference to the type of problem which includes human\nreadable documentation.\n", + "type": "string", + "format": "uri", + "default": "about:blank" + }, + "title": { + "description": "Short, human-readable summary of the problem, should not change by\noccurrence.\n", + "type": "string" + }, + "status": { + "description": "HTTP status code", + "type": "integer", + "example": 400 + }, + "instance": { + "description": "A relative URI reference that identifies the specific occurrence of\nthe problem\n", + "format": "uri", + "type": "string" + }, + "detail": { + "description": "A human-readable explanation specific to this occurrence of the\nproblem. Focus on helping correct the problem, rather than giving\ndebugging information.\n", + "type": "string" + } + }, + "additionalProperties": false + } + } + } + } + } + }, + "post": { + "summary": "Update a collection of Components", + "description": "Update the state for a collection of Components in the BOS database", + "tags": [ + "v2", + "components" + ], + "x-openapi-router-controller": "bos.server.controllers.v2.components", + "operationId": "patch_v2_components", + "requestBody": { + "description": "The state for an array of Components", + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" } } } diff --git a/cray/tests/test_modules/test_bos.py b/cray/tests/test_modules/test_bos.py index 25d0b8d..c09b634 100644 --- a/cray/tests/test_modules/test_bos.py +++ b/cray/tests/test_modules/test_bos.py @@ -143,44 +143,6 @@ def test_cray_bos_v2_applystaged_create(cli_runner, rest_mock): data['body'] ) - -# tests: components - -def test_cray_bos_components_base(cli_runner, rest_mock): - """ Test cray bos components base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'components']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'describe', 'list', 'update', 'updatemany'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_components_base(cli_runner, rest_mock): - """ Test cray bos v2 components base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'components']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'describe', 'list', 'update', 'updatemany'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_components_updatemany(cli_runner, rest_mock): - """ Test cray bos v2 components updatemany""" - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'v2', 'components', 'updatemany', '--filter-ids', - 'test1,test2', '--patch', '{}'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PATCH' - assert data['url'] == bos_url(config, ver="v2", uri='/components') - # tests: healthz def test_cray_bos_healthz_base(cli_runner, rest_mock): @@ -227,708 +189,6 @@ def test_cray_bos_v2_options_base(cli_runner, rest_mock): for txt in outputs: assert txt in result.output -# tests: sessions - -def test_cray_bos_sessions_base(cli_runner, rest_mock): - """ Test cray bos session base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions']) - assert result.exit_code == 0 - - outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete', - 'describe', 'list'] - for txt in outputs: - assert txt in result.output - assert 'update' not in result.output - - -def test_cray_bos_v2_sessions_base(cli_runner, rest_mock): - """ Test cray bos v2 session base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions']) - assert result.exit_code == 0 - - outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete', - 'describe', 'list'] - for txt in outputs: - assert txt in result.output - assert 'update' not in result.output - - -def test_cray_bos_sessions_delete(cli_runner, rest_mock): - """ Test cray bos delete session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'delete', 'foo']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'DELETE' - assert data['url'] == bos_url(config, uri='/sessions/foo') - - -def test_cray_bos_v2_sessions_delete(cli_runner, rest_mock): - """ Test cray bos v2 delete session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'delete', 'foo']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'DELETE' - assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo') - - -def test_cray_bos_sessions_list(cli_runner, rest_mock): - """ Test cray bos list session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'list']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessions') - - -def test_cray_bos_v2_sessions_list(cli_runner, rest_mock): - """ Test cray bos v2 list session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'list']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessions') - - -def test_cray_bos_sessions_list_filtered(cli_runner, rest_mock): - """ Test cray bos list session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, - ['bos', 'sessions', 'list', - '--status', 'complete', - '--max-age', '1d', - '--min-age', '1h']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - expected_url_without_params = bos_url(config, uri='/sessions') - assert data['url'][:len(expected_url_without_params)+1] == f"{expected_url_without_params}?" - actual_url_param_string = data['url'].split('?')[-1] - actual_params = {} - for kvstring in actual_url_param_string.split('&'): - k, v = kvstring.split('=') - actual_params[k] = v - - expected_params = {'min_age': '1h', - 'max_age': '1d', - 'status': 'complete'} - compare_dicts(expected_params, actual_params) - - -def test_cray_bos_v2_sessions_list_filtered(cli_runner, rest_mock): - """ Test cray bos v2 list session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, - ['bos', 'v2', 'sessions', 'list', - '--status', 'complete', - '--max-age', '1d', - '--min-age', '1h']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - expected_url_without_params = bos_url(config, ver="v2", uri='/sessions') - assert data['url'][:len(expected_url_without_params)+1] == f"{expected_url_without_params}?" - actual_url_param_string = data['url'].split('?')[-1] - actual_params = {} - for kvstring in actual_url_param_string.split('&'): - k, v = kvstring.split('=') - actual_params[k] = v - - expected_params = {'min_age': '1h', - 'max_age': '1d', - 'status': 'complete'} - compare_dicts(expected_params, actual_params) - - -def test_bad_path_cray_bos_sessions_list_filtered_invalid(cli_runner, rest_mock): - """ Test cray bos list session with invalid status filter """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, - ['bos', 'sessions', 'list', - '--status', 'foo', - '--max-age', '1d', - '--min-age', '1h']) - assert result.exit_code != 0 - assert '--status' in result.output - - -def test_bad_path_cray_bos_v2_sessions_list_filtered_invalid(cli_runner, rest_mock): - """ Test cray bos v2 list session with invalid status filter """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, - ['bos', 'v2', 'sessions', 'list', - '--status', 'foo', - '--max-age', '1d', - '--min-age', '1h']) - assert result.exit_code != 0 - assert '--status' in result.output - - -def test_cray_bos_sessions_describe(cli_runner, rest_mock): - """ Test cray bos describe session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'describe', 'foo']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessions/foo') - - -def test_cray_bos_v2_sessions_describe(cli_runner, rest_mock): - """ Test cray bos v2 describe session """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'describe', 'foo']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo') - - -# pylint: disable=redefined-outer-name -def test_cray_bos_sessions_create(cli_runner, rest_mock): - """ Test cray bos create session ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'sessions', 'create', - '--template-name', 'foo', - '--name', 'bar', - '--limit', 'harf,blah', - '--stage', 'true', - '--include-disabled', 'true', - '--operation', 'boot'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'POST' - assert data['url'] == bos_url(config, uri='/sessions') - compare_dicts( - { - 'template_name': 'foo', - 'name': 'bar', - 'limit': 'harf,blah', - 'stage': True, - 'include_disabled': True, - 'operation': 'boot', - }, - data['body'] - ) - - -# pylint: disable=redefined-outer-name -def test_cray_bos_v2_sessions_create(cli_runner, rest_mock): - """ Test cray bos create v2 session ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'v2', 'sessions', 'create', - '--template-name', 'foo', - '--name', 'bar', - '--limit', 'harf,blah', - '--stage', 'true', - '--include-disabled', 'true', - '--operation', 'boot'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'POST' - assert data['url'] == bos_url(config, ver="v2", uri='/sessions') - compare_dicts( - { - 'template_name': 'foo', - 'name': 'bar', - 'limit': 'harf,blah', - 'stage': True, - 'include_disabled': True, - 'operation': 'boot', - }, - data['body'] - ) - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_sessions_create_missing_required(cli_runner, rest_mock): - """ Test cray bos create session ... when all required parameters are missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'create']) - assert result.exit_code != 0 - assert '--template-name' in result.output or '--operation' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_v2_sessions_create_missing_required(cli_runner, rest_mock): - """ Test cray bos v2 create session ... when all required parameters are missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create']) - assert result.exit_code != 0 - assert '--template-name' in result.output or '--operation' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_sessions_create_missing_required_template(cli_runner, rest_mock): - """ Test cray bos create session ... when a required parameter is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'create', - '--operation', 'reboot']) - assert result.exit_code != 0 - assert '--template-name' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_v2_sessions_create_missing_required_template(cli_runner, rest_mock): - """ Test cray bos v2 create session ... when a required parameter is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', - '--operation', 'reboot']) - assert result.exit_code != 0 - assert '--template-name' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_sessions_create_missing_required_operation(cli_runner, rest_mock): - """ Test cray bos create session ... when a required parameter is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'create', - '--template-name', 'foo']) - assert result.exit_code != 0 - assert '--operation' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_v2_sessions_create_missing_required_operation(cli_runner, rest_mock): - """ Test cray bos v2 create session ... when a required parameter is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', - '--template-name', 'foo']) - assert result.exit_code != 0 - assert '--operation' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_sessions_create_invalid_operation(cli_runner, rest_mock): - """ Test cray bos create session ... when an invalid operation is specified - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'create', - '--template-name', 'foo', '--operation', 'bar']) - assert result.exit_code != 0 - assert '--operation' in result.output - - -# pylint: disable=redefined-outer-name -def test_bad_path_cray_bos_v2_sessions_create_invalid_operation(cli_runner, rest_mock): - """ Test cray bos v2 create session ... when an invalid operation is specified - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', - '--template-name', 'foo', '--operation', 'bar']) - assert result.exit_code != 0 - assert '--operation' in result.output - -def test_bad_path_cray_bos_sessions_update(cli_runner, rest_mock): - """ Test cray bos session update -- should not work """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'update']) - assert result.exit_code != 0 - - -def test_bad_path_cray_bos_v2_sessions_update(cli_runner, rest_mock): - """ Test cray bos v2 session update -- should not work """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'update']) - assert result.exit_code != 0 - -# tests: sessions: status - -def test_cray_bos_sessions_status_base(cli_runner, rest_mock): - """ Test cray bos session status base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'status']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'list'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_sessions_status_base(cli_runner, rest_mock): - """ Test cray bos v2 session status base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'status']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'list'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_sessions_status_list(cli_runner, rest_mock): - """ Test cray bos session status list""" - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'sessions', 'status', 'list', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessions/foo/status') - - -def test_cray_bos_v2_sessions_status_list(cli_runner, rest_mock): - """ Test cray bos v2 session status list""" - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'v2', 'sessions', 'status', 'list', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo/status') - - -def test_bad_path_cray_bos_sessions_status_list_missing_required_session( - cli_runner, - rest_mock -): - """Test cray bos session status list... when the required Session ID - parameter missing - - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessions', 'status', 'list']) - assert result.exit_code != 0 - assert 'SESSION_ID' in result.output - - -def test_bad_path_cray_bos_v2_sessions_status_list_missing_required_session( - cli_runner, - rest_mock -): - """Test cray bos v2 session status list... when the required Session ID - parameter missing - - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'status', 'list']) - assert result.exit_code != 0 - assert 'SESSION_ID' in result.output - -# tests: sessiontemplates - -def test_cray_bos_sessiontemplates_base(cli_runner, rest_mock): - """ Test cray bos sessiontemplates base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessiontemplates']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'create', 'delete', 'describe', 'list', 'update'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_sessiontemplates_base(cli_runner, rest_mock): - """ Test cray bos v2 sessiontemplates base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'create', 'delete', 'describe', 'list', 'update'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_sessiontemplates_delete(cli_runner, rest_mock): - """ Test cray bos delete sessiontemplates """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'sessiontemplates', 'delete', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'DELETE' - assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') - - -def test_cray_bos_v2_sessiontemplates_delete(cli_runner, rest_mock): - """ Test cray bos v2 delete sessiontemplates """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'v2', 'sessiontemplates', 'delete', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'DELETE' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') - - -def test_cray_bos_sessiontemplates_list(cli_runner, rest_mock): - """ Test cray bos list sessiontemplates """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'sessiontemplates', 'list']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessiontemplates') - - -def test_cray_bos_v2_sessiontemplates_list(cli_runner, rest_mock): - """ Test cray bos v2 list sessiontemplates """ - runner, cli, config = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates', 'list']) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates') - - -def test_cray_bos_sessiontemplates_describe(cli_runner, rest_mock): - """ Test cray bos describe sessiontemplate """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'sessiontemplates', 'describe', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') - - -def test_cray_bos_v2_sessiontemplates_describe(cli_runner, rest_mock): - """ Test cray bos v2 describe sessiontemplate """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'v2', 'sessiontemplates', 'describe', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') - - -def test_cray_bos_sessiontemplates_create(cli_runner, rest_mock): - """ Test cray bos create sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'sessiontemplates', 'create', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PUT' - assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') - compare_dicts( - { - 'enable_cfs': True - }, data['body'] - ) - - -def test_cray_bos_v2_sessiontemplates_create(cli_runner, rest_mock): - """ Test cray bos v2 create sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'v2', 'sessiontemplates', 'create', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PUT' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') - compare_dicts( - { - 'enable_cfs': True - }, data['body'] - ) - - -def test_cray_bos_sessiontemplates_create_full(cli_runner, rest_mock): - """ Test cray bos create sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'sessiontemplates', 'create', - '--enable-cfs', False, '--cfs-configuration', - 'test-config', '--description', 'desc', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PUT' - assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') - expected = { - 'enable_cfs': False, - 'cfs': {'configuration': 'test-config'}, - 'description': 'desc' - } - compare_dicts(expected, data['body']) - - -def test_cray_bos_v2_sessiontemplates_create_full(cli_runner, rest_mock): - """ Test cray bos v2 create sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'v2', 'sessiontemplates', 'create', - '--enable-cfs', False, '--cfs-configuration', - 'test-config', '--description', 'desc', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PUT' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') - expected = { - 'enable_cfs': False, - 'cfs': {'configuration': 'test-config'}, - 'description': 'desc' - } - compare_dicts(expected, data['body']) - - -def test_cray_bos_sessiontemplates_update(cli_runner, rest_mock): - """ Test cray bos update sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'sessiontemplates', 'update', - '--enable-cfs', False, '--cfs-configuration', - 'test-config', '--description', 'desc', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PATCH' - assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') - expected = { - 'enable_cfs': False, - 'cfs': {'configuration': 'test-config'}, - 'description': 'desc' - } - compare_dicts(expected, data['body']) - - -def test_cray_bos_v2_sessiontemplates_update(cli_runner, rest_mock): - """ Test cray bos v2 update sessiontemplate ... happy path """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, - ['bos', 'v2', 'sessiontemplates', 'update', - '--enable-cfs', False, '--cfs-configuration', - 'test-config', '--description', 'desc', 'foo'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'PATCH' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') - expected = { - 'enable_cfs': False, - 'cfs': {'configuration': 'test-config'}, - 'description': 'desc' - } - compare_dicts(expected, data['body']) - - -def test_bad_path_cray_bos_sessiontemplates_create_missing_required( - cli_runner, - rest_mock -): - """Test cray bos create sessiontemplate ... when a required parameter - is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessiontemplates', 'create']) - assert result.exit_code != 0 - assert 'SESSION_TEMPLATE_ID' in result.output - - -def test_bad_path_cray_bos_v2_sessiontemplates_create_missing_required( - cli_runner, - rest_mock -): - """Test cray bos v2 create sessiontemplate ... when a required parameter - is missing - """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates', 'create']) - assert result.exit_code != 0 - assert 'SESSION_TEMPLATE_ID' in result.output - -# tests: sessiontemplatesvalid - -def test_cray_bos_sessiontemplatesvalid_base(cli_runner, rest_mock): - """ Test cray bos sessiontemplatesvalid base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessiontemplatesvalid']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'describe'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_sessiontemplatesvalid_base(cli_runner, rest_mock): - """ Test cray bos v2 sessiontemplatesvalid base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplatesvalid']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'describe'] - for txt in outputs: - assert txt in result.output - -# tests: sessiontemplatetemplate - -def test_cray_bos_sessiontemplatetemplate_base(cli_runner, rest_mock): - """ Test cray bos sessiontemplatetemplate base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'sessiontemplatetemplate']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'list'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_v2_sessiontemplatetemplate_base(cli_runner, rest_mock): - """ Test cray bos v2 sessiontemplatetemplate base command """ - runner, cli, _ = cli_runner - result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplatetemplate']) - assert result.exit_code == 0 - - outputs = ['Commands:', 'list'] - for txt in outputs: - assert txt in result.output - - -def test_cray_bos_sessiontemplatetemplate_list(cli_runner, rest_mock): - """ Test cray bos sessiontemplatetemplate list """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'sessiontemplatetemplate', 'list'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, uri='/sessiontemplatetemplate') - - -def test_cray_bos_v2_sessiontemplatetemplate_list(cli_runner, rest_mock): - """ Test cray bos v2 sessiontemplatetemplate list """ - runner, cli, config = cli_runner - result = runner.invoke( - cli, ['bos', 'v2', 'sessiontemplatetemplate', 'list'] - ) - assert result.exit_code == 0 - data = json.loads(result.output) - assert data['method'] == 'GET' - assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplatetemplate') - # tests: version def test_cray_bos_version_base(cli_runner, rest_mock): diff --git a/cray/tests/test_modules/test_bos_components.py b/cray/tests/test_modules/test_bos_components.py new file mode 100644 index 0000000..fd868ee --- /dev/null +++ b/cray/tests/test_modules/test_bos_components.py @@ -0,0 +1,240 @@ +# +# MIT License +# +# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +""" Test the bos module -- components actions""" +# pylint: disable=unused-argument +# pylint: disable=invalid-name + +from itertools import chain, combinations +import json + +from cray.tests.utils import compare_dicts + +from cray.tests.test_modules.test_bos import bos_url + +# helpers + +def verify_commands_equal(runner, cli, expected_result_data, command_list): + """ Verifies that all of the specified commands pass and give the same result """ + for command in command_list: + result = runner.invoke(cli, command) + assert result.exit_code == 0 + data = json.loads(result.output) + compare_dicts(expected_result_data, data) + +# From Python 3 docs: https://docs.python.org/3/library/itertools.html +def powerset(iterable): + """powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)""" + s = list(iterable) + return chain.from_iterable(combinations(s, r) for r in range(len(s)+1)) + +# tests + +def test_cray_bos_components_base(cli_runner, rest_mock): + """ Test cray bos components base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'components']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'describe', 'list', 'update', 'updatemany'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_components_base(cli_runner, rest_mock): + """ Test cray bos v2 components base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'components']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'describe', 'list', 'update', 'updatemany'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_components_update_basic(cli_runner, rest_mock): + """ Test cray bos v2 components updatemany""" + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'v2', 'components', 'update', '--retry-policy', '2', 'fakexname'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, ver="v2", uri='/components/fakexname') + compare_dicts( + { + 'retry_policy': 2 + }, + data['body'] + ) + + +def test_cray_bos_v2_components_update_clear(cli_runner, rest_mock): + """ Test cray bos v2 components update""" + runner, cli, config = cli_runner + common_command_prefix = ['bos', 'v2', 'components', 'update'] + common_command_suffix = ['--enabled', 'False', 'fakexname'] + command_arguments_list = [ + ['--staged-state-session', '', + '--staged-state-configuration', '', + '--staged-state-boot-artifacts-initrd', '', + '--staged-state-boot-artifacts-kernel-parameters', '', + '--staged-state-boot-artifacts-kernel', '', + '--desired-state-bss-token', '', + '--desired-state-configuration', '', + '--desired-state-boot-artifacts-initrd', '', + '--desired-state-boot-artifacts-kernel-parameters', '', + '--desired-state-boot-artifacts-kernel', '' + ], + ['--clear-staged-state', '--clear-desired-state'], + ['--clear-pending-state'] + ] + result = runner.invoke( + cli, + common_command_prefix + command_arguments_list[0] + common_command_suffix + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, ver="v2", uri='/components/fakexname') + compare_dicts( + { + 'enabled': False, + 'staged_state': { + 'session': '', + 'configuration': '', + 'boot_artifacts': { + 'initrd': '', + 'kernel_parameters': '', + 'kernel': '' + } + }, + 'desired_state': { + 'bss_token': '', + 'configuration': '', + 'boot_artifacts': { + 'initrd': '', + 'kernel_parameters': '', + 'kernel': '' + } + } + }, + data['body'] + ) + # Now make sure that the other versions of the command produce identical results + verify_commands_equal(runner, cli, data, + [common_command_prefix + command_args + common_command_suffix + for command_args in command_arguments_list[1:]]) + + +def test_cray_bos_v2_components_updatemany_by_ids(cli_runner, rest_mock): + """ Test cray bos v2 components updatemany""" + runner, cli, config = cli_runner + common_command_prefix = ['bos', 'v2', 'components', 'updatemany', '--filter-ids', 'id1,id2'] + command_arguments_list = [ + ['--enabled', 'False'], + ['--enabled', 'False', '--patch', '{}'], + ['--patch', '{ "enabled": false }'] + ] + result = runner.invoke(cli, common_command_prefix + command_arguments_list[0]) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, ver="v2", uri='/components') + compare_dicts( + { + 'patch': { 'enabled': False }, + 'filters': { 'ids': 'id1,id2' } + }, + data['body'] + ) + # Now make sure that the other versions of the command produce identical results + verify_commands_equal(runner, cli, data, + [common_command_prefix + command_args + for command_args in command_arguments_list[1:]]) + + +def test_cray_bos_v2_components_updatemany_by_session(cli_runner, rest_mock): + """ Test cray bos v2 components updatemany""" + runner, cli, config = cli_runner + common_command_prefix = ['bos', 'v2', 'components', 'updatemany', '--filter-session', 'test1'] + full_patch_data = { + 'retry_policy': 57, + 'staged_state': { + 'session': '', + 'configuration': '', + 'boot_artifacts': { + 'initrd': '', + 'kernel_parameters': '', + 'kernel': '' + } + }, + 'desired_state': { + 'bss_token': '', + 'configuration': '', + 'boot_artifacts': { + 'initrd': '', + 'kernel_parameters': '', + 'kernel': '' + } + } + } + def json_patch(*fields): + return json.dumps({ k: v for k, v in full_patch_data.items() if k in fields }) + + command_arguments_list = [] + all_arguments = ['--retry-policy', '--clear-staged-state', '--clear-desired-state', + '--clear-pending-state'] + for explicit_args in powerset(all_arguments): + args=list(explicit_args) + patch_fields=[] + if '--retry-policy' in explicit_args: + args.insert(args.index('--retry-policy')+1, '57') + else: + patch_fields.append('retry_policy') + if {'--clear-staged-state', '--clear-pending-state'}.isdisjoint(explicit_args): + patch_fields.append('staged_state') + if {'--clear-desired-state', '--clear-pending-state'}.isdisjoint(explicit_args): + patch_fields.append('desired_state') + command_arguments_list.append(args + ['--patch', json_patch(*patch_fields)]) + if not patch_fields: + # This means we can equivalently omit the --patch argument + command_arguments_list.append(args) + result = runner.invoke(cli, common_command_prefix + command_arguments_list[0]) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, ver="v2", uri='/components') + compare_dicts( + { + 'patch': full_patch_data, + 'filters': { 'session': 'test1' } + }, + data['body'] + ) + # Now make sure that the other versions of the command produce identical results + verify_commands_equal(runner, cli, data, + [common_command_prefix + command_args + for command_args in command_arguments_list[1:]]) diff --git a/cray/tests/test_modules/test_bos_sessions.py b/cray/tests/test_modules/test_bos_sessions.py new file mode 100644 index 0000000..667f1a1 --- /dev/null +++ b/cray/tests/test_modules/test_bos_sessions.py @@ -0,0 +1,427 @@ +# +# MIT License +# +# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +""" Test the bos module - sessions actions.""" +# pylint: disable=unused-argument +# pylint: disable=invalid-name + +import json + +from cray.tests.utils import compare_dicts +from cray.tests.test_modules.test_bos import bos_url + + +def test_cray_bos_sessions_base(cli_runner, rest_mock): + """ Test cray bos session base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions']) + assert result.exit_code == 0 + + outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete', + 'describe', 'list'] + for txt in outputs: + assert txt in result.output + assert 'update' not in result.output + + +def test_cray_bos_v2_sessions_base(cli_runner, rest_mock): + """ Test cray bos v2 session base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions']) + assert result.exit_code == 0 + + outputs = ['Groups:', 'status', 'Commands:', 'create', 'delete', + 'describe', 'list'] + for txt in outputs: + assert txt in result.output + assert 'update' not in result.output + + +def test_cray_bos_sessions_delete(cli_runner, rest_mock): + """ Test cray bos delete session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'delete', 'foo']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'DELETE' + assert data['url'] == bos_url(config, uri='/sessions/foo') + + +def test_cray_bos_v2_sessions_delete(cli_runner, rest_mock): + """ Test cray bos v2 delete session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'delete', 'foo']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'DELETE' + assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo') + + +def test_cray_bos_sessions_list(cli_runner, rest_mock): + """ Test cray bos list session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'list']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessions') + + +def test_cray_bos_v2_sessions_list(cli_runner, rest_mock): + """ Test cray bos v2 list session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'list']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessions') + + +def test_cray_bos_sessions_list_filtered(cli_runner, rest_mock): + """ Test cray bos list session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, + ['bos', 'sessions', 'list', + '--status', 'complete', + '--max-age', '1d', + '--min-age', '1h']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + expected_url_without_params = bos_url(config, uri='/sessions') + assert data['url'][:len(expected_url_without_params)+1] == f"{expected_url_without_params}?" + actual_url_param_string = data['url'].split('?')[-1] + actual_params = {} + for kvstring in actual_url_param_string.split('&'): + k, v = kvstring.split('=') + actual_params[k] = v + + expected_params = {'min_age': '1h', + 'max_age': '1d', + 'status': 'complete'} + compare_dicts(expected_params, actual_params) + + +def test_cray_bos_v2_sessions_list_filtered(cli_runner, rest_mock): + """ Test cray bos v2 list session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, + ['bos', 'v2', 'sessions', 'list', + '--status', 'complete', + '--max-age', '1d', + '--min-age', '1h']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + expected_url_without_params = bos_url(config, ver="v2", uri='/sessions') + assert data['url'][:len(expected_url_without_params)+1] == f"{expected_url_without_params}?" + actual_url_param_string = data['url'].split('?')[-1] + actual_params = {} + for kvstring in actual_url_param_string.split('&'): + k, v = kvstring.split('=') + actual_params[k] = v + + expected_params = {'min_age': '1h', + 'max_age': '1d', + 'status': 'complete'} + compare_dicts(expected_params, actual_params) + + +def test_bad_path_cray_bos_sessions_list_filtered_invalid(cli_runner, rest_mock): + """ Test cray bos list session with invalid status filter """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, + ['bos', 'sessions', 'list', + '--status', 'foo', + '--max-age', '1d', + '--min-age', '1h']) + assert result.exit_code != 0 + assert '--status' in result.output + + +def test_bad_path_cray_bos_v2_sessions_list_filtered_invalid(cli_runner, rest_mock): + """ Test cray bos v2 list session with invalid status filter """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, + ['bos', 'v2', 'sessions', 'list', + '--status', 'foo', + '--max-age', '1d', + '--min-age', '1h']) + assert result.exit_code != 0 + assert '--status' in result.output + + +def test_cray_bos_sessions_describe(cli_runner, rest_mock): + """ Test cray bos describe session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'describe', 'foo']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessions/foo') + + +def test_cray_bos_v2_sessions_describe(cli_runner, rest_mock): + """ Test cray bos v2 describe session """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'describe', 'foo']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo') + + +# pylint: disable=redefined-outer-name +def test_cray_bos_sessions_create(cli_runner, rest_mock): + """ Test cray bos create session ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'sessions', 'create', + '--template-name', 'foo', + '--name', 'bar', + '--limit', 'harf,blah', + '--stage', 'true', + '--include-disabled', 'true', + '--operation', 'boot'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'POST' + assert data['url'] == bos_url(config, uri='/sessions') + compare_dicts( + { + 'template_name': 'foo', + 'name': 'bar', + 'limit': 'harf,blah', + 'stage': True, + 'include_disabled': True, + 'operation': 'boot', + }, + data['body'] + ) + + +# pylint: disable=redefined-outer-name +def test_cray_bos_v2_sessions_create(cli_runner, rest_mock): + """ Test cray bos create v2 session ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'v2', 'sessions', 'create', + '--template-name', 'foo', + '--name', 'bar', + '--limit', 'harf,blah', + '--stage', 'true', + '--include-disabled', 'true', + '--operation', 'boot'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'POST' + assert data['url'] == bos_url(config, ver="v2", uri='/sessions') + compare_dicts( + { + 'template_name': 'foo', + 'name': 'bar', + 'limit': 'harf,blah', + 'stage': True, + 'include_disabled': True, + 'operation': 'boot', + }, + data['body'] + ) + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_sessions_create_missing_required(cli_runner, rest_mock): + """ Test cray bos create session ... when all required parameters are missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'create']) + assert result.exit_code != 0 + assert '--template-name' in result.output or '--operation' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_v2_sessions_create_missing_required(cli_runner, rest_mock): + """ Test cray bos v2 create session ... when all required parameters are missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create']) + assert result.exit_code != 0 + assert '--template-name' in result.output or '--operation' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_sessions_create_missing_required_template(cli_runner, rest_mock): + """ Test cray bos create session ... when a required parameter is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'create', + '--operation', 'reboot']) + assert result.exit_code != 0 + assert '--template-name' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_v2_sessions_create_missing_required_template(cli_runner, rest_mock): + """ Test cray bos v2 create session ... when a required parameter is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', + '--operation', 'reboot']) + assert result.exit_code != 0 + assert '--template-name' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_sessions_create_missing_required_operation(cli_runner, rest_mock): + """ Test cray bos create session ... when a required parameter is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'create', + '--template-name', 'foo']) + assert result.exit_code != 0 + assert '--operation' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_v2_sessions_create_missing_required_operation(cli_runner, rest_mock): + """ Test cray bos v2 create session ... when a required parameter is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', + '--template-name', 'foo']) + assert result.exit_code != 0 + assert '--operation' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_sessions_create_invalid_operation(cli_runner, rest_mock): + """ Test cray bos create session ... when an invalid operation is specified + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'create', + '--template-name', 'foo', '--operation', 'bar']) + assert result.exit_code != 0 + assert '--operation' in result.output + + +# pylint: disable=redefined-outer-name +def test_bad_path_cray_bos_v2_sessions_create_invalid_operation(cli_runner, rest_mock): + """ Test cray bos v2 create session ... when an invalid operation is specified + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'create', + '--template-name', 'foo', '--operation', 'bar']) + assert result.exit_code != 0 + assert '--operation' in result.output + +def test_bad_path_cray_bos_sessions_update(cli_runner, rest_mock): + """ Test cray bos session update -- should not work """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'update']) + assert result.exit_code != 0 + + +def test_bad_path_cray_bos_v2_sessions_update(cli_runner, rest_mock): + """ Test cray bos v2 session update -- should not work """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'update']) + assert result.exit_code != 0 + +# tests: sessions: status + +def test_cray_bos_sessions_status_base(cli_runner, rest_mock): + """ Test cray bos session status base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'status']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'list'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_sessions_status_base(cli_runner, rest_mock): + """ Test cray bos v2 session status base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'status']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'list'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_sessions_status_list(cli_runner, rest_mock): + """ Test cray bos session status list""" + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'sessions', 'status', 'list', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessions/foo/status') + + +def test_cray_bos_v2_sessions_status_list(cli_runner, rest_mock): + """ Test cray bos v2 session status list""" + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'v2', 'sessions', 'status', 'list', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessions/foo/status') + + +def test_bad_path_cray_bos_sessions_status_list_missing_required_session( + cli_runner, + rest_mock +): + """Test cray bos session status list... when the required Session ID + parameter missing + + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessions', 'status', 'list']) + assert result.exit_code != 0 + assert 'SESSION_ID' in result.output + + +def test_bad_path_cray_bos_v2_sessions_status_list_missing_required_session( + cli_runner, + rest_mock +): + """Test cray bos v2 session status list... when the required Session ID + parameter missing + + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessions', 'status', 'list']) + assert result.exit_code != 0 + assert 'SESSION_ID' in result.output diff --git a/cray/tests/test_modules/test_bos_sessiontemplates.py b/cray/tests/test_modules/test_bos_sessiontemplates.py new file mode 100644 index 0000000..e3a9cef --- /dev/null +++ b/cray/tests/test_modules/test_bos_sessiontemplates.py @@ -0,0 +1,334 @@ +# +# MIT License +# +# (C) Copyright 2020-2024 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +""" Test the bos module - sessiontemplates actions.""" +# pylint: disable=unused-argument +# pylint: disable=invalid-name + +import json + +from cray.tests.utils import compare_dicts +from cray.tests.test_modules.test_bos import bos_url + +def test_cray_bos_sessiontemplates_base(cli_runner, rest_mock): + """ Test cray bos sessiontemplates base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessiontemplates']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'create', 'delete', 'describe', 'list', 'update'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_sessiontemplates_base(cli_runner, rest_mock): + """ Test cray bos v2 sessiontemplates base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'create', 'delete', 'describe', 'list', 'update'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_sessiontemplates_delete(cli_runner, rest_mock): + """ Test cray bos delete sessiontemplates """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'sessiontemplates', 'delete', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'DELETE' + assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') + + +def test_cray_bos_v2_sessiontemplates_delete(cli_runner, rest_mock): + """ Test cray bos v2 delete sessiontemplates """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'v2', 'sessiontemplates', 'delete', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'DELETE' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') + + +def test_cray_bos_sessiontemplates_list(cli_runner, rest_mock): + """ Test cray bos list sessiontemplates """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'sessiontemplates', 'list']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessiontemplates') + + +def test_cray_bos_v2_sessiontemplates_list(cli_runner, rest_mock): + """ Test cray bos v2 list sessiontemplates """ + runner, cli, config = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates', 'list']) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates') + + +def test_cray_bos_sessiontemplates_describe(cli_runner, rest_mock): + """ Test cray bos describe sessiontemplate """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'sessiontemplates', 'describe', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') + + +def test_cray_bos_v2_sessiontemplates_describe(cli_runner, rest_mock): + """ Test cray bos v2 describe sessiontemplate """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'v2', 'sessiontemplates', 'describe', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') + + +def test_cray_bos_sessiontemplates_create(cli_runner, rest_mock): + """ Test cray bos create sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'sessiontemplates', 'create', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PUT' + assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') + compare_dicts( + { + 'enable_cfs': True + }, data['body'] + ) + + +def test_cray_bos_v2_sessiontemplates_create(cli_runner, rest_mock): + """ Test cray bos v2 create sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'v2', 'sessiontemplates', 'create', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PUT' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') + compare_dicts( + { + 'enable_cfs': True + }, data['body'] + ) + + +def test_cray_bos_sessiontemplates_create_full(cli_runner, rest_mock): + """ Test cray bos create sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'sessiontemplates', 'create', + '--enable-cfs', False, '--cfs-configuration', + 'test-config', '--description', 'desc', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PUT' + assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') + expected = { + 'enable_cfs': False, + 'cfs': {'configuration': 'test-config'}, + 'description': 'desc' + } + compare_dicts(expected, data['body']) + + +def test_cray_bos_v2_sessiontemplates_create_full(cli_runner, rest_mock): + """ Test cray bos v2 create sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'v2', 'sessiontemplates', 'create', + '--enable-cfs', False, '--cfs-configuration', + 'test-config', '--description', 'desc', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PUT' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') + expected = { + 'enable_cfs': False, + 'cfs': {'configuration': 'test-config'}, + 'description': 'desc' + } + compare_dicts(expected, data['body']) + + +def test_cray_bos_sessiontemplates_update(cli_runner, rest_mock): + """ Test cray bos update sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'sessiontemplates', 'update', + '--enable-cfs', False, '--cfs-configuration', + 'test-config', '--description', 'desc', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, uri='/sessiontemplates/foo') + expected = { + 'enable_cfs': False, + 'cfs': {'configuration': 'test-config'}, + 'description': 'desc' + } + compare_dicts(expected, data['body']) + + +def test_cray_bos_v2_sessiontemplates_update(cli_runner, rest_mock): + """ Test cray bos v2 update sessiontemplate ... happy path """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, + ['bos', 'v2', 'sessiontemplates', 'update', + '--enable-cfs', False, '--cfs-configuration', + 'test-config', '--description', 'desc', 'foo'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'PATCH' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplates/foo') + expected = { + 'enable_cfs': False, + 'cfs': {'configuration': 'test-config'}, + 'description': 'desc' + } + compare_dicts(expected, data['body']) + + +def test_bad_path_cray_bos_sessiontemplates_create_missing_required( + cli_runner, + rest_mock +): + """Test cray bos create sessiontemplate ... when a required parameter + is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessiontemplates', 'create']) + assert result.exit_code != 0 + assert 'SESSION_TEMPLATE_ID' in result.output + + +def test_bad_path_cray_bos_v2_sessiontemplates_create_missing_required( + cli_runner, + rest_mock +): + """Test cray bos v2 create sessiontemplate ... when a required parameter + is missing + """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplates', 'create']) + assert result.exit_code != 0 + assert 'SESSION_TEMPLATE_ID' in result.output + +# tests: sessiontemplatesvalid + +def test_cray_bos_sessiontemplatesvalid_base(cli_runner, rest_mock): + """ Test cray bos sessiontemplatesvalid base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessiontemplatesvalid']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'describe'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_sessiontemplatesvalid_base(cli_runner, rest_mock): + """ Test cray bos v2 sessiontemplatesvalid base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplatesvalid']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'describe'] + for txt in outputs: + assert txt in result.output + +# tests: sessiontemplatetemplate + +def test_cray_bos_sessiontemplatetemplate_base(cli_runner, rest_mock): + """ Test cray bos sessiontemplatetemplate base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'sessiontemplatetemplate']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'list'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_v2_sessiontemplatetemplate_base(cli_runner, rest_mock): + """ Test cray bos v2 sessiontemplatetemplate base command """ + runner, cli, _ = cli_runner + result = runner.invoke(cli, ['bos', 'v2', 'sessiontemplatetemplate']) + assert result.exit_code == 0 + + outputs = ['Commands:', 'list'] + for txt in outputs: + assert txt in result.output + + +def test_cray_bos_sessiontemplatetemplate_list(cli_runner, rest_mock): + """ Test cray bos sessiontemplatetemplate list """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'sessiontemplatetemplate', 'list'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, uri='/sessiontemplatetemplate') + + +def test_cray_bos_v2_sessiontemplatetemplate_list(cli_runner, rest_mock): + """ Test cray bos v2 sessiontemplatetemplate list """ + runner, cli, config = cli_runner + result = runner.invoke( + cli, ['bos', 'v2', 'sessiontemplatetemplate', 'list'] + ) + assert result.exit_code == 0 + data = json.loads(result.output) + assert data['method'] == 'GET' + assert data['url'] == bos_url(config, ver="v2", uri='/sessiontemplatetemplate')