Exemple #1
0
def get_standard_interface_template(service_template):
    the_type = service_template.interface_types.get_descendant('test_interface_type')

    op_templates = dict(
        (op_name, models.OperationTemplate(
            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 models.InterfaceTemplate(name=NORMATIVE_STANDARD_INTERFACE,
                                    operation_templates=op_templates,
                                    type=the_type)
Exemple #2
0
def create_interface_template(service_template, interface_name, operation_name,
                              operation_kwargs=None, interface_kwargs=None):
    the_type = service_template.interface_types.get_descendant('test_interface_type')
    operation_template = models.OperationTemplate(
        name=operation_name,
        **(operation_kwargs or {})
    )
    return models.InterfaceTemplate(
        type=the_type,
        operation_templates=_dictify(operation_template),
        name=interface_name,
        **(interface_kwargs or {})
    )