Exemplo n.º 1
0
    def set_search_list(cls):
        try:
            for cmd in cls.command_list:
                cls.cli_search_list.append(cmd)
                cls.cli_validate_list.append(cmd)

                if (CONFIG.get_config_instance().has_section(cmd)):
                    opt_list = CONFIG.cli_get_value(cmd, CONFIG.get_cmd_opt_key_name())
                    tmp = []
                    for opt in opt_list.split(','):
                        tmp.append(opt.strip())
                        cls.cli_validate_list.append(cmd + ' ' + opt.strip())
                    cls.cli_search_list_sub[cmd] = tmp

            cls.cli_search_list.append('menu')
            cls.cli_search_list.append('quit')
            cls.cli_search_list.append('exit')
            cls.cli_search_list.append('sys')
            cls.cli_search_list.append('dis-system')
            cls.cli_search_list.append('help')

            tmp_sys = []
            tmp_sys.append('all')
            cls.cli_validate_list.append('sys all')
            for onos_name in SYS.get_sys_list():
                tmp_sys.append(onos_name)
                cls.cli_validate_list.append('sys ' + onos_name)
            cls.cli_search_list_sub['sys'] = tmp_sys
        except:
            LOG.exception_err_write()
Exemplo n.º 2
0
    def set_search_list(cls):
        try:
            for cmd in cls.command_list:
                cls.cli_search_list.append(cmd)
                cls.cli_validate_list.append(cmd)

                if (CONFIG.get_config_instance().has_section(cmd)):
                    opt_list = CONFIG.cli_get_value(
                        cmd, CONFIG.get_cmd_opt_key_name())
                    tmp = []
                    for opt in opt_list.split(','):
                        tmp.append(opt.strip())
                        cls.cli_validate_list.append(cmd + ' ' + opt.strip())
                    cls.cli_search_list_sub[cmd] = tmp

            cls.cli_search_list.append('menu')
            cls.cli_search_list.append('exit')
            cls.cli_search_list.append('sys')
            cls.cli_search_list.append('onos-shell')
            cls.cli_search_list.append('os-shell')
            cls.cli_search_list.append('monitoring-details')
            cls.cli_search_list.append('event-history')
            cls.cli_search_list.append('flow-trace')
            cls.cli_search_list.append('traffic-test')
            cls.cli_search_list.append('help')

            onos_list = []
            shell_list = []
            tmp_sys = []
            tmp_sys.append('all')
            cls.cli_validate_list.append('sys all')
            for sys_name in SYS.get_sys_list():
                tmp_sys.append(sys_name)
                cls.cli_validate_list.append('sys ' + sys_name)
                cls.cli_validate_list.append('os-shell ' + sys_name)

                if dict(SYS.sys_list[sys_name])['TYPE'] == 'ONOS':
                    onos_list.append(sys_name)

                shell_list.append(sys_name)

            cls.cli_search_list_sub['sys'] = tmp_sys
            cls.cli_search_list_sub['onos-shell'] = onos_list
            cls.cli_search_list_sub['os-shell'] = shell_list
        except:
            LOG.exception_err_write()