-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CZ-96 Add support for tier1 node type (#5)
* CZ-96 Add support for tier1 node type * CZ-96 Update tier1 node * CZ-96 Update plugin yaml file * CZ-96 Update handling state for tier1 resource * CZ-96 Update handling state for tier1 resource * CZ-96 Add extra state for check if tier1 resource is ready or not * CZ-96 Update state handling for tier1 * CZ-96 Update readme file
- Loading branch information
mabuaisha
authored
Aug 23, 2020
1 parent
41d2ad2
commit ab0f907
Showing
11 changed files
with
478 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
######## | ||
# Copyright (c) 2020 Cloudify Technologies Ltd. All rights reserved | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# * See the License for the specific language governing permissions and | ||
# * limitations under the License. | ||
|
||
# STATE VALUES | ||
STATE_PENDING = 'pending' | ||
STATE_IN_PROGRESS = 'in_progress' | ||
STATE_IN_SYNC = 'in_sync' | ||
STATE_SUCCESS = 'success' | ||
|
||
# SEGMENTS | ||
TASK_DELETE = 'delete_task' | ||
|
||
# OPERATIONS | ||
DELETE_OPERATION = 'cloudify.interfaces.lifecycle.delete' | ||
CREATE_OPERATION = 'cloudify.interfaces.lifecycle.create' | ||
|
||
# RUNTIME PROPERTIES | ||
BASIC_RUNTIME_PROPERTIES = ( | ||
'id', | ||
'resource_type' | ||
) | ||
NSXT_ID_PROPERTY = 'id' | ||
NSXT_NAME_PROPERTY = 'name' | ||
NSXT_TYPE_PROPERTY = 'type' | ||
NSXT_RESOURCE_CONFIG_PROPERTY = 'resource_config' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
######## | ||
# Copyright (c) 2020 Cloudify Technologies Ltd. All rights reserved | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# * See the License for the specific language governing permissions and | ||
# * limitations under the License. | ||
from cloudify import ctx | ||
|
||
from nsx_t_plugin.decorators import with_nsx_t_client | ||
from nsx_t_plugin.constants import ( | ||
STATE_IN_PROGRESS, | ||
STATE_SUCCESS, | ||
STATE_PENDING, | ||
STATE_IN_SYNC | ||
) | ||
from nsx_t_plugin.utils import ( | ||
validate_if_resource_started, | ||
validate_if_resource_deleted, | ||
) | ||
from nsx_t_sdk.resources import Tier1, Tier1state | ||
|
||
|
||
@with_nsx_t_client(Tier1) | ||
def create(nsx_t_resource): | ||
# Trigger the actual call to the NSXT Manager API | ||
resource = nsx_t_resource.create() | ||
# Update the resource_id with the new "id" returned from API | ||
nsx_t_resource.resource_id = resource.id | ||
# Save path as runtime property to use it later on | ||
ctx.instance.runtime_properties['path'] = resource.path | ||
|
||
|
||
@with_nsx_t_client(Tier1state) | ||
def start(nsx_t_resource): | ||
validate_if_resource_started( | ||
'Tier1', | ||
nsx_t_resource, | ||
[STATE_IN_PROGRESS, STATE_PENDING], | ||
[STATE_SUCCESS, STATE_IN_SYNC] | ||
) | ||
|
||
|
||
@with_nsx_t_client(Tier1) | ||
def delete(nsx_t_resource): | ||
validate_if_resource_deleted(nsx_t_resource) |
Oops, something went wrong.