diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index 09bbe0eec8a..45a904e426c 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -407,6 +407,7 @@ public class EventTypes { public static final String EVENT_GUEST_VLAN_RANGE_DEDICATE = "GUESTVLANRANGE.DEDICATE"; public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE"; + static { // TODO: need a way to force author adding event types to declare the entity details as well, with out braking diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index 89bc1cf5708..562a7feb96f 100755 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -427,8 +427,11 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L prodVersion = prodVersion.trim(); } - if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6"))) - return new XcpServerResource(); + if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) { + return new XcpServerResource("1.1"); + } else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) { + return new XcpServerResource("1.6"); + } if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) return new XenServer56Resource(); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java index 5bcec13acb5..34b8f2981e2 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java @@ -28,6 +28,7 @@ import org.apache.log4j.Logger; public class CitrixHelper { private static final Logger s_logger = Logger.getLogger(CitrixHelper.class); private static final HashMap _xcp100GuestOsMap = new HashMap(70); + private static final HashMap _xcp160GuestOsMap = new HashMap(70); private static final HashMap _xenServerGuestOsMap = new HashMap(70); private static final HashMap _xenServer56FP1GuestOsMap = new HashMap(70); private static final HashMap _xenServer56FP2GuestOsMap = new HashMap(70); @@ -114,6 +115,83 @@ public class CitrixHelper { _xcp100GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)"); } + static { + _xcp160GuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("CentOS 5.5 (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("CentOS 5.5 (64-bit)", "CentOS 5 (64-bit)"); + _xcp160GuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)"); + _xcp160GuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)"); + _xcp160GuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)"); + _xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", "SUSE Linux Enterprise Server 11 SP1 (32-bit)"); + _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", "SUSE Linux Enterprise Server 11 SP1 (64-bit)"); + _xcp160GuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)"); + _xcp160GuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)"); + _xcp160GuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003 (32-bit)"); + _xcp160GuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 (64-bit)"); + _xcp160GuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)"); + _xcp160GuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)"); + _xcp160GuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)"); + _xcp160GuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)"); + _xcp160GuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)"); + _xcp160GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)"); + _xcp160GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)"); + _xcp160GuestOsMap.put("Other Linux (32-bit)", "Other install media"); + _xcp160GuestOsMap.put("Other Linux (64-bit)", "Other install media"); + _xcp160GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)"); + _xcp160GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)"); + } + static { _xenServerGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)"); @@ -694,6 +772,15 @@ public class CitrixHelper { return guestOS; } + public static String getXcp160GuestOsType(String stdType) { + String guestOS = _xcp160GuestOsMap.get(stdType); + if (guestOS == null) { + s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest"); + guestOS = "Other install media"; + } + return guestOS; + } + public static String getXenServerGuestOsType(String stdType, boolean bootFromCD) { String guestOS = _xenServerGuestOsMap.get(stdType); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java index 7a958708e76..6baf6a09e3f 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java @@ -39,9 +39,10 @@ import com.xensource.xenapi.Types.XenAPIException; @Local(value=ServerResource.class) public class XcpServerResource extends CitrixResourceBase { private final static Logger s_logger = Logger.getLogger(XcpServerResource.class); - - public XcpServerResource() { + private String version; + public XcpServerResource(String version) { super(); + this.version = version; } @Override @@ -55,7 +56,11 @@ public class XcpServerResource extends CitrixResourceBase { @Override protected String getGuestOsType(String stdType, boolean bootFromCD) { - return CitrixHelper.getXcpGuestOsType(stdType); + if (version.equalsIgnoreCase("1.6")) { + return CitrixHelper.getXcp160GuestOsType(stdType); + } else { + return CitrixHelper.getXcpGuestOsType(stdType); + } } @Override diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java index 443bb40f57f..470c4e88217 100644 --- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java +++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java @@ -434,16 +434,14 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro @Override public boolean isReady(PhysicalNetworkServiceProvider provider) { - // TODO Auto-generated method stub - return false; + return true; } @Override public boolean shutdownProviderInstances( PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { - // TODO Auto-generated method stub - return false; + return true; } @Override diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java old mode 100644 new mode 100755 index 8d21a55a65e..9ba1c836a98 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java @@ -95,7 +95,7 @@ public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd { @Override public String getEventType() { - return EventTypes.EVENT_EXTERNAL_LB_DEVICE_DELETE; + return EventTypes.EVENT_EXTERNAL_NVP_CONTROLLER_DELETE; } @Override diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 67d228655b3..fce1f719086 100755 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -129,6 +129,8 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.dao.AccountGuestVlanMapDao; +import com.cloud.network.dao.AccountGuestVlanMapVO; import com.cloud.network.IpAddress; import com.cloud.network.Network; import com.cloud.network.Network.Capability; diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 682b5a626c7..a8f572f828f 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -2014,23 +2014,28 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L if (_networksDao.countByZoneAndUri(zoneId, uri) > 0) { throw new InvalidParameterValueException("Network with vlan " + vlanId + " already exists in zone " + zoneId); } else { - DataCenterVnetVO dcVnet = _datacenterVnetDao.findVnet(zoneId, vlanId.toString()).get(0); - // Fail network creation if specified vlan is dedicated to a different account - if (dcVnet.getAccountGuestVlanMapId() != null) { - Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId(); - AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId); - if (map.getAccountId() != owner.getAccountId()) { - throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account"); - } - // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool - } else { - List maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId()); - if (maps != null && !maps.isEmpty()) { - int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId()); - int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId()); - if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) { - throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" + - " to the vlan range dedicated to the owner "+ owner.getAccountName()); + List dcVnets = _datacenterVnetDao.findVnet(zoneId, vlanId.toString()); + //for the network that is created as part of private gateway, + //the vnet is not coming from the data center vnet table, so the list can be empty + if (!dcVnets.isEmpty()) { + DataCenterVnetVO dcVnet = dcVnets.get(0); + // Fail network creation if specified vlan is dedicated to a different account + if (dcVnet.getAccountGuestVlanMapId() != null) { + Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId(); + AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId); + if (map.getAccountId() != owner.getAccountId()) { + throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account"); + } + // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool + } else { + List maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId()); + if (maps != null && !maps.isEmpty()) { + int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId()); + int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId()); + if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) { + throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" + + " to the vlan range dedicated to the owner "+ owner.getAccountName()); + } } } } diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java index f1d62852b13..135fd290535 100755 --- a/server/src/com/cloud/network/NetworkModelImpl.java +++ b/server/src/com/cloud/network/NetworkModelImpl.java @@ -2066,6 +2066,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { return null; } + @Override public IpAddress getPublicIpAddress(String ipAddress, long zoneId) { List networks = _networksDao.listByZoneAndTrafficType(zoneId, TrafficType.Public); @@ -2080,6 +2081,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { public Map getNtwkOffDetails(long offId) { return _ntwkOffDetailsDao.getNtwkOffDetails(offId); } + @Override public Networks.IsolationType[] listNetworkIsolationMethods() { diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index ace7b8ac474..a02eec1a3cc 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -198,6 +198,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; + /** * NetworkServiceImpl implements NetworkService. */ @@ -2185,6 +2186,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { return allPossibleIps; } + protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId) { NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId); NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 3d7ad2e9de2..86c1a640da9 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -2877,6 +2877,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe cmdList.add(StartInternalLBVMCmd.class); cmdList.add(ListInternalLBVMsCmd.class); cmdList.add(ListNetworkIsolationMethodsCmd.class); + cmdList.add(ListNetworkIsolationMethodsCmd.class); + return cmdList; } diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java index b5305666788..84ae818f489 100644 --- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java @@ -62,6 +62,7 @@ import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.network.PublicIpAddress; import com.cloud.network.addr.PublicIp; +import com.cloud.network.dao.AccountGuestVlanMapVO; import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.NetworkServiceMapDao; import com.cloud.network.dao.NetworkVO; @@ -91,6 +92,16 @@ import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.Type; import com.cloud.vm.VirtualMachineProfile; +import org.apache.cloudstack.acl.ControlledEntity.ACLType; +import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd; +import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd; +import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd; +import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd; +import org.apache.cloudstack.api.command.user.network.ListNetworksCmd; +import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; +import org.apache.cloudstack.api.command.user.vm.ListNicsCmd; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; @Component diff --git a/services/console-proxy/server/css/ajaxviewer.css b/services/console-proxy/server/css/ajaxviewer.css index 5ea552b176f..fd2fb3c44e9 100644 --- a/services/console-proxy/server/css/ajaxviewer.css +++ b/services/console-proxy/server/css/ajaxviewer.css @@ -91,12 +91,12 @@ body { position: absolute; top:32; width: 260; - height: 65; + height: 95; display: block; display: none; border-top: 1px solid black; - background-image:url(/resource/images/back.gif); - background-repeat:repeat-x repeat-y; + background-image:url(/resource/images/back.gif); + background-repeat:repeat-x repeat-y; } #toolbar ul li ul li { diff --git a/services/console-proxy/server/js/ajaxkeys.js b/services/console-proxy/server/js/ajaxkeys.js index 2ecf5b561e0..1ed41c562d4 100644 --- a/services/console-proxy/server/js/ajaxkeys.js +++ b/services/console-proxy/server/js/ajaxkeys.js @@ -23,55 +23,286 @@ under the License. * They are used by the ajaxviewer.js */ -//client event type. corresponds to events in ajaxviewer. -X11_KEY_CIRCUMFLEX_ACCENT = 0x5e; // ^ -X11_KEY_YEN_MARK = 0xa5; +//client event type. corresponds to events in ajaxviewer. + + +//use java AWT key modifier masks +JS_KEY_BACKSPACE = 8; +JS_KEY_TAB = 9; +JS_KEY_ENTER = 13; +JS_KEY_SHIFT = 16; +JS_KEY_CTRL = 17; +JS_KEY_ALT = 18; +JS_KEY_CAPSLOCK = 20; +JS_KEY_ESCAPE = 27; +JS_KEY_PAGEUP = 33; +JS_KEY_PAGEDOWN = 34; +JS_KEY_END = 35; +JS_KEY_HOME = 36; +JS_KEY_LEFT = 37; +JS_KEY_UP = 38; +JS_KEY_RIGHT = 39; +JS_KEY_DOWN = 40; +JS_KEY_INSERT = 45; +JS_KEY_DELETE = 46; +JS_KEY_SELECT_KEY = 93; +JS_KEY_NUMPAD0 = 96; +JS_KEY_NUMPAD1 = 97; +JS_KEY_NUMPAD2 = 98; +JS_KEY_NUMPAD3 = 99; +JS_KEY_NUMPAD4 = 100; +JS_KEY_NUMPAD5 = 101; +JS_KEY_NUMPAD6 = 102; +JS_KEY_NUMPAD7 = 103; +JS_KEY_NUMPAD8 = 104; +JS_KEY_NUMPAD9 = 105; +JS_KEY_MULTIPLY = 106; +JS_KEY_ADD = 107; +JS_KEY_SUBSTRACT = 109; +JS_KEY_DECIMAL_POINT = 110; +JS_KEY_DIVIDE = 111; +JS_KEY_F1 = 112; +JS_KEY_F2 = 113; +JS_KEY_F3 = 114; +JS_KEY_F4 = 115; +JS_KEY_F5 = 116; +JS_KEY_F6 = 117; +JS_KEY_F7 = 118; +JS_KEY_F8 = 119; +JS_KEY_F9 = 120; +JS_KEY_F10 = 121; +JS_KEY_F11 = 122; +JS_KEY_F12 = 123; +JS_KEY_SEMI_COLON = 186; // ; +JS_KEY_COMMA = 188; // , +JS_KEY_DASH = 189; // - +JS_KEY_PERIOD = 190; // . +JS_KEY_FORWARD_SLASH = 191; // / +JS_KEY_GRAVE_ACCENT = 192; // ` +JS_KEY_OPEN_BRACKET = 219; // [ +JS_KEY_BACK_SLASH = 220; // \ +JS_KEY_CLOSE_BRACKET = 221; // ] +JS_KEY_SINGLE_QUOTE = 222; // ' + + +//X11 keysym definitions +X11_KEY_CAPSLOCK = 0xffe5; +X11_KEY_BACKSPACE = 0xff08; +X11_KEY_TAB = 0xff09; +X11_KEY_ENTER = 0xff0d; +X11_KEY_ESCAPE = 0xff1b; +X11_KEY_INSERT = 0xff63; +X11_KEY_DELETE = 0xffff; +X11_KEY_HOME = 0xff50; +X11_KEY_END = 0xff57; +X11_KEY_PAGEUP = 0xff55; +X11_KEY_PAGEDOWN = 0xff56; +X11_KEY_LEFT = 0xff51; +X11_KEY_UP = 0xff52; +X11_KEY_RIGHT = 0xff53; +X11_KEY_DOWN = 0xff54; +X11_KEY_F1 = 0xffbe; +X11_KEY_F2 = 0xffbf; +X11_KEY_F3 = 0xffc0; +X11_KEY_F4 = 0xffc1; +X11_KEY_F5 = 0xffc2; +X11_KEY_F6 = 0xffc3; +X11_KEY_F7 = 0xffc4; +X11_KEY_F8 = 0xffc5; +X11_KEY_F9 = 0xffc6; +X11_KEY_F10 = 0xffc7; +X11_KEY_F11 = 0xffc8; +X11_KEY_F12 = 0xffc9; +X11_KEY_SHIFT = 0xffe1; +X11_KEY_CTRL = 0xffe3; +X11_KEY_ALT = 0xffe9; +X11_KEY_GRAVE_ACCENT = 0x60; +X11_KEY_SUBSTRACT = 0x2d; +X11_KEY_ADD = 0x2b; X11_KEY_OPEN_BRACKET = 0x5b; X11_KEY_CLOSE_BRACKET = 0x5d; +X11_KEY_BACK_SLASH = 0x7c; +X11_KEY_REVERSE_SOLIUS = 0x5c; // another back slash (back slash on JP keyboard) +X11_KEY_SINGLE_QUOTE = 0x22; +X11_KEY_COMMA = 0x3c; +X11_KEY_PERIOD = 0x3e; +X11_KEY_FORWARD_SLASH = 0x3f; +X11_KEY_DASH = 0x2d; X11_KEY_COLON = 0x3a; -X11_KEY_REVERSE_SOLIUS = 0x5c; // another back slash (back slash on JP keyboard) -X11_KEY_CAPSLOCK = 0xffe5; X11_KEY_SEMI_COLON = 0x3b; -X11_KEY_SHIFT = 0xffe1; -X11_KEY_ADD = 0x2b; +X11_KEY_NUMPAD0 = 0x30; +X11_KEY_NUMPAD1 = 0x31; +X11_KEY_NUMPAD2 = 0x32; +X11_KEY_NUMPAD3 = 0x33; +X11_KEY_NUMPAD4 = 0x34; +X11_KEY_NUMPAD5 = 0x35; +X11_KEY_NUMPAD6 = 0x36; +X11_KEY_NUMPAD7 = 0x37; +X11_KEY_NUMPAD8 = 0x38; +X11_KEY_NUMPAD9 = 0x39; +X11_KEY_DECIMAL_POINT = 0x2e; +X11_KEY_DIVIDE = 0x3f; +X11_KEY_TILDE = 0x7e; // ~ +X11_KEY_CIRCUMFLEX_ACCENT = 0x5e; // ^ +X11_KEY_YEN_MARK = 0xa5; // Japanese YEN mark +X11_KEY_ASTERISK = 0x2a; KEY_DOWN = 5; KEY_UP = 6; +KEYBOARD_TYPE_COOKED = "us"; +KEYBOARD_TYPE_JP = "jp"; +KEYBOARD_TYPE_UK = "uk"; + //JP keyboard type -// +// var keyboardTables = [ - {tindex: 0, keyboardType: "EN-Cooked", mappingTable: - {X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT}, + {tindex: 0, keyboardType: KEYBOARD_TYPE_COOKED, mappingTable: + {X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT}, {keycode: 220, entry: X11_KEY_YEN_MARK}, - {keycode: 219, entry: X11_KEY_OPEN_BRACKET}, - {keycode: 221, entry: X11_KEY_CLOSE_BRACKET}, - {keycode: 59, entry: X11_KEY_COLON, browser: "Firefox"}, {keycode: 186, entry: X11_KEY_COLON, browser: "Chrome"}, {keycode: 9, entry: 9, guestos: "XenServer"}, {keycode: 226, entry: X11_KEY_REVERSE_SOLIUS}, + {keycode: 240, entry: [ {type: KEY_DOWN, code: X11_KEY_CAPSLOCK, modifiers: 0 }, {type: KEY_UP, code: X11_KEY_CAPSLOCK, modifiers: 0 }, ] + } + ], + keyPress: [ + {keycode: 59, entry: [ + {type: KEY_DOWN, code: X11_KEY_SEMI_COLON, modifiers: 0 }, + {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers: 0 }, + ] }, - ], - keyPress: [ - {keycode: 59, entry: [ - {type: KEY_DOWN, code: X11_KEY_SEMI_COLON, modifiers: 0 }, - {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers: 0 }, - ] - }, - {keycode: 43, entry: [ - {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, - {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false }, - {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false }, - {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, - {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true }, - {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true }, - ] - }, - ] - } - } ] + {keycode: 43, entry: [ + {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, + {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false }, + {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false }, + {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, + {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true }, + {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true }, + ] + } + ] + } + }, {tindex: 1, keyboardType: KEYBOARD_TYPE_JP, mappingTable: + // intialize keyboard mapping for RAW keyboard + {X11: [ + {keycode: JS_KEY_CAPSLOCK, entry : X11_KEY_CAPSLOCK}, + {keycode: JS_KEY_BACKSPACE, entry : X11_KEY_BACKSPACE}, + {keycode: JS_KEY_TAB, entry : X11_KEY_TAB}, + {keycode: JS_KEY_ENTER, entry : X11_KEY_ENTER}, + {keycode: JS_KEY_ESCAPE, entry : X11_KEY_ESCAPE}, + {keycode: JS_KEY_INSERT, entry : X11_KEY_INSERT}, + {keycode: JS_KEY_DELETE, entry : X11_KEY_DELETE}, + {keycode: JS_KEY_HOME, entry : X11_KEY_HOME}, + {keycode: JS_KEY_END, entry : X11_KEY_END}, + {keycode: JS_KEY_PAGEUP, entry : X11_KEY_PAGEUP}, + {keycode: JS_KEY_PAGEDOWN, entry : X11_KEY_PAGEDOWN}, + {keycode: JS_KEY_LEFT, entry : X11_KEY_LEFT}, + {keycode: JS_KEY_UP, entry : X11_KEY_UP}, + {keycode: JS_KEY_RIGHT, entry : X11_KEY_RIGHT}, + {keycode: JS_KEY_DOWN, entry : X11_KEY_DOWN}, + {keycode: JS_KEY_F1, entry : X11_KEY_F1}, + {keycode: JS_KEY_F2, entry : X11_KEY_F2}, + {keycode: JS_KEY_F3, entry : X11_KEY_F3}, + {keycode: JS_KEY_F4, entry : X11_KEY_F4}, + {keycode: JS_KEY_F5, entry : X11_KEY_F5}, + {keycode: JS_KEY_F6, entry : X11_KEY_F6}, + {keycode: JS_KEY_F7, entry : X11_KEY_F7}, + {keycode: JS_KEY_F8, entry : X11_KEY_F8}, + {keycode: JS_KEY_F9, entry : X11_KEY_F9}, + {keycode: JS_KEY_F10, entry : X11_KEY_F10}, + {keycode: JS_KEY_F11, entry : X11_KEY_F11}, + {keycode: JS_KEY_F12, entry : X11_KEY_F12}, + {keycode: JS_KEY_SHIFT, entry : X11_KEY_SHIFT}, + {keycode: JS_KEY_CTRL, entry : X11_KEY_CTRL}, + {keycode: JS_KEY_ALT, entry : X11_KEY_ALT}, + {keycode: JS_KEY_GRAVE_ACCENT, entry : X11_KEY_GRAVE_ACCENT}, + {keycode: JS_KEY_SUBSTRACT, entry : X11_KEY_SUBSTRACT}, + {keycode: JS_KEY_ADD, entry : X11_KEY_ADD}, + {keycode: JS_KEY_OPEN_BRACKET, entry : X11_KEY_OPEN_BRACKET}, + {keycode: JS_KEY_CLOSE_BRACKET, entry : X11_KEY_CLOSE_BRACKET}, + {keycode: JS_KEY_BACK_SLASH, entry : X11_KEY_BACK_SLASH}, + {keycode: JS_KEY_SINGLE_QUOTE, entry : X11_KEY_SINGLE_QUOTE}, + {keycode: JS_KEY_COMMA, entry : X11_KEY_COMMA}, + {keycode: JS_KEY_PERIOD, entry : X11_KEY_PERIOD}, + {keycode: JS_KEY_FORWARD_SLASH, entry : X11_KEY_FORWARD_SLASH}, + {keycode: JS_KEY_DASH, entry : X11_KEY_DASH}, + {keycode: JS_KEY_SEMI_COLON, entry : X11_KEY_SEMI_COLON}, + {keycode: JS_KEY_NUMPAD0, entry : X11_KEY_NUMPAD0}, + {keycode: JS_KEY_NUMPAD1, entry : X11_KEY_NUMPAD1}, + {keycode: JS_KEY_NUMPAD2, entry : X11_KEY_NUMPAD2}, + {keycode: JS_KEY_NUMPAD3, entry : X11_KEY_NUMPAD3}, + {keycode: JS_KEY_NUMPAD4, entry : X11_KEY_NUMPAD4}, + {keycode: JS_KEY_NUMPAD5, entry : X11_KEY_NUMPAD5}, + {keycode: JS_KEY_NUMPAD6, entry : X11_KEY_NUMPAD6}, + {keycode: JS_KEY_NUMPAD7, entry : X11_KEY_NUMPAD7}, + {keycode: JS_KEY_NUMPAD8, entry : X11_KEY_NUMPAD8}, + {keycode: JS_KEY_NUMPAD9, entry : X11_KEY_NUMPAD9}, + {keycode: JS_KEY_DECIMAL_POINT, entry : X11_KEY_DECIMAL_POINT}, + {keycode: JS_KEY_DIVIDE, entry : X11_KEY_DIVIDE}, + {keycode: JS_KEY_MULTIPLY, entry : [ + {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0 }, + {type: KEY_DOWN, code: X11_KEY_ASTERISK, modifiers: 0 }, + {type: KEY_UP, code: X11_KEY_ASTERISK, modifiers: 0 }, + {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0 } + ]}, + {keycode: JS_KEY_ADD, entry : false} + ], + keyPress: [ + {keycode: 61, entry: [ + {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false }, + {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false } + ]}, + {keycode: 43, entry: [ + {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, + {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false }, + {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false }, + {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false }, + {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true }, + {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true } + ]} + ] + } + }, {tindex: 2, keyboardType: KEYBOARD_TYPE_UK, mappingTable: + {X11: [], + keyPress: [ + //[34 = "] + {keycode: 34, entry: + [{type : KEY_DOWN, code : 0x40, modifiers : 64, shift : true}] + }, + //[35 = #] + {keycode: 35, entry: + [{type : KEY_DOWN, code : 0x5c, modifiers : 0, shift : false}] + }, + // [64 = @] + {keycode: 64, entry: + [{type : KEY_DOWN, code : 0x22, modifiers : 64, shift : true}] + }, + // [92 = \] + {keycode: 92, entry: + [{type : KEY_DOWN, code : 0xa6, modifiers : 0, shift : false}] + }, + // [126 = ~] + {keycode: 126, entry: + [{type : KEY_DOWN, code : 0x7c, modifiers : 64, shift : true}] + }, + // [163 = £] + {keycode: 163, entry: + [{type : KEY_DOWN, code : 0x23, modifiers : 64, shift : true}] + }, + // [172 = ¬] + {keycode: 172, entry: + [{type : KEY_DOWN, code : 0x7e, modifiers : 64, shift : true}] + }, + // [166 = ¦] + {keycode: 166, entry: + [{type : KEY_DOWN, code : 0x60, modifiers : 896, shift : false}] + } + ] + } + }] diff --git a/services/console-proxy/server/js/ajaxviewer.js b/services/console-proxy/server/js/ajaxviewer.js index e95615d8946..a6e1edafaea 100644 --- a/services/console-proxy/server/js/ajaxviewer.js +++ b/services/console-proxy/server/js/ajaxviewer.js @@ -99,92 +99,13 @@ function KeyboardMapper() { // KeyboardMapper.KEYBOARD_TYPE_RAW = 0; KeyboardMapper.KEYBOARD_TYPE_COOKED = 1; +KeyboardMapper.KEYBOARD_TYPE_UK = 2; KeyboardMapper.prototype = { - + setKeyboardType : function(keyboardType) { this.keyboardType = keyboardType; - - if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_RAW) { - // intialize keyboard mapping for RAW keyboard - this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] = AjaxViewer.X11_KEY_CAPSLOCK; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] = AjaxViewer.X11_KEY_BACKSPACE; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_TAB] = AjaxViewer.X11_KEY_TAB; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_ENTER] = AjaxViewer.X11_KEY_ENTER; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_ESCAPE] = AjaxViewer.X11_KEY_ESCAPE; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_INSERT] = AjaxViewer.X11_KEY_INSERT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_DELETE] = AjaxViewer.X11_KEY_DELETE; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_HOME] = AjaxViewer.X11_KEY_HOME; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_END] = AjaxViewer.X11_KEY_END; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEUP] = AjaxViewer.X11_KEY_PAGEUP; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEDOWN] = AjaxViewer.X11_KEY_PAGEDOWN; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_LEFT] = AjaxViewer.X11_KEY_LEFT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_UP] = AjaxViewer.X11_KEY_UP; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_RIGHT] = AjaxViewer.X11_KEY_RIGHT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_DOWN] = AjaxViewer.X11_KEY_DOWN; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F1] = AjaxViewer.X11_KEY_F1; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F2] = AjaxViewer.X11_KEY_F2; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F3] = AjaxViewer.X11_KEY_F3; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F4] = AjaxViewer.X11_KEY_F4; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F5] = AjaxViewer.X11_KEY_F5; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F6] = AjaxViewer.X11_KEY_F6; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F7] = AjaxViewer.X11_KEY_F7; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F8] = AjaxViewer.X11_KEY_F8; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F9] = AjaxViewer.X11_KEY_F9; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F10] = AjaxViewer.X11_KEY_F10; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F11] = AjaxViewer.X11_KEY_F11; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_F12] = AjaxViewer.X11_KEY_F12; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_SHIFT] = AjaxViewer.X11_KEY_SHIFT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_CTRL] = AjaxViewer.X11_KEY_CTRL; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_ALT] = AjaxViewer.X11_KEY_ALT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_GRAVE_ACCENT] = AjaxViewer.X11_KEY_GRAVE_ACCENT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_SUBSTRACT] = AjaxViewer.X11_KEY_SUBSTRACT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] = AjaxViewer.X11_KEY_ADD; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_OPEN_BRACKET] = AjaxViewer.X11_KEY_OPEN_BRACKET; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_CLOSE_BRACKET] = AjaxViewer.X11_KEY_CLOSE_BRACKET; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACK_SLASH] = AjaxViewer.X11_KEY_BACK_SLASH; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_SINGLE_QUOTE] = AjaxViewer.X11_KEY_SINGLE_QUOTE; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_COMMA] = AjaxViewer.X11_KEY_COMMA; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_PERIOD] = AjaxViewer.X11_KEY_PERIOD; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_FORWARD_SLASH] = AjaxViewer.X11_KEY_FORWARD_SLASH; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_DASH] = AjaxViewer.X11_KEY_DASH; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_SEMI_COLON] = AjaxViewer.X11_KEY_SEMI_COLON; - - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD0] = AjaxViewer.X11_KEY_NUMPAD0; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD1] = AjaxViewer.X11_KEY_NUMPAD1; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD2] = AjaxViewer.X11_KEY_NUMPAD2; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD3] = AjaxViewer.X11_KEY_NUMPAD3; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD4] = AjaxViewer.X11_KEY_NUMPAD4; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD5] = AjaxViewer.X11_KEY_NUMPAD5; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD6] = AjaxViewer.X11_KEY_NUMPAD6; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD7] = AjaxViewer.X11_KEY_NUMPAD7; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD8] = AjaxViewer.X11_KEY_NUMPAD8; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD9] = AjaxViewer.X11_KEY_NUMPAD9; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_DECIMAL_POINT] = AjaxViewer.X11_KEY_DECIMAL_POINT; - this.jsX11KeysymMap[AjaxViewer.JS_KEY_DIVIDE] = AjaxViewer.X11_KEY_DIVIDE; - - this.jsX11KeysymMap[AjaxViewer.JS_KEY_MULTIPLY] = [ - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 }, - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 } - ]; - - this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] = false; - this.jsKeyPressX11KeysymMap = []; - this.jsKeyPressX11KeysymMap[61] = [ - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false } - ]; - this.jsKeyPressX11KeysymMap[43] = [ - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false }, - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false }, - {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true }, - {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true } - ]; - } else { + if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_COOKED || keyboardType == KeyboardMapper.KEYBOARD_TYPE_UK) { // initialize mapping for COOKED keyboard this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] = AjaxViewer.X11_KEY_CAPSLOCK; this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] = AjaxViewer.X11_KEY_BACKSPACE; @@ -325,7 +246,6 @@ KeyboardMapper.prototype = { // ENTER/BACKSPACE key should already have been sent through KEY DOWN/KEY UP event if(code == AjaxViewer.JS_KEY_ENTER || code == AjaxViewer.JS_KEY_BACKSPACE) return; - if(code > 0) { var X11Keysym = code; X11Keysym = this.jsKeyPressX11KeysymMap[code]; @@ -475,6 +395,7 @@ AjaxViewer.STATUS_SENDING = 3; AjaxViewer.STATUS_SENT = 4; AjaxViewer.KEYBOARD_TYPE_ENGLISH = "us"; +AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH = "uk"; AjaxViewer.KEYBOARD_TYPE_JAPANESE = "jp"; AjaxViewer.JS_KEY_BACKSPACE = 8; @@ -736,6 +657,10 @@ AjaxViewer.prototype = { this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_ENGLISH] = mapper; mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_COOKED); + var mapper = new KeyboardMapper(); + this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH] = mapper; + mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_UK); + mapper = new KeyboardMapper(); this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE] = mapper; mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_RAW); @@ -795,25 +720,25 @@ AjaxViewer.prototype = { */ // create the mapping table based on the tables input - if (keyboardTables != undefined ) { + if (keyboardTables != undefined ) { - for(var i = 0; i < keyboardTables.length; i++) { - var mappingTbl = keyboardTables[i]; - var mappings = mappingTbl.mappingTable; - var x11Maps = mappings.X11; - for (var j = 0; j < x11Maps.length; j++) { - var code = x11Maps[j].keycode; - var mappedEntry = x11Maps[j].entry; - mapper.jsX11KeysymMap[code] = mappedEntry; + for(var i = 0; i < keyboardTables.length; i++) { + var mappingTbl = keyboardTables[i]; + var keyboardType = mappingTbl.keyboardType; + var mappings = mappingTbl.mappingTable; + var x11Maps = mappings.X11; + for (var j = 0; j < x11Maps.length; j++) { + var code = x11Maps[j].keycode; + var mappedEntry = x11Maps[j].entry; + this.keyboardMappers[keyboardType].jsX11KeysymMap[code] = mappedEntry; + } + var keyPressMaps = mappings.keyPress; + for (var j = 0; j < keyPressMaps.length; j++) { + var code = keyPressMaps[j].keycode; + var mappedEntry = keyPressMaps[j].entry; + this.keyboardMappers[keyboardType].jsKeyPressX11KeysymMap[code] = mappedEntry; + } } - var keyPressMaps = mappings.keyPress; - for (var j = 0; j < keyPressMaps.length; j++) { - var code = keyPressMaps[j].keycode; - var mappedEntry = keyPressMaps[j].entry; - mapper.jsKeyPressX11KeysymMap[code] = mappedEntry; - } - - } } }, // end of the setupKeyboardTranslationTable function @@ -867,6 +792,9 @@ AjaxViewer.prototype = { } else if(cmd == "keyboard_us") { $("#toolbar").find(".pulldown").find("ul").hide(); this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_ENGLISH; + } else if(cmd == "keyboard_uk") { + $("#toolbar").find(".pulldown").find("ul").hide(); + this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH; } else if(cmd == "sendCtrlAltDel") { this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe9, 0); // X11 Alt this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe3, 0); // X11 Ctrl diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java index 289bdab2f8a..f4c912a9e53 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java @@ -329,6 +329,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons "", "", "", diff --git a/setup/db/db/schema-2214to30.sql b/setup/db/db/schema-2214to30.sql index 60eceea447d..e288b0fd4f9 100755 --- a/setup/db/db/schema-2214to30.sql +++ b/setup/db/db/schema-2214to30.sql @@ -664,6 +664,7 @@ ALTER TABLE `cloud`.`dc_storage_network_ip_range` ADD COLUMN `gateway` varchar(1 ALTER TABLE `cloud`.`volumes` ADD COLUMN `last_pool_id` bigint unsigned; UPDATE `cloud`.`volumes` SET `last_pool_id` = `pool_id`; +UPDATE `cloud`.`volumes` SET `path` = SUBSTRING_INDEX(`path`, '/', -1); ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `is_system` int(1) unsigned NOT NULL default '0'; ALTER TABLE `cloud`.`volumes` ADD COLUMN `update_count` bigint unsigned NOT NULL DEFAULT 0; diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index fb38e627582..9cbefe55fdb 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -60,7 +60,7 @@ class Services: "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, + "memory": 128, # In MBs }, "virtual_machine": { diff --git a/test/integration/component/test_allocation_states.py b/test/integration/component/test_allocation_states.py index fe4c35f3b9f..5ce0b21124b 100644 --- a/test/integration/component/test_allocation_states.py +++ b/test/integration/component/test_allocation_states.py @@ -49,7 +49,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index a6ea25a846a..d099bf1a448 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -51,7 +51,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py index 4af6eee94f4..872ca2c7b5d 100644 --- a/test/integration/component/test_egress_rules.py +++ b/test/integration/component/test_egress_rules.py @@ -69,7 +69,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "security_group": { "name": 'SSH', diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py index cb41859acd3..b01371b7643 100644 --- a/test/integration/component/test_eip_elb.py +++ b/test/integration/component/test_eip_elb.py @@ -49,7 +49,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "lbrule": { "name": "SSH", diff --git a/test/integration/component/test_multiple_ip_ranges.py b/test/integration/component/test_multiple_ip_ranges.py index 29942bd3af2..7e9e712aef0 100644 --- a/test/integration/component/test_multiple_ip_ranges.py +++ b/test/integration/component/test_multiple_ip_ranges.py @@ -368,3 +368,62 @@ class TestMultipleIpRanges(cloudstackTestCase): #Test will reach here there is a bug in overlap ip range checking self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed") return + + + @attr(tags=["advanced_sg", "sg"]) + def test_06_add_ip_range_overlapped_with_two_ranges(self): + """Test adding overlapped ip range in existing cidr + + 1.Add ip range in new cidr e.g:10.147.40.2-10.147.40.10 + 2.Add another ip range in the same cidr e.g:10.147.40.20-10.147.40.30 + 2.Add ip range overlapped with both the ip ranges e.g.10.147.40.10-20 + """ + #call increment_cidr function to get exiting cidr from the setup and increment it + ip2 = self.increment_cidr() + test_nw = ip2.network + ip = IPAddress(test_nw) + #Add IP range in the new CIDR + test_gateway = ip.__add__(1) + test_startIp = ip.__add__(2) + test_endIp = ip.__add__(10) + test_startIp2 = ip.__add__(20) + test_endIp2 = ip.__add__(30) + test_startIp3 = ip.__add__(10) + test_endIp3 = ip.__add__(20) + #Populating services with new IP range + self.services["vlan_ip_range"]["startip"] = test_startIp + self.services["vlan_ip_range"]["endip"] = test_endIp + self.services["vlan_ip_range"]["gateway"] = test_gateway + self.services["vlan_ip_range"]["netmask"] = self.netmask + self.services["vlan_ip_range"]["zoneid"] = self.zone.id + self.services["vlan_ip_range"]["podid"] = self.pod.id + #create new vlan ip range + new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp)) + self.cleanup.append(new_vlan) + new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id) + #Compare list output with configured values + self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"]) + #Add 2nd IP range in the same CIDR + self.services["vlan_ip_range"]["startip"] = test_startIp2 + self.services["vlan_ip_range"]["endip"] = test_endIp2 + new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2)) + self.cleanup.append(new_vlan) + new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id) + #Compare list output with configured values + self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"]) + #Add ip range which will overlap with two existing ip ranges in the same CIDR + #Populating services with new IP range + self.services["vlan_ip_range"]["startip"] = test_startIp3 + self.services["vlan_ip_range"]["endip"] = test_endIp3 + #Try to create ip range overlapped with exiting ip range + try: + PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"]) + except cloudstackAPIException as cs: + self.debug(cs.errorMsg) + self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr") + return + #Test will reach here there is a bug in overlap ip range checking + self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed") + return diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py index 00566a0d400..e33c3765642 100644 --- a/test/integration/component/test_network_offering.py +++ b/test/integration/component/test_network_offering.py @@ -49,7 +49,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "network_offering": { "name": 'Network offering-VR services', diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py index fa2ee0adb2b..1eef123b2ee 100644 --- a/test/integration/component/test_project_configs.py +++ b/test/integration/component/test_project_configs.py @@ -70,7 +70,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "virtual_machine": { "displayname": "Test VM", @@ -242,8 +242,8 @@ class TestUserProjectCreation(cloudstackTestCase): project = Project.create( self.apiclient, self.services["project"], - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) # Cleanup created project at end of test self.cleanup.append(project) @@ -409,11 +409,11 @@ class TestProjectCreationNegative(cloudstackTestCase): project = Project.create( self.apiclient, self.services["project"], - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.debug("Project creation with domain user: %s failed" % - self.user.account.name) + self.user.name) return @@ -531,21 +531,21 @@ class TestProjectInviteRequired(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.debug(accounts_reponse) self.assertEqual( @@ -684,22 +684,22 @@ class TestProjectInviteRequiredTrue(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -853,22 +853,22 @@ class TestProjectInviteTimeout(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -894,18 +894,18 @@ class TestProjectInviteTimeout(cloudstackTestCase): self.apiclient, projectid=project.id, accept=True, - account=self.user.account.name + account=self.user.name ) self.debug( "Accepting project invitation for project: %s user: %s" % ( project.name, - self.user.account.name + self.user.name )) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( @@ -979,22 +979,22 @@ class TestProjectInviteTimeout(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1025,18 +1025,18 @@ class TestProjectInviteTimeout(cloudstackTestCase): self.apiclient, projectid=project.id, accept=True, - account=self.user.account.name + account=self.user.name ) self.debug( "Accepting invitation after expiry project: %s user: %s" % ( project.name, - self.user.account.name + self.user.name )) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( @@ -1110,22 +1110,22 @@ class TestProjectInviteTimeout(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1151,22 +1151,22 @@ class TestProjectInviteTimeout(cloudstackTestCase): time.sleep(int(self.config.value) * 2) self.debug("Adding %s user again to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1239,22 +1239,22 @@ class TestProjectInviteTimeout(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = ProjectInvitation.list( self.apiclient, state='Pending', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1279,18 +1279,18 @@ class TestProjectInviteTimeout(cloudstackTestCase): self.apiclient, projectid=project.id, accept=False, - account=self.user.account.name + account=self.user.name ) self.debug( "Declining invitation for project: %s user: %s" % ( project.name, - self.user.account.name + self.user.name )) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( accounts_reponse, @@ -1367,19 +1367,19 @@ class TestProjectInviteTimeout(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding user with email: %s to project: %s" % ( - self.user.account.email, + self.user.email, project.name )) # Add user to the project project.addAccount( self.apiclient, - email=self.user.account.user[0].email + email=self.user.user[0].email ) # Fetch the latest mail sent to user mail_content = fetch_latest_mail( self.services["mail_account"], - from_mail=self.user.account.user[0].email + from_mail=self.user.user[0].email ) return diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py index 4a8b9d48227..17ddfc67da5 100644 --- a/test/integration/component/test_project_limits.py +++ b/test/integration/component/test_project_limits.py @@ -63,7 +63,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Tiny Disk Offering", @@ -429,14 +429,14 @@ class TestProjectLimits(cloudstackTestCase): ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, + self.user.name, ) # Get the resource limits for domain @@ -459,14 +459,14 @@ class TestProjectLimits(cloudstackTestCase): #with self.assertRaises(Exception): self.debug( "Attempting to update resource limit by user: %s" % ( - self.user.account.name + self.user.name )) # Update project resource limits to 3 update_resource_limit( self.apiclient, resource.resourcetype, - account=self.user.account.name, - domainid=self.user.account.domainid, + account=self.user.name, + domainid=self.user.domainid, max=3, projectid=project.id ) diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py index e79254ce6ac..84141889f3f 100644 --- a/test/integration/component/test_project_resources.py +++ b/test/integration/component/test_project_resources.py @@ -64,7 +64,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Tiny Disk Offering", diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py index 44ef2f9a0a9..ab789e1c13d 100644 --- a/test/integration/component/test_project_usage.py +++ b/test/integration/component/test_project_usage.py @@ -52,7 +52,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py index 9fa60750afe..f013e99a0dd 100644 --- a/test/integration/component/test_projects.py +++ b/test/integration/component/test_projects.py @@ -78,7 +78,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "virtual_machine": { "displayname": "Test VM", @@ -248,15 +248,15 @@ class TestMultipleProjectCreation(cloudstackTestCase): # Add user to the project project_1.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project_1.id, - account=self.user.account.name, + account=self.user.name, ) self.debug(accounts_reponse) self.assertEqual( @@ -280,15 +280,15 @@ class TestMultipleProjectCreation(cloudstackTestCase): # Add user to the project project_2.addAccount( self.apiclient, - self.user.account.name, - self.user.account.email + self.user.name, + self.user.email ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project_2.id, - account=self.user.account.name, + account=self.user.name, ) self.debug(accounts_reponse) self.assertEqual( @@ -432,15 +432,15 @@ class TestCrossDomainAccountAdd(cloudstackTestCase): ) self.debug("Adding user: %s from domain: %s to project: %s" % ( - self.user.account.name, - self.user.account.domainid, + self.user.name, + self.user.domainid, project.id )) with self.assertRaises(Exception): # Add user to the project from different domain project.addAccount( self.apiclient, - self.user.account.name + self.user.name ) self.debug("User add to project failed!") return @@ -938,7 +938,7 @@ class TestProjectOwners(cloudstackTestCase): ) self.cleanup.append(self.user) self.debug("Created account with ID: %s" % - self.user.account.name) + self.user.name) list_projects_reponse = Project.list( self.apiclient, @@ -1033,20 +1033,20 @@ class TestProjectOwners(cloudstackTestCase): ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, + self.user.name, ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1068,19 +1068,19 @@ class TestProjectOwners(cloudstackTestCase): ) self.debug("Updating project with new Admin: %s" % - self.user.account.name) + self.user.name) # Update the project with new admin project.update( self.apiclient, - account=self.user.account.name + account=self.user.name ) # listProjectAccount to verify the user is new admin of the project accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.debug(accounts_reponse) self.assertEqual( @@ -1248,20 +1248,20 @@ class TestProjectResources(cloudstackTestCase): "Check project name from list response" ) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name, + self.user.name, ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1370,20 +1370,20 @@ class TestProjectResources(cloudstackTestCase): ) self.cleanup.append(self.user) self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, project.name )) # Add user to the project project.addAccount( self.apiclient, - self.user.account.name + self.user.name ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( isinstance(accounts_reponse, list), @@ -1543,20 +1543,20 @@ class TestProjectSuspendActivate(cloudstackTestCase): # account deletion. self.debug("Adding %s user to project: %s" % ( - self.user.account.name, + self.user.name, self.project.name )) # Add user to the project self.project.addAccount( self.apiclient, - self.user.account.name, + self.user.name, ) # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( self.apiclient, projectid=self.project.id, - account=self.user.account.name, + account=self.user.name, ) self.assertEqual( isinstance(accounts_reponse, list), diff --git a/test/integration/component/test_regions.py b/test/integration/component/test_regions.py new file mode 100644 index 00000000000..daf16cd1f44 --- /dev/null +++ b/test/integration/component/test_regions.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.cloudstackTestCase import * +from marvin.cloudstackAPI import * +from marvin.integration.lib.utils import * +from marvin.integration.lib.base import * +from marvin.integration.lib.common import * +from nose.plugins.attrib import attr +from random import choice + +class Services: + def __init__(self): + self.services = { + "region": { + "regionid": "2", + "regionname": "Region2", + "regionendpoint": "http://region2:8080/client" + } + } + +class TestRegions(cloudstackTestCase): + """Test Regions - CRUD tests for regions + """ + + @classmethod + def setUpClass(cls): + cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient() + cls.services = Services().services + cls.domain = get_domain(cls.api_client, cls.services) + cls.cleanup = [] + return + + def setUp(self): + pseudo_random_int = choice(xrange(1, 200)) + self.services["region"]["regionid"] = pseudo_random_int + self.services["region"]["regionname"] = "region" + str(pseudo_random_int) + self.services["region"]["regionendpoint"] = "http://region" + str(pseudo_random_int) + ":8080/client" + + self.region = Region.create(self.api_client, + self.services["region"] + ) + self.cleanup = [] + self.cleanup.append(self.region) + + list_region = Region.list(self.api_client, + id=self.services["region"]["regionid"] + ) + + self.assertEqual( + isinstance(list_region, list), + True, + msg="Region creation failed" + ) + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createRegionWithExistingRegionId(self): + """Test for duplicate checks on region id + """ + self.services["region"]["regionname"] = random_gen() #alter region name but not id + self.assertRaises(Exception, Region.create, self.api_client, self.services["region"]) + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createRegionWithExistingRegionName(self): + """Test for duplicate checks on region name + """ + random_int = choice(xrange(1, 200)) + self.services["region"]["regionid"] = random_int #alter id but not name + self.services["region"]["regionendpoint"] = "http://region" + str(random_int) + ":8080/client" + self.assertRaises(Exception, Region.create, self.api_client, self.services["region"]) + + @attr(tags=["simulator", "basic", "advanced"]) + def test_updateRegion(self): + """ Test for update Region + """ + self.services["region"]["regionname"] = "Region3" + random_gen() + self.services["region"]["regionendpoint"] = "http://region3updated:8080/client" + + updated_region = self.region.update(self.api_client, + self.services["region"] + ) + + list_region = Region.list(self.api_client, + id=self.services["region"]["regionid"] + ) + + self.assertEqual( + isinstance(list_region, list), + True, + "Check for list Region response" + ) + region_response = list_region[0] + + self.assertEqual( + region_response.id, + updated_region.id, + "listRegion response does not match with region Id created" + ) + + self.assertEqual( + region_response.name, + updated_region.name, + "listRegion response does not match with region name created" + ) + self.assertEqual( + region_response.endpoint, + updated_region.endpoint, + "listRegion response does not match with region endpoint created" + ) + + def tearDown(self): + """ Test for delete region as cleanup + """ + try: + #Clean up + cleanup_resources(self.api_client, self.cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) + + @classmethod + def tearDownClass(cls): + """ + Nothing to do + """ + pass diff --git a/test/integration/component/test_regions_accounts.py b/test/integration/component/test_regions_accounts.py new file mode 100644 index 00000000000..113f725f598 --- /dev/null +++ b/test/integration/component/test_regions_accounts.py @@ -0,0 +1,206 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.cloudstackTestCase import * +from marvin.cloudstackAPI import * +from marvin.integration.lib.utils import * +from marvin.integration.lib.base import * +from marvin.integration.lib.common import * +from nose.plugins.attrib import attr + +class Services: + def __init__(self): + self.services = { + "domain": { + "name": "testuuid", + "domainUUID": "domain1" + }, + "account": { + "email": "test@test.com", + "firstname": "Testuuid", + "lastname": "Useruuid", + "username": "test", + "password": "password", + "accountUUID": "account1", + "userUUID": "user1" + }, + "user": { + "email": "test@test.com", + "firstname": "Testuuid", + "lastname": "Useruuid", + "username": "test", + "password": "password", + "userUUID": "user2" + }, + } + + +class TestRegionsAccounts(cloudstackTestCase): + """Test Accounts in Regions - CRUD tests for accounts in regions + """ + + @classmethod + def setUpClass(cls): + cls.api_client = super(TestRegionsAccounts, cls).getClsTestClient().getApiClient() + cls.services = Services().services + cls.domain = get_domain(cls.api_client, cls.services) + cls.cleanup = [] + return + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createAccountWithUUID(self): + """Test for creating account by passing id parameter + + # Validate the following + # 1.Create an Account by passing id parameter.Verify the account is created. + # 2.List this account by passing id parameter.Verify that list account is able to lis this account. + # 3.Delete account should succeed. + """ + account = Account.create( + self.api_client, + self.services["account"], + domainid=self.domain.id + ) + self.assertIn(self.services["account"]["accountUUID"], account.id, + "Account is not created with the accountId passed") + + list_account = Account.list(self.api_client, + id=account.id) + + self.assertEqual( + isinstance(list_account, list), + True, + "Check for list account response by uuid failed" + ) + + account_response = list_account[0] + self.assertEqual(account_response.id, + account.id, + "listAccount response does not match with account Id " + ) + self.assertEqual( + account_response.user[0].firstname, + self.services["account"]["firstname"], + "listAccount response does not match with account firstname" + ) + + self.cleanup.append(account) + return + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createUserWithUUID(self): + """Test for creating User by passing id parameter + + # Validate the following + # 1.Create a User by passing id parameter.Verify the user is created. + # 2.List this user by passing id parameter.Verify that list user is able to list this user. + # 3.Delete User should succeed. + """ + + user = User.create( + self.api_client, + self.services["user"], + account="admin", + domainid=self.domain.id + ) + self.assertIn(self.services["user"]["userUUID"], user.id, + "User is not created successfully with the userId passed") + + list_user = User.list(self.api_client, id=user.id) + + self.assertEqual( + isinstance(list_user, list), + True, + "Check for list user response by uuid failed" + ) + + user_response = list_user[0] + + self.assertEqual(user_response.id, + user.id, + "list User response does not match with user Id " + ) + self.assertEqual( + user_response.firstname, + self.services["user"]["firstname"], + "listUser response does not match with user firstname" + ) + + user.delete(self.api_client) + + list_user = User.list(self.api_client, + id=user.id + ) + + self.assertIsNone( + list_user, + "Deletion of user failed" + ) + return + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createdomainWithUUID(self): + """Test for creating Domain by passing id parameter + + # Validate the following + # 1.Create a domain by passing id parameter.Verify the domain is created. + # 2.List this domain by passing id parameter.Verify that list domain is able to list this domain. + # 3.Delete domain should succeed. + """ + + domain = Domain.create( + self.api_client, + self.services["domain"] + ) + + self.assertIn(self.services["domain"]["domainUUID"], domain.id, + "Domain is not created with the doaminId passed") + + list_domain = Domain.list(self.api_client, + id=domain.id + ) + + self.assertEqual( + isinstance(list_domain, list), + True, + "Check for list domain response by uuid failed" + ) + + domain_response = list_domain[0] + + self.assertEqual(domain_response.id, + domain.id, + "list domain response does not match with domain Id " + ) + self.assertIn( + self.services["domain"]["name"], + domain_response.name, + "list domaiin response does not match with user firstname" + ) + try: + domain.delete(self.api_client) + except Exception as e: + self.fail("Failed to delete domain: %s" % e) + return + + @classmethod + def tearDownClass(cls): + try: + #Clean up + cleanup_resources(cls.api_client, cls.cleanup) + except Exception as e: + raise Exception("Warning: Exception during cleanup : %s" % e) \ No newline at end of file diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py index 418080ab052..1d876b6195f 100644 --- a/test/integration/component/test_resource_limits.py +++ b/test/integration/component/test_resource_limits.py @@ -51,7 +51,7 @@ class Services: "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, + "memory": 128, # In MBs }, "disk_offering": { diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index 96eb9aae403..bc33d754260 100644 --- a/test/integration/component/test_routers.py +++ b/test/integration/component/test_routers.py @@ -41,7 +41,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "virtual_machine": { diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py index fe2561aa084..54b5c67fa4d 100644 --- a/test/integration/component/test_security_groups.py +++ b/test/integration/component/test_security_groups.py @@ -74,7 +74,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "security_group": { "name": 'SSH', diff --git a/test/integration/component/test_storage_motion.py b/test/integration/component/test_storage_motion.py index 086ec77b48d..c05d79e6861 100644 --- a/test/integration/component/test_storage_motion.py +++ b/test/integration/component/test_storage_motion.py @@ -98,16 +98,16 @@ class TestStorageMotion(cloudstackTestCase): # Get Zone, Domain and templates domain = get_domain(cls.api_client, cls.services) - zone = get_zone(cls.api_client, cls.services) + cls.zone = get_zone(cls.api_client, cls.services) cls.services['mode'] = cls.zone.networktype template = get_template( cls.api_client, - zone.id, + cls.zone.id, cls.services["ostype"] ) # Set Zones and disk offerings - cls.services["small"]["zoneid"] = zone.id + cls.services["small"]["zoneid"] = cls.zone.id cls.services["small"]["template"] = template.id # Create VMs, NAT Rules etc @@ -258,6 +258,17 @@ class TestStorageMotion(cloudstackTestCase): self.apiclient, id=volume.id ) + self.assertEqual( + isinstance(pools, list), + True, + "Check list storage pools response for valid list" + ) + self.assertNotEqual( + pools, + None, + "Check if pools exists in ListStoragePools" + ) + pool = pools[0] self.debug("Migrating Volume-ID: %s to Pool: %s" % ( volume.id, diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py index 3867fb44d19..1a60123b820 100644 --- a/test/integration/component/test_templates.py +++ b/test/integration/component/test_templates.py @@ -51,7 +51,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py index dbd0be97b72..a3779e4dc2f 100644 --- a/test/integration/component/test_usage.py +++ b/test/integration/component/test_usage.py @@ -48,7 +48,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index f7eb9f92600..34a067930de 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -52,7 +52,7 @@ class Services: "displaytext": "Tiny Instance", "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, # In MBs + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small", diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index 6ccd478bf2d..e0e1a17273b 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -48,7 +48,7 @@ class Services: "cpunumber": 1, "cpuspeed": 100, # in MHz - "memory": 64, + "memory": 128, # In MBs }, "ostype": 'CentOS 5.3 (64-bit)', diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py index fd9e320addc..8ca9bd05a2d 100644 --- a/test/integration/smoke/test_deploy_vm_with_userdata.py +++ b/test/integration/smoke/test_deploy_vm_with_userdata.py @@ -111,6 +111,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): vm = vms[0] self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assert_(vm.state == "Running", "VM is not in Running state") + self.cleanup.append(deployVmResponse) @attr(tags=["simulator", "devcloud", "basic", "advanced"]) def test_deployvm_userdata(self): @@ -134,6 +135,7 @@ class TestDeployVmWithUserData(cloudstackTestCase): vm = vms[0] self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assert_(vm.state == "Running", "VM is not in Running state") + self.cleanup.append(deployVmResponse) @classmethod def tearDownClass(cls): diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py index 17234775ca1..704fe59bfff 100644 --- a/test/integration/smoke/test_guest_vlan_range.py +++ b/test/integration/smoke/test_guest_vlan_range.py @@ -44,7 +44,8 @@ class Services: "password": "password", }, "name": "testphysicalnetwork", - "vlan": "118-120", + + "vlan": "2118-2120", } @@ -149,6 +150,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase): ) self.debug("Releasing guest vlan range"); +<<<<<<< HEAD dedicated_guest_vlan_response.release(self.apiclient) list_dedicated_guest_vlan_range_response = PhysicalNetwork.listDedicated( self.apiclient, @@ -160,4 +162,14 @@ class TestDedicateGuestVlanRange(cloudstackTestCase): "system", "Check account name is system account in listDedicatedGuestVlanRanges" ) +======= + dedicate_guest_vlan_range_response.release(self.apiclient) + list_dedicated_guest_vlan_range_response = PhysicalNetwork.listDedicated(self.apiclient) + self.assertEqual( + list_dedicated_guest_vlan_range_response, + None, + "Check vlan range is not available in listDedicatedGuestVlanRanges" + + ) +>>>>>>> master diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index 322e8c25c8e..4a7bb44da2c 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -151,8 +151,8 @@ class TestPublicIP(cloudstackTestCase): cls.user_network = Network.create( cls.api_client, cls.services["network"], - cls.user.account.name, - cls.user.account.domainid + cls.user.name, + cls.user.domainid ) # Create Source NAT IP addresses @@ -164,9 +164,9 @@ class TestPublicIP(cloudstackTestCase): ) user_src_nat_ip = PublicIPAddress.create( cls.api_client, - cls.user.account.name, + cls.user.name, cls.zone.id, - cls.user.account.domainid + cls.user.domainid ) cls._cleanup = [ cls.account_network, @@ -248,9 +248,9 @@ class TestPublicIP(cloudstackTestCase): ip_address = PublicIPAddress.create( self.apiclient, - self.user.account.name, + self.user.name, self.zone.id, - self.user.account.domainid + self.user.domainid ) #listPublicIpAddresses should return newly created public IP diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py new file mode 100644 index 00000000000..5d12e74e8dd --- /dev/null +++ b/test/integration/smoke/test_regions.py @@ -0,0 +1,93 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.cloudstackTestCase import * +from marvin.cloudstackAPI import * +from marvin.integration.lib.utils import * +from marvin.integration.lib.base import * +from marvin.integration.lib.common import * +from nose.plugins.attrib import attr + +class Services: + def __init__(self): + self.services = { + "region": { + "regionid": "2", + "regionname": "Region2", + "regionendpoint": "http://region2:8080/client" + } + } + + +class TestRegions(cloudstackTestCase): + """Test Regions - basic region creation + """ + + @classmethod + def setUpClass(cls): + cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient() + cls.services = Services().services + cls.domain = get_domain(cls.api_client, cls.services) + cls.cleanup = [] + + @attr(tags=["simulator", "basic", "advanced"]) + def test_createRegion(self): + """ Test for create region + """ + region = Region.create(self.api_client, + self.services["region"] + ) + + list_region = Region.list(self.api_client, + id=self.services["region"]["regionid"] + ) + + self.assertEqual( + isinstance(list_region, list), + True, + "Check for list Region response" + ) + region_response = list_region[0] + + self.assertEqual( + str(region_response.id), + self.services["region"]["regionid"], + "listRegion response does not match with region Id created" + ) + + self.assertEqual( + region_response.name, + self.services["region"]["regionname"], + "listRegion response does not match with region name created" + ) + self.assertEqual( + region_response.endpoint, + self.services["region"]["regionendpoint"], + "listRegion response does not match with region endpoint created" + ) + self.cleanup.append(region) + return + + @classmethod + def tearDownClass(cls): + try: + #Clean up + cleanup_resources(cls.api_client, cls.cleanup) + list_region = Region.list(cls.api_client, id=cls.services["region"]["regionid"]) + assert list_region is None, "Region deletion fails" + except Exception as e: + raise Exception("Warning: Region cleanup/delete fails with : %s" % e) \ No newline at end of file diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py index fa4bc4014ec..382f56f8980 100644 --- a/test/integration/smoke/test_templates.py +++ b/test/integration/smoke/test_templates.py @@ -292,6 +292,7 @@ class TestTemplates(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services) + cls.services['mode'] = cls.zone.networktype #populate second zone id for iso copy cmd = listZones.listZonesCmd() zones = cls.api_client.listZones(cmd) @@ -751,8 +752,8 @@ class TestTemplates(cloudstackTestCase): list_template_response = list_templates( self.apiclient, templatefilter='featured', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(list_template_response, list), @@ -783,8 +784,8 @@ class TestTemplates(cloudstackTestCase): list_template_response = list_templates( self.apiclient, templatefilter='featured', - account=self.user.account.name, - domainid=self.user.account.domainid + account=self.user.name, + domainid=self.user.domainid ) self.assertEqual( isinstance(list_template_response, list), diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index ecac8c903c1..4bf8203e74c 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -287,6 +287,7 @@ class TestVolumes(cloudstackTestCase): # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services) + cls.services['mode'] = cls.zone.networktype cls.disk_offering = DiskOffering.create( cls.api_client, cls.services["disk_offering"] diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py index cdb6a36c41d..ecdc8412fdb 100755 --- a/tools/marvin/marvin/integration/lib/base.py +++ b/tools/marvin/marvin/integration/lib/base.py @@ -40,6 +40,9 @@ class Domain: cmd = createDomain.createDomainCmd() + if "domainUUID" in services: + cmd.domainid = "-".join([services["domainUUID"], random_gen()]) + if name: cmd.name = "-".join([name, random_gen()]) elif "name" in services: @@ -97,6 +100,13 @@ class Account: cmd.password = services["password"] cmd.username = "-".join([services["username"], random_gen()]) + if "accountUUID" in services: + cmd.accountid = "-".join([services["accountUUID"],random_gen()]) + + if "userUUID" in services: + cmd.userid = "-".join([services["userUUID"],random_gen()]) + + if domainid: cmd.domainid = domainid account = apiclient.createAccount(cmd) @@ -135,6 +145,9 @@ class User: cmd.firstname = services["firstname"] cmd.lastname = services["lastname"] + if "userUUID" in services: + cmd.userid = "-".join([services["userUUID"],random_gen()]) + # Password Encoding mdf = hashlib.md5() mdf.update(services["password"]) @@ -2202,7 +2215,7 @@ class PhysicalNetwork: cmd = listDedicatedGuestVlanRanges.listDedicatedGuestVlanRangesCmd() [setattr(cmd, k, v) for k, v in kwargs.items()] - return map(lambda pn : PhysicalNetwork(pn.__dict__), apiclient.listDedicatedGuestVlanRanges(cmd)) + return apiclient.listDedicatedGuestVlanRanges(cmd) @classmethod def list(cls, apiclient, **kwargs): @@ -3108,3 +3121,44 @@ class VmSnapshot: cmd.vmsnapshotid = vmsnapshotid return apiclient.deleteVMSnapshot(cmd) + +class Region: + """ Regions related Api """ + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def create(cls, apiclient, services): + cmd = addRegion.addRegionCmd() + cmd.id = services["regionid"] + cmd.endpoint = services["regionendpoint"] + cmd.name = services["regionname"] + try: + region = apiclient.addRegion(cmd) + if region is not None: + return Region(region.__dict__) + except Exception as e: + raise e + + @classmethod + def list(cls, apiclient, **kwargs): + cmd = listRegions.listRegionsCmd() + [setattr(cmd, k, v) for k, v in kwargs.items()] + region = apiclient.listRegions(cmd) + return region + + def update(self, apiclient, services): + cmd = updateRegion.updateRegionCmd() + cmd.id = self.id + if services["regionendpoint"]: + cmd.endpoint = services["regionendpoint"] + if services["regionname"]: + cmd.name = services["regionname"] + region = apiclient.updateRegion(cmd) + return region + + def delete(self, apiclient): + cmd = removeRegion.removeRegionCmd() + cmd.id = self.id + region = apiclient.removeRegion(cmd) + return region diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 122f4a03491..6a886ba0ae6 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -20,15 +20,20 @@ } var loadCSS = function(path) { - var $link = $(''); + if (document.createStyleSheet) { + // IE-compatible CSS loading + document.createStyleSheet(path); + } else { + var $link = $(''); - $link.attr({ - rel: 'stylesheet', - type: 'text/css', - href: path - }); + $link.attr({ + rel: 'stylesheet', + type: 'text/css', + href: path + }); - $('head').append($link); + $('html head').append($link); + } }; $.extend(cloudStack.pluginAPI, { diff --git a/ui/scripts/system.js b/ui/scripts/system.js index dc09ea86926..34ba64c917d 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1018,12 +1018,7 @@ dataType: "json", success: function(json) { var jobId = json.updatephysicalnetworkresponse.jobid; - - var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); - - updateTrafficLabels(trafficType, args.data, function() { args.response.success({ _custom: { jobId: jobId }}); - }); }, error:function(json){ @@ -1071,10 +1066,7 @@ dataType: "json", success: function(json) { var jobId = json.updatephysicalnetworkresponse.jobid; - var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); - updateTrafficLabels(trafficType, args.data, function() { args.response.success({ _custom: { jobId: jobId }}); - }); }, error:function(json){ diff --git a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java b/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java index fdab390557d..d86b7100658 100644 --- a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java +++ b/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java @@ -546,10 +546,15 @@ public class VsmCommand { vmware.appendChild(portgroup); portProf.appendChild(vmware); - // org root/%vdc% + // org %vdc% // vservice node profile + Element vdcValue = doc.createElement(s_paramvalue); + vdcValue.setAttribute("isKey", "true"); + vdcValue.setTextContent(vdc); + Element org = doc.createElement("org"); - org.appendChild(doc.createElement(vdc)); + org.appendChild(doc.createElement("orgname")) + .appendChild(vdcValue); portProf.appendChild(org); String asaNodeName = "ASA_" + vlanid;