|
|
@ -273,6 +273,22 @@ public class NetworkInterfaceManager : INetworkInterfaceManager |
|
|
|
|
|
|
|
private async Task<NetworkInterfaceOperationResult> ExecuteMultiConfigStartCommandsAsync(CommandTemplateConfig startCommand, NetworkConfiguration networkConfig) |
|
|
|
{ |
|
|
|
// 执行主配置命令
|
|
|
|
var primaryConfig = networkConfig.CoreOrImsConfigs.FirstOrDefault(s => s.Index == 1); |
|
|
|
if (primaryConfig != null) |
|
|
|
{ |
|
|
|
var primaryCommand = string.Format(startCommand.Template, 1); |
|
|
|
var fullCommand = $"{primaryCommand} {networkConfig.RagConfig} {primaryConfig.CoreNetworkConfig} {primaryConfig.ImsConfig}"; |
|
|
|
|
|
|
|
_logger.LogInformation("执行主配置启动命令: {Command}", fullCommand); |
|
|
|
//_context.TokenSource
|
|
|
|
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource()); |
|
|
|
if (!result.IsSuccess) |
|
|
|
{ |
|
|
|
return NetworkInterfaceOperationResult.Failure($"主配置命令执行失败: {result.Error}", NetworkConfigType.BothRagAndCore); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 添加次要配置命令
|
|
|
|
var secondaryConfigs = networkConfig.CoreOrImsConfigs.Where(s => s.Index != 1).ToArray(); |
|
|
|
var secondaryTasks = new List<Task<CommandExecutionResult>>(); |
|
|
@ -295,22 +311,6 @@ public class NetworkInterfaceManager : INetworkInterfaceManager |
|
|
|
return NetworkInterfaceOperationResult.Failure("部分次要配置命令执行失败", NetworkConfigType.BothRagAndCore); |
|
|
|
} |
|
|
|
|
|
|
|
// 执行主配置命令
|
|
|
|
var primaryConfig = networkConfig.CoreOrImsConfigs.FirstOrDefault(s => s.Index == 1); |
|
|
|
if (primaryConfig != null) |
|
|
|
{ |
|
|
|
var primaryCommand = string.Format(startCommand.Template, 1); |
|
|
|
var fullCommand = $"{primaryCommand} {networkConfig.RagConfig} {primaryConfig.CoreNetworkConfig} {primaryConfig.ImsConfig}"; |
|
|
|
|
|
|
|
_logger.LogInformation("执行主配置启动命令: {Command}", fullCommand); |
|
|
|
//_context.TokenSource
|
|
|
|
var result = await _commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource()); |
|
|
|
if (!result.IsSuccess) |
|
|
|
{ |
|
|
|
return NetworkInterfaceOperationResult.Failure($"主配置命令执行失败: {result.Error}", NetworkConfigType.BothRagAndCore); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return NetworkInterfaceOperationResult.Success(NetworkConfigType.BothRagAndCore); |
|
|
|
} |
|
|
|
} |