Пример #1
0
class SystemKV(DispatchKV, TestKVSetupMixin):
    kv_class = 'keyvalue'
    dtype = 'SYS_kv'
    dgroup = 'kv'
    create_args = [
        key_argument('key'),
        value_argument('value'),
        create_pk_argument('obj_pk', dtype)
    ]

    update_args = [
        key_argument('key'),
        value_argument('value'),
        update_pk_argument('kv_pk', dtype)
    ]

    delete_args = [delete_pk_argument('kv_pk', dtype)]

    detail_args = [detail_pk_argument('kv_pk', dtype)]

    kvlist_args = [kvlist_pk_argument('obj_pk', dtype)]

    def do_test_setup(self, test_case):
        command = [EXEC, DispatchSystem.dtype, 'create']
        for add_arg, extract_arg, tm in DispatchSystem.create_args:
            command.append(test_method_to_params(tm()))
        command_str = ' '.join(command)
        ret, errors, rc = call_to_json(command_str)
        if errors:
            test_case.fail(errors)
        return ret['pk']
Пример #2
0
class StaticRegKV(DispatchKV, TestKVSetupMixin):
    kv_class = 'staticregkeyvalue'
    dtype = 'SREG_kv'
    dgroup = 'kv'
    create_args = [
        key_argument('key'),
        value_argument('value'),
        create_pk_argument('obj_pk', dtype)
    ]

    update_args = [
        key_argument('key'),
        value_argument('value'),
        update_pk_argument('kv_pk', dtype)
    ]

    delete_args = [
        delete_pk_argument('kv_pk', dtype)
    ]

    detail_args = [detail_pk_argument('kv_pk', dtype)]

    kvlist_args = [kvlist_pk_argument('obj_pk', dtype)]

    def do_test_setup(self, test_case):
        return self.do_setup(DispatchSREG, test_case)
Пример #3
0
class VlanKV(DispatchKV, TestKVSetupMixin):
    kv_class = 'vlankeyvalue'
    dtype = 'VLAN_kv'
    dgroup = 'kv'

    create_args = [
        key_argument('key'),
        value_argument('value'),
        create_pk_argument('obj_pk', dtype)
    ]

    update_args = [
        key_argument('key'),
        value_argument('value'),
        update_pk_argument('kv_pk', dtype)
    ]

    delete_args = [delete_pk_argument('kv_pk', dtype)]

    detail_args = [detail_pk_argument('kv_pk', dtype)]

    kvlist_args = [kvlist_pk_argument('obj_pk', dtype)]

    def do_test_setup(self, test_case):
        return self.do_setup(DispatchVlan, test_case)
Пример #4
0
class HWAdapterKV(DispatchKV, TestKVSetupMixin):
    kv_class = 'hwadapterkeyvalue'
    dtype = 'HW_kv'
    dgroup = 'kv'
    create_args = [
        key_argument('key'),
        value_argument('value'),
        create_pk_argument('obj_pk', dtype)
    ]
    update_args = [
        key_argument('key'),
        value_argument('value'),
        update_pk_argument('kv_pk', dtype)
    ]

    delete_args = [
        delete_pk_argument('kv_pk', dtype)
    ]

    detail_args = [detail_pk_argument('kv_pk', dtype)]

    kvlist_args = [kvlist_pk_argument('obj_pk', dtype)]

    def do_test_setup(self, test_case):
        sreg_pk = self.do_setup(DispatchSREG, test_case)

        # Create a HW
        command = [EXEC, DispatchHW.dtype, 'create']
        for add_arg, extract_arg, test_method in DispatchHW.create_args:
            command.append(test_method_to_params(test_method()))
        command_str = ' '.join(command)
        # lol, we are jinja2. evaluate our placeholder
        command_str = command_str.replace('{{ sreg_pk }}', str(sreg_pk))
        hw_ret, hw_errors, hw_rc = call_to_json(command_str)

        if hw_errors:
            test_case.fail(hw_errors)
        return hw_ret['pk']