|
|
@ -273,16 +273,32 @@ 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>>(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < secondaryConfigs.Length; i++) |
|
|
|
{ |
|
|
|
var config = secondaryConfigs[i]; |
|
|
|
var command = string.Format(startCommand.Template, i + 2); |
|
|
|
var fullCommand = $"{command} NULL {config.CoreNetworkConfig} {config.ImsConfig}"; |
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("并发执行次要配置启动命令: {Command}", fullCommand); |
|
|
|
//_context.TokenSource
|
|
|
|
secondaryTasks.Add(_commandExecutor.ExecuteCommandAsync(fullCommand, new CancellationTokenSource())); |
|
|
@ -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); |
|
|
|
} |
|
|
|
} |