def setUpClass(cls): cls.browser = cls.get_browser() login(cls.browser) cls.system_one_details = { 'fqdn' : u'a1', 'type' : u'Machine', 'arch' : u'i386', 'status' : u'Automated', 'owner' : data_setup.create_user(),} cls.system_one = data_setup.create_system(**cls.system_one_details) cls.system_one.loaned = data_setup.create_user() cls.system_one.numa = Numa(nodes=2) cls.system_one.key_values_string.append(Key_Value_String( Key.by_name(u'CPUMODEL'), 'foocodename')) cls.system_one.key_values_string.append(Key_Value_String( Key.by_name(u'HVM'), '1')) cls.system_one.cpu = Cpu(flags=['flag1', 'flag2']) cls.system_one.key_values_int.append(Key_Value_Int( Key.by_name(u'DISKSPACE'), '1024')) cls.system_one.key_values_int.append(Key_Value_Int( Key.by_name(u'MEMORY'), '4096')) cls.system_two_details = { 'fqdn' : u'a2', 'type' : u'Prototype', 'arch' : u'x86_64', 'status' : u'Manual', 'owner' : data_setup.create_user(),} cls.system_two = data_setup.create_system(**cls.system_two_details) cls.system_two.key_values_int.append(Key_Value_Int( Key.by_name(u'DISKSPACE'), '900')) cls.system_two.key_values_string.append(Key_Value_String( Key.by_name(u'HVM'), '1')) device_class = DeviceClass.lazy_create(device_class='class_type') device1 = Device.lazy_create(vendor_id = '0000', device_id = '0000', subsys_vendor_id = '2223', subsys_device_id = '2224', bus = '0000', driver = '0000', device_class_id = device_class.id, description = 'blah') cls.system_two.devices.append(device1) cls.system_three_details = { 'fqdn' : u'a3', 'type' : u'Laptop', 'arch' : u'ia64', 'status' : u'Removed', 'owner' : data_setup.create_user(),} cls.system_three = data_setup.create_system(**cls.system_three_details) cls.system_three.numa = Numa(nodes=1) device2 = Device.lazy_create(vendor_id = '0000', device_id = '0000', subsys_vendor_id = '1111', subsys_device_id = '1112', bus = '0000', driver = '0000', device_class_id = device_class.id, description = 'blah') cls.system_three.devices.append(device2)
def create_device(device_class=None, **kwargs): if device_class is not None: kwargs['device_class_id'] = create_device_class(device_class).id return Device.lazy_create(**kwargs)
def setUpClass(cls): cls.system_one_details = { 'fqdn': u'a1', 'type': u'Machine', 'arch': u'i386', 'status': u'Automated', 'owner': data_setup.create_user(), } cls.system_one = data_setup.create_system(**cls.system_one_details) cls.system_one.loaned = data_setup.create_user() cls.system_one.numa = Numa(nodes=2) cls.system_one.key_values_string.append( Key_Value_String(Key.by_name(u'CPUMODEL'), 'foocodename')) cls.system_one.key_values_string.append( Key_Value_String(Key.by_name(u'HVM'), '1')) cls.system_one.cpu = Cpu(flags=['flag1', 'flag2']) cls.system_one.key_values_int.append( Key_Value_Int(Key.by_name(u'DISKSPACE'), '1024')) cls.system_one.key_values_int.append( Key_Value_Int(Key.by_name(u'MEMORY'), '4096')) cls.system_two_details = { 'fqdn': u'a2', 'type': u'Prototype', 'arch': u'x86_64', 'status': u'Manual', 'owner': data_setup.create_user(), } cls.system_two = data_setup.create_system(**cls.system_two_details) cls.system_two.key_values_int.append( Key_Value_Int(Key.by_name(u'DISKSPACE'), '900')) cls.system_two.key_values_string.append( Key_Value_String(Key.by_name(u'HVM'), '1')) device_class = DeviceClass.lazy_create(device_class='class_type') device1 = Device.lazy_create(vendor_id='0000', device_id='0000', subsys_vendor_id='2223', subsys_device_id='2224', bus='0000', driver='0000', device_class_id=device_class.id, description='blah') cls.system_two.devices.append(device1) cls.system_three_details = { 'fqdn': u'a3', 'type': u'Laptop', 'arch': u'ia64', 'status': u'Automated', 'owner': data_setup.create_user(), } cls.system_three = data_setup.create_system(**cls.system_three_details) cls.system_three.numa = Numa(nodes=1) device2 = Device.lazy_create(vendor_id='0000', device_id='0000', subsys_vendor_id='1111', subsys_device_id='1112', bus='0000', driver='0000', device_class_id=device_class.id, description='blah') cls.system_three.devices.append(device2) cls.system_four_details = { 'status': u'Removed', } cls.system_four = data_setup.create_system(**cls.system_four_details) cls.system_four.key_values_string.append( Key_Value_String(Key.by_name(u'CPUMODEL'), 'foocodename'))