def create_interface(service, interface_name, operation_name, operation_kwargs=None, interface_kwargs=None): the_type = service.service_template.interface_types.get_descendant('test_interface_type') operation = create_operation(operation_name, operation_kwargs) return models.Interface( type=the_type, operations=_dictify(operation), name=interface_name, **(interface_kwargs or {}) )
def get_standard_interface(service): the_type = service.service_template.interface_types.get_descendant('test_interface_type') ops = dict( (op_name, models.Operation( name=op_name, implementation='{0}.{1}'.format(__file__, mock_operation.__name__))) for op_name in (NORMATIVE_CREATE, NORMATIVE_CONFIGURE, NORMATIVE_START, NORMATIVE_STOP, NORMATIVE_DELETE) ) return { NORMATIVE_STANDARD_INTERFACE: models.Interface(name=NORMATIVE_STANDARD_INTERFACE, operations=ops, type=the_type) }
def get_configure_interfaces(service): the_type = service.service_template.interface_types.get_descendant('test_interface_type') operations = dict( (op_name, models.Operation( name=op_name, implementation='{0}.{1}'.format(__file__, mock_operation.__name__))) for op_name in (NORMATIVE_PRE_CONFIGURE_SOURCE, NORMATIVE_POST_CONFIGURE_SOURCE, NORMATIVE_ADD_SOURCE, NORMATIVE_REMOVE_SOURCE, NORMATIVE_PRE_CONFIGURE_TARGET, NORMATIVE_POST_CONFIGURE_TARGET, NORMATIVE_ADD_TARGET, NORMATIVE_REMOVE_TARGET) ) interface = { NORMATIVE_CONFIGURE_INTERFACE: models.Interface( name=NORMATIVE_CONFIGURE_INTERFACE, operations=operations, type=the_type) } return interface
def create_interface(service, interface_name, operation_name, operation_kwargs=None, interface_kwargs=None): the_type = service.service_template.interface_types.get_descendant( 'test_interface_type') if operation_kwargs and operation_kwargs.get('arguments'): operation_kwargs['arguments'] = dict( (argument_name, models.Argument.wrap(argument_name, argument_value)) for argument_name, argument_value in operation_kwargs['arguments'].iteritems() if argument_value is not None) operation = models.Operation(name=operation_name, **(operation_kwargs or {})) return models.Interface(type=the_type, operations=_dictify(operation), name=interface_name, **(interface_kwargs or {}))