From e31cd2b3d20fcd6f7e42bb44fe38f714aae04003 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Wed, 6 Mar 2013 10:11:28 -0800 Subject: [PATCH] CLOUDSTACK-1402: listRouters API response doesn't return linklocal IP and public IP details. --- .../query/dao/DomainRouterJoinDaoImpl.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java index cdb859e8eb8..488c4e494e1 100644 --- a/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java @@ -170,6 +170,29 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase 0) { + TrafficType ty = vr.getTrafficType(); + if (ty != null) { + // legacy code, public/control/guest nic info is kept in + // nics response object + if (ty == TrafficType.Public) { + vrData.setPublicIp(vr.getIpAddress()); + vrData.setPublicMacAddress(vr.getMacAddress()); + vrData.setPublicNetmask(vr.getNetmask()); + vrData.setGateway(vr.getGateway()); + vrData.setPublicNetworkId(vr.getNetworkUuid()); + } else if (ty == TrafficType.Control) { + vrData.setLinkLocalIp(vr.getIpAddress()); + vrData.setLinkLocalMacAddress(vr.getMacAddress()); + vrData.setLinkLocalNetmask(vr.getNetmask()); + vrData.setLinkLocalNetworkId(vr.getNetworkUuid()); + } else if (ty == TrafficType.Guest) { + vrData.setGuestIpAddress(vr.getIpAddress()); + vrData.setGuestMacAddress(vr.getMacAddress()); + vrData.setGuestNetmask(vr.getNetmask()); + vrData.setGuestNetworkId(vr.getNetworkUuid()); + vrData.setNetworkDomain(vr.getNetworkDomain()); + } + } NicResponse nicResponse = new NicResponse(); nicResponse.setId(vr.getNicUuid()); nicResponse.setIpaddress(vr.getIpAddress());