示例#1
0
 def test_too_many_addresses(self):
     address = '192.168.0.100'
     db.floating_ip_create(context.get_admin_context(), {
         'address': address,
         'project_id': self.project_id
     })
     self.assertRaises(exception.QuotaError,
                       self.network.allocate_floating_ip, self.context,
                       self.project_id)
     db.floating_ip_destroy(context.get_admin_context(), address)
示例#2
0
 def test_too_many_addresses(self):
     address = '192.168.0.100'
     db.floating_ip_create(context.get_admin_context(),
                           {'address': address,
                            'project_id': self.project_id})
     self.assertRaises(exception.QuotaError,
                       self.network.allocate_floating_ip,
                       self.context,
                       self.project_id)
     db.floating_ip_destroy(context.get_admin_context(), address)
 def _create_floating_ip(self):
     """Create a floating ip object."""
     host = "fake_host"
     return db.floating_ip_create(self.context,
                                  {'address': self.floating_ip,
                                   'pool': 'engine',
                                   'host': host})
示例#4
0
 def _create_floating_ip(self):
     """Create a floating ip object."""
     host = "fake_host"
     return db.floating_ip_create(self.context, {
         'address': testaddress,
         'host': host
     })
示例#5
0
 def _create_floating_ip(self):
     """Create a floating ip object."""
     host = "fake_host"
     return db.floating_ip_create(self.context, {
         'address': self.floating_ip,
         'pool': 'engine',
         'host': host
     })
示例#6
0
def _setup_networking(instance_id, ip='1.2.3.4', flo_addr='1.2.1.2'):
    ctxt = context.get_admin_context()
    network_ref = db.project_get_networks(ctxt,
                                           'fake',
                                           associate=True)[0]
    vif = {'address': '56:12:12:12:12:12',
           'network_id': network_ref['id'],
           'instance_id': instance_id}
    vif_ref = db.virtual_interface_create(ctxt, vif)

    fixed_ip = {'address': ip,
                'network_id': network_ref['id'],
                'virtual_interface_id': vif_ref['id'],
                'allocated': True,
                'instance_id': instance_id}
    db.fixed_ip_create(ctxt, fixed_ip)
    fix_ref = db.fixed_ip_get_by_address(ctxt, ip)
    db.floating_ip_create(ctxt, {'address': flo_addr,
                                 'fixed_ip_id': fix_ref['id']})
示例#7
0
def _setup_networking(instance_id, ip='1.2.3.4', flo_addr='1.2.1.2'):
    ctxt = context.get_admin_context()
    network_ref = db.project_get_networks(ctxt, 'fake', associate=True)[0]
    vif = {
        'address': '56:12:12:12:12:12',
        'network_id': network_ref['id'],
        'instance_id': instance_id
    }
    vif_ref = db.virtual_interface_create(ctxt, vif)

    fixed_ip = {
        'address': ip,
        'network_id': network_ref['id'],
        'virtual_interface_id': vif_ref['id'],
        'allocated': True,
        'instance_id': instance_id
    }
    db.fixed_ip_create(ctxt, fixed_ip)
    fix_ref = db.fixed_ip_get_by_address(ctxt, ip)
    db.floating_ip_create(ctxt, {
        'address': flo_addr,
        'fixed_ip_id': fix_ref['id']
    })
 def _create_floating_ip(self):
     """Create a floating ip object."""
     host = "fake_host"
     return db.floating_ip_create(self.context,
                                  {'address': testaddress,
                                   'host': host})