diff --git a/LTEMvcApp/Controllers/IpGroupController.cs b/LTEMvcApp/Controllers/IpGroupController.cs index e4cd03a..b4c25aa 100644 --- a/LTEMvcApp/Controllers/IpGroupController.cs +++ b/LTEMvcApp/Controllers/IpGroupController.cs @@ -117,10 +117,14 @@ namespace LTEMvcApp.Controllers /// 添加网络配置(转发) /// [HttpPost("network-config")] - public async Task AddNetworkConfig([FromQuery] string ip, [FromQuery] string port, [FromBody] object config) + public async Task 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"; diff --git a/LTEMvcApp/Models/NetworkConfiguration.cs b/LTEMvcApp/Models/NetworkConfiguration.cs new file mode 100644 index 0000000..8a9b531 --- /dev/null +++ b/LTEMvcApp/Models/NetworkConfiguration.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; + +namespace LTEMvcApp.Models +{ + /// + /// 网络配置聚合根 + /// + public class NetworkConfiguration + { + /// + /// 配置键值 + /// + [JsonPropertyName("configKey")] + public string ConfigKey { get; set; } = string.Empty; + + /// + /// RAN配置文件路径 + /// + [JsonPropertyName("ragConfig")] + public string RagConfig { get; set; } = string.Empty; + + /// + /// 核心网和IMS配置列表 + /// + [JsonPropertyName("coreOrImsConfigs")] + public List CoreOrImsConfigs { get; set; } = new(); + + /// + /// APN配置 + /// + [Required(ErrorMessage = "APN配置不能为空")] + [JsonPropertyName("apn")] + public string Apn { get; set; } = string.Empty; + + /// + /// 频段配置 + /// + [JsonPropertyName("band")] + public List Band { get; set; } = new(); + + /// + /// 配置说明 + /// + [JsonPropertyName("comment")] + public string Comment { get; set; } = string.Empty; + } + + /// + /// 核心网和IMS配置 + /// + public class CoreImsConfig + { + /// + /// 索引 + /// + [JsonPropertyName("index")] + public int Index { get; set; } + + /// + /// PLMN + /// + [JsonPropertyName("plmn")] + public string Plmn { get; set; } = string.Empty; + + /// + /// 核心网配置 + /// + [JsonPropertyName("coreNetworkConfig")] + public string CoreNetworkConfig { get; set; } = string.Empty; + + /// + /// IMS配置 + /// + [JsonPropertyName("imsConfig")] + public string ImsConfig { get; set; } = string.Empty; + } +} \ No newline at end of file