|
Lines 50-56
from univention.management.console.modules import Base, UMC_OptionTypeError, UMC
Link Here
|
| 50 |
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response |
50 |
from univention.management.console.modules.decorators import simple_response, sanitize, multi_response |
| 51 |
from univention.management.console.modules.sanitizers import ( |
51 |
from univention.management.console.modules.sanitizers import ( |
| 52 |
LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer, |
52 |
LDAPSearchSanitizer, EmailSanitizer, ChoicesSanitizer, |
| 53 |
ListSanitizer, StringSanitizer, DictSanitizer |
53 |
ListSanitizer, StringSanitizer, DictSanitizer, BooleanSanitizer |
| 54 |
) |
54 |
) |
| 55 |
from univention.management.console.modules.mixins import ProgressMixin |
55 |
from univention.management.console.modules.mixins import ProgressMixin |
| 56 |
from univention.management.console.log import MODULE |
56 |
from univention.management.console.log import MODULE |
|
Lines 644-649
class Instance(Base, ProgressMixin):
Link Here
|
| 644 |
result = module.get_default_values(property_name) |
644 |
result = module.get_default_values(property_name) |
| 645 |
self.finished(request.id, result) |
645 |
self.finished(request.id, result) |
| 646 |
|
646 |
|
|
|
647 |
@sanitize( |
| 648 |
networkDN=StringSanitizer(required=True), |
| 649 |
increaseCounter=BooleanSanitizer(default=False) |
| 650 |
) |
| 647 |
def network(self, request): |
651 |
def network(self, request): |
| 648 |
"""Returns the next IP configuration based on the given network object |
652 |
"""Returns the next IP configuration based on the given network object |
| 649 |
|
653 |
|
|
Lines 653-664
class Instance(Base, ProgressMixin):
Link Here
|
| 653 |
|
657 |
|
| 654 |
return: {} |
658 |
return: {} |
| 655 |
""" |
659 |
""" |
| 656 |
self.required_options(request, 'networkDN') |
|
|
| 657 |
module = self._get_module('networks/network') |
660 |
module = self._get_module('networks/network') |
| 658 |
obj = module.get(request.options['networkDN']) |
661 |
obj = module.get(request.options['networkDN']) |
| 659 |
|
662 |
|
| 660 |
if not obj: |
663 |
if not obj: |
| 661 |
raise UMC_OptionTypeError('Could not find network object') |
664 |
raise ObjectDoesNotExists(request.options['networkDN']) |
| 662 |
try: |
665 |
try: |
| 663 |
obj.refreshNextIp() |
666 |
obj.refreshNextIp() |
| 664 |
except udm_errors.nextFreeIp: |
667 |
except udm_errors.nextFreeIp: |
|
Lines 667-673
class Instance(Base, ProgressMixin):
Link Here
|
| 667 |
result = {'ip': obj['nextIp'], 'dnsEntryZoneForward': obj['dnsEntryZoneForward'], 'dhcpEntryZone': obj['dhcpEntryZone'], 'dnsEntryZoneReverse': obj['dnsEntryZoneReverse']} |
670 |
result = {'ip': obj['nextIp'], 'dnsEntryZoneForward': obj['dnsEntryZoneForward'], 'dhcpEntryZone': obj['dhcpEntryZone'], 'dnsEntryZoneReverse': obj['dnsEntryZoneReverse']} |
| 668 |
self.finished(request.id, result) |
671 |
self.finished(request.id, result) |
| 669 |
|
672 |
|
| 670 |
if request.options.get('increaseCounter', False) == True: |
673 |
if request.options['increaseCounter']: |
| 671 |
# increase the next free IP address |
674 |
# increase the next free IP address |
| 672 |
obj.stepIp() |
675 |
obj.stepIp() |
| 673 |
obj.modify() |
676 |
obj.modify() |