diff --git a/category/get_net_info.py b/category/get_net_info.py index 582de89158269c6058fc51fe6c6eee70a6418f23..95dc6aa206547e4548c14a9bdd74819f2f90744b 100644 --- a/category/get_net_info.py +++ b/category/get_net_info.py @@ -11,6 +11,7 @@ if sys.getdefaultencoding() != 'utf-8': sys.setdefaultencoding('utf-8') from common.decorator_wrap import DecoratorWrap +from common.file import FileOperation from common.log import Logger from common.command import Command @@ -65,4 +66,22 @@ def __get_devices(self): if 'yes' in res.strip().lower(): self.__netdev_act[ifc] = 'ethernet' - return True \ No newline at end of file + return True + +def __get_devices_info(self): + ''' + nmcli con show + ''' + cmd_name = "nmcli con show" + res_list = [] + res = '' + + devices_command="nmcli con show" + cmd_result = Command.cmd_run(devices_command) + res_list.append(cmd_result) + + #wrap result + for i,cmd_result in enumerate(res_list): + split = '=' if i == len(res_list)-1 else '-' + res += FileOperation.wrap_output_format(cmd_name, cmd_result, split) + return Command.cmd_write_file(res, self.__default_file_name) \ No newline at end of file