Bug 53789 - UCSTestUDM.create_with_defaults()
UCSTestUDM.create_with_defaults()
Status: NEW
Product: UCS Test
Classification: Unclassified
Component: UDM
unspecified
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-09-15 03:00 CEST by Florian Best
Modified: 2021-09-16 10:05 CEST (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 Florian Best univentionstaff 2021-09-15 03:00:56 CEST
We should add a method "UCSTestUDM.create_with_defaults(module_name, **kwargs)" which can create any UDM object type with all properties set to valid and meaningful values.

This can be the basis for various test cases, e.g. create every object type in the UDM REST API or validate if the UDM-UMC search filters work.
Comment 1 Florian Best univentionstaff 2021-09-16 09:57:42 CEST
The basis has been implemented, which works with all modules except virtual ones, users/self, users/passwd, ms/*.

Some special handling for shares/printergroup <-> shares/printer was necessary as they have a cyclic dependency on each other with required=True fields. This still needs to be improoed.
Some special handling for dhcp/{subnet,shared_subnet,pool} was necessary, to make sure all values are valid with the superordinates.

ucs-test (10.0.6-45)
5936e9664829 | Bug #53789: create referenced objects in UCSTestUDM.create_with_defaults()
7f34a520510f | Bug #53789: add initial version of UCSTestUDM.create_with_defaults()

with UCSTestUDM() as udm:
    dn, props = udm.create_with_defaults('users/user')

Creates e.g.:

DN: uid=eapbmsrciv,cn=users,l=school,l=dev                                                                                                                                                                                                     
  accountActivationDate: None                                                                                                                                                                                                                  
  birthday: 2025-08-23                                                                                                                                                                                                                         
  city: r0txng4cho                                                                                                                                                                                                                             
  country: DZ                                                                                                                                                                                                                                  
  departmentNumber: n1rcvy6ko6                                                                                                                                                                                                                 
  departmentNumber: lsdagiac5u                                                                                                                                                                                                                 
  departmentNumber: h8q53cwx6y                                                                                                                                                                                                                 
  departmentNumber: 4x1lj3chgu                                                                                                                                                                                                                 
  description: 0afnh5mv52                                                                                                                                                                                                                      
  disabled: 1                                                                                                                                                                                                                                  
  displayName: dootou1gsl                                                                                                                                                                                                                      
  e-mail: w3nlpdx1om@ozf4mloynp.q5s6u0edpn                                                                                                                                                                                                     
  e-mail: z0a3f1mwrc@f570g0ui4i.hg1ppyudcv                                                                                                                                                                                                     
  e-mail: h64d2t3gbz@eo42r7jzjb.c2cpxplb8k
  e-mail: huqpmdqxgp@vneskbl2zc.ag5w9qahee
  employeeNumber: npd9u7ne5w                                                                                                                                                                                                                   
  employeeType: 1t6j2ox7ji                                                                                                                                                                                                                     
  firstname: gtadoq2yzq                                                                                                                                                                                                                        
  gecos: t55jbt1f9c                                                                                                                                                                                                                            
  gidNumber: 43849                                                                                                                                                                                                                            
  homeShare: None                                                                                                                                                                                                                              
  homeSharePath: None                                                                                                                                                                                                                          
  homeTelephoneNumber: +49 421 82531-1                                                                                                                                                                                                         
  homedrive: kvsr55jgh7                                                                                                                                                                                                                       
  initials: c3cpqt                                                                                                                                                                                                                            
  jpegPhoto: None                                                                                                                                                                                                                              
  lastbind: None                                                                                                                                                                                                                               
  lastname: wj0hgis8zs                                                                                                                                                                                                                         
  locked: 0                                                                                                                                                                                                                                    
  lockedTime: 0                                                                                                                                                                                                                               
  mailForwardCopyToSelf: 0                                                                                                                                                                                                                     
  mailHomeServer: zyqsl.efqjh                                                                                                                                                                                                                  
  mailPrimaryAddress: None                                                                                                                                                                                                                     
  mobileTelephoneNumber: +49 421 59566-5                                                                                                                                                                                                       
  mobileTelephoneNumber: +49 421 29846-2                                                                                                                                                                                                      
  mobileTelephoneNumber: +49 421 61683-9                                                                                                                                                                                                       
  networkAccess: 0                                                                                                                                                                                                                            
  organisation: 7hbczum7v2z508s9y6900trf1uqg7wku9nic40herqp0vv23move76wowkpt5i5o                                                                                                                                                               
  overridePWHistory: None                                                                                                                                                                                                                      
  overridePWLength: None                                                                                                                                                                                                                       
  password: {crypt}!$6$pZ0K/pwJMZW23E2c$tOS630TANfGrTjpqFiE1tzs2PPBZ54iknef/s.PqRS3.47n/GqRTNBDTay7z4oE5HfMzfD6nOXrDYkXBuhf5O0                                                                                                                 
  passwordexpiry: 2021-09-15                                                                                                                                                                                                                   
  phone: +49 421 46920-0                                                                                                                                                                                                                       
  phone: +49 421 12340-5                                                                                                                                                                                                                       
  phone: +49 421 49245-4                                                                                                                                                                                                                       
  phone: +49 421 73419-2                                                                                                                                                                                                                       
  physicalDeliveryOfficeName: 5hjlqq1lj3                                                                               
  postOfficeBox: 6wepirmvjk                                                                                                                                                                                                                    
  postOfficeBox: 4292yqg8oo                                                                                                                                                                                                                    
  postcode: 9wifqhx6z1                                                                                                                                                                                                                         
  preferredDeliveryMethod: ia5                                                                                                                                                                                                                 
  preferredLanguage: at1ja636mj                                                                                                                                                                                                                
  primaryGroup: cn=m9uxm7mwyi,cn=groups,l=school,l=dev                                                                                                                                                                                         
  profilepath: 9x65w4ld81                                                                                                                                                                                                                      
  pwdChangeNextLogin: 1                                                                                                                                                                                                                        
  roomNumber: 1sifkidqcv        
  roomNumber: w3w7ehi9j3                                     
  sambaLogonHours: 001000000000000000000000000000000000000000
  sambaPrivileges: SePrintOperatorPrivilege 
  sambaPrivileges: SeRemoteShutdownPrivilege                     
  sambaRID: 9255                   
  sambaUserWorkstations: 4pt93stfof
  sambahome: ijn9mqf4k9
  scriptpath: 3r94pvfat1
  secretary: uid=yvsu16nwbt,cn=users,l=school,l=dev
  secretary: uid=kzp8o2vo2t,cn=users,l=school,l=dev
  shell: n3a50jp9k9
  street: gf6fy6gsrj
  title: xfa648f1bf
  uidNumber: 51959
  unixhome: /88ofyc2mo3
  unlock: None
  unlockTime: None
  userexpiry: 2011-03-11
  username: eapbmsrciv

Warning: also fields like disabled, userexpiry, accountActivationDate are set randomly!

TODO: make sure unique values for sambaRID, uidNumer, gidNumber, etc. are selected otherwise the creation fails with:  E: Object exists: (nolock) The attribute 'uidNumber' could not get locked.
Comment 2 Florian Best univentionstaff 2021-09-16 10:05:20 CEST
TODO: create a short CLI script which has equal arguments as udm but uses this method.

TODO: create default-value-functions for all other syntax classes used by any objects.