Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Driver Description="Deploy OpenStack Nova Instance from Image" MainClass="driver.DeployOSNovaImageInstanceDriver" Name="Deploy OpenStack Nova Image Instance" Version="0.0.12">
<Driver Description="Deploy OpenStack Nova Instance from Image" MainClass="driver.DeployOSNovaImageInstanceDriver" Name="Deploy OpenStack Nova Image Instance" Version="0.0.13">
<Layout>
<Category Name="App Management">
<Command Description="" DisplayName="Deploy" Name="Deploy" Tags="allow_shared" />
Expand Down
2 changes: 1 addition & 1 deletion drivers/openstack_shell/src/drivermetadata.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Driver Description="This driver orchestrate all the command that will be executed on OpenStack" MainClass="driver.OpenStackShellDriver" Name="OpenStack Shell Driver" Version="0.0.12">
<Driver Description="This driver orchestrate all the command that will be executed on OpenStack" MainClass="driver.OpenStackShellDriver" Name="OpenStack Shell Driver" Version="0.0.13">
<Layout>
<Category Name="Deployment">
<Command Description="" DisplayName="Deploy From Image" Name="deploy_from_image" Tags="allow_unreserved" />
Expand Down
9 changes: 4 additions & 5 deletions drivers/openstack_shellPackage/Configuration/shellconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
<Description>Template for creating OpenStack cloud Provider Resource</Description>
<AutoLoad Enable="true">
<Description>Checks that the inputs are valid for the target OpenStack</Description>
</AutoLoad>
</AutoLoad>
<Attributes>
<Attribute Name="Controller URL" Value=""/>
<Attribute Name="OpenStack Domain Name" Value=""/>
<Attribute Name="Controller URL" Value="http://[controller-ip]:5000/v3"/>
<Attribute Name="OpenStack Domain Name" Value="default"/>
<Attribute Name="OpenStack Project Name" Value=""/>
<Attribute Name="OpenStack User Name" Value=""/>
<Attribute Name="OpenStack User Password" Value=""/>
<Attribute Name="OpenStack Management VLAN ID" Value="100"/>
<Attribute Name="Quali Management VLAN ID" Value="110"/>
<Attribute Name="Quali Management Network UUID" Value=""/>
</Attributes>
</ResourceTemplate>
</ResourceTemplates>
Expand Down
73 changes: 10 additions & 63 deletions drivers/openstack_shellPackage/DataModel/datamodel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Rules/>
</AttributeInfo>
<!-- 1 -->
<AttributeInfo DefaultValue="" Description="Public Endpoint of the Keystone Controller URL for the OpenStack deployment." IsReadOnly="false" Name="Controller URL" Type="String">
<AttributeInfo DefaultValue="http://controller:5000/v3" Description="Public Endpoint of the Keystone Controller URL for the OpenStack deployment. Typically this will be of the form http://controler-ip:5000/v3" IsReadOnly="false" Name="Controller URL" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand All @@ -26,7 +26,7 @@
</Rules>
</AttributeInfo>
<!-- 4 -->
<AttributeInfo DefaultValue="" Description="In a multi-region deployment name of the region where resources will be deployed" IsReadOnly="false" Name="OpenStack Region" Type="String">
<AttributeInfo DefaultValue="" Description="In a multi-region deployment name of the region where resources will be deployed. Leave blank for single region." IsReadOnly="false" Name="OpenStack Region" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand All @@ -46,31 +46,9 @@
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 7 -->
<AttributeInfo DefaultValue="" Description="OpenStack management network VLAN ID. This network will be used by OpenStack components for internal communication. This can be empty it means, untagged network is used for management." IsReadOnly="false" Name="OpenStack Management VLAN ID" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 8 -->
<AttributeInfo DefaultValue="" Description="Quali Management VLAN ID. This network will be used for running QualiX and Execution Servers" IsReadOnly="false" Name="Quali Management VLAN ID" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>

<!-- 9 -->
<AttributeInfo DefaultValue="" Description="IP Subnet for OpenStack Management (not used by cloudshell)" IsReadOnly="false" Name="OpenStack Management Subnet CIDR" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>

<!-- 10 -->
<AttributeInfo DefaultValue="" Description="IP Subnet for QualiX ane Quali EC" IsReadOnly="false" Name="Quali Management Subnet CIDR" Type="String">
<!-- 7 -->
<AttributeInfo DefaultValue="" Description="Network ID of Quali Management Network." IsReadOnly="false" Name="Quali Management Network UUID" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand Down Expand Up @@ -101,14 +79,14 @@
</Rules>
</AttributeInfo>
<!-- 3 -->
<AttributeInfo DefaultValue="" Description="Image name to be used for deployment." IsReadOnly="false" Name="Image Name" Type="String">
<AttributeInfo DefaultValue="" Description="UUID of the image to be used for deployment. Check Horizon UI for Image ID" IsReadOnly="false" Name="Image UUID" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 4 -->
<AttributeInfo DefaultValue="" Description="Flavor of the compute Instance" IsReadOnly="false" Name="Instance Flavor" Type="String">
<AttributeInfo DefaultValue="" Description="Flavor of the compute Instance. Check Horizon UI for supported flavors" IsReadOnly="false" Name="Instance Flavor" Type="String">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
Expand All @@ -121,20 +99,6 @@
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 6 -->
<AttributeInfo DefaultValue="false" Description="Enables the automatic power off of an app during reservation Teardown." IsReadOnly="false" Name="Auto Power Off" Type="Boolean">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 7 -->
<AttributeInfo DefaultValue="false" Description="Enables the automatic deletion of an app during reservation Teardown." IsReadOnly="false" Name="Auto Delete" Type="Boolean">
<Rules>
<Rule Name="Configuration" />
<Rule Name="Setting" />
</Rules>
</AttributeInfo>
<!-- 8 -->
<AttributeInfo DefaultValue="false" Description="Enables the automatic execution of the Autoload command during reservation Setup.." IsReadOnly="false" Name="Autoload" Type="Boolean">
<Rules>
Expand Down Expand Up @@ -175,25 +139,16 @@
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack Project Name" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack Region" UserInput="true">
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Quali Management Network UUID" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack User Name" UserInput="true">
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack Region" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack User Password" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack Management VLAN ID" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Quali Management VLAN ID" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack Management Subnet CIDR" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Quali Management Subnet CIDR" UserInput="true">
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="OpenStack User Name" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Floating IP Pool" UserInput="true">
Expand Down Expand Up @@ -268,7 +223,7 @@
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Availability Zone" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Image Name" UserInput="true">
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Image UUID" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Instance Flavor" UserInput="true">
Expand All @@ -277,12 +232,6 @@
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Add Floating IP" UserInput="true">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Auto Power Off" UserInput="false">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Auto Delete" UserInput="false">
<AllowedValues />
</AttachedAttribute>
<AttachedAttribute IsLocal="true" IsOverridable="true" Name="Autoload" UserInput="false">
<AllowedValues />
</AttachedAttribute>
Expand All @@ -294,8 +243,6 @@
</AttachedAttribute>
</AttachedAttributes>
<AttributeValues>
<AttributeValue Name="Auto Power Off" Value="true"/>
<AttributeValue Name="Auto Delete" Value="true"/>
<AttributeValue Name="Autoload" Value="true"/>
</AttributeValues>
<ParentModels />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ def __init__(self):
self.instance_waiter = InstanceWaiter()
self.instance_service = NovaInstanceService(self.instance_waiter)

def deploy(self, os_session, name, reservation, deploy_req_model, logger):
def deploy(self, os_session, name, reservation, cp_resource_model, deploy_req_model, logger):
"""
Performs actual deploy operation.
:param keystoneauth1.session.Session os_session:
:param str name: Name of the instance to be deployed
:param ReservationModel reservation:
:param DeployDataHolder deploy_req_model:
:param OpenStackResourceModel cp_resource_model:
:param LoggingSessionContext logger:
:rtype DeployResultModel:
"""
Expand All @@ -29,6 +30,7 @@ def deploy(self, os_session, name, reservation, deploy_req_model, logger):
instance = self.instance_service.create_instance(openstack_session=os_session,
name=name,
reservation=reservation,
cp_resource_model=cp_resource_model,
deploy_req_model=deploy_req_model,
logger=logger)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ def __init__(self, instance_waiter):
# can be called without a proper client object

def create_instance(self, openstack_session, name, reservation,
deploy_req_model, logger):
cp_resource_model, deploy_req_model, logger):
"""
:param keystoneauth1.session.Session openstack_session: Keystone Session
:param str name: Name of Instance
:param ReservationModel reservation: Reservation Model
:param OpenStackResourceModel cp_resource_model:
:param DeployOSNovaImageInstanceResourceModel deploy_req_model: Details of the Image to be deployed
:param LoggingSessionContext logger:
:rtype novaclient.Client.servers.Server:
Expand All @@ -32,14 +33,14 @@ def create_instance(self, openstack_session, name, reservation,

client = novaclient.Client(self.API_VERSION, session=openstack_session)

logger.info("Creating OpenStack Instance for Image: {0}, Flavor: {1}".format(deploy_req_model.img_name,
logger.info("Creating OpenStack Instance for Image: {0}, Flavor: {1}".format(deploy_req_model.img_uuid,
deploy_req_model.instance_flavor))
# FIXME: Add other arguments as kwargs
img_obj = client.images.find(name=deploy_req_model.img_name)
img_obj = client.images.find(id=deploy_req_model.img_uuid)
flavor_obj = client.flavors.find(name=deploy_req_model.instance_flavor)
# Quali Network - FIXME: Remove hard coded (get it from network service)
qnet_obj = client.networks.find(label='quali-network')
qnet_dict = {'net-id':qnet_obj.id}

# Quali Network - Quali Network UUID is a OpenStack Resource Model attribute
qnet_dict = {'net-id': cp_resource_model.qs_mgmt_os_net_uuid}

uniq = CloudshellDriverHelper.get_uuid() #str(uuid.uuid4()).split("-")[0]
name = name + "-" + uniq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ class DeployOSNovaImageInstanceResourceModel(object):
def __init__(self):
self.cloud_provider = ''
self.cp_avail_zone = ''
self.img_name = ''
self.img_uuid = ''
self.instance_flavor = ''
self.add_floating_ip = False
self.auto_power_off = False
self.autoload = False
self.auto_delete = False
self.outbound_ports = ''
self.inbound_ports = ''
15 changes: 4 additions & 11 deletions package/cloudshell/cp/openstack/models/model_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ def get_resource_model_from_context(resource):
os_res_model.os_region = attrs['OpenStack Region']
os_res_model.os_user_name = attrs['OpenStack User Name']
os_res_model.os_user_password = attrs['OpenStack User Password']
os_res_model.os_mgmt_vlan_id = attrs['OpenStack Management VLAN ID']
os_res_model.qs_mgmt_vlan_id = attrs['Quali Management VLAN ID']
os_res_model.os_mgmt_subnet_cidr = attrs['OpenStack Management Subnet CIDR']
os_res_model.qs_mgmt_subnet_cidr = attrs['Quali Management Subnet CIDR']
os_res_model.qs_mgmt_os_net_uuid = attrs['Quali Management Network UUID']
os_res_model.os_floating_ip_pool = attrs['Floating IP Pool']
return os_res_model

Expand All @@ -37,11 +34,9 @@ def deploy_res_model_appname_from_deploy_req(deploy_req):
deploy_res_model = DeployOSNovaImageInstanceResourceModel()
deploy_res_model.cloud_provider = data_holder.image.cloud_provider
deploy_res_model.cp_avail_zone = data_holder.image.cp_avail_zone
deploy_res_model.img_name = data_holder.image.img_name
deploy_res_model.img_uuid = data_holder.image.img_uuid
deploy_res_model.instance_flavor = data_holder.image.instance_flavor
deploy_res_model.add_floating_ip = data_holder.image.add_floating_ip
deploy_res_model.auto_power_off = data_holder.image.auto_power_off
deploy_res_model.auto_delete = data_holder.image.auto_delete
deploy_res_model.autoload = data_holder.image.autoload
deploy_res_model.inbound_ports = data_holder.image.inbound_ports
deploy_res_model.outbound_ports = data_holder.image.outbound_ports
Expand All @@ -56,11 +51,9 @@ def get_deploy_resource_model_from_context_resource(resource):
deploy_resource_model = DeployOSNovaImageInstanceResourceModel()
deploy_resource_model.cloud_provider = attrs['Cloud Provider']
deploy_resource_model.cp_avail_zone = attrs['Availability Zone']
deploy_resource_model.img_name = attrs['Image Name']
deploy_resource_model.img_uuid = attrs['Image UUID']
deploy_resource_model.instance_flavor = attrs['Instance Flavor']
deploy_resource_model.add_floating_ip = OpenStackShellModelParser.parse_boolean(attrs['Add Floating IP'])
deploy_resource_model.auto_power_off = OpenStackShellModelParser.parse_boolean(attrs['Auto Power Off'])
deploy_resource_model.auto_delete = OpenStackShellModelParser.parse_boolean(attrs['Auto Delete'])
deploy_resource_model.autoload = OpenStackShellModelParser.parse_boolean(attrs['Autoload'])
deploy_resource_model.inbound_ports = attrs['Inbound Ports']
deploy_resource_model.outbound_ports = attrs['Outbound Ports']
Expand All @@ -74,4 +67,4 @@ def parse_boolean(value):
@staticmethod
def deployed_app_resource_from_context_remote(context_remote):
deployed_app_json = jsonpickle.decode(context_remote.app_context.deployed_app_json)
return DeployDataHolder(deployed_app_json)
return DeployDataHolder(deployed_app_json)
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ def __init__(self):
self.os_region = ''
self.os_user_name = ''
self.os_user_password = ''
self.os_mgmt_vlan_id = ''
self.qs_mgmt_vlan_id = ''
self.os_mgmt_subnet_cidr = ''
self.qs_mgmt_subnet_cidr = ''
self.qs_mgmt_os_net_uuid = ''
self.os_floating_ip_pool = ''

def __str__(self):
Expand Down
1 change: 1 addition & 0 deletions package/cloudshell/cp/openstack/openstack_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def deploy_instance_from_image(self, command_context, deploy_request):
deployed_data = self.deploy_operation.deploy(os_session=os_session,
name=app_name,
reservation=reservation_model,
cp_resource_model=resource_model,
deploy_req_model=deploy_req_model,
logger=logger)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def setUp(self):
self.openstack_session = Mock()
self.reservation = Mock()
self.mock_logger = Mock()
self.cp_resource_model = Mock()

def test_deploy_instance_success(self):

Expand All @@ -39,6 +40,7 @@ def test_deploy_instance_success(self):
test_result = self.deploy_operation.deploy(os_session=self.openstack_session,
name=test_name,
reservation=self.reservation,
cp_resource_model=self.cp_resource_model,
deploy_req_model=test_deploy_req_model,
logger=self.mock_logger)

Expand Down
Loading