Bug 50687 - importou.py: broken dhcp subnet handling
importou.py: broken dhcp subnet handling
Status: RESOLVED FIXED
Product: UCS@school
Classification: Unclassified
Component: ucs-test
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: Jürn Brodersen
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-01-06 17:19 CET by Jürn Brodersen
Modified: 2020-01-06 17:28 CET (History)
0 users

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürn Brodersen univentionstaff 2020-01-06 17:19:30 CET
importou.py test lib uses the machine ip address for a subnet address instead of the machines network address to create a dhcp subnet.

Bug 44135 introduced a check that the network address and subnet mask are a valid combination. Which it isn't in this case.




=================================== FAILURES ===================================
_______________________ test_import_ou_with_existing_dc ________________________

    def test_import_ou_with_existing_dc():
>      eio.import_ou_with_existing_dc(use_cli_api=False, use_python_api=True)
30_import-create_ou_via_python_api.py:76: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/pymodules/python2.7/univention/testing/ucsschool/importou.py:630: in import_ou_with_existing_dc
    dhcp_subnet2 = udm.create_object('dhcp/subnet', superordinate=dhcp_service, **dhcp_subnet_properties)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <univention.testing.udm.UCSTestUDM object at 0x7ffab3a9af50>
modulename = 'dhcp/subnet', wait_for_replication = True
check_for_drs_replication = False, wait_for = False
kwargs = {'subnet': IPv4Address('10.207.36.105'), 'subnetmask': 16, 'superordinate': 'cn=w1c7w5dyvs,dc=autotest201,dc=local'}
dn = None
cmd = ['/usr/sbin/udm-test', 'dhcp/subnet', 'create', '--superordinate', 'cn=w1c7w5dyvs,dc=autotest201,dc=local', '--set', ...]
child = <subprocess.Popen object at 0x7ffaaf2abdd0>
stdout = 'The subnet mask does not match the subnet.\n', stderr = ''
    def create_object(self, modulename, wait_for_replication=True, check_for_drs_replication=False, wait_for=False, **kwargs):
            r"""
           Creates a LDAP object via UDM. Values for UDM properties can be passed via keyword arguments
           only and have to exactly match UDM property names (case-sensitive!).
    
           :param str modulename: name of UDM module (e.g. 'users/user')
           :param bool wait_for_replication: delay return until Listener has settled.
           :param bool check_for_drs_replication: delay return until Samab4 has settled.
           :param \*\*kwargs:
           """
            if not modulename:
                    raise UCSTestUDM_MissingModulename()
    
            dn = None
            cmd = self._build_udm_cmdline(modulename, 'create', kwargs)
            print('Creating %s object with %s' % (modulename, _prettify_cmd(cmd)))
            child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
            (stdout, stderr) = child.communicate()
    
            if six.PY3:
                    stdout, stderr = stdout.decode('utf-8', 'replace'), stderr.decode('utf-8', 'replace')
    
            if child.returncode:
>                   raise UCSTestUDM_CreateUDMObjectFailed({'module': modulename, 'kwargs': kwargs, 'returncode': child.returncode, 'stdout': stdout, 'stderr': stderr})
E                   UCSTestUDM_CreateUDMObjectFailed: returncode=3
E                   stdout=The subnet mask does not match the subnet.
E                   
E                   stderr=
E                   module=dhcp/subnet
E                   kwargs={'superordinate': 'cn=w1c7w5dyvs,dc=autotest201,dc=local', 'subnet': IPv4Address('10.207.36.105'), 'subnetmask': 16}
check_for_drs_replication = False
child      = <subprocess.Popen object at 0x7ffaaf2abdd0>
cmd        = ['/usr/sbin/udm-test', 'dhcp/subnet', 'create', '--superordinate', 'cn=w1c7w5dyvs,dc=autotest201,dc=local', '--set', ...]
dn         = None
kwargs     = {'subnet': IPv4Address('10.207.36.105'), 'subnetmask': 16, 'superordinate': 'cn=w1c7w5dyvs,dc=autotest201,dc=local'}
modulename = 'dhcp/subnet'
self       = <univention.testing.udm.UCSTestUDM object at 0x7ffab3a9af50>
stderr     = ''
stdout     = 'The subnet mask does not match the subnet.\n'
wait_for   = False
wait_for_replication = True
/usr/lib/python2.7/dist-packages/univention/testing/udm.py:341: UCSTestUDM_CreateUDMObjectFailed
=================== 1 failed, 169 passed in 2180.13 seconds ====================
Comment 1 Jürn Brodersen univentionstaff 2020-01-06 17:28:09 CET
[4.4 54c170691] Bug #50687: fix importou.py dhcp subnet creation

Package: ucs-test-ucsschool
Version: 6.0.86A~4.4.0.202001061725
Branch: ucs_4.4-0
Scope: ucs-school-4.4