更改业务IP绑定、静态路由添加逻辑。
拓扑管理对端交换机名称处理
This commit is contained in:
+2
-2
@@ -70,7 +70,7 @@ public interface RemoteRocketMqService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
|
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
|
||||||
public R<String> innerIssueSwitchPolicy(Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<String> innerIssueSwitchPolicy(@RequestParam("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
/**
|
/**
|
||||||
* 查询策略信息
|
* 查询策略信息
|
||||||
* @param rmMonitorPolicyRemote
|
* @param rmMonitorPolicyRemote
|
||||||
@@ -95,7 +95,7 @@ public interface RemoteRocketMqService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
|
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
|
||||||
public R<Integer> issueDefaultPolicyByClientId(String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<Integer> issueDefaultPolicyByClientId(@RequestParam("clientId") String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
@PostMapping("policy/addDeployScript")
|
@PostMapping("policy/addDeployScript")
|
||||||
R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -92,4 +92,6 @@ public class RmEpsTopologyManagement extends BaseEntity
|
|||||||
* 服务器clientId
|
* 服务器clientId
|
||||||
*/
|
*/
|
||||||
private String serverClientId;
|
private String serverClientId;
|
||||||
|
/** 对端交换机名称 */
|
||||||
|
private String peerName;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -41,7 +41,8 @@ public class RmEpsTopologyManagementServiceImpl implements IRmEpsTopologyManagem
|
|||||||
@Override
|
@Override
|
||||||
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement)
|
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement)
|
||||||
{
|
{
|
||||||
return rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
|
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+20
-6
@@ -961,8 +961,11 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
|||||||
// 1. 处理IP绑定和记录
|
// 1. 处理IP绑定和记录
|
||||||
rmResourceRegistration.getBindNetworkMsg().forEach(map -> {
|
rmResourceRegistration.getBindNetworkMsg().forEach(map -> {
|
||||||
// 绑定IP
|
// 绑定IP
|
||||||
|
if (map.get("id") == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
RmNetworkInterfaceRemote network = new RmNetworkInterfaceRemote();
|
RmNetworkInterfaceRemote network = new RmNetworkInterfaceRemote();
|
||||||
network.setId((Long) map.get("id"));
|
network.setId(Long.parseLong(map.get("id").toString()));
|
||||||
network.setBindIp(map.get("status").toString());
|
network.setBindIp(map.get("status").toString());
|
||||||
remoteRocketMqService.bindPublicIp(network, SecurityConstants.INNER);
|
remoteRocketMqService.bindPublicIp(network, SecurityConstants.INNER);
|
||||||
|
|
||||||
@@ -998,6 +1001,13 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
|||||||
.filter(ni -> "1".equals(ni.getBindIp()) || "3".equals(ni.getBindIp()))
|
.filter(ni -> "1".equals(ni.getBindIp()) || "3".equals(ni.getBindIp()))
|
||||||
.collect(Collectors.toList()))
|
.collect(Collectors.toList()))
|
||||||
.orElse(Collections.emptyList());
|
.orElse(Collections.emptyList());
|
||||||
|
// 管理网信息
|
||||||
|
List<RmNetworkInterfaceRemote> mtmNetworks = Optional.ofNullable(netList)
|
||||||
|
.map(R::getData)
|
||||||
|
.map(list -> list.stream()
|
||||||
|
.filter(ni -> "2".equals(ni.getBindIp()) || "3".equals(ni.getBindIp()))
|
||||||
|
.collect(Collectors.toList()))
|
||||||
|
.orElse(Collections.emptyList());
|
||||||
|
|
||||||
// 如果有符合条件的网络接口
|
// 如果有符合条件的网络接口
|
||||||
if (!filteredNetworks.isEmpty()) {
|
if (!filteredNetworks.isEmpty()) {
|
||||||
@@ -1014,10 +1024,6 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
|||||||
String netName = netNameBuilder.toString();
|
String netName = netNameBuilder.toString();
|
||||||
|
|
||||||
// 发送注册响应
|
// 发送注册响应
|
||||||
RouteMsg routeMsg = new RouteMsg();
|
|
||||||
routeMsg.setName(filteredNetworks.get(0).getInterfaceName()); // 使用拼接后的网络接口名称
|
|
||||||
routeMsg.setGateway(filteredNetworks.get(0).getGateway()); // 使用第一个网络接口的网关,或者您可以根据需要调整
|
|
||||||
|
|
||||||
MessageVo messageVo = new MessageVo();
|
MessageVo messageVo = new MessageVo();
|
||||||
messageVo.setClientId(clientId);
|
messageVo.setClientId(clientId);
|
||||||
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
||||||
@@ -1025,7 +1031,15 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
|||||||
RspVo rspVo = new RspVo();
|
RspVo rspVo = new RspVo();
|
||||||
rspVo.setResCode(1);
|
rspVo.setResCode(1);
|
||||||
rspVo.setResMag("注册成功");
|
rspVo.setResMag("注册成功");
|
||||||
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
if(mtmNetworks != null && !mtmNetworks.isEmpty()){
|
||||||
|
RouteMsg routeMsg = new RouteMsg();
|
||||||
|
String gateWay = mtmNetworks.get(0).getGateway();
|
||||||
|
routeMsg.setName(mtmNetworks.get(0).getInterfaceName()); // 使用拼接后的网络接口名称
|
||||||
|
routeMsg.setGateway(gateWay); // 使用第一个网络接口的网关,或者您可以根据需要调整
|
||||||
|
if(gateWay != null){
|
||||||
|
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
||||||
|
}
|
||||||
|
}
|
||||||
rspVo.setNetName(netName);
|
rspVo.setNetName(netName);
|
||||||
|
|
||||||
messageVo.setData(JSONObject.toJSONString(rspVo));
|
messageVo.setData(JSONObject.toJSONString(rspVo));
|
||||||
|
|||||||
+23
-1
@@ -24,10 +24,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="peerSwitchName" column="peer_switch_name" />
|
<result property="peerSwitchName" column="peer_switch_name" />
|
||||||
<result property="peerSwitchInterface" column="peer_switch_interface" />
|
<result property="peerSwitchInterface" column="peer_switch_interface" />
|
||||||
<result property="serverClientId" column="server_client_id" />
|
<result property="serverClientId" column="server_client_id" />
|
||||||
|
<result property="peerName" column="peerName" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectRmEpsTopologyManagementVo">
|
<sql id="selectRmEpsTopologyManagementVo">
|
||||||
select id, switch_name, client_id, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name, switch_ip_address, peer_switch_name, peer_switch_interface, server_client_id from rm_eps_topology_management
|
SELECT
|
||||||
|
id,
|
||||||
|
switch_name,
|
||||||
|
client_id,
|
||||||
|
switch_sn,
|
||||||
|
interface_name,
|
||||||
|
connected_device_type,
|
||||||
|
server_name,
|
||||||
|
server_sn,
|
||||||
|
server_port,
|
||||||
|
create_time,
|
||||||
|
update_time,
|
||||||
|
creator_id,
|
||||||
|
creator_name,
|
||||||
|
updater_id,
|
||||||
|
updater_name,
|
||||||
|
switch_ip_address,
|
||||||
|
peer_switch_name,
|
||||||
|
(SELECT switch_name FROM rm_switch_management WHERE client_id = rm_eps_topology_management.peer_switch_name) AS peerName,
|
||||||
|
peer_switch_interface,
|
||||||
|
server_client_id
|
||||||
|
FROM rm_eps_topology_management
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
|
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
|
||||||
|
|||||||
Reference in New Issue
Block a user