Revision 92d2d1ce snf-cyclades-app/synnefo/db/models_factory.py
b/snf-cyclades-app/synnefo/db/models_factory.py | ||
---|---|---|
186 | 186 |
factory.Sequence(round_seq_first(FACTORY_FOR.FIREWALL_PROFILES)) |
187 | 187 |
|
188 | 188 |
|
189 |
class IPPoolTableFactory(factory.DjangoModelFactory): |
|
190 |
FACTORY_FOR = models.IPPoolTable |
|
191 |
size = 0 |
|
192 |
|
|
193 |
|
|
189 | 194 |
class IPv4SubnetFactory(factory.DjangoModelFactory): |
190 | 195 |
FACTORY_FOR = models.Subnet |
191 | 196 |
|
192 |
network = factory.SubFactory(NetworkFactory) |
|
197 |
network = factory.SubFactory(NetworkFactory, state="ACTIVE")
|
|
193 | 198 |
name = factory.LazyAttribute(lambda self: random_string(30)) |
194 | 199 |
ipversion = 4 |
195 | 200 |
cidr = factory.Sequence(lambda n: '192.168.{0}.0/24'.format(n)) |
... | ... | |
197 | 202 |
gateway = factory.Sequence(lambda n: '192.168.{0}.1'.format(n)) |
198 | 203 |
dns_nameservers = [] |
199 | 204 |
host_routes = [] |
205 |
pool = factory.RelatedFactory(IPPoolTableFactory, 'subnet') |
|
200 | 206 |
|
201 | 207 |
|
202 | 208 |
class IPv6SubnetFactory(IPv4SubnetFactory): |
... | ... | |
213 | 219 |
address =\ |
214 | 220 |
factory.LazyAttributeSequence(lambda self, n: self.subnet.cidr[:-4] + |
215 | 221 |
'{0}'.format(int(n) + 2)) |
222 |
nic = factory.SubFactory(NetworkInterfaceFactory, |
|
223 |
network=factory.SelfAttribute('..network')) |
|
224 |
|
|
225 |
|
|
226 |
class IPv6AddressFactory(IPv4AddressFactory): |
|
227 |
FACTORY_FOR = models.IPAddress |
|
228 |
|
|
229 |
subnet = factory.SubFactory(IPv6SubnetFactory) |
|
230 |
network = factory.SubFactory(NetworkFactory) |
|
231 |
address = "babe::" |
|
232 |
nic = factory.SubFactory(NetworkInterfaceFactory, |
|
233 |
network=factory.SelfAttribute('..network')) |
|
216 | 234 |
|
217 | 235 |
|
218 | 236 |
class FloatingIPFactory(IPv4AddressFactory): |
Also available in: Unified diff