You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2012/11/22 07:01:36 UTC

svn commit: r1412429 - in /libcloud/trunk/libcloud: compute/drivers/ec2.py compute/types.py data/pricing.json test/compute/test_ec2.py

Author: tomaz
Date: Thu Nov 22 06:01:34 2012
New Revision: 1412429

URL: http://svn.apache.org/viewvc?rev=1412429&view=rev
Log:
Start working on moving Amazon EC2 compute drivers from one class per region to
one class with "datacenter" argument model.

Also split "base" EC2 functionality into BaseEC2NodeDriver class and make
Eucalyptus and Nimbus driver inherit from it.

Note: This change is backward compatible and the old way of instantiating the
driver still works.

Modified:
    libcloud/trunk/libcloud/compute/drivers/ec2.py
    libcloud/trunk/libcloud/compute/types.py
    libcloud/trunk/libcloud/data/pricing.json
    libcloud/trunk/libcloud/test/compute/test_ec2.py

Modified: libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1412429&r1=1412428&r2=1412429&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ec2.py Thu Nov 22 06:01:34 2012
@@ -14,8 +14,9 @@
 # limitations under the License.
 
 """
-Amazon EC2 driver
+Amazon EC2, Eucalyptus and Nimbus drivers.
 """
+
 from __future__ import with_statement
 
 import sys
@@ -159,6 +160,8 @@ INSTANCE_TYPES = {
 REGION_DETAILS = {
     'us-east-1': {
         'endpoint': 'ec2.us-east-1.amazonaws.com',
+        'api_name': 'ec2_us_east',
+        'country': 'USA',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -179,6 +182,8 @@ REGION_DETAILS = {
     },
     'us-west-1': {
         'endpoint': 'ec2.us-west-1.amazonaws.com',
+        'api_name': 'ec2_us_west',
+        'country': 'USA',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -194,6 +199,8 @@ REGION_DETAILS = {
     },
     'us-west-2': {
         'endpoint': 'ec2.us-west-2.amazonaws.com',
+        'api_name': 'ec2_us_west_oregon',
+        'country': 'US',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -210,6 +217,8 @@ REGION_DETAILS = {
     },
     'eu-west-1': {
         'endpoint': 'ec2.eu-west-1.amazonaws.com',
+        'api_name': 'ec2_eu_west',
+        'country': 'Ireland',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -226,6 +235,8 @@ REGION_DETAILS = {
     },
     'ap-southeast-1': {
         'endpoint': 'ec2.ap-southeast-1.amazonaws.com',
+        'api_name': 'ec2_ap_southeast',
+        'country': 'Singapore',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -241,6 +252,8 @@ REGION_DETAILS = {
     },
     'ap-northeast-1': {
         'endpoint': 'ec2.ap-northeast-1.amazonaws.com',
+        'api_name': 'ec2_ap_northeast',
+        'country': 'Japan',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -256,6 +269,8 @@ REGION_DETAILS = {
     },
     'sa-east-1': {
         'endpoint': 'ec2.sa-east-1.amazonaws.com',
+        'api_name': 'ec2_sa_east',
+        'country': 'Brazil',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -272,6 +287,8 @@ REGION_DETAILS = {
     },
     'ap-southeast-2': {
         'endpoint': 'ec2.ap-southeast-2.amazonaws.com',
+        'api_name': 'ec2_ap_southeast_2',
+        'country': 'Australia',
         'instance_types': [
             't1.micro',
             'm1.small',
@@ -288,6 +305,7 @@ REGION_DETAILS = {
     'nimbus': {
         # Nimbus clouds have 3 EC2-style instance types but their particular
         # RAM allocations are configured by the admin
+        'country': 'custom',
         'instance_types': [
             'm1.small',
             'm1.large',
@@ -296,6 +314,9 @@ REGION_DETAILS = {
     }
 }
 
+VALID_EC2_DATACENTERS = REGION_DETAILS.keys()
+VALID_EC2_DATACENTERS.remove('nimbus')
+
 
 class EC2NodeLocation(NodeLocation):
     def __init__(self, id, name, country, driver, availability_zone):
@@ -346,7 +367,7 @@ class EC2Response(AWSBaseResponse):
 
 class EC2Connection(ConnectionUserAndKey):
     """
-    Represents a single connection to the EC2 Endpoint
+    Represents a single connection to the EC2 Endpoint.
     """
 
     host = REGION_DETAILS['us-east-1']['endpoint']
@@ -414,21 +435,15 @@ class ExEC2AvailabilityZone(object):
                 % (self.name, self.zone_state, self.region_name))
 
 
-class EC2NodeDriver(NodeDriver):
+class BaseEC2NodeDriver(NodeDriver):
     """
-    Amazon EC2 node driver
+    Base Amazon EC2 node driver.
+
+    Used for main EC2 and other derivate driver classes to inherit from it.
     """
 
     connectionCls = EC2Connection
-    type = Provider.EC2
-    api_name = 'ec2_us_east'
-    name = 'Amazon EC2 (us-east-1)'
-    website = 'http://aws.amazon.com/ec2/'
-    friendly_name = 'Amazon US N. Virginia'
-    country = 'US'
-    region_name = 'us-east-1'
     path = '/'
-
     features = {'create_node': ['ssh_key']}
 
     NODE_STATE_MAP = {
@@ -659,10 +674,10 @@ class EC2NodeDriver(NodeDriver):
 
     def list_locations(self):
         locations = []
-        for index, availability_zone in\
+        for index, availability_zone in \
                 enumerate(self.ex_list_availability_zones()):
                     locations.append(EC2NodeLocation(
-                        index, self.friendly_name, self.country, self,
+                        index, availability_zone, self.country, self,
                         availability_zone)
                     )
         return locations
@@ -1366,160 +1381,104 @@ class EC2NodeDriver(NodeDriver):
         return self._get_terminate_boolean(res)
 
 
-class IdempotentParamError(LibcloudError):
-    """
-    Request used the same client token as a previous,
-    but non-identical request.
-    """
-
-    def __str__(self):
-        return repr(self.value)
-
-
-class EC2EUConnection(EC2Connection):
+class EC2NodeDriver(BaseEC2NodeDriver):
     """
-    Connection class for EC2 in the Western Europe Region
+    Amazon EC2 node driver.
     """
-    host = REGION_DETAILS['eu-west-1']['endpoint']
 
+    connectionCls = EC2Connection
+    type = Provider.EC2
+    name = 'Amazon EC2'
+    website = 'http://aws.amazon.com/ec2/'
+    path = '/'
 
-class EC2EUNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Western Europe Region
-    """
+    features = {'create_node': ['ssh_key']}
 
-    api_name = 'ec2_eu_west'
-    name = 'Amazon EC2 (eu-west-1)'
-    friendly_name = 'Amazon Europe Ireland'
-    country = 'IE'
-    region_name = 'eu-west-1'
-    connectionCls = EC2EUConnection
+    NODE_STATE_MAP = {
+        'pending': NodeState.PENDING,
+        'running': NodeState.RUNNING,
+        'shutting-down': NodeState.TERMINATED,
+        'terminated': NodeState.TERMINATED
+    }
 
+    def __init__(self, key, secret=None, secure=True, host=None, port=None,
+                 datacenter='us-east-1', **kwargs):
 
-class EC2USWestConnection(EC2Connection):
-    """
-    Connection class for EC2 in the Western US Region
-    """
+        if hasattr(self, '_datacenter'):
+            datacenter = self._datacenter
 
-    host = REGION_DETAILS['us-west-1']['endpoint']
+        if datacenter not in VALID_EC2_DATACENTERS:
+            raise ValueError('Invalid datacenter: %s' % (datacenter))
 
+        details = REGION_DETAILS[datacenter]
+        self.region_name = datacenter
+        self.api_name = details['api_name']
+        self.country = details['country']
 
-class EC2USWestNodeDriver(EC2NodeDriver):
-    """
-    Driver class for EC2 in the Western US Region
-    """
+        self.connectionCls.host = details['endpoint']
 
-    api_name = 'ec2_us_west'
-    name = 'Amazon EC2 (us-west-1)'
-    friendly_name = 'Amazon US N. California'
-    country = 'US'
-    region_name = 'us-west-1'
-    connectionCls = EC2USWestConnection
+        super(EC2NodeDriver, self).__init__(key=key, secret=secret,
+                                            secure=secure, host=host,
+                                            port=port, **kwargs)
 
 
-class EC2USWestOregonConnection(EC2Connection):
+class IdempotentParamError(LibcloudError):
     """
-    Connection class for EC2 in the Western US Region (Oregon).
+    Request used the same client token as a previous,
+    but non-identical request.
     """
 
-    host = REGION_DETAILS['us-west-2']['endpoint']
+    def __str__(self):
+        return repr(self.value)
 
 
-class EC2USWestOregonNodeDriver(EC2NodeDriver):
+class EC2EUNodeDriver(EC2NodeDriver):
     """
-    Driver class for EC2 in the US West Oregon region.
+    Driver class for EC2 in the Western Europe Region.
     """
-
-    api_name = 'ec2_us_west_oregon'
-    name = 'Amazon EC2 (us-west-2)'
-    friendly_name = 'Amazon US West - Oregon'
-    country = 'US'
-    region_name = 'us-west-2'
-    connectionCls = EC2USWestOregonConnection
+    _datacenter = 'eu-west-1'
 
 
-class EC2APSEConnection(EC2Connection):
+class EC2USWestNodeDriver(EC2NodeDriver):
     """
-    Connection class for EC2 in the Southeast Asia Pacific Region.
+    Driver class for EC2 in the Western US Region
     """
+    _datacenter = 'us-west-1'
 
-    host = REGION_DETAILS['ap-southeast-1']['endpoint']
 
-
-class EC2APNEConnection(EC2Connection):
+class EC2USWestOregonNodeDriver(EC2NodeDriver):
     """
-    Connection class for EC2 in the Northeast Asia Pacific Region.
+    Driver class for EC2 in the US West Oregon region.
     """
-
-    host = REGION_DETAILS['ap-northeast-1']['endpoint']
+    _datacenter = 'us-west-2'
 
 
 class EC2APSENodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Southeast Asia Pacific Region.
     """
-
-    api_name = 'ec2_ap_southeast'
-    name = 'Amazon EC2 (ap-southeast-1)'
-    friendly_name = 'Amazon Asia-Pacific Singapore'
-    country = 'SG'
-    region_name = 'ap-southeast-1'
-    connectionCls = EC2APSEConnection
+    _datacenter = 'ap-southeast-1'
 
 
 class EC2APNENodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Northeast Asia Pacific Region.
     """
-
-    api_name = 'ec2_ap_northeast'
-    name = 'Amazon EC2 (ap-northeast-1)'
-    friendly_name = 'Amazon Asia-Pacific Tokyo'
-    country = 'JP'
-    region_name = 'ap-northeast-1'
-    connectionCls = EC2APNEConnection
-
-
-class EC2SAEastConnection(EC2Connection):
-    """
-    Connection class for EC2 in the South America (Sao Paulo) Region.
-    """
-
-    host = REGION_DETAILS['sa-east-1']['endpoint']
+    _datacenter = 'ap-northeast-1'
 
 
 class EC2SAEastNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the South America (Sao Paulo) Region.
     """
-
-    api_name = 'ec2_sa_east'
-    name = 'Amazon EC2 (sa-east-1)'
-    friendly_name = 'Amazon South America Sao Paulo'
-    country = 'BR'
-    region_name = 'sa-east-1'
-    connectionCls = EC2SAEastConnection
-
-
-class EC2APSESydneyConnection(EC2Connection):
-    """
-    Connection class for EC2 in the Southeast Asia Pacific (Sydney) Region.
-    """
-
-    host = REGION_DETAILS['ap-southeast-2']['endpoint']
+    _datacenter = 'sa-east-1'
 
 
 class EC2APSESydneyNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Southeast Asia Pacific (Sydney) Region.
     """
-
-    api_name = 'ec2_ap_southeast_2'
-    name = 'Amazon EC2 (ap-southeast-2)'
-    friendly_name = 'Amazon Asia-Pacific Sydney'
-    country = 'AU'
-    region_name = 'ap-southeast-2'
-    connectionCls = EC2APSESydneyConnection
+    _datacenter = 'ap-southeast-2'
 
 
 class EucConnection(EC2Connection):
@@ -1530,14 +1489,15 @@ class EucConnection(EC2Connection):
     host = None
 
 
-class EucNodeDriver(EC2NodeDriver):
+class EucNodeDriver(BaseEC2NodeDriver):
     """
     Driver class for Eucalyptus
     """
 
     name = 'Eucalyptus'
-    connectionCls = EucConnection
+    api_name = 'ec2_us_east'
     region_name = 'us-east-1'
+    connectionCls = EucConnection
 
     def __init__(self, key, secret=None, secure=True, host=None,
                  path=None, port=None):
@@ -1572,13 +1532,14 @@ class NimbusConnection(EC2Connection):
     host = None
 
 
-class NimbusNodeDriver(EC2NodeDriver):
+class NimbusNodeDriver(BaseEC2NodeDriver):
     """
     Driver class for Nimbus
     """
 
     type = Provider.NIMBUS
     name = 'Nimbus'
+    country = 'Private'
     api_name = 'nimbus'
     region_name = 'nimbus'
     friendly_name = 'Nimbus Private Cloud'
@@ -1586,7 +1547,7 @@ class NimbusNodeDriver(EC2NodeDriver):
 
     def ex_describe_addresses(self, nodes):
         """
-        Nimbus doesn't support elastic IPs, so this is a passthrough
+        Nimbus doesn't support elastic IPs, so this is a passthrough.
 
         @inherits: L{EC2NodeDriver.ex_describe_addresses}
         """
@@ -1598,7 +1559,7 @@ class NimbusNodeDriver(EC2NodeDriver):
 
     def ex_create_tags(self, resource, tags):
         """
-        Nimbus doesn't support creating tags, so this is a passthrough
+        Nimbus doesn't support creating tags, so this is a passthrough.
 
         @inherits: L{EC2NodeDriver.ex_create_tags}
         """

Modified: libcloud/trunk/libcloud/compute/types.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/types.py?rev=1412429&r1=1412428&r2=1412429&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/types.py (original)
+++ libcloud/trunk/libcloud/compute/types.py Thu Nov 22 06:01:34 2012
@@ -71,10 +71,7 @@ class Provider(object):
     @cvar GRIDSPOT: Gridspot driver
     """
     DUMMY = 'dummy'
-    EC2 = 'ec2'  # deprecated name
-    EC2_US_EAST = 'ec2_us_east'
-    EC2_EU = 'ec2_eu'  # deprecated name
-    EC2_EU_WEST = 'ec2_eu_west'
+    EC2 = 'ec2'
     RACKSPACE = 'rackspace'
     SLICEHOST = 'slicehost'
     GOGRID = 'gogrid'
@@ -82,7 +79,6 @@ class Provider(object):
     LINODE = 'linode'
     VCLOUD = 'vcloud'
     RIMUHOSTING = 'rimuhosting'
-    EC2_US_WEST = 'ec2_us_west'
     VOXEL = 'voxel'
     SOFTLAYER = 'softlayer'
     EUCALYPTUS = 'eucalyptus'
@@ -94,10 +90,8 @@ class Provider(object):
     ELASTICHOSTS_UK1 = 'elastichosts_uk1'
     ELASTICHOSTS_UK2 = 'elastichosts_uk2'
     ELASTICHOSTS_US1 = 'elastichosts_us1'
-    EC2_AP_SOUTHEAST = 'ec2_ap_southeast'
     BRIGHTBOX = 'brightbox'
     CLOUDSIGMA = 'cloudsigma'
-    EC2_AP_NORTHEAST = 'ec2_ap_northeast'
     NIMBUS = 'nimbus'
     BLUEBOX = 'bluebox'
     GANDI = 'gandi'
@@ -107,10 +101,8 @@ class Provider(object):
     SERVERLOVE = 'serverlove'
     NINEFOLD = 'ninefold'
     TERREMARK = 'terremark'
-    EC2_US_WEST_OREGON = 'ec2_us_west_oregon'
     CLOUDSTACK = 'cloudstack'
     CLOUDSIGMA_US = 'cloudsigma_us'
-    EC2_SA_EAST = 'ec2_sa_east'
     LIBVIRT = 'libvirt'
     ELASTICHOSTS_US2 = 'elastichosts_us2'
     ELASTICHOSTS_CA1 = 'elastichosts_ca1'
@@ -120,9 +112,19 @@ class Provider(object):
     GRIDSPOT = 'gridspot'
     RACKSPACE_FIRST_GEN = 'rackspace_first_gen'
     HOSTVIRTUAL = 'hostvirtual'
+
+    # Deprecated constants which are still supported
+    EC2_US_EAST = 'ec2_us_east'
+    EC2_EU = 'ec2_eu'  # deprecated name
+    EC2_EU_WEST = 'ec2_eu_west'
+    EC2_US_WEST = 'ec2_us_west'
+    EC2_AP_SOUTHEAST = 'ec2_ap_southeast'
+    EC2_AP_NORTHEAST = 'ec2_ap_northeast'
+    EC2_US_WEST_OREGON = 'ec2_us_west_oregon'
+    EC2_SA_EAST = 'ec2_sa_east'
     EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'
 
-    # Deprecated constants
+    # Deprecated constants which aren't supported anymore
     RACKSPACE_UK = 'rackspace_uk'
     RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
     RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'

Modified: libcloud/trunk/libcloud/data/pricing.json
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/data/pricing.json?rev=1412429&r1=1412428&r2=1412429&view=diff
==============================================================================
--- libcloud/trunk/libcloud/data/pricing.json (original)
+++ libcloud/trunk/libcloud/data/pricing.json Thu Nov 22 06:01:34 2012
@@ -87,7 +87,8 @@
             "c1.xlarge": 0.68,
             "m2.xlarge": 0.50,
             "m2.2xlarge": 1.0,
-            "m2.4xlarge": 2.0
+            "m2.4xlarge": 2.0,
+            "cc2.8xlarge": 2.400
         },
 
        "ec2_eu_west": {

Modified: libcloud/trunk/libcloud/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/test_ec2.py?rev=1412429&r1=1412428&r2=1412429&view=diff
==============================================================================
--- libcloud/trunk/libcloud/test/compute/test_ec2.py (original)
+++ libcloud/trunk/libcloud/test/compute/test_ec2.py Thu Nov 22 06:01:34 2012
@@ -18,9 +18,16 @@ import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.compute.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver
-from libcloud.compute.drivers.ec2 import NimbusNodeDriver, EucNodeDriver
+from libcloud.compute.drivers.ec2 import EC2USWestNodeDriver
+from libcloud.compute.drivers.ec2 import EC2USWestOregonNodeDriver
+from libcloud.compute.drivers.ec2 import EC2EUNodeDriver
+from libcloud.compute.drivers.ec2 import EC2APSENodeDriver
 from libcloud.compute.drivers.ec2 import EC2APNENodeDriver
+from libcloud.compute.drivers.ec2 import EC2APSESydneyNodeDriver
+from libcloud.compute.drivers.ec2 import EC2SAEastNodeDriver
+from libcloud.compute.drivers.ec2 import NimbusNodeDriver, EucNodeDriver
 from libcloud.compute.drivers.ec2 import IdempotentParamError
+from libcloud.compute.drivers.ec2 import REGION_DETAILS
 from libcloud.compute.base import Node, NodeImage, NodeSize, NodeLocation
 from libcloud.compute.base import StorageVolume
 
@@ -31,15 +38,35 @@ from libcloud.test.file_fixtures import 
 from libcloud.test.secrets import EC2_PARAMS
 
 
+class BaseEC2Tests(LibcloudTestCase):
+    def test_instantiate_driver_valid_datacenters(self):
+        datacenters = REGION_DETAILS.keys()
+        datacenters.remove('nimbus')
+
+        for datacenter in datacenters:
+            EC2NodeDriver(*EC2_PARAMS, datacenter=datacenter)
+
+    def test_instantiate_driver_invalid_datacenters(self):
+        for datacenter in ['invalid', 'nimbus']:
+            try:
+                EC2NodeDriver(*EC2_PARAMS, datacenter=datacenter)
+            except ValueError:
+                pass
+            else:
+                self.fail('Invalid region, but exception was not thrown')
+
+
 class EC2Tests(LibcloudTestCase, TestCaseMixin):
     image_name = 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml'
+    datacenter = 'us-east-1'
 
     def setUp(self):
         EC2MockHttp.test = self
         EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
         EC2MockHttp.use_param = 'Action'
         EC2MockHttp.type = None
-        self.driver = EC2NodeDriver(*EC2_PARAMS)
+
+        self.driver = EC2NodeDriver(*EC2_PARAMS, datacenter=self.datacenter)
 
     def test_create_node(self):
         image = NodeImage(id='ami-be3adfd7',
@@ -344,8 +371,76 @@ class EC2Tests(LibcloudTestCase, TestCas
         self.assertTrue(retValue)
 
 
-class EC2MockHttp(MockHttp):
+class EC2USWest1Tests(EC2Tests):
+    datacenter = 'us-west-1'
+
+
+class EC2USWest2Tests(EC2Tests):
+    datacenter = 'us-west-2'
+
+
+class EC2EUWestTests(EC2Tests):
+    datacenter = 'eu-west-1'
+
+
+class EC2APSE1Tests(EC2Tests):
+    datacenter = 'ap-southeast-1'
+
+
+class EC2APNETests(EC2Tests):
+    datacenter = 'ap-northeast-1'
+
+
+class EC2APSE2Tests(EC2Tests):
+    datacenter = 'ap-southeast-2'
+
+
+class EC2SAEastTests(EC2Tests):
+    datacenter = 'sa-east-1'
+
+
+# Tests for the old, deprecated way of instantiating a driver.
+class EC2OldStyleModelTests(EC2Tests):
+    driver_klass = EC2USWestNodeDriver
+
+    def setUp(self):
+        EC2MockHttp.test = self
+        EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
+        EC2MockHttp.use_param = 'Action'
+        EC2MockHttp.type = None
 
+        self.driver = self.driver_klass(*EC2_PARAMS)
+
+
+class EC2USWest1OldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2USWestNodeDriver
+
+
+class EC2USWest2OldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2USWestOregonNodeDriver
+
+
+class EC2EUWestOldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2EUNodeDriver
+
+
+class EC2APSE1OldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2APSENodeDriver
+
+
+class EC2APNEOldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2APNENodeDriver
+
+
+class EC2APSE2OldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2APSESydneyNodeDriver
+
+
+class EC2SAEastOldStyleModelTests(EC2OldStyleModelTests):
+    driver_klass = EC2SAEastNodeDriver
+
+
+class EC2MockHttp(MockHttp):
     fixtures = ComputeFileFixtures('ec2')
 
     def _DescribeInstances(self, method, url, body, headers):
@@ -489,22 +584,6 @@ class EucMockHttp(EC2MockHttp):
         return self._CreateTags(method, url, body, headers)
 
 
-class EC2APSETests(EC2Tests):
-    def setUp(self):
-        EC2APSENodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
-        EC2MockHttp.use_param = 'Action'
-        EC2MockHttp.type = None
-        self.driver = EC2APSENodeDriver(*EC2_PARAMS)
-
-
-class EC2APNETests(EC2Tests):
-    def setUp(self):
-        EC2APNENodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
-        EC2MockHttp.use_param = 'Action'
-        EC2MockHttp.type = None
-        self.driver = EC2APNENodeDriver(*EC2_PARAMS)
-
-
 class NimbusTests(EC2Tests):
     def setUp(self):
         NimbusNodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)