68
class FakeNetworkManager(network_manager.NetworkManager):
69
"""This NetworkManager doesn't call the base class so we can bypass all
70
inherited service cruft and just perform unit tests.
74
def fixed_ip_get_by_instance(self, context, instance_id):
75
return [dict(address='10.0.0.0'), dict(address='10.0.0.1'),
76
dict(address='10.0.0.2')]
78
def network_get_by_cidr(self, context, cidr):
79
raise exception.NetworkNotFoundForCidr()
81
def network_create_safe(self, context, net):
86
def network_get_all(self, context):
87
raise exception.NoNetworksFound()
89
def virtual_interface_get_all(self, context):
90
floats = [{'address': '172.16.1.1'},
91
{'address': '172.16.1.2'},
92
{'address': '173.16.1.2'}]
94
vifs = [{'instance_id': 0,
95
'fixed_ipv6': '2001:db8::dcad:beff:feef:1',
96
'fixed_ips': [{'address': '172.16.0.1',
97
'floating_ips': [floats[0]]}]},
99
'fixed_ipv6': '2001:db8::dcad:beff:feef:2',
100
'fixed_ips': [{'address': '172.16.0.2',
101
'floating_ips': [floats[1]]}]},
103
'fixed_ipv6': '2002:db8::dcad:beff:feef:2',
104
'fixed_ips': [{'address': '173.16.0.2',
105
'floating_ips': [floats[2]]}]}]
108
def instance_get_uuids_by_ids(self, context, ids):
109
# NOTE(jkoelker): This is just here until we can rely on UUIDs
110
return [{'uuid': str(utils.gen_uuid()),
111
'id': id} for id in ids]
114
self.db = self.FakeDB()
115
self.deallocate_called = None
117
def deallocate_fixed_ip(self, context, address):
118
self.deallocate_called = address
120
def _create_fixed_ips(self, context, network_id):
67
124
flavor = {'id': 0,
68
125
'name': 'fake_flavor',
69
126
'memory_mb': 2048,