CLOUDSTACK-1402: listRouters API response doesn't return linklocal IP and public IP details.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e31cd2b3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e31cd2b3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e31cd2b3 Branch: refs/heads/gslb-wip Commit: e31cd2b3d20fcd6f7e42bb44fe38f714aae04003 Parents: aa40c7e Author: Min Chen <min.c...@citrix.com> Authored: Wed Mar 6 10:11:28 2013 -0800 Committer: Min Chen <min.c...@citrix.com> Committed: Wed Mar 6 11:31:52 2013 -0800 ---------------------------------------------------------------------- .../api/query/dao/DomainRouterJoinDaoImpl.java | 23 +++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e31cd2b3/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DomainRouterJoinDaoImpl.java index cdb859e..488c4e4 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<DomainRouterJoinVO, public DomainRouterResponse setDomainRouterResponse(DomainRouterResponse vrData, DomainRouterJoinVO vr) { long nic_id = vr.getNicId(); if (nic_id > 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());