From 269d0d6511f4db30334e9c8113f07461aa4f0a72 Mon Sep 17 00:00:00 2001 From: "Vanathi.Selvaraju" Date: Tue, 9 Jul 2024 14:04:51 -0400 Subject: [PATCH] sw-patch strategy orchestration removal. sw-patch strategy orchestration CLI removal and corresponding API clean up. sw-patch strategy is no longer supported in stx-10 as the patch release deploy is handled by sw-deploy strategy. Test Plan: PASSED: sw-manager sw-patch-strategy absent from CLI. PASSED: sw-patch absent from REST API. PASSED: sw-deploy strategy tested. PASSED: sw-deploy strategy has no impacts. Story: 2011045 Task: 50535 Depends-on : https://review.opendev.org/c/starlingx/distcloud/+/924452 Change-Id: I6e1f363f607cae6cc3ace380e5d66196abdc9489 Signed-off-by: Vanathi.Selvaraju --- api-ref/source/api-ref-nfv-vim-v1.rst | 1371 +---------------- .../nfv_client/openstack/sw_update.py | 6 +- nfv/nfv-client/nfv_client/shell.py | 61 +- .../nfv_client/sw_update/__init__.py | 2 - .../nfv_client/sw_update/_sw_update.py | 6 +- nfv/nfv-client/scripts/sw-manager.completion | 78 - .../nfv_unit_tests/tests/test_nfv_client.py | 7 - .../v1/orchestration/_controller.py | 8 +- .../v1/orchestration/sw_update/__init__.py | 1 - .../v1/orchestration/sw_update/_sw_patch.py | 54 - .../sw_update/_sw_update_defs.py | 2 - .../sw_update/_sw_update_strategy.py | 96 +- 12 files changed, 12 insertions(+), 1680 deletions(-) delete mode 100755 nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_patch.py diff --git a/api-ref/source/api-ref-nfv-vim-v1.rst b/api-ref/source/api-ref-nfv-vim-v1.rst index c38dd795..4dbf1e7f 100644 --- a/api-ref/source/api-ref-nfv-vim-v1.rst +++ b/api-ref/source/api-ref-nfv-vim-v1.rst @@ -107,10 +107,6 @@ forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) "href": "http://192.168.204.2:4545/orchestration/", "rel": "self" }, - { - "href": "http://192.168.204.2:4545/orchestration/sw-patch/", - "rel": "sw-patch" - }, { "href": "http://192.168.204.2:4545/orchestration/sw-upgrade/", "rel": "sw-upgrade" @@ -132,39 +128,6 @@ forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) This operation does not accept a request body. -********************************************************************** -Lists information about all NFV VIM API orchestration sw-patch links -********************************************************************** - -.. rest_method:: GET /api/orchestration/sw-patch - -**Normal response codes** - -200 - -**Error response codes** - -serviceUnavailable (503), badRequest (400), unauthorized (401), -forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) - -:: - - { - "id": "sw-patch", - "links": [ - { - "href": "http://192.168.204.2:4545/orchestration/sw-patch/", - "rel": "self" - }, - { - "href": "http://192.168.204.2:4545/orchestration/sw-patch/strategy/", - "rel": "strategy" - } - ] - } - -This operation does not accept a request body. - ************************************************************************ Lists information about all NFV VIM API orchestration sw-upgrade links ************************************************************************ @@ -297,1338 +260,6 @@ forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) This operation does not accept a request body. ---------------- -Patch Strategy ---------------- - -Patch orchestration is done with a patch orchestration strategy, or -plan, for the automated patching procedure which contains a number of -parameters for customizing the particular behavior of the patching -orchestration. - -**************************************************************** -Shows detailed information about the current sw-patch strategy -**************************************************************** - -.. rest_method:: GET /api/orchestration/sw-patch/strategy - -**Normal response codes** - -200 - -**Error response codes** - -serviceUnavailable (503), badRequest (400), unauthorized (401), -forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) - -:: - - { - "strategy": { - "controller-apply-type": "serial", - "current-phase-completion-percentage": 100, - "uuid": "c1971c42-b494-4ff0-8abf-dbde17929972", - "worker-apply-type": "serial", - "max-parallel-worker-hosts": 2, - "alarm-restrictions": "strict", - "current-phase": "build", - "apply-phase": { - "start-date-time": "", - "end-date-time": "", - "phase-name": "apply", - "completion-percentage": 100, - "total-stages": 6, - "stop-at-stage": 0, - "result": "initial", - "timeout": 0, - "reason": "", - "inprogress": false, - "stages": [ - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 0, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "523cbd2d-f7f8-4707-8617-d085386f8711" - ], - "step-name": "swact-hosts", - "result": "initial", - "entity-names": [ - "controller-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "523cbd2d-f7f8-4707-8617-d085386f8711" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "controller-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "523cbd2d-f7f8-4707-8617-d085386f8711" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "controller-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "523cbd2d-f7f8-4707-8617-d085386f8711" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "controller-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-controllers" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 1, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "0f3715c0-fecd-46e0-9cd0-4fbb31810393" - ], - "step-name": "swact-hosts", - "result": "initial", - "entity-names": [ - "controller-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "0f3715c0-fecd-46e0-9cd0-4fbb31810393" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "controller-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "0f3715c0-fecd-46e0-9cd0-4fbb31810393" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "controller-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "0f3715c0-fecd-46e0-9cd0-4fbb31810393" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "controller-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-controllers" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 2, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "instances", - "step-id": 1, - "entity-uuids": [ - "e5236dac-288f-4a1d-b1de-1c630aaa0df0" - ], - "step-name": "migrate-instances", - "result": "initial", - "entity-names": [ - "cirros-image-with-volumes-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "9a0dd555-a73b-4e49-b8e0-9cefeb2fb636" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "compute-3" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "9a0dd555-a73b-4e49-b8e0-9cefeb2fb636" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-3" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "9a0dd555-a73b-4e49-b8e0-9cefeb2fb636" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "compute-3" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 3, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "instances", - "step-id": 1, - "entity-uuids": [ - "ab977908-b5a4-44f1-832b-d7ebcfa476f0", - "7da7e6c6-fe9a-400e-99e5-4940b9b372ad", - "936fe92e-e48c-46ad-a052-9cdaea6fe840" - ], - "step-name": "migrate-instances", - "result": "initial", - "entity-names": [ - "cirros-ephemeral-swap-1", - "cirros-1", - "cirros-ephemeral-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "8fb371f2-fe1c-4325-a6f5-3487e33c9059" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "compute-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "8fb371f2-fe1c-4325-a6f5-3487e33c9059" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "8fb371f2-fe1c-4325-a6f5-3487e33c9059" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "compute-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 4, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "instances", - "step-id": 1, - "entity-uuids": [ - "f8c263c7-06c6-46f9-8c34-e2451e5ac8d5" - ], - "step-name": "migrate-instances", - "result": "initial", - "entity-names": [ - "cirros-swap-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "14cfa022-a29f-488b-a1e3-0c2a8231b33a" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "compute-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "14cfa022-a29f-488b-a1e3-0c2a8231b33a" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "14cfa022-a29f-488b-a1e3-0c2a8231b33a" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "compute-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 5, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "instances", - "step-id": 1, - "entity-uuids": [ - "25ad74e3-e4fe-4d1d-920a-7e1ecb38625b" - ], - "step-name": "migrate-instances", - "result": "initial", - "entity-names": [ - "cirros-image-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 2, - "entity-uuids": [ - "c4f93e44-241b-4230-b4b3-098c0a9949fb" - ], - "step-name": "lock-hosts", - "result": "initial", - "entity-names": [ - "compute-2" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 3, - "entity-uuids": [ - "c4f93e44-241b-4230-b4b3-098c0a9949fb" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-2" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 900, - "entity-type": "hosts", - "step-id": 4, - "entity-uuids": [ - "c4f93e44-241b-4230-b4b3-098c0a9949fb" - ], - "step-name": "unlock-hosts", - "result": "initial", - "entity-names": [ - "compute-2" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 5, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 4621, - "total-steps": 6, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - } - ], - "current-stage": 0 - }, - "storage-apply-type": "serial", - "state": "ready-to-apply", - "default-instance-action": "migrate", - "abort-phase": { - "start-date-time": "", - "end-date-time": "", - "phase-name": "abort", - "completion-percentage": 100, - "total-stages": 0, - "stop-at-stage": 0, - "result": "initial", - "timeout": 0, - "reason": "", - "inprogress": false, - "stages": [], - "current-stage": 0 - }, - "build-phase": { - "start-date-time": "2016-11-16 13:36:27", - "end-date-time": "2016-11-16 13:36:28", - "phase-name": "build", - "completion-percentage": 100, - "total-stages": 1, - "stop-at-stage": 1, - "result": "success", - "timeout": 182, - "reason": "", - "inprogress": false, - "stages": [ - { - "start-date-time": "2016-11-16 13:36:27", - "end-date-time": "2016-11-16 13:36:28", - "stage-id": 0, - "reason": "", - "current-step": 3, - "steps": [ - { - "start-date-time": "2016-11-16 13:36:27", - "end-date-time": "2016-11-16 13:36:27", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "success", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "2016-11-16 13:36:27", - "end-date-time": "2016-11-16 13:36:28", - "timeout": 60, - "entity-type": "", - "step-id": 1, - "entity-uuids": [], - "step-name": "query-sw-patches", - "result": "success", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "2016-11-16 13:36:28", - "end-date-time": "2016-11-16 13:36:28", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "query-sw-patch-hosts", - "result": "success", - "entity-names": [], - "reason": "" - } - ], - "result": "success", - "timeout": 181, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-query" - } - ], - "current-stage": 1 - }, - "swift-apply-type": "ignore" - } - } - -This operation does not accept a request body. - -***************************** -Creates a sw-patch strategy -***************************** - -.. rest_method:: POST /api/orchestration/sw-patch/strategy - -**Normal response codes** - -200 - -**Error response codes** - -serviceUnavailable (503), badRequest (400), unauthorized (401), -forbidden (403), badMethod (405), overLimit (413) - -**Request parameters** - -.. csv-table:: - :header: "Parameter", "Style", "Type", "Description" - :widths: 20, 20, 20, 60 - - "controller-apply-type", "plain", "xsd:string", "The apply type for controller hosts: ``serial`` or ``ignore``." - "storage-apply-type", "plain", "xsd:string", "The apply type for storage hosts: ``serial``, ``parallel`` or ``ignore``." - "worker-apply-type", "plain", "xsd:string", "The apply type for worker hosts: ``serial``, ``parallel`` or ``ignore``." - "max-parallel-worker-hosts (Optional)", "plain", "xsd:integer", "The maximum number of worker hosts to patch in parallel; only applicable if ``worker-apply-type = parallel``. Default value is ``2``." - "swift-apply-type", "plain", "xsd:string", "The apply type for swift hosts: ``serial``, ``parallel`` or ``ignore``." - "default-instance-action", "plain", "xsd:string", "The default instance action: ``stop-start`` or ``migrate``." - "alarm-restrictions (Optional)", "plain", "xsd:string", "The strictness of alarm checks: ``strict`` or ``relaxed``." - -:: - - { - "controller-apply-type": "serial", - "default-instance-action": "stop-start", - "worker-apply-type": "serial", - "storage-apply-type": "serial", - "swift-apply-type": "ignore", - "alarm-restrictions": "strict" - } - -:: - - { - "strategy": { - "controller-apply-type": "serial", - "current-phase-completion-percentage": 0, - "uuid": "15dc4b63-ae5f-48ca-b76e-ec367ef817f5", - "worker-apply-type": "serial", - "max-parallel-worker-hosts": 2, - "alarm-restrictions": "strict", - "current-phase": "build", - "apply-phase": { - "start-date-time": "", - "end-date-time": "", - "phase-name": "apply", - "completion-percentage": 100, - "total-stages": 0, - "stop-at-stage": 0, - "result": "initial", - "timeout": 0, - "reason": "", - "inprogress": false, - "stages": [], - "current-stage": 0 - }, - "storage-apply-type": "serial", - "state": "building", - "default-instance-action": "stop-start", - "abort-phase": { - "start-date-time": "", - "end-date-time": "", - "phase-name": "abort", - "completion-percentage": 100, - "total-stages": 0, - "stop-at-stage": 0, - "result": "initial", - "timeout": 0, - "reason": "", - "inprogress": false, - "stages": [], - "current-stage": 0 - }, - "build-phase": { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "", - "phase-name": "build", - "completion-percentage": 0, - "total-stages": 1, - "stop-at-stage": 1, - "result": "inprogress", - "timeout": 182, - "reason": "", - "inprogress": true, - "stages": [ - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "", - "stage-id": 0, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "wait", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 1, - "entity-uuids": [], - "step-name": "query-sw-patches", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "query-sw-patch-hosts", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "inprogress", - "timeout": 181, - "total-steps": 3, - "inprogress": true, - "stage-name": "sw-patch-query" - } - ], - "current-stage": 0 - }, - "swift-apply-type": "ignore" - } - } - -*************************************** -Deletes the current sw-patch strategy -*************************************** - -.. rest_method:: DELETE /api/orchestration/sw-patch/strategy - -**Normal response codes** - -204 - -:: - - { - } - -*************************************** -Applies or aborts a sw-patch strategy -*************************************** - -.. rest_method:: POST /api/orchestration/sw-patch/strategy/actions - -**Normal response codes** - -202 - -**Error response codes** - -serviceUnavailable (503), badRequest (400), unauthorized (401), -forbidden (403), badMethod (405), overLimit (413) - -**Request parameters** - -.. csv-table:: - :header: "Parameter", "Style", "Type", "Description" - :widths: 20, 20, 20, 60 - - "action", "plain", "xsd:string", "The action to take: ``apply-all``, ``apply-stage``, ``abort`` or ``abort-stage``." - "stage-id (Optional)", "plain", "xsd:string", "The stage-id to apply or abort. Only used with ``apply-stage`` or ``abort-stage`` actions." - -:: - - { - "action": "apply-all" - } - -:: - - { - "strategy": { - "controller-apply-type": "serial", - "current-phase-completion-percentage": 0, - "uuid": "15dc4b63-ae5f-48ca-b76e-ec367ef817f5", - "worker-apply-type": "serial", - "max-parallel-worker-hosts": 2, - "alarm-restrictions": "strict", - "current-phase": "apply", - "apply-phase": { - "start-date-time": "2016-11-16 19:28:28", - "end-date-time": "", - "phase-name": "apply", - "completion-percentage": 0, - "total-stages": 5, - "stop-at-stage": 5, - "result": "inprogress", - "timeout": 9606, - "reason": "", - "inprogress": true, - "stages": [ - { - "start-date-time": "2016-11-16 19:28:28", - "end-date-time": "", - "stage-id": 0, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "2016-11-16 19:28:28", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "wait", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "0f3715c0-fecd-46e0-9cd0-4fbb31810393" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "controller-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "inprogress", - "timeout": 1921, - "total-steps": 3, - "inprogress": true, - "stage-name": "sw-patch-controllers" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 1, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "9a0dd555-a73b-4e49-b8e0-9cefeb2fb636" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-3" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 1921, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 2, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "8fb371f2-fe1c-4325-a6f5-3487e33c9059" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-0" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 1921, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 3, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "14cfa022-a29f-488b-a1e3-0c2a8231b33a" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-1" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 1921, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - }, - { - "start-date-time": "", - "end-date-time": "", - "stage-id": 4, - "reason": "", - "current-step": 0, - "steps": [ - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "initial", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 1800, - "entity-type": "hosts", - "step-id": 1, - "entity-uuids": [ - "c4f93e44-241b-4230-b4b3-098c0a9949fb" - ], - "step-name": "sw-patch-hosts", - "result": "initial", - "entity-names": [ - "compute-2" - ], - "reason": "" - }, - { - "start-date-time": "", - "end-date-time": "", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "system-stabilize", - "result": "initial", - "entity-names": [], - "reason": "" - } - ], - "result": "initial", - "timeout": 1921, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-worker-hosts" - } - ], - "current-stage": 0 - }, - "storage-apply-type": "serial", - "state": "applying", - "default-instance-action": "stop-start", - "abort-phase": { - "start-date-time": "", - "end-date-time": "", - "phase-name": "abort", - "completion-percentage": 100, - "total-stages": 0, - "stop-at-stage": 0, - "result": "initial", - "timeout": 0, - "reason": "", - "inprogress": false, - "stages": [], - "current-stage": 0 - }, - "build-phase": { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "2016-11-16 19:14:05", - "phase-name": "build", - "completion-percentage": 100, - "total-stages": 1, - "stop-at-stage": 1, - "result": "success", - "timeout": 182, - "reason": "", - "inprogress": false, - "stages": [ - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "2016-11-16 19:14:05", - "stage-id": 0, - "reason": "", - "current-step": 3, - "steps": [ - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "2016-11-16 19:14:05", - "timeout": 60, - "entity-type": "", - "step-id": 0, - "entity-uuids": [], - "step-name": "query-alarms", - "result": "success", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "2016-11-16 19:14:05", - "timeout": 60, - "entity-type": "", - "step-id": 1, - "entity-uuids": [], - "step-name": "query-sw-patches", - "result": "success", - "entity-names": [], - "reason": "" - }, - { - "start-date-time": "2016-11-16 19:14:05", - "end-date-time": "2016-11-16 19:14:05", - "timeout": 60, - "entity-type": "", - "step-id": 2, - "entity-uuids": [], - "step-name": "query-sw-patch-hosts", - "result": "success", - "entity-names": [], - "reason": "" - } - ], - "result": "success", - "timeout": 181, - "total-steps": 3, - "inprogress": false, - "stage-name": "sw-patch-query" - } - ], - "current-stage": 1 - }, - "swift-apply-type": "ignore" - } - } - ----------------- Upgrade Strategy ----------------- @@ -3844,7 +2475,7 @@ forbidden (403), badMethod (405), overLimit (413), itemNotFound (404) { "strategy": { - "name": "sw-patch" + "name": "sw-upgrade" "state": "applying" } } diff --git a/nfv/nfv-client/nfv_client/openstack/sw_update.py b/nfv/nfv-client/nfv_client/openstack/sw_update.py index b5afe0ef..945c6aaa 100755 --- a/nfv/nfv-client/nfv_client/openstack/sw_update.py +++ b/nfv/nfv-client/nfv_client/openstack/sw_update.py @@ -275,11 +275,7 @@ def create_strategy(token_id, api_cmd_headers['X-Auth-Token'] = token_id api_cmd_payload = dict() - if sw_update.STRATEGY_NAME_SW_PATCH == strategy_name: - api_cmd_payload['controller-apply-type'] = controller_apply_type - api_cmd_payload['swift-apply-type'] = swift_apply_type - api_cmd_payload['default-instance-action'] = default_instance_action - elif sw_update.STRATEGY_NAME_FW_UPDATE == strategy_name: + if sw_update.STRATEGY_NAME_FW_UPDATE == strategy_name: api_cmd_payload['controller-apply-type'] = controller_apply_type api_cmd_payload['default-instance-action'] = default_instance_action elif sw_update.STRATEGY_NAME_KUBE_ROOTCA_UPDATE == strategy_name: diff --git a/nfv/nfv-client/nfv_client/shell.py b/nfv/nfv-client/nfv_client/shell.py index 2b6cb5b2..b00e96c4 100755 --- a/nfv/nfv-client/nfv_client/shell.py +++ b/nfv/nfv-client/nfv_client/shell.py @@ -52,10 +52,7 @@ def get_extra_create_args(cmd_area, args): :returns: a dictionary of additional kwargs for the create_strategy command :raises: ValueError if a strategy has been registered but not update here """ - if sw_update.CMD_NAME_SW_PATCH == cmd_area: - # no additional kwargs for patch - return {} - elif sw_update.CMD_NAME_SW_DEPLOY == cmd_area: + if sw_update.CMD_NAME_SW_DEPLOY == cmd_area: # We can't use mutual exclusion for release and rollback because # release is a positional arg. if args.release is None and not args.rollback: @@ -107,7 +104,7 @@ def setup_abort_cmd(parser): """ Sets up an 'abort' command for a strategy command parser. - ex: sw-manager patch-strategy abort + ex: sw-manager sw-deploy-strategy abort :param parser: the strategy parser to add the create command to. """ @@ -123,7 +120,7 @@ def setup_apply_cmd(parser): """ Sets up an 'apply' command for a strategy command parser. - ex: sw-manager patch-strategy apply + ex: sw-manager sw-deploy-strategy apply :param parser: the strategy parser to register the command under """ @@ -147,7 +144,7 @@ def setup_create_cmd(parser, """ Sets up a 'create' command for a strategy command parser. - ex: sw-manager patch-strategy create + ex: sw-manager sw-deploy-strategy create :param parser: the strategy parser to register the command under :param controller_types: list of the valid apply types for controller @@ -180,7 +177,7 @@ def setup_delete_cmd(parser): """ Sets up a 'delete' command for a strategy command parser. - ex: sw-manager patch-strategy delete + ex: sw-manager sw-deploy-strategy delete :param parser: the strategy parser to register the command under """ @@ -196,7 +193,7 @@ def setup_show_cmd(parser): """ Sets up a 'show' command for a strategy command parser. - ex: sw-manager patch-strategy show + ex: sw-manager sw-deploy-strategy show :param parser: the strategy parser to register the command under """ @@ -360,49 +357,6 @@ def setup_kube_upgrade_parser(commands): _ = setup_show_cmd(sub_cmds) -def setup_patch_parser(commands): - """Patch Strategy Commands""" - - cmd_area = sw_update.CMD_NAME_SW_PATCH - register_strategy(cmd_area, sw_update.STRATEGY_NAME_SW_PATCH) - cmd_parser = commands.add_parser(cmd_area, - help='Patch Strategy') - cmd_parser.set_defaults(cmd_area=cmd_area) - - sub_cmds = cmd_parser.add_subparsers(title='Software Patch Commands', - metavar='') - sub_cmds.required = True - - # define the create command - # alarm restrictions, defaults to strict - _ = setup_create_cmd( - sub_cmds, - [sw_update.APPLY_TYPE_SERIAL, # controller supports serial - sw_update.APPLY_TYPE_IGNORE], - [sw_update.APPLY_TYPE_SERIAL, # storage supports serial and parallel - sw_update.APPLY_TYPE_PARALLEL, - sw_update.APPLY_TYPE_IGNORE], - [sw_update.APPLY_TYPE_SERIAL, # worker supports serial and parallel - sw_update.APPLY_TYPE_PARALLEL, - sw_update.APPLY_TYPE_IGNORE], - [sw_update.INSTANCE_ACTION_STOP_START, # instance actions - sw_update.INSTANCE_ACTION_MIGRATE], - [sw_update.ALARM_RESTRICTIONS_STRICT, # alarm restrictions - sw_update.ALARM_RESTRICTIONS_RELAXED], - min_parallel=2, - max_parallel=100 # patch supports 2..100 workers in parallel - ) - - # define the delete command - _ = setup_delete_cmd(sub_cmds) - # define the apply command - _ = setup_apply_cmd(sub_cmds) - # define the abort command - _ = setup_abort_cmd(sub_cmds) - # define the show command - _ = setup_show_cmd(sub_cmds) - - def setup_system_config_update_parser(commands): """System config update Strategy Commands""" @@ -537,9 +491,6 @@ def process_main(argv=sys.argv[1:]): # pylint: disable=dangerous-default-value # Add kubernetes upgrade strategy commands setup_kube_upgrade_parser(commands) - # Add software patch strategy commands - setup_patch_parser(commands) - # Add system config update strategy commands setup_system_config_update_parser(commands) diff --git a/nfv/nfv-client/nfv_client/sw_update/__init__.py b/nfv/nfv-client/nfv_client/sw_update/__init__.py index faf8c7a0..da6532de 100755 --- a/nfv/nfv-client/nfv_client/sw_update/__init__.py +++ b/nfv/nfv-client/nfv_client/sw_update/__init__.py @@ -13,7 +13,6 @@ from nfv_client.sw_update._sw_update import CMD_NAME_FW_UPDATE # noqa: F401 from nfv_client.sw_update._sw_update import CMD_NAME_KUBE_ROOTCA_UPDATE # noqa: F401 from nfv_client.sw_update._sw_update import CMD_NAME_KUBE_UPGRADE # noqa: F401 from nfv_client.sw_update._sw_update import CMD_NAME_SW_DEPLOY # noqa: F401 -from nfv_client.sw_update._sw_update import CMD_NAME_SW_PATCH # noqa: F401 from nfv_client.sw_update._sw_update import CMD_NAME_SYSTEM_CONFIG_UPDATE # noqa: F401 from nfv_client.sw_update._sw_update import create_strategy # noqa: F401 from nfv_client.sw_update._sw_update import delete_strategy # noqa: F401 @@ -23,6 +22,5 @@ from nfv_client.sw_update._sw_update import show_strategy # noqa: F401 from nfv_client.sw_update._sw_update import STRATEGY_NAME_FW_UPDATE # noqa: F401 from nfv_client.sw_update._sw_update import STRATEGY_NAME_KUBE_ROOTCA_UPDATE # noqa: F401 from nfv_client.sw_update._sw_update import STRATEGY_NAME_KUBE_UPGRADE # noqa: F401 -from nfv_client.sw_update._sw_update import STRATEGY_NAME_SW_PATCH # noqa: F401 from nfv_client.sw_update._sw_update import STRATEGY_NAME_SW_UPGRADE # noqa: F401 from nfv_client.sw_update._sw_update import STRATEGY_NAME_SYSTEM_CONFIG_UPDATE # noqa: F401 diff --git a/nfv/nfv-client/nfv_client/sw_update/_sw_update.py b/nfv/nfv-client/nfv_client/sw_update/_sw_update.py index 2607c527..2bbd5835 100755 --- a/nfv/nfv-client/nfv_client/sw_update/_sw_update.py +++ b/nfv/nfv-client/nfv_client/sw_update/_sw_update.py @@ -7,14 +7,12 @@ from nfv_client.openstack import openstack from nfv_client.openstack import sw_update import textwrap -STRATEGY_NAME_SW_PATCH = 'sw-patch' STRATEGY_NAME_SW_UPGRADE = 'sw-upgrade' STRATEGY_NAME_FW_UPDATE = 'fw-update' STRATEGY_NAME_KUBE_ROOTCA_UPDATE = 'kube-rootca-update' STRATEGY_NAME_KUBE_UPGRADE = 'kube-upgrade' STRATEGY_NAME_SYSTEM_CONFIG_UPDATE = 'system-config-update' -CMD_NAME_SW_PATCH = 'patch-strategy' CMD_NAME_SW_DEPLOY = 'sw-deploy-strategy' CMD_NAME_FW_UPDATE = 'fw-update-strategy' CMD_NAME_KUBE_ROOTCA_UPDATE = 'kube-rootca-update-strategy' @@ -141,10 +139,8 @@ def _display_strategy(strategy, details=False, active=False, error_details=False """ Software Update - Display Strategy Information """ - if strategy.name == STRATEGY_NAME_SW_PATCH: - print("Strategy Patch Strategy:") # TODO(jkraitbe): Backend for sw-deploy will continue as old sw-upgrade for now - elif strategy.name == STRATEGY_NAME_SW_UPGRADE: + if strategy.name == STRATEGY_NAME_SW_UPGRADE: print("Strategy Software Deploy Strategy:") elif strategy.name == STRATEGY_NAME_FW_UPDATE: print("Strategy Firmware Update Strategy:") diff --git a/nfv/nfv-client/scripts/sw-manager.completion b/nfv/nfv-client/scripts/sw-manager.completion index c72882c7..311187c1 100755 --- a/nfv/nfv-client/scripts/sw-manager.completion +++ b/nfv/nfv-client/scripts/sw-manager.completion @@ -19,7 +19,6 @@ function _swmanager() # The available sw-manager subcommands # local subcommands=" - patch-strategy sw-deploy-strategy fw-update-strategy kube-rootca-update-strategy @@ -32,83 +31,6 @@ function _swmanager() # Complete the arguments to the subcommands # case "$subcommand" in - patch-strategy) - local actions=" - create - delete - apply - abort - show - " - if [ $COMP_CWORD -gt 2 ]; then - local action=${COMP_WORDS[2]} - # - # Complete the arguments for each action - # - case "$action" in - create) - local createopts=" - --controller-apply-type - --storage-apply-type - --worker-apply-type - --max-parallel-worker-hosts - --instance-action - --alarm-restrictions - " - local createopt=${prev} - case "$createopt" in - --controller-apply-type) - COMPREPLY=($(compgen -W "serial ignore" -- ${cur})) - return 0 - ;; - --storage-apply-type|--worker-apply-type) - COMPREPLY=($(compgen -W "serial parallel ignore" -- ${cur})) - return 0 - ;; - --max-parallel-worker-hosts) - COMPREPLY=( $(compgen -- ${cur})) - return 0 - ;; - --instance-action) - COMPREPLY=($(compgen -W "migrate stop-start" -- ${cur})) - return 0 - ;; - --alarm-restrictions) - COMPREPLY=($(compgen -W "strict relaxed" -- ${cur})) - return 0 - ;; - *) - ;; - esac - COMPREPLY=($(compgen -W "${createopts}" -- ${cur})) - return 0 - ;; - apply|abort) - if [ "${prev}" = "${action}" ]; then - COMPREPLY=($(compgen -W "--stage-id" -- ${cur})) - fi - return 0 - ;; - show) - if [ "${prev}" = "${action}" ]; then - COMPREPLY=($(compgen -W "--details --active" -- ${cur})) - fi - return 0 - ;; - delete) - # These subcommands have no options/arguments - COMPREPLY=( $(compgen -- ${cur}) ) - return 0 - ;; - *) - ;; - esac - fi - - # Provide actions for completion - COMPREPLY=($(compgen -W "${actions}" -- ${cur})) - return 0 - ;; sw-deploy-strategy) local actions=" create diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_nfv_client.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_nfv_client.py index 7b4cdf96..42c445f2 100755 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_nfv_client.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_nfv_client.py @@ -279,13 +279,6 @@ class TestCLISwDeployStrategy(TestNFVClientShell, assert str(e) == 'Cannot set both release and rollback', e -class TestCLIPatchStrategy(TestNFVClientShell, - StrategyMixin): - def setUp(self): - super(TestCLIPatchStrategy, self).setUp() - self.set_strategy('patch-strategy') - - class TestCLIFwUpdateStrategy(TestNFVClientShell, StrategyMixin): def setUp(self): diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/_controller.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/_controller.py index a0ace2de..f1d3f057 100755 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/_controller.py +++ b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/_controller.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2021 Wind River Systems, Inc. +# Copyright (c) 2015-2024 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # @@ -14,7 +14,6 @@ from nfv_vim.api.controllers.v1.orchestration.sw_update import FwUpdateAPI from nfv_vim.api.controllers.v1.orchestration.sw_update import KubeRootcaUpdateAPI from nfv_vim.api.controllers.v1.orchestration.sw_update import KubeUpgradeAPI from nfv_vim.api.controllers.v1.orchestration.sw_update import StrategyAPI -from nfv_vim.api.controllers.v1.orchestration.sw_update import SwPatchAPI from nfv_vim.api.controllers.v1.orchestration.sw_update import SwUpgradeAPI from nfv_vim.api.controllers.v1.orchestration.sw_update import SystemConfigUpdateAPI @@ -34,7 +33,6 @@ class OrchestrationDescription(wsme_types.Base): description.id = "orchestration" description.links = [ Link.make_link('self', url, 'orchestration'), - Link.make_link('sw-patch', url, 'orchestration/sw-patch', ''), Link.make_link('sw-upgrade', url, 'orchestration/sw-upgrade', ''), Link.make_link('system-config-update', url, 'orchestration/system-config-update', ''), @@ -53,9 +51,7 @@ class OrchestrationAPI(rest.RestController): """ @pecan.expose() def _lookup(self, key, *remainder): - if 'sw-patch' == key: - return SwPatchAPI(), remainder - elif 'sw-upgrade' == key: + if 'sw-upgrade' == key: return SwUpgradeAPI(), remainder elif 'system-config-update' == key: return SystemConfigUpdateAPI(), remainder diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/__init__.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/__init__.py index 245f1493..ae588a13 100755 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/__init__.py +++ b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/__init__.py @@ -7,6 +7,5 @@ from nfv_vim.api.controllers.v1.orchestration.sw_update._current_strategy import from nfv_vim.api.controllers.v1.orchestration.sw_update._fw_update import FwUpdateAPI # noqa: F401 from nfv_vim.api.controllers.v1.orchestration.sw_update._kube_rootca_update import KubeRootcaUpdateAPI # noqa: F401 from nfv_vim.api.controllers.v1.orchestration.sw_update._kube_upgrade import KubeUpgradeAPI # noqa: F401 -from nfv_vim.api.controllers.v1.orchestration.sw_update._sw_patch import SwPatchAPI # noqa: F401 from nfv_vim.api.controllers.v1.orchestration.sw_update._sw_upgrade import SwUpgradeAPI # noqa: F401 from nfv_vim.api.controllers.v1.orchestration.sw_update._system_config_update import SystemConfigUpdateAPI # noqa: F401 diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_patch.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_patch.py deleted file mode 100755 index 496d59fc..00000000 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_patch.py +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 2016 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# -import pecan -from pecan import rest -from six.moves import http_client as httplib -from wsme import types as wsme_types -import wsmeext.pecan as wsme_pecan - -from nfv_common import debug -from nfv_vim.api._link import Link -from nfv_vim.api.controllers.v1.orchestration.sw_update._sw_update_strategy import SwPatchStrategyAPI - -DLOG = debug.debug_get_logger('nfv_vim.api.sw_patch') - - -class SwPatchDescription(wsme_types.Base): - """ - Software Patch Description - """ - id = wsme_types.text - links = wsme_types.wsattr([Link], name='links') - - @classmethod - def convert(cls): - url = pecan.request.host_url - - description = SwPatchDescription() - description.id = "sw-patch" - description.links = [ - Link.make_link('self', url, 'orchestration/sw-patch'), - Link.make_link('strategy', url, 'orchestration/sw-patch/strategy')] - return description - - -class SwPatchAPI(rest.RestController): - """ - Software Patch Rest API - """ - @pecan.expose() - def _lookup(self, key, *remainder): - if 'strategy' == key: - return SwPatchStrategyAPI(), remainder - else: - pecan.abort(httplib.NOT_FOUND) - - @wsme_pecan.wsexpose(SwPatchDescription) - def get(self): - # NOTE: The reason why convert() is being called for every - # request is because we need to get the host url from - # the request object to make the links. - return SwPatchDescription.convert() diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py index 8af29a19..820dcabc 100755 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py +++ b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_defs.py @@ -19,7 +19,6 @@ class SwUpdateNames(Constants): FW_UPDATE = Constant('fw-update') KUBE_ROOTCA_UPDATE = Constant('kube-rootca-update') KUBE_UPGRADE = Constant('kube-upgrade') - SW_PATCH = Constant('sw-patch') SW_UPGRADE = Constant('sw-upgrade') SYSTEM_CONFIG_UPDATE = Constant('system-config-update') CURRENT_STRATEGY = Constant('current-strategy') @@ -77,7 +76,6 @@ SwUpdateNames = wsme_types.Enum(str, SW_UPDATE_NAME.FW_UPDATE, SW_UPDATE_NAME.KUBE_ROOTCA_UPDATE, SW_UPDATE_NAME.KUBE_UPGRADE, - SW_UPDATE_NAME.SW_PATCH, SW_UPDATE_NAME.SW_UPGRADE, SW_UPDATE_NAME.SYSTEM_CONFIG_UPDATE, SW_UPDATE_NAME.CURRENT_STRATEGY) diff --git a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_strategy.py b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_strategy.py index a9052c92..1cd4043c 100755 --- a/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_strategy.py +++ b/nfv/nfv-vim/nfv_vim/api/controllers/v1/orchestration/sw_update/_sw_update_strategy.py @@ -16,7 +16,6 @@ from nfv_common import validate from nfv_vim.api.acl.policies import fw_update_strategy_policy from nfv_vim.api.acl.policies import kube_rootca_update_strategy_policy from nfv_vim.api.acl.policies import kube_upgrade_strategy_policy -from nfv_vim.api.acl.policies import sw_patch_strategy_policy from nfv_vim.api.acl.policies import sw_update_strategy_policy from nfv_vim.api.acl.policies import sw_upgrade_strategy_policy from nfv_vim.api.acl.policies import system_config_update_strategy_policy @@ -47,9 +46,7 @@ MAX_PARALLEL_UPGRADE_HOSTS = 10 def _get_sw_update_type_from_path(path): split_path = path.split('/') - if 'sw-patch' in split_path: - return SW_UPDATE_NAME.SW_PATCH - elif 'sw-upgrade' in split_path: + if 'sw-upgrade' in split_path: return SW_UPDATE_NAME.SW_UPGRADE elif 'system-config-update' in split_path: return SW_UPDATE_NAME.SYSTEM_CONFIG_UPDATE @@ -147,29 +144,6 @@ class SwUpdateStrategyData(wsme_types.Base): abort_phase = wsme_types.wsattr(SwUpdateStrategyPhaseData, name='abort-phase') -class SwPatchStrategyCreateData(wsme_types.Base): - """ - Software Patch Strategy - Create Data - """ - controller_apply_type = wsme_types.wsattr(SwUpdateApplyTypes, mandatory=True, - name='controller-apply-type') - storage_apply_type = wsme_types.wsattr(SwUpdateApplyTypes, mandatory=True, - name='storage-apply-type') - swift_apply_type = wsme_types.wsattr(SwUpdateApplyTypes, mandatory=False, - name='swift-apply-type') - worker_apply_type = wsme_types.wsattr(SwUpdateApplyTypes, mandatory=True, - name='worker-apply-type') - max_parallel_worker_hosts = wsme_types.wsattr( - int, mandatory=False, name='max-parallel-worker-hosts') - default_instance_action = wsme_types.wsattr(SwUpdateInstanceActionTypes, - mandatory=True, - name='default-instance-action') - alarm_restrictions = wsme_types.wsattr( - SwUpdateAlarmRestrictionTypes, mandatory=False, - default=SW_UPDATE_ALARM_RESTRICTION_TYPES.STRICT, - name='alarm-restrictions') - - class SwUpgradeStrategyCreateData(wsme_types.Base): """ Software Upgrade Strategy - Create Data @@ -599,74 +573,6 @@ class SwUpdateStrategyAPI(rest.RestController): return pecan.abort(httplib.INTERNAL_SERVER_ERROR) -class SwPatchStrategyAPI(SwUpdateStrategyAPI): - """ - Software Patch Strategy Rest API - """ - @wsme_pecan.wsexpose(SwUpdateStrategyQueryData, - body=SwPatchStrategyCreateData, - status_code=httplib.OK) - def post(self, request_data): - rpc_request = rpc.APIRequestCreateSwUpdateStrategy() - rpc_request.sw_update_type = _get_sw_update_type_from_path( - pecan.request.path) - rpc_request.controller_apply_type = request_data.controller_apply_type - rpc_request.storage_apply_type = request_data.storage_apply_type - if wsme_types.Unset == request_data.swift_apply_type: - rpc_request.swift_apply_type = SW_UPDATE_APPLY_TYPE.IGNORE - else: - rpc_request.swift_apply_type = request_data.swift_apply_type - rpc_request.worker_apply_type = request_data.worker_apply_type - if wsme_types.Unset != request_data.max_parallel_worker_hosts: - if request_data.max_parallel_worker_hosts < MIN_PARALLEL_HOSTS \ - or request_data.max_parallel_worker_hosts > \ - MAX_PARALLEL_PATCH_HOSTS: - return pecan.abort( - httplib.BAD_REQUEST, - "Invalid value for max-parallel-worker-hosts") - rpc_request.max_parallel_worker_hosts = \ - request_data.max_parallel_worker_hosts - rpc_request.default_instance_action = request_data.default_instance_action - rpc_request.alarm_restrictions = request_data.alarm_restrictions - vim_connection = pecan.request.vim.open_connection() - vim_connection.send(rpc_request.serialize()) - msg = vim_connection.receive(timeout_in_secs=30) - if msg is None: - DLOG.error("No response received.") - return pecan.abort(httplib.INTERNAL_SERVER_ERROR) - - response = rpc.RPCMessage.deserialize(msg) - if rpc.RPC_MSG_TYPE.CREATE_SW_UPDATE_STRATEGY_RESPONSE != response.type: - DLOG.error("Unexpected message type received, msg_type=%s." - % response.type) - return pecan.abort(httplib.INTERNAL_SERVER_ERROR) - - if rpc.RPC_MSG_RESULT.SUCCESS == response.result: - strategy = json.loads(response.strategy) - query_data = SwUpdateStrategyQueryData() - query_data.convert_strategy(strategy) - return query_data - elif rpc.RPC_MSG_RESULT.CONFLICT == response.result: - return pecan.abort(httplib.CONFLICT, response.error_string) - - DLOG.error("Unexpected result received, result=%s." % response.result) - return pecan.abort(httplib.INTERNAL_SERVER_ERROR) - - def enforce_policy(self, method_name, auth_context_dict): - """Check policy rules for each action of this controller.""" - if method_name == "delete": - policy.check(sw_patch_strategy_policy.POLICY_ROOT % "delete", {}, - auth_context_dict, exc=policy.PolicyForbidden) - elif method_name in ["get_all", "get_one"]: - policy.check(sw_patch_strategy_policy.POLICY_ROOT % "get", {}, - auth_context_dict, exc=policy.PolicyForbidden) - elif method_name == "post": - policy.check(sw_patch_strategy_policy.POLICY_ROOT % "add", {}, - auth_context_dict, exc=policy.PolicyForbidden) - else: - policy.check('admin_in_system_projects', {}, auth_context_dict) - - class SwUpgradeStrategyAPI(SwUpdateStrategyAPI): """ Software Upgrade Strategy Rest API