Browse Source

大大大

feature/MultiClientLog
root 1 month ago
parent
commit
cff369c5d3
  1. 6
      LTEMvcApp/Controllers/IpGroupController.cs
  2. 79
      LTEMvcApp/Models/NetworkConfiguration.cs

6
LTEMvcApp/Controllers/IpGroupController.cs

@ -117,10 +117,14 @@ namespace LTEMvcApp.Controllers
/// 添加网络配置(转发)
/// </summary>
[HttpPost("network-config")]
public async Task<ActionResult> AddNetworkConfig([FromQuery] string ip, [FromQuery] string port, [FromBody] object config)
public async Task<ActionResult> AddNetworkConfig([FromQuery] string ip, [FromQuery] string port, [FromBody] NetworkConfiguration config)
{
if (string.IsNullOrEmpty(ip) || string.IsNullOrEmpty(port))
return BadRequest("ip和port不能为空");
if (!ModelState.IsValid)
return BadRequest(ModelState);
try
{
var apiUrl = $"http://{ip}:{port}/api/v1/NetworkConfig";

79
LTEMvcApp/Models/NetworkConfiguration.cs

@ -0,0 +1,79 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace LTEMvcApp.Models
{
/// <summary>
/// 网络配置聚合根
/// </summary>
public class NetworkConfiguration
{
/// <summary>
/// 配置键值
/// </summary>
[JsonPropertyName("configKey")]
public string ConfigKey { get; set; } = string.Empty;
/// <summary>
/// RAN配置文件路径
/// </summary>
[JsonPropertyName("ragConfig")]
public string RagConfig { get; set; } = string.Empty;
/// <summary>
/// 核心网和IMS配置列表
/// </summary>
[JsonPropertyName("coreOrImsConfigs")]
public List<CoreImsConfig> CoreOrImsConfigs { get; set; } = new();
/// <summary>
/// APN配置
/// </summary>
[Required(ErrorMessage = "APN配置不能为空")]
[JsonPropertyName("apn")]
public string Apn { get; set; } = string.Empty;
/// <summary>
/// 频段配置
/// </summary>
[JsonPropertyName("band")]
public List<string> Band { get; set; } = new();
/// <summary>
/// 配置说明
/// </summary>
[JsonPropertyName("comment")]
public string Comment { get; set; } = string.Empty;
}
/// <summary>
/// 核心网和IMS配置
/// </summary>
public class CoreImsConfig
{
/// <summary>
/// 索引
/// </summary>
[JsonPropertyName("index")]
public int Index { get; set; }
/// <summary>
/// PLMN
/// </summary>
[JsonPropertyName("plmn")]
public string Plmn { get; set; } = string.Empty;
/// <summary>
/// 核心网配置
/// </summary>
[JsonPropertyName("coreNetworkConfig")]
public string CoreNetworkConfig { get; set; } = string.Empty;
/// <summary>
/// IMS配置
/// </summary>
[JsonPropertyName("imsConfig")]
public string ImsConfig { get; set; } = string.Empty;
}
}
Loading…
Cancel
Save