def test_for_windows_ms_sql__web(self): notification_options = NotificationOptions( {'com.rackspace__1__options': '36'}) options_dict = notification_options.to_cuf_options() self.assertEquals( options_dict, 'osLicenseType="WINDOWS" ' 'applicationLicense="MSSQL_WEB"')
def test_for_windows_ms_sql__web(self): options_dict_result = { 'is_redhat': 'false', 'is_ms_sql': 'false', 'is_ms_sql_web': 'true', 'is_windows': 'true', 'is_se_linux': 'false', 'is_managed': 'false' } notification_options = NotificationOptions( {'com.rackspace__1__options': '36'}) options_dict = notification_options.to_cuf_options() self.assertEquals(options_dict, options_dict_result)
def _create_cuf_xml(self, deployment_info, json_body): payload = NotificationPayload(json_body['payload']) notification_options = {'com.rackspace__1__options': payload.options} cuf_xml_values = NotificationOptions( notification_options).to_cuf_options() cuf_xml_values['bandwidth_in'] = payload.bandwidth_in cuf_xml_values['bandwidth_out'] = payload.bandwidth_out cuf_xml_values['start_time'] = payload.start_time cuf_xml_values['end_time'] = payload.end_time cuf_xml_values['tenant_id'] = payload.tenant_id cuf_xml_values['instance_id'] = payload.instance_id cuf_xml_values['id'] = json_body['_unique_id'] cuf_xml_values['flavor'] = payload.flavor cuf_xml_values['data_center'] = deployment_info['data_center'] cuf_xml_values['region'] = deployment_info['region'] cuf_xml = nova_cuf_template % cuf_xml_values return cuf_xml
def _create_cuf_xml(self, json_body): payload = NotificationPayload(json_body['payload']) notification_options = {'com.rackspace__1__options': payload.options} cuf_xml_values = {} cuf_xml_values['options_string'] = NotificationOptions( notification_options).to_cuf_options() cuf_xml_values['bandwidth_in'] = payload.bandwidth_in cuf_xml_values['bandwidth_out'] = payload.bandwidth_out cuf_xml_values['start_time'] = datetime.datetime.strftime( payload.start_time, atom_hopper_time_format) cuf_xml_values['end_time'] = datetime.datetime.strftime( payload.end_time, atom_hopper_time_format) cuf_xml_values['tenant_id'] = payload.tenant_id cuf_xml_values['instance_id'] = payload.instance_id cuf_xml_values['instance_name'] = payload.instance_name cuf_xml_values['id'] = self.generate_new_id() cuf_xml_values['flavor_id'] = payload.flavor_id cuf_xml_values['flavor_name'] = payload.flavor_name cuf_xml_values['status'] = payload.status cuf_xml_values['data_center'] = self.data_center cuf_xml_values['region'] = self.region cuf_xml = nova_cuf_template % cuf_xml_values return cuf_xml
def test_for_no_options_gives_osLicense_linux(self): notification_options = NotificationOptions( {'com.rackspace__1__options': '0'}) options_dict = notification_options.to_cuf_options() self.assertEquals(options_dict, 'osLicenseType="LINUX"')
def test_for_windows(self): notification_options = NotificationOptions( {'com.rackspace__1__options': '4'}) options_dict = notification_options.to_cuf_options() self.assertEquals(options_dict, 'osLicenseType="WINDOWS"')
def test_for_se_linux(self): notification_options = NotificationOptions( {'com.rackspace__1__options': '2'}) options_dict = notification_options.to_cuf_options() self.assertEquals(options_dict, '')
def test_for_red_hat(self): notification_options = NotificationOptions( {'com.rackspace__1__options': '1'}) options_dict = notification_options.to_cuf_options() self.assertEquals(options_dict, 'osLicenseType="RHEL"')