Add test_SlaveInstance_request_SlaveInstance_From_SoftwareInstance test

Test for bug_module/20120103-128245F
parent 5fcf2571
...@@ -1197,6 +1197,115 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -1197,6 +1197,115 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def stepCheckConnectionXmlOfSlaveInstanceFromComputerPartition(self, sequence):
computer_reference = sequence["computer_reference"]
computer_partition_reference = sequence["computer_partition_reference"]
slave_reference = sequence["requested_reference"]
slave_software_release = sequence["software_release_uri"]
slave_software_type = sequence["requested_software_type"]
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
# Get Computer Partition
computer_partition = self.slap.registerComputerPartition(
computer_reference, computer_partition_reference)
# Get slave
slave_instance = computer_partition.request(
software_release=slave_software_release,
software_type=slave_software_type,
partition_reference=slave_reference,
shared=True,
)
self.assertTrue(sequence["slave_instance_site_url"] == \
slave_instance.getConnectionParameter("site_url"))
def test_SlaveInstance_request_SlaveInstance_From_SoftwareInstance(self):
"""
Check that existing Software Instance can request new Slave Instance
and access to its parameters.
Scenario :
All Software Instances use the same SoftwareRelease.
SoftwareType requested_software_type can act as master instance, slave
instance.
SoftwareType another_requested_software_type can act as Software Instance
requesting a Slave Instance of SoftwareType requested_software_type.
1/ Request instance "Master Instance" with SoftwareType
requested_software_type.
2/ Simulate succesful deployment of instance
3/ Request instance "Normal instance" with SoftwareType
another_requested_software_type.
4/ From "Normal Instance", request a Slave Instance with SoftwareType
requested_software_type.
5/ From "Master Instance", try to set connection XML of Slave Instance
5/ Check that "Normal Instance" can access connection XML of Slave
Instance.
"""
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + '\
Tic \
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
CheckEmptySlaveInstanceListFromOneComputerPartition \
\
SelectAnotherRequestedSoftwareType \
SelectAnotherRequestedReference \
SlapLoginTestVifibCustomer \
PersonRequestSlapSoftwareInstancePrepare \
Tic \
SlapLogout \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
Logout \
SlapLoginTestVifibCustomer \
PersonRequestSlapSoftwareInstance \
Tic \
SlapLogout \
LoginDefaultUser \
SetRequestedComputerPartition \
SetRequestedComputerPartitionAsCurrentComputerPartition \
SlapLogout \
Tic \
SlapLoginCurrentComputer \
SoftwareInstanceAvailable \
Tic \
\
LoginDefaultUser \
SetCurrentComputerPartitionFromRequestedComputerPartition \
SelectSoftwareInstanceFromCurrentComputerPartition \
Logout \
SlapLoginCurrentSoftwareInstance \
SelectRequestedParameterDictRequestedParameter \
SelectYetAnotherRequestedReference \
SelectRequestedSoftwaretype \
RequestSlaveInstanceFromComputerPartition \
Tic \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
Logout \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout \
LoginDefaultUser \
SetComputerPartitionFromRootSoftwareInstance \
SelectSlaveInstanceFromOneComputerPartition \
SlapLoginSoftwareInstanceFromCurrentSoftwareInstance \
SetConnectionXmlToSlaveInstance \
SlapLogout \
LoginDefaultUser \
SetRequestedComputerPartitionAsCurrentComputerPartition \
SelectSoftwareInstanceFromCurrentComputerPartition \
Logout \
SlapLoginCurrentSoftwareInstance \
CheckConnectionXmlOfSlaveInstanceFromComputerPartition \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
################################################## ##################################################
# ComputerPartition.request - change software type # ComputerPartition.request - change software type
################################################## ##################################################
......
...@@ -195,7 +195,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -195,7 +195,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
open_order.request( open_order.request(
software_release=software_release, software_release=software_release,
software_type=sequence.get('software_type', 'software_type'), software_type=sequence.get('requested_software_type', 'software_type'),
partition_reference=sequence.get('requested_reference', partition_reference=sequence.get('requested_reference',
'requested_reference'), 'requested_reference'),
partition_parameter_kw=sequence.get('requested_parameter_dict', {}), partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
...@@ -210,7 +210,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -210,7 +210,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request( requested_slap_computer_partition = open_order.request(
software_release=software_release, software_release=software_release,
software_type=sequence.get('software_type', 'software_type'), software_type=sequence.get('requested_software_type', 'software_type'),
partition_reference=sequence.get('requested_reference', partition_reference=sequence.get('requested_reference',
'requested_reference'), 'requested_reference'),
partition_parameter_kw=sequence.get('requested_parameter_dict', {}), partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
...@@ -221,6 +221,43 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -221,6 +221,43 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
requested_computer_partition_reference=\ requested_computer_partition_reference=\
requested_slap_computer_partition.getId()) requested_slap_computer_partition.getId())
def stepSetCurrentComputerPartitionFromRequestedComputerPartition(self, sequence):
sequence['computer_partition_reference'] = \
sequence["requested_computer_partition_reference"]
def stepSelectSoftwareInstanceFromCurrentComputerPartition(self, sequence):
computer_partition_reference = sequence["computer_partition_reference"]
computer_partition = self.portal.portal_catalog.getResultValue(
portal_type="Computer Partition",
reference=computer_partition_reference)
software_instance = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
aggregate_uid=computer_partition.getUid()).getAggregateValue(
portal_type="Software Instance")
sequence.edit(
software_instance_uid=software_instance.getUid(),
software_instance_reference=software_instance.getReference(),
hosting_subscription_uid=software_instance.getAggregateRelatedValue(
portal_type='Sale Order Line').getAggregateValue(
portal_type='Hosting Subscription').getUid())
def stepSelectSoftwareInstanceFromCurrentSlaveInstance(self, sequence):
slave_instance_reference = sequence["software_instance_reference"]
slave_instance = self.portal.portal_catalog.getResultValue(
portal_type=self.slave_instance_portal_type,
reference=slave_instance_reference)
computer_partition = slave_instance.getAggregateRelatedValue(
portal_type="Sale Packing List Line").getAggregateValue(
portal_type="Computer Partition")
software_instance = self.portal.portal_catalog.getResultValue(
portal_type="Sale Packing List Line",
aggregate_uid=computer_partition.getUid(),
aggregatep_portal_type=self.software_instance_portal_type,
).getAggregateValue(portal_type=self.software_instance_portal_type)
sequence.edit(
software_instance_uid=software_instance.getUid(),
software_instance_reference=software_instance.getReference())
def stepSetCurrentPersonSlapRequestedSoftwareInstance(self, sequence, **kw): def stepSetCurrentPersonSlapRequestedSoftwareInstance(self, sequence, **kw):
cleanup_resource = self.portal.portal_preferences\ cleanup_resource = self.portal.portal_preferences\
.getPreferredInstanceCleanupResource() .getPreferredInstanceCleanupResource()
...@@ -511,6 +548,17 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -511,6 +548,17 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type='Sale Order Line').getAggregateValue( portal_type='Sale Order Line').getAggregateValue(
portal_type='Hosting Subscription').getUid()) portal_type='Hosting Subscription').getUid())
def stepSetComputerPartitionFromRootSoftwareInstance(self, sequence):
computer_partition = self.portal.portal_catalog.getResultValue(
title=sequence['root_software_instance_title'],
portal_type="Software Instance").getAggregateRelatedValue(
portal_type="Sale Packing List Line").getAggregateValue(
portal_type="Computer Partition")
sequence.edit(
computer_partition_uid=computer_partition.getUid(),
computer_partition_reference=computer_partition.getReference()
)
def stepSetSelectedComputerPartition(self, sequence, **kw): def stepSetSelectedComputerPartition(self, sequence, **kw):
"""Sets in sequence computer partition parameters related to current """Sets in sequence computer partition parameters related to current
software instance""" software instance"""
...@@ -1608,6 +1656,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1608,6 +1656,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
sequence.edit(requested_reference='requested_reference') sequence.edit(requested_reference='requested_reference')
sequence.edit(requested_software_type='requested_software_type') sequence.edit(requested_software_type='requested_software_type')
def stepSelectRequestedSoftwaretype(self, sequence, **kw):
sequence.edit(requested_software_type='requested_software_type')
def stepSelectRequestedReferenceChildrenA(self, sequence, **kw): def stepSelectRequestedReferenceChildrenA(self, sequence, **kw):
sequence.edit(requested_reference='children_a') sequence.edit(requested_reference='children_a')
sequence.edit(requested_software_type='children_a') sequence.edit(requested_software_type='children_a')
...@@ -1994,6 +2045,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1994,6 +2045,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
sequence.edit(requested_computer_partition=self\ sequence.edit(requested_computer_partition=self\
._getComputerPartitionByReference(sequence)) ._getComputerPartitionByReference(sequence))
def stepSetRequestedComputerPartitionAsCurrentComputerPartition(self,
sequence):
sequence.edit(computer_partition_reference=\
sequence["requested_computer_partition"].getReference())
def stepCheckComputerPartitionChildrenANoChild(self, sequence, **kw): def stepCheckComputerPartitionChildrenANoChild(self, sequence, **kw):
computer_partition = sequence['children_a_computer_partition'] computer_partition = sequence['children_a_computer_partition']
self._checkComputerPartitionAndRelatedSoftwareInstance(computer_partition) self._checkComputerPartitionAndRelatedSoftwareInstance(computer_partition)
...@@ -3641,7 +3697,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3641,7 +3697,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSelectSlaveInstanceFromOneComputerPartition(self, sequence): def stepSelectSlaveInstanceFromOneComputerPartition(self, sequence):
slave_instance = self._getSlaveInstanceFromCurrentComputerPartition(sequence) slave_instance = self._getSlaveInstanceFromCurrentComputerPartition(sequence)
sequence.edit(software_instance_uid=slave_instance.getUid()) sequence.edit(software_instance_uid=slave_instance.getUid(),
software_instance_reference=slave_instance.getReference())
def stepCheckEmptySlaveInstanceListFromOneComputerPartition(self, sequence): def stepCheckEmptySlaveInstanceListFromOneComputerPartition(self, sequence):
computer_guid = sequence["computer_reference"] computer_guid = sequence["computer_reference"]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment