Merge "Remove useless tests and TODOes for internet gateway"

This commit is contained in:
Jenkins
2015-02-09 11:23:59 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 22 deletions

View File

@@ -76,8 +76,7 @@ def attach_internet_gateway(context, internet_gateway_id, vpc_id):
os_networks = neutron.list_networks(**search_opts)['networks'] os_networks = neutron.list_networks(**search_opts)['networks']
os_public_network = os_networks[0] os_public_network = os_networks[0]
# TODO(ft): # TODO(ft): set attaching state into db
# set attaching state in db
with common.OnCrashCleaner() as cleaner: with common.OnCrashCleaner() as cleaner:
_attach_internet_gateway_item(context, igw, vpc['id']) _attach_internet_gateway_item(context, igw, vpc['id'])
cleaner.addCleanup(_detach_internet_gateway_item, context, igw) cleaner.addCleanup(_detach_internet_gateway_item, context, igw)
@@ -94,8 +93,7 @@ def detach_internet_gateway(context, internet_gateway_id, vpc_id):
vpc_id=vpc['id']) vpc_id=vpc['id'])
neutron = clients.neutron(context) neutron = clients.neutron(context)
# TODO(ft): # TODO(ft): set detaching state into db
# set detaching state in db
with common.OnCrashCleaner() as cleaner: with common.OnCrashCleaner() as cleaner:
_detach_internet_gateway_item(context, igw) _detach_internet_gateway_item(context, igw)
cleaner.addCleanup(_attach_internet_gateway_item, cleaner.addCleanup(_attach_internet_gateway_item,
@@ -103,9 +101,6 @@ def detach_internet_gateway(context, internet_gateway_id, vpc_id):
try: try:
neutron.remove_gateway_router(vpc["os_id"]) neutron.remove_gateway_router(vpc["os_id"])
except neutron_exception.NotFound: except neutron_exception.NotFound:
# TODO(ft): do log error
# TODO(ft): adjust catched exception classes to catch:
# the router doesn't exist
pass pass
return True return True
@@ -143,8 +138,11 @@ def _format_internet_gateway(igw):
ec2_igw = {'internetGatewayId': igw['id'], ec2_igw = {'internetGatewayId': igw['id'],
'attachmentSet': []} 'attachmentSet': []}
if igw.get('vpc_id'): if igw.get('vpc_id'):
# NOTE(ft): AWS actually returns 'available' state rather than
# documented 'attached' one
attachment_state = 'available'
attachment = {'vpcId': igw['vpc_id'], attachment = {'vpcId': igw['vpc_id'],
'state': 'available'} 'state': attachment_state}
ec2_igw['attachmentSet'].append(attachment) ec2_igw['attachmentSet'].append(attachment)
return ec2_igw return ec2_igw

View File

@@ -42,10 +42,6 @@ class IgwTestCase(base.ApiTestCase):
self.db_api.add_item.assert_called_with( self.db_api.add_item.assert_called_with(
mock.ANY, 'igw', {}) mock.ANY, 'igw', {})
@base.skip_not_implemented
def test_create_igw_overlimit(self):
pass
def test_attach_igw(self): def test_attach_igw(self):
conf = cfg.CONF conf = cfg.CONF
self.addCleanup(conf.reset) self.addCleanup(conf.reset)
@@ -247,8 +243,8 @@ class IgwTestCase(base.ApiTestCase):
def do_check(error_code): def do_check(error_code):
resp = self.execute( resp = self.execute(
'DeleteInternetGateway', 'DeleteInternetGateway',
{'InternetGatewayId': {'InternetGatewayId': (
fakes.EC2_IGW_1['internetGatewayId']}) fakes.EC2_IGW_1['internetGatewayId'])})
self.assertEqual(400, resp['http_status_code']) self.assertEqual(400, resp['http_status_code'])
self.assertEqual(error_code, resp['Error']['Code']) self.assertEqual(error_code, resp['Error']['Code'])
@@ -290,11 +286,3 @@ class IgwTestCase(base.ApiTestCase):
self.check_tag_support( self.check_tag_support(
'DescribeInternetGateways', 'internetGatewaySet', 'DescribeInternetGateways', 'internetGatewaySet',
fakes.ID_EC2_IGW_2, 'internetGatewayId') fakes.ID_EC2_IGW_2, 'internetGatewayId')
@base.skip_not_implemented
def test_describe_igw_no_vpc(self):
pass
@base.skip_not_implemented
def test_describe_igw_is_attached_to_broken_vpc(self):
pass