def test_create_hosting_device_template(self): """Create hosting device template.""" resource = 'hosting_device_template' cmd = hostingdevicetemplate.HostingDeviceTemplateCreate( test_cli20.MyApp(sys.stdout), None) name = 'Device template 1' host_category = 'Hardware' myid = 'myid' args = [name, host_category] position_names = ['name', 'host_category'] position_values = [name, host_category] self._test_create_resource(resource, cmd, None, myid, args, position_names, position_values)
def _test_create_hosting_device_template_optional_args( self, disabled=None, service_types=None, servicetypes=None, image=None, flavor=None, creds_id=None, credsid=None, conf_mech=None, confmech=None, proto_port=None, protoport=None, boot_time=None, boottime=None, slot_capacity=None, slotcapacity=None, slots_free=None, slotsfree=None, tenant_bound=None, tenantbound=None, dev_drv=None, devdrv=None, plug_drv=None, plugdrv=None): resource = 'hosting_device_template' cmd = hostingdevicetemplate.HostingDeviceTemplateCreate( test_cli20.MyApp(sys.stdout), None) myid = 'myid' name = 'Device template 1' host_category = 'Hardware' args = [] expected = {} if disabled is not None: args += ['--disabled'] expected['enabled'] = False if service_types is not None: args += ['--service_types', service_types] expected['service_types'] = service_types if servicetypes is not None: args += ['--service-types', servicetypes] expected['service_types'] = servicetypes if image is not None: args += ['--image', image] expected['image'] = image if flavor is not None: args += ['--flavor', flavor] expected['flavor'] = flavor if creds_id is not None: args += ['--credentials_id', creds_id] expected['default_credentials_id'] = creds_id if credsid is not None: args += ['--credentials-id', credsid] expected['default_credentials_id'] = credsid if conf_mech is not None: args += ['--config_mechanism', conf_mech] expected['configuration_mechanism'] = conf_mech if confmech is not None: args += ['--config-mechanism', confmech] expected['configuration_mechanism'] = confmech if proto_port is not None: args += ['--protocol_port', proto_port] expected['protocol_port'] = proto_port if protoport is not None: args += ['--protocol-port', protoport] expected['protocol_port'] = protoport if boot_time is not None: args += ['--booting_time', boot_time] expected['booting_time'] = boot_time if boottime is not None: args += ['--booting-time', boottime] expected['booting_time'] = boottime if slot_capacity is not None: args += ['--slot_capacity', slot_capacity] expected['slot_capacity'] = slot_capacity if slotcapacity is not None: args += ['--slot-capacity', slotcapacity] expected['slot_capacity'] = slotcapacity if slots_free is not None: args += ['--desired_slots_free', slots_free] expected['desired_slots_free'] = slots_free if slotsfree is not None: args += ['--desired-slots-free', slotsfree] expected['desired_slots_free'] = slotsfree if dev_drv is not None: args += ['--device_driver', dev_drv] expected['device_driver'] = dev_drv if devdrv is not None: args += ['--device-driver', devdrv] expected['device_driver'] = devdrv if plug_drv is not None: args += ['--plugging_driver', plug_drv] expected['plugging_driver'] = plug_drv if plugdrv is not None: args += ['--plugging-driver', plugdrv] expected['plugging_driver'] = plugdrv if tenant_bound is not None: args += ['--tenant_bound', tenant_bound] expected['tenant_bound'] = (tenant_bound if tenant_bound != "None" else None) if tenantbound is not None: args += ['--tenant-bound', tenantbound] expected['tenant_bound'] = (tenantbound if tenantbound != "None" else None) position_names = ['name', 'host_category'] position_values = [name, host_category] for p_v in position_values: args.append(p_v) self._test_create_resource(resource, cmd, None, myid, args, position_names, position_values, **expected)