bug 8816: 1) return linkLocal instead of private ip/netmask/mac in listRouters 2) return linkLocal/private ip/netmask/mac in listSystemVms response

This commit is contained in:
alena 2011-03-09 16:46:41 -08:00
parent eaf9414a52
commit b6ae35728e
5 changed files with 95 additions and 51 deletions

View File

@ -205,5 +205,12 @@ public class ApiConstants {
public static final String LINMIN_PASSWORD = "linminpassword";
public static final String LINMIN_APID = "linminapid";
public static final String DHCP_SERVER_TYPE = "dhcpservertype";
public static final String LINK_LOCAL_IP = "linklocalip";
public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress";
public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask";
public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid";
public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress";
public static final String PRIVATE_NETMASK = "privatenetmask";
public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
}

View File

@ -27,7 +27,6 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.DomainRouterResponse;
import com.cloud.api.response.ListResponse;
import com.cloud.async.AsyncJob;

View File

@ -58,17 +58,17 @@ public class DomainRouterResponse extends BaseResponse {
@SerializedName("hostname") @Param(description="the hostname for the router")
private String hostName;
@SerializedName(ApiConstants.PRIVATE_IP) @Param(description="the private IP address for the router")
private String privateIp;
@SerializedName(ApiConstants.LINK_LOCAL_IP) @Param(description="the link local IP address for the router")
private String linkLocalIp;
@SerializedName("privatemacaddress") @Param(description="the private MAC address for the router")
private String privateMacAddress;
@SerializedName(ApiConstants.LINK_LOCAL_MAC_ADDRESS) @Param(description="the link local MAC address for the router")
private String linkLocalMacAddress;
@SerializedName("privatenetmask") @Param(description="the private netmask for the router")
private String privateNetmask;
@SerializedName(ApiConstants.LINK_LOCAL_MAC_NETMASK) @Param(description="the link local netmask for the router")
private String linkLocalNetmask;
@SerializedName("privatenetworkid") @Param(description="the ID of the corresponding private network")
private Long privateNetworkId;
@SerializedName(ApiConstants.LINK_LOCAL_NETWORK_ID) @Param(description="the ID of the corresponding link local network")
private Long linkLocalNetworkId;
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public IP address for the router")
private String publicIp;
@ -209,30 +209,6 @@ public class DomainRouterResponse extends BaseResponse {
this.hostName = hostName;
}
public String getPrivateIp() {
return privateIp;
}
public void setPrivateIp(String privateIp) {
this.privateIp = privateIp;
}
public String getPrivateMacAddress() {
return privateMacAddress;
}
public void setPrivateMacAddress(String privateMacAddress) {
this.privateMacAddress = privateMacAddress;
}
public String getPrivateNetmask() {
return privateNetmask;
}
public void setPrivateNetmask(String privateNetmask) {
this.privateNetmask = privateNetmask;
}
public String getPublicIp() {
return publicIp;
}
@ -328,15 +304,7 @@ public class DomainRouterResponse extends BaseResponse {
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public Long getPrivateNetworkId() {
return privateNetworkId;
}
public void setPrivateNetworkId(Long privateNetworkId) {
this.privateNetworkId = privateNetworkId;
}
public Long getPublicNetworkId() {
return publicNetworkId;
}
@ -352,4 +320,37 @@ public class DomainRouterResponse extends BaseResponse {
public void setGuestNetworkId(Long guestNetworkId) {
this.guestNetworkId = guestNetworkId;
}
public String getLinkLocalIp() {
return linkLocalIp;
}
public void setLinkLocalIp(String linkLocalIp) {
this.linkLocalIp = linkLocalIp;
}
public String getLinkLocalMacAddress() {
return linkLocalMacAddress;
}
public void setLinkLocalMacAddress(String linkLocalMacAddress) {
this.linkLocalMacAddress = linkLocalMacAddress;
}
public String getLinkLocalNetmask() {
return linkLocalNetmask;
}
public void setLinkLocalNetmask(String linkLocalNetmask) {
this.linkLocalNetmask = linkLocalNetmask;
}
public Long getLinkLocalNetworkId() {
return linkLocalNetworkId;
}
public void setLinkLocalNetworkId(Long linkLocalNetworkId) {
this.linkLocalNetworkId = linkLocalNetworkId;
}
}

View File

@ -19,6 +19,7 @@ package com.cloud.api.response;
import java.util.Date;
import com.cloud.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@ -65,14 +66,23 @@ public class SystemVmResponse extends BaseResponse {
@SerializedName("hostname") @Param(description="the hostname for the system VM")
private String hostName;
@SerializedName("privateip") @Param(description="the private IP address for the system VM")
@SerializedName(ApiConstants.PRIVATE_IP) @Param(description="the private IP address for the system VM")
private String privateIp;
@SerializedName("privatemacaddress") @Param(description="the private MAC address for the system VM")
@SerializedName(ApiConstants.PRIVATE_MAC_ADDRESS) @Param(description="the private MAC address for the system VM")
private String privateMacAddress;
@SerializedName("privatenetmask") @Param(description="the private netmask for the system VM")
@SerializedName(ApiConstants.PRIVATE_NETMASK) @Param(description="the private netmask for the system VM")
private String privateNetmask;
@SerializedName(ApiConstants.LINK_LOCAL_IP) @Param(description="the link local IP address for the system vm")
private String linkLocalIp;
@SerializedName(ApiConstants.LINK_LOCAL_MAC_ADDRESS) @Param(description="the link local MAC address for the system vm")
private String linkLocalMacAddress;
@SerializedName(ApiConstants.LINK_LOCAL_MAC_NETMASK) @Param(description="the link local netmask for the system vm")
private String linkLocalNetmask;
@SerializedName("publicip") @Param(description="the public IP address for the system VM")
private String publicIp;
@ -290,4 +300,28 @@ public class SystemVmResponse extends BaseResponse {
public void setActiveViewerSessions(Integer activeViewerSessions) {
this.activeViewerSessions = activeViewerSessions;
}
public String getLinkLocalIp() {
return linkLocalIp;
}
public void setLinkLocalIp(String linkLocalIp) {
this.linkLocalIp = linkLocalIp;
}
public String getLinkLocalMacAddress() {
return linkLocalMacAddress;
}
public void setLinkLocalMacAddress(String linkLocalMacAddress) {
this.linkLocalMacAddress = linkLocalMacAddress;
}
public String getLinkLocalNetmask() {
return linkLocalNetmask;
}
public void setLinkLocalNetmask(String linkLocalNetmask) {
this.linkLocalNetmask = linkLocalNetmask;
}
}

View File

@ -123,7 +123,6 @@ import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOSCategoryVO;
import com.cloud.storage.Snapshot;
import com.cloud.storage.Snapshot.Type;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.Storage.TemplateType;
@ -1181,10 +1180,10 @@ public class ApiResponseHelper implements ResponseGenerator {
routerResponse.setGateway(singleNicProfile.getGateway());
routerResponse.setPublicNetworkId(singleNicProfile.getNetworkId());
} else if (network.getTrafficType() == TrafficType.Control) {
routerResponse.setPrivateIp(singleNicProfile.getIp4Address());
routerResponse.setPrivateMacAddress(singleNicProfile.getMacAddress());
routerResponse.setPrivateNetmask(singleNicProfile.getNetmask());
routerResponse.setPrivateNetworkId(singleNicProfile.getNetworkId());
routerResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
routerResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
routerResponse.setLinkLocalMacAddress(singleNicProfile.getNetmask());
routerResponse.setLinkLocalNetworkId(singleNicProfile.getNetworkId());
} else if (network.getTrafficType() == TrafficType.Guest) {
routerResponse.setGuestIpAddress(singleNicProfile.getIp4Address());
routerResponse.setGuestMacAddress(singleNicProfile.getMacAddress());
@ -1265,10 +1264,14 @@ public class ApiResponseHelper implements ResponseGenerator {
vmResponse.setPublicIp(singleNicProfile.getIp4Address());
vmResponse.setPublicMacAddress(singleNicProfile.getMacAddress());
vmResponse.setPublicNetmask(singleNicProfile.getNetmask());
} else if (network.getTrafficType() == TrafficType.Control) {
} else if (network.getTrafficType() == TrafficType.Management) {
vmResponse.setPrivateIp(singleNicProfile.getIp4Address());
vmResponse.setPrivateMacAddress(singleNicProfile.getMacAddress());
vmResponse.setPrivateNetmask(singleNicProfile.getNetmask());
} else if (network.getTrafficType() == TrafficType.Control) {
vmResponse.setLinkLocalIp(singleNicProfile.getIp4Address());
vmResponse.setLinkLocalMacAddress(singleNicProfile.getMacAddress());
vmResponse.setLinkLocalNetmask(singleNicProfile.getNetmask());
}
}
}