selftest: add vampire_2000_dc environment
authorBob Campbell <bobcampbell@catalyst.net.nz>
Tue, 7 Feb 2017 20:16:41 +0000 (09:16 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 14 Feb 2017 01:20:07 +0000 (02:20 +0100)
This is the equivalent of vampire_dc, but using a domain functional
level of DS_DOMAIN_FUNCTION_2000.

Using this functional level is useful for tests involving replication
and linked attributes, as they behave differently at it.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11139
Pair-programmed-with: Bob Campbell <bobcampbell@catalyst.net.nz>

selftest/selftest.pl
selftest/target/Samba.pm
selftest/target/Samba4.pm

index bfc8d7f7d914ed8bf77c2a315fb457cba7980033..45e0ae0451f1851530602c4abbeb906add5085fb 100755 (executable)
@@ -811,6 +811,13 @@ my @exported_envvars = (
        "VAMPIRE_DC_NETBIOSNAME",
        "VAMPIRE_DC_NETBIOSALIAS",
 
+       # domain controller stuff for FL 2000 Vampired DC
+       "VAMPIRE_2000_DC_SERVER",
+       "VAMPIRE_2000_DC_SERVER_IP",
+       "VAMPIRE_2000_DC_SERVER_IPV6",
+       "VAMPIRE_2000_DC_NETBIOSNAME",
+       "VAMPIRE_2000_DC_NETBIOSALIAS",
+
        "PROMOTED_DC_SERVER",
        "PROMOTED_DC_SERVER_IP",
        "PROMOTED_DC_SERVER_IPV6",
index 24484c970e7052961fff9a4148d891feda2d1a6b..e5c7f93fe039a0fdc44bd29b39014170f166aa21 100644 (file)
@@ -308,6 +308,7 @@ sub get_interface($)
     $interfaces{"fakednsforwarder1"} = 36;
     $interfaces{"fakednsforwarder2"} = 37;
     $interfaces{"s4member_dflt"} = 38;
+    $interfaces{"vampire2000dc"} = 39;
 
     # update lib/socket_wrapper/socket_wrapper.c
     #  #define MAX_WRAPPED_INTERFACES 40
index dacdab40ac8bc5931f51511566820e088599abf3..8b5e699389b31f9aedf0823c86c2ed79016518b2 100755 (executable)
@@ -1246,15 +1246,20 @@ sub provision_promoted_dc($$$)
 
 sub provision_vampire_dc($$$)
 {
-       my ($self, $prefix, $dcvars) = @_;
-       print "PROVISIONING VAMPIRE DC...\n";
+       my ($self, $prefix, $dcvars, $fl) = @_;
+       print "PROVISIONING VAMPIRE DC @ FL $fl...\n";
+       my $name = "localvampiredc";
+
+       if ($fl == "2000") {
+           $name = "vampire2000dc";
+       }
 
        # We do this so that we don't run the provision.  That's the job of 'net vampire'.
        my $ctx = $self->provision_raw_prepare($prefix, "domain controller",
-                                              "localvampiredc",
-                                              "SAMBADOMAIN",
-                                              "samba.example.com",
-                                              "2008",
+                                              $name,
+                                              $dcvars->{DOMAIN},
+                                              $dcvars->{REALM},
+                                              $fl,
                                               $dcvars->{PASSWORD},
                                               $dcvars->{SERVER_IP},
                                               $dcvars->{SERVER_IPV6});
@@ -1299,11 +1304,17 @@ sub provision_vampire_dc($$$)
                return undef;
        }
 
-       $ret->{VAMPIRE_DC_SERVER} = $ret->{SERVER};
-       $ret->{VAMPIRE_DC_SERVER_IP} = $ret->{SERVER_IP};
-       $ret->{VAMPIRE_DC_SERVER_IPV6} = $ret->{SERVER_IPV6};
-       $ret->{VAMPIRE_DC_NETBIOSNAME} = $ret->{NETBIOSNAME};
-
+        if ($fl == "2000") {
+               $ret->{VAMPIRE_2000_DC_SERVER} = $ret->{SERVER};
+               $ret->{VAMPIRE_2000_DC_SERVER_IP} = $ret->{SERVER_IP};
+               $ret->{VAMPIRE_2000_DC_SERVER_IPV6} = $ret->{SERVER_IPV6};
+               $ret->{VAMPIRE_2000_DC_NETBIOSNAME} = $ret->{NETBIOSNAME};
+        } else {
+               $ret->{VAMPIRE_DC_SERVER} = $ret->{SERVER};
+               $ret->{VAMPIRE_DC_SERVER_IP} = $ret->{SERVER_IP};
+               $ret->{VAMPIRE_DC_SERVER_IPV6} = $ret->{SERVER_IPV6};
+               $ret->{VAMPIRE_DC_NETBIOSNAME} = $ret->{NETBIOSNAME};
+        }
        $ret->{DC_SERVER} = $dcvars->{DC_SERVER};
        $ret->{DC_SERVER_IP} = $dcvars->{DC_SERVER_IP};
        $ret->{DC_SERVER_IPV6} = $dcvars->{DC_SERVER_IPV6};
@@ -2002,6 +2013,11 @@ sub setup_env($$$)
                return $self->setup_ad_dc_ntvfs("$path/ad_dc_ntvfs");
        } elsif ($envname eq "fl2000dc") {
                return $self->setup_fl2000dc("$path/fl2000dc");
+       } elsif ($envname eq "vampire_2000_dc") {
+               if (not defined($self->{vars}->{fl2000dc})) {
+                       $self->setup_fl2000dc("$path/fl2000dc");
+               }
+               return $self->setup_vampire_dc("$path/vampire_2000_dc", $self->{vars}->{fl2000dc}, "2000");
        } elsif ($envname eq "fl2003dc") {
                if (not defined($self->{vars}->{ad_dc})) {
                        $self->setup_ad_dc("$path/ad_dc");
@@ -2021,7 +2037,7 @@ sub setup_env($$$)
                if (not defined($self->{vars}->{ad_dc_ntvfs})) {
                        $self->setup_ad_dc_ntvfs("$path/ad_dc_ntvfs");
                }
-               return $self->setup_vampire_dc("$path/vampire_dc", $self->{vars}->{ad_dc_ntvfs});
+               return $self->setup_vampire_dc("$path/vampire_dc", $self->{vars}->{ad_dc_ntvfs}, "2008");
        } elsif ($envname eq "promoted_dc") {
                if (not defined($self->{vars}->{ad_dc_ntvfs})) {
                        $self->setup_ad_dc_ntvfs("$path/ad_dc_ntvfs");
@@ -2211,11 +2227,11 @@ sub setup_fl2008r2dc($$$)
        return $env;
 }
 
-sub setup_vampire_dc($$$)
+sub setup_vampire_dc($$$$)
 {
-       my ($self, $path, $dc_vars) = @_;
+       my ($self, $path, $dc_vars, $fl) = @_;
 
-       my $env = $self->provision_vampire_dc($path, $dc_vars);
+       my $env = $self->provision_vampire_dc($path, $dc_vars, $fl);
 
        if (defined $env) {
                if (not defined($self->check_or_start($env, "single"))) {