Revision 108ef251
b/snf-cyclades-app/synnefo/logic/networks.py | ||
---|---|---|
185 | 185 |
# Check that network size is allowed! |
186 | 186 |
prefixlen = network.prefixlen |
187 | 187 |
if not prefixlen <= 29 and prefixlen > settings.MAX_CIDR_BLOCK: |
188 |
raise faults.OverLimit(message="Unsupported network size",
|
|
189 |
details="Network mask must be in range"
|
|
190 |
" (%s, 29]"
|
|
191 |
% settings.MAX_CIDR_BLOCK)
|
|
188 |
raise faults.OverLimit( |
|
189 |
message="Unsupported network size",
|
|
190 |
details="Netmask must be in range: (%s, 29]" %
|
|
191 |
settings.MAX_CIDR_BLOCK) |
|
192 | 192 |
if gateway: # Check that gateway belongs to network |
193 | 193 |
try: |
194 | 194 |
gateway = ipaddr.IPv4Address(gateway) |
... | ... | |
203 | 203 |
network6 = ipaddr.IPv6Network(subnet6, strict=True) |
204 | 204 |
except ValueError: |
205 | 205 |
raise faults.BadRequest("Invalid network IPv6 subnet") |
206 |
# Check that network6 is an /64 subnet, because this is imposed by |
|
207 |
# 'mac2eui64' utiity. |
|
208 |
if network6.prefixlen != 64: |
|
209 |
msg = ("Unsupported IPv6 subnet size. Network netmask must be" |
|
210 |
" /64") |
|
211 |
raise faults.BadRequest(msg) |
|
206 | 212 |
if gateway6: |
207 | 213 |
try: |
208 | 214 |
gateway6 = ipaddr.IPv6Address(gateway6) |
Also available in: Unified diff