[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Wed Nov 17 21:30:01 MST 2010


The branch, master has been updated
       via  1c4807a s4-test: added greater control over tests to run
      from  23e053d s4-test: rename scripting/devel/howto to scripting/devel/wintest

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1c4807a62f2a7c4199079b7ab13ed6a4b121ff09
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Nov 18 14:43:53 2010 +1100

    s4-test: added greater control over tests to run
    
    now supports --list to list tests, and --skip to skip the named tests
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Thu Nov 18 04:29:24 UTC 2010 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source4/scripting/devel/wintest/test-howto.py |  468 ++++++++++++++-----------
 source4/scripting/devel/wintest/tridge.conf   |   30 ++-
 source4/scripting/devel/wintest/wintest.py    |   42 ++-
 3 files changed, 320 insertions(+), 220 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/devel/wintest/test-howto.py b/source4/scripting/devel/wintest/test-howto.py
index e08595a..c53fc51 100755
--- a/source4/scripting/devel/wintest/test-howto.py
+++ b/source4/scripting/devel/wintest/test-howto.py
@@ -8,12 +8,8 @@ import wintest
 
 vars = {}
 
-parser = optparse.OptionParser("samba_dnsupdate")
-parser.add_option("--conf", type='string', default='', help='config file')
-
-
 def check_prerequesites(t):
-    print("Checking prerequesites")
+    t.info("Checking prerequesites")
     t.setvar('HOSTNAME', t.cmd_output("hostname -s").strip())
     if os.getuid() != 0:
         raise Exception("You must run this script as root")
@@ -22,7 +18,7 @@ def check_prerequesites(t):
 
 def build_s4(t):
     '''build samba4'''
-    print('Building s4')
+    t.info('Building s4')
     t.chdir('${SOURCETREE}/source4')
     t.putenv('CC', 'ccache gcc')
     t.run_cmd('make reconfigure || ./configure --enable-auto-reconfigure --enable-developer --prefix=${PREFIX} -C')
@@ -32,7 +28,7 @@ def build_s4(t):
 
 def provision_s4(t):
     '''provision s4 as a DC'''
-    print('Provisioning s4')
+    t.info('Provisioning s4')
     t.chdir('${PREFIX}')
     t.run_cmd("rm -rf etc private")
     t.run_cmd('sbin/provision --realm=${LCREALM} --domain=${DOMAIN} --adminpass=${PASSWORD1} --server-role="domain controller" --function-level=2008 -d${DEBUGLEVEL}')
@@ -41,7 +37,7 @@ def provision_s4(t):
     t.run_cmd('bin/samba-tool group addmembers "Allowed RODC Password Replication Group" testallowed')
 
 def start_s4(t, interfaces=None):
-    print('Starting Samba4')
+    t.info('Starting Samba4')
     t.chdir("${PREFIX}")
     t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
     t.run_cmd(['sbin/samba',
@@ -50,7 +46,7 @@ def start_s4(t, interfaces=None):
     t.port_wait("localhost", 445)
 
 def test_smbclient(t):
-    print('Testing smbclient')
+    t.info('Testing smbclient')
     t.chdir('${PREFIX}')
     t.cmd_contains("bin/smbclient --version", ["Version 4.0"])
     t.retry_cmd('bin/smbclient -L localhost -U%', ["netlogon", "sysvol", "IPC Service"])
@@ -66,7 +62,7 @@ def test_smbclient(t):
     child.sendline("rmdir testdir")
 
 def create_shares(t):
-    print("Adding test shares")
+    t.info("Adding test shares")
     t.chdir('${PREFIX}')
     f = open("etc/smb.conf", mode='a')
     f.write(t.substitute('''
@@ -83,7 +79,7 @@ def create_shares(t):
 
 
 def restart_bind(t):
-    print("Restarting bind9")
+    t.info("Restarting bind9")
     t.putenv('KEYTAB_FILE', '${PREFIX}/private/dns.keytab')
     t.putenv('KRB5_KTNAME', '${PREFIX}/private/dns.keytab')
     t.run_cmd('killall -9 -q named', checkfail=False)
@@ -95,7 +91,7 @@ def restart_bind(t):
     t.run_cmd("${RNDC} thaw")
 
 def test_dns(t):
-    print("Testing DNS")
+    t.info("Testing DNS")
     t.cmd_contains("host -t SRV _ldap._tcp.${LCREALM}.",
                  ['_ldap._tcp.${LCREALM} has SRV record 0 100 389 ${HOSTNAME}.${LCREALM}'])
     t.cmd_contains("host -t SRV  _kerberos._udp.${LCREALM}.",
@@ -104,7 +100,7 @@ def test_dns(t):
                  ['${HOSTNAME}.${LCREALM} has address'])
 
 def test_kerberos(t):
-    print("Testing kerberos")
+    t.info("Testing kerberos")
     t.run_cmd("kdestroy")
     t.kinit("administrator@${REALM}", "${PASSWORD1}")
     t.cmd_contains("klist -e", ["Ticket cache", "Default principal", "Valid starting"])
@@ -116,44 +112,49 @@ def test_dyndns(t):
     t.run_cmd("${RNDC} flush")
     t.cmd_contains("sbin/samba_dnsupdate --verbose", ["No DNS updates needed"])
 
-def join_win7(t):
-    print("Joining a Win7 box to the domain")
-    t.vm_poweroff("${WINDOWS7_VM}", checkfail=False)
-    t.vm_restore("${WINDOWS7_VM}", "${WINDOWS7_SNAPSHOT}")
-    t.ping_wait("${WINDOWS7}")
-    t.port_wait("${WINDOWS7}", 23)
-    child = t.open_telnet("${WINDOWS7}", "administrator", "${PASSWORD1}", set_time=True)
-    child.sendline("netdom join ${WINDOWS7} /Domain:${LCREALM} /PasswordD:${PASSWORD1} /UserD:administrator")
-    child.expect("The computer needs to be restarted in order to complete the operation")
+def run_winjoin(t, vm):
+    t.setwinvars(vm)
+
+    t.info("Joining a windows box to the domain")
+    t.vm_poweroff("${WIN_VM}", checkfail=False)
+    t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
+    t.ping_wait("${WIN_HOSTNAME}")
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True)
+    child.sendline("netdom join ${WIN_HOSTNAME} /Domain:${LCREALM} /PasswordD:${PASSWORD1} /UserD:administrator")
     child.expect("The command completed successfully")
     child.sendline("shutdown /r -t 0")
-    t.port_wait("${WINDOWS7}", 23, wait_for_fail=True)
-    t.port_wait("${WINDOWS7}", 23)
+    t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
+    t.port_wait("${WIN_HOSTNAME}", 23)
 
 
-def test_win7(t):
-    print("Checking the win7 join is OK")
+def test_winjoin(t, vm):
+    t.setwinvars(vm)
+    t.info("Checking the windows join is OK")
     t.chdir('${PREFIX}')
-    t.port_wait("${WINDOWS7}", 445)
-    t.retry_cmd('bin/smbclient -L ${WINDOWS7}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains("host -t A ${WINDOWS7}.${LCREALM}.", ['has address'])
-    t.cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -k no -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains('bin/smbclient -L ${WINDOWS7}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.port_wait("${WINDOWS7}", 23)
-    child = t.open_telnet("${WINDOWS7}", "${DOMAIN}\\administrator", "${PASSWORD1}")
+    t.port_wait("${WIN_HOSTNAME}", 445)
+    t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
+    t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k no -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}")
     child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
     child.expect("The command completed successfully")
-    t.vm_poweroff("${WINDOWS7_VM}")
-
-
-def join_w2k8(t):
-    print("Joining a w2k8 box to the domain as a DC")
-    t.vm_poweroff("${WINDOWS_DC1_VM}", checkfail=False)
-    t.vm_restore("${WINDOWS_DC1_VM}", "${WINDOWS_DC1_SNAPSHOT}")
-    t.ping_wait("${WINDOWS_DC1}")
-    t.port_wait("${WINDOWS_DC1}", 23)
-    child = t.open_telnet("${WINDOWS_DC1}", "administrator", "${WINDOWS_DC1_PASS}")
+    t.vm_poweroff("${WIN_VM}")
+
+
+def run_dcpromo(t, vm):
+    '''run a dcpromo on windows'''
+    t.setwinvars(vm)
+    
+    t.info("Joining a windows VM ${WIN_VM} to the domain as a DC using dcpromo")
+    t.vm_poweroff("${WIN_VM}", checkfail=False)
+    t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
+    t.ping_wait("${WIN_HOSTNAME}")
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}")
     child.sendline("copy /Y con answers.txt")
     child.sendline('''
 [DCInstall]
@@ -179,26 +180,27 @@ RebootOnCompletion=No
     if i != 0:
         raise Exception("dcpromo failed")
     child.sendline("shutdown -r -t 0")
-    t.port_wait("${WINDOWS_DC1}", 23, wait_for_fail=True)
-    t.port_wait("${WINDOWS_DC1}", 23)
+    t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
+    t.port_wait("${WIN_HOSTNAME}", 23)
 
 
-def test_w2k8(t):
-    print("Checking the w2k8 join is OK")
+def test_dcpromo(t, vm):
+    t.setwinvars(vm)
+    t.info("Checking the dcpromo join is OK")
     t.chdir('${PREFIX}')
-    t.port_wait("${WINDOWS_DC1}", 445)
-    t.retry_cmd('bin/smbclient -L ${WINDOWS_DC1}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains("host -t A ${WINDOWS_DC1}.${LCREALM}.", ['has address'])
-    t.cmd_contains('bin/smbclient -L ${WINDOWS_DC1}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.port_wait("${WINDOWS_DC1}", 23)
+    t.port_wait("${WIN_HOSTNAME}", 445)
+    t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
+    t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.port_wait("${WIN_HOSTNAME}", 23)
 
     t.cmd_contains("bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
-    t.cmd_contains("bin/samba-tool drs kcc ${WINDOWS_DC1} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
+    t.cmd_contains("bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
 
     t.kinit("administrator@${REALM}", "${PASSWORD1}")
     for nc in [ '${BASEDN}', 'CN=Configuration,${BASEDN}', 'CN=Schema,CN=Configuration,${BASEDN}' ]:
-        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WINDOWS_DC1} %s -k yes" % nc, ["was successful"])
-        t.cmd_contains("bin/samba-tool drs replicate ${WINDOWS_DC1} ${HOSTNAME} %s -k yes" % nc, ["was successful"])
+        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"])
+        t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME} ${HOSTNAME} %s -k yes" % nc, ["was successful"])
 
     t.cmd_contains("bin/samba-tool drs showrepl ${HOSTNAME} -k yes",
                  [ "INBOUND NEIGHBORS",
@@ -213,7 +215,7 @@ def test_w2k8(t):
                    "Last success"],
                  ordered=True)
 
-    t.cmd_contains("bin/samba-tool drs showrepl ${WINDOWS_DC1} -k yes",
+    t.cmd_contains("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -k yes",
                  [ "INBOUND NEIGHBORS",
                    "${BASEDN}",
                    "Last attempt", "was successful",
@@ -226,13 +228,13 @@ def test_w2k8(t):
                    "Last success" ],
                  ordered=True)
 
-    child = t.open_telnet("${WINDOWS_DC1}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
     child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
     child.expect("The command completed successfully")
 
     t.run_net_time(child)
 
-    print("Checking if showrepl is happy")
+    t.info("Checking if showrepl is happy")
     child.sendline("repadmin /showrepl")
     child.expect("${BASEDN}")
     child.expect("was successful")
@@ -241,12 +243,12 @@ def test_w2k8(t):
     child.expect("CN=Schema,CN=Configuration,${BASEDN}")
     child.expect("was successful")
 
-    print("Checking if new users propogate to windows")
+    t.info("Checking if new users propogate to windows")
     t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
 
-    print("Checking if new users on windows propogate to samba")
+    t.info("Checking if new users on windows propogate to samba")
     child.sendline("net user test3 ${PASSWORD3} /add")
     while True:
         i = child.expect(["The command completed successfully",
@@ -258,25 +260,26 @@ def test_w2k8(t):
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
 
-    print("Checking propogation of user deletion")
+    t.info("Checking propogation of user deletion")
     t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${LCREALM}%${PASSWORD1}')
     child.sendline("net user test3 /del")
     child.expect("The command completed successfully")
 
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC1} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
-    t.vm_poweroff("${WINDOWS_DC1_VM}")
+    t.vm_poweroff("${WIN_VM}")
 
 
-def join_w2k8_rodc(t):
-    print("Joining a w2k8 box to the domain as a RODC")
-    t.vm_poweroff("${WINDOWS_DC2_VM}", checkfail=False)
-    t.vm_restore("${WINDOWS_DC2_VM}", "${WINDOWS_DC2_SNAPSHOT}")
-    t.ping_wait("${WINDOWS_DC2}")
-    t.port_wait("${WINDOWS_DC2}", 23)
-    child = t.open_telnet("${WINDOWS_DC2}", "administrator", "${WINDOWS_DC2_PASS}")
+def run_dcpromo_rodc(t, vm):
+    t.setwinvars(vm)
+    t.info("Joining a w2k8 box to the domain as a RODC")
+    t.vm_poweroff("${WIN_VM}", checkfail=False)
+    t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
+    t.ping_wait("${WIN_HOSTNAME}")
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}")
     child.sendline("copy /Y con answers.txt")
     child.sendline('''
 [DCInstall]
@@ -309,24 +312,25 @@ RebootOnCompletion=No
     if i != 0:
         raise Exception("dcpromo failed")
     child.sendline("shutdown -r -t 0")
-    t.port_wait("${WINDOWS_DC2}", 23, wait_for_fail=True)
-    t.port_wait("${WINDOWS_DC2}", 23)
+    t.port_wait("${WIN_HOSTNAME}", 23, wait_for_fail=True)
+    t.port_wait("${WIN_HOSTNAME}", 23)
 
 
 
-def test_w2k8_rodc(t):
-    print("Checking the w2k8 RODC join is OK")
+def test_dcpromo_rodc(t, vm):
+    t.setwinvars(vm)
+    t.info("Checking the w2k8 RODC join is OK")
     t.chdir('${PREFIX}')
-    t.port_wait("${WINDOWS_DC2}", 445)
-    t.retry_cmd('bin/smbclient -L ${WINDOWS_DC2}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains("host -t A ${WINDOWS_DC2}.${LCREALM}.", ['has address'])
-    t.cmd_contains('bin/smbclient -L ${WINDOWS_DC2}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
-    t.port_wait("${WINDOWS_DC2}", 23)
-    child = t.open_telnet("${WINDOWS_DC2}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
+    t.port_wait("${WIN_HOSTNAME}", 445)
+    t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
+    t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
     child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
     child.expect("The command completed successfully")
 
-    print("Checking if showrepl is happy")
+    t.info("Checking if showrepl is happy")
     child.sendline("repadmin /showrepl")
     child.expect("${BASEDN}")
     child.expect("was successful")
@@ -335,188 +339,238 @@ def test_w2k8_rodc(t):
     child.expect("CN=Schema,CN=Configuration,${BASEDN}")
     child.expect("was successful")
 
-    print("Checking if new users are available on windows")
+    t.info("Checking if new users are available on windows")
     t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
     t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${LCREALM}%${PASSWORD1}')
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC2} -Utest2%${PASSWORD2}", ['LOGON_FAILURE'])
-    t.vm_poweroff("${WINDOWS_DC2_VM}")
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2}", ['LOGON_FAILURE'])
+    t.vm_poweroff("${WIN_VM}")
 
 
-def vampire_w2k8(t):
-    print("Joining w2k8 as a second DC")
+def join_as_dc(t, vm):
+    t.setwinvars(vm)
+    t.info("Joining ${WIN_VM} as a second DC using samba-tool join DC")
     t.chdir('${PREFIX}')
     t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
-    t.vm_poweroff("${WINDOWS_DC3_VM}", checkfail=False)
-    t.vm_restore("${WINDOWS_DC3_VM}", "${WINDOWS_DC3_SNAPSHOT}")
+    t.vm_poweroff("${WIN_VM}", checkfail=False)
+    t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
     t.run_cmd('${RNDC} flush')
     t.run_cmd("rm -rf etc private")
-    t.open_telnet("${WINDOWS_DC3}", "${WINDOWS_DC3_DOMAIN}\\administrator", "${WINDOWS_DC3_PASS}", set_time=True)
-    t.retry_cmd("bin/samba-tool drs showrepl ${WINDOWS_DC3} -Uadministrator%${WINDOWS_DC3_PASS}", ['INBOUND NEIGHBORS'] )
-    t.run_cmd('bin/samba-tool join ${WINDOWS_DC3_REALM} DC -Uadministrator%${WINDOWS_DC3_PASS} -d${DEBUGLEVEL}')
-    t.run_cmd('bin/samba-tool drs kcc ${WINDOWS_DC3} -Uadministrator@${WINDOWS_DC3_REALM}%${WINDOWS_DC3_PASS}')
+    t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
+    t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] )
+    t.run_cmd('bin/samba-tool join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL}')
+    t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
 
 
-def test_vampire(t):
-    print("Checking the DC join is OK")
+def test_join_as_dc(t, vm):
+    t.setwinvars(vm)
+    t.info("Checking the DC join is OK")
     t.chdir('${PREFIX}')
-    t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WINDOWS_DC3_REALM} -Uadministrator@${WINDOWS_DC3_REALM}%${WINDOWS_DC3_PASS}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains("host -t A ${HOSTNAME}.${WINDOWS_DC3_REALM}.", ['has address'])
-    t.port_wait("${WINDOWS_DC3}", 23)
-    child = t.open_telnet("${WINDOWS_DC3}", "${WINDOWS_DC3_DOMAIN}\\administrator", "${WINDOWS_DC3_PASS}", set_time=True)
+    t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address'])
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
 
-    print("Forcing kcc runs, and replication")
-    t.run_cmd('bin/samba-tool drs kcc ${WINDOWS_DC3} -Uadministrator@${WINDOWS_DC3_REALM}%${WINDOWS_DC3_PASS}')
-    t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${WINDOWS_DC3_REALM}%${WINDOWS_DC3_PASS}')
+    t.info("Forcing kcc runs, and replication")
+    t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
+    t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
 
-    t.kinit("administrator@${WINDOWS_DC3_REALM}", "${WINDOWS_DC3_PASS}")
-    for nc in [ '${WINDOWS_DC3_BASEDN}', 'CN=Configuration,${WINDOWS_DC3_BASEDN}', 'CN=Schema,CN=Configuration,${WINDOWS_DC3_BASEDN}' ]:
-        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WINDOWS_DC3} %s -k yes" % nc, ["was successful"])
-        t.cmd_contains("bin/samba-tool drs replicate ${WINDOWS_DC3} ${HOSTNAME} %s -k yes" % nc, ["was successful"])
+    t.kinit("administrator@${WIN_REALM}", "${WIN_PASS}")
+    for nc in [ '${WIN_BASEDN}', 'CN=Configuration,${WIN_BASEDN}', 'CN=Schema,CN=Configuration,${WIN_BASEDN}' ]:
+        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"])
+        t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME} ${HOSTNAME} %s -k yes" % nc, ["was successful"])
 
-    child.sendline("net use t: \\\\${HOSTNAME}.${WINDOWS_DC3_REALM}\\test")
+    child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
     child.expect("The command completed successfully")
 
-    print("Checking if showrepl is happy")
+    t.info("Checking if showrepl is happy")
     child.sendline("repadmin /showrepl")
-    child.expect("${WINDOWS_DC3_BASEDN}")
+    child.expect("${WIN_BASEDN}")
     child.expect("was successful")
-    child.expect("CN=Configuration,${WINDOWS_DC3_BASEDN}")
+    child.expect("CN=Configuration,${WIN_BASEDN}")
     child.expect("was successful")
-    child.expect("CN=Schema,CN=Configuration,${WINDOWS_DC3_BASEDN}")
+    child.expect("CN=Schema,CN=Configuration,${WIN_BASEDN}")
     child.expect("was successful")
 
-    print("Checking if new users propogate to windows")
+    t.info("Checking if new users propogate to windows")
     t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
 
-    print("Checking if new users on windows propogate to samba")
+    t.info("Checking if new users on windows propogate to samba")
     child.sendline("net user test3 ${PASSWORD3} /add")
     child.expect("The command completed successfully")
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'IPC'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'IPC'])
 
-    print("Checking propogation of user deletion")
-    t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${WINDOWS_DC3_REALM}%${WINDOWS_DC3_PASS}')
+    t.info("Checking propogation of user deletion")
+    t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${WIN_REALM}%${WIN_PASS}')
     child.sendline("net user test3 /del")
     child.expect("The command completed successfully")
 
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])
-    t.retry_cmd("bin/smbclient -L ${WINDOWS_DC3} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
+    t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
     t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
-    t.vm_poweroff("${WINDOWS_DC3_VM}")
+    t.vm_poweroff("${WIN_VM}")
 
 
-def vampire_w2k3(t):
-    print("Joining w2k3 as a second DC")
+def join_as_rodc(t, vm):
+    t.setwinvars(vm)
+    t.info("Joining ${WIN_VM} as a RODC using samba-tool join DC")
     t.chdir('${PREFIX}')
     t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
-    t.vm_poweroff("${WINDOWS_DC4_VM}", checkfail=False)
-    t.vm_restore("${WINDOWS_DC4_VM}", "${WINDOWS_DC4_SNAPSHOT}")
+    t.vm_poweroff("${WIN_VM}", checkfail=False)
+    t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
     t.run_cmd('${RNDC} flush')
     t.run_cmd("rm -rf etc private")
-    t.open_telnet("${WINDOWS_DC4}", "${WINDOWS_DC4_DOMAIN}\\administrator", "${WINDOWS_DC4_PASS}", set_time=True)
-    t.retry_cmd("bin/samba-tool drs showrepl ${WINDOWS_DC4} -Uadministrator%${WINDOWS_DC4_PASS}", ['INBOUND NEIGHBORS'] )
-    t.run_cmd('bin/samba-tool join ${WINDOWS_DC4_REALM} DC -Uadministrator%${WINDOWS_DC4_PASS} -d${DEBUGLEVEL}')
-    t.run_cmd('bin/samba-tool drs kcc ${WINDOWS_DC4} -Uadministrator@${WINDOWS_DC4_REALM}%${WINDOWS_DC4_PASS}')
+    t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
+    t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] )
+    t.run_cmd('bin/samba-tool join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL}')
+    t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
 
 
-def test_vampire_w2k3(t):
-    print("Checking the DC join is OK")
+def test_join_as_rodc(t, vm):
+    t.setwinvars(vm)
+    t.info("Checking the RODC join is OK")
     t.chdir('${PREFIX}')
-    t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WINDOWS_DC4_REALM} -Uadministrator@${WINDOWS_DC4_REALM}%${WINDOWS_DC4_PASS}', ["C$", "IPC$", "Sharename"])
-    t.cmd_contains("host -t A ${HOSTNAME}.${WINDOWS_DC4_REALM}.", ['has address'])
-    t.port_wait("${WINDOWS_DC4}", 23)
-    child = t.open_telnet("${WINDOWS_DC4}", "${WINDOWS_DC4_DOMAIN}\\administrator", "${WINDOWS_DC4_PASS}", set_time=True)
+    t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"])
+    t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address'])
+    t.port_wait("${WIN_HOSTNAME}", 23)
+    child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
 
-    print("Forcing kcc runs, and replication")
-    t.run_cmd('bin/samba-tool drs kcc ${WINDOWS_DC4} -Uadministrator@${WINDOWS_DC4_REALM}%${WINDOWS_DC4_PASS}')
-    t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${WINDOWS_DC4_REALM}%${WINDOWS_DC4_PASS}')
+    t.info("Forcing kcc runs, and replication")
+    t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
 
-    t.kinit("administrator@${WINDOWS_DC4_REALM}", "${WINDOWS_DC4_PASS}")
-    for nc in [ '${WINDOWS_DC4_BASEDN}', 'CN=Configuration,${WINDOWS_DC4_BASEDN}', 'CN=Schema,CN=Configuration,${WINDOWS_DC4_BASEDN}' ]:
-        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WINDOWS_DC4} %s -k yes" % nc, ["was successful"])
-        t.cmd_contains("bin/samba-tool drs replicate ${WINDOWS_DC4} ${HOSTNAME} %s -k yes" % nc, ["was successful"])
+    t.kinit("administrator@${WIN_REALM}", "${WIN_PASS}")
+    for nc in [ '${WIN_BASEDN}', 'CN=Configuration,${WIN_BASEDN}', 'CN=Schema,CN=Configuration,${WIN_BASEDN}' ]:
+        t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"])


-- 
Samba Shared Repository


More information about the samba-cvs mailing list