## Command line defined variables. ## SERVERS => 'genbchoff.srv' ## Command line defined parameters. use frsobjsup; package main; my ($__HashRef, $__k, $__v); my (%CMD_VARS, %CMD_PARS); &FRSSUP::ProcessCmdLine(\%CMD_VARS, \%CMD_PARS); my $Usage = " Specific Usage: perl $0 [cmd options] \> output Process the genbchoff.mrs configuration script. Command line options must be prefixed with a dash. The required input options to this script are: -DREPLICA_SET_NAME=\"name of replica set\" The REPLICA_SET_NAME parameter overrides the value set to the \$replica_set_name variable in the server_input_file. "; FRSSUP::CheckForHelp(\%CMD_PARS, \$Usage); sub CREATE_HUB_SPOKE_CONN { my %__args = (@_); my ($__HashRef, $__k, $__v); $Hx = 0; $NHub = scalar @{ $__args{HUBSET} } ; #print " NHUB = $NHub\n\n" #print " NBCH FRS _COUNT_SET( /SET= % BCHSET % ) " foreach $bch ( @{ $__args{BCHSET} } ) { #print "working on branch: $bch->{MNAME}\n" $hubsrv = $__args{HUBSET}[$Hx]; FRS_CONNECTION->New( TO=>$bch, FROM=>$__args{HUBSET}[$Hx], SCHED=>$__args{SC1}, TIME_ZONE=>$bch->{time_zone}, ONAME=>"FROM-".$hubsrv->{MNAME}."-TO-".$bch->{MNAME} ); FRS_CONNECTION->New( TO=>$__args{HUBSET}[$Hx], FROM=>$bch, SCHED=>$__args{SC1}, TIME_ZONE=>$hubsrv->{time_zone}, ONAME=>"FROM-".$bch->{MNAME}."-TO-".$hubsrv->{MNAME} ); $Hx=($Hx+1) % $NHub; if ($Hx == 0) { FRS_SCHEDULE::FRS_STAGGER( SCHED=>$__args{SC1} ); } } } # FRS_END_SUB sub CREATE_RING_CONN { my %__args = (@_); my ($__HashRef, $__k, $__v); $Ringx = 0; $RingCount = scalar @{ $__args{HUBSET} } ; #print " RingCount = $RingCount\n\n" for ($Ringx=0; $Ringx < $RingCount-1; $Ringx++) { $RM1 = $__args{HUBSET}[$Ringx]; $RM2 = $__args{HUBSET}[($Ringx+1) % $RingCount]; FRS_CONNECTION->New( TO=>$RM1, FROM=>$RM2, SCHED=>ON, TIME_ZONE=>$RM1->{time_zone}, ONAME=>"FROM-".$RM2->{MNAME}."-TO-".$RM1->{MNAME} ); FRS_CONNECTION->New( TO=>$RM2, FROM=>$RM1, SCHED=>ON, TIME_ZONE=>$RM2->{time_zone}, ONAME=>"FROM-".$RM1->{MNAME}."-TO-".$RM2->{MNAME} ); } } # FRS_END_SUB sub CREATE_HUB_SPOKE { my %__args = (@_); my ($__HashRef, $__k, $__v); #FRSSUP::PrintHash(\% # Restriction: All subroutine argument refs are surrounded by "%" # notation "->{...}" foreach $hub ( @{ $__args{HUBSET} } ) { $__HashRef = FRS_MEMBER->New( UNDER=>$__args{REPSETDN}, SERVER=>$hub, COMPUTER=>$hub->{COMPUTER}, ONAME=>$hub->{MNAME} ); &FRSSUP::AddToSet("MOBJHUB", $__HashRef); } foreach $bch ( @{ FRSSUP::FRS_SET( SET=>$__args{BCHSET} ) } ) { $__HashRef = FRS_MEMBER->New( UNDER=>$__args{REPSETDN}, SERVER=>$bch, COMPUTER=>$bch->{COMPUTER}, ONAME=>$bch->{MNAME} ); &FRSSUP::AddToSet("MOBJBCH", $__HashRef); } &CREATE_RING_CONN ( HUBSET=>&FRSSUP::SelectSet(MOBJHUB) ); &CREATE_HUB_SPOKE_CONN ( HUBSET=>&FRSSUP::SelectSet(MOBJHUB), BCHSET=>&FRSSUP::SelectSet(MOBJBCH), SC1=>$__args{SC1} ); &FRSSUP::DeleteSet("MOBJHUB"); &FRSSUP::DeleteSet("MOBJBCH"); } # FRS_END_SUB $replica_set_name = "genbchoff-test-1hub"; $__HashRef = FRS_SETTINGS->New( DN=>"cn=system,dc=frs0419,dc=nttest,dc=microsoft,dc=com", ONAME=>"cn=file replication service" ); &FRSSUP::AddToSet("SETTINGS", $__HashRef); $__HashRef = FRS_SERVER->New( COMPUTER=>'FRSDIFF\\sudarctest1$', DNS_NAME=>"sudarctest1.frs0419.nttest.microsoft.com", MNAME=>"H-sudarctest1", RP=>"E:\\RSB", SP=>"D:\\staging", MAKE_PRIMARY_MEMBER=>TRUE ); &FRSSUP::AddToSet("HUB", $__HashRef); $__HashRef = FRS_SERVER->New( COMPUTER=>'FRSDIFF\\sudarctest4$', DNS_NAME=>"sudarctest4.frs0419.nttest.microsoft.com", MNAME=>"B-sudarctest4", RP=>"D:\\RSB", SP=>"D:\\staging" ); &FRSSUP::AddToSet("BCH", $__HashRef); $__HashRef = FRS_SERVER->New( COMPUTER=>'FRSDIFF\\DREWSAM-SRV$', DNS_NAME=>"DREWSAM-SRV.frs0419.nttest.microsoft.com", MNAME=>"B-DREWSAM-SRV", RP=>"D:\\RSB", SP=>"D:\\staging" ); &FRSSUP::AddToSet("BCH", $__HashRef); $__HashRef = FRS_SERVER->New( COMPUTER=>'FRSDIFF\\sudarctest2$', DNS_NAME=>"sudarctest2.frs0419.nttest.microsoft.com", MNAME=>"B-sudarctest2", RP=>"D:\\RSB", SP=>"D:\\staging" ); &FRSSUP::AddToSet("BCH", $__HashRef); $__HashRef = FRS_SCHEDULE->New( REPL_INTERVAL=>4, REPL_DURATION=>"1:30", TIME_ZONE=>"-5:00", REPL_OFFSET=>0, STAGGER=>"0:15", METHOD=>1, NAME=>'Primary Sched', DISABLE=>"mo:07:30-mo:18:00,tu:07:30-tu:18:00,we:07:30-we:18:00,th:07:30-th:18:00,fr:07:30-fr:18:00" ); &FRSSUP::AddToSet("PRIMARY_SCH", $__HashRef); if (exists $CMD_VARS{"REPLICA_SET_NAME"}) { $replica_set_name = $CMD_VARS{"REPLICA_SET_NAME"}; } FRSSUP::ShowHelp("ERROR - Required parameter replica set name not found.", \$Usage) if (!defined $replica_set_name); $__HashRef = FRS_REPLICASET->New( UNDER=>&FRSSUP::SelectSet(SETTINGS)->[0], TYPE=>DFS, ONAME=>$replica_set_name ); &FRSSUP::AddToSet("SET", $__HashRef); &CREATE_HUB_SPOKE ( HUBSET=>&FRSSUP::SelectSet(HUB), BCHSET=>&FRSSUP::SelectSet(BCH), SC1=>&FRSSUP::SelectSet(PRIMARY_SCH)->[0], REPSETDN=>&FRSSUP::SelectSet(SET)->[0] ); __END__