line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
818
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
708
|
use HH::Unispool::Config; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
492
|
use HH::Unispool::Config::OS; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
483
|
|
5
|
1
|
|
|
1
|
|
518
|
use HH::Unispool::Config::Entry::Filter; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
857
|
use HH::Unispool::Config::Entry::System; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
691
|
use HH::Unispool::Config::Entry::Device::5; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
811
|
use HH::Unispool::Config::Entry::Device::6; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
708
|
use HH::Unispool::Config::Entry::RemoteSystem::8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
415
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Read and write config |
12
|
|
|
|
|
|
|
my $conf1 = HH::Unispool::Config->new_from_file('t/config.sample'); |
13
|
|
|
|
|
|
|
$conf1->write('t/config.sample.1.out'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Read again, modify a little and diff config |
16
|
|
|
|
|
|
|
my $conf2 = HH::Unispool::Config->new_from_file('t/config.sample'); |
17
|
|
|
|
|
|
|
$conf2->delete_system('foobar.bar.org'); |
18
|
|
|
|
|
|
|
my $diff = $conf1->diff($conf2); |
19
|
|
|
|
|
|
|
if ($diff) { |
20
|
|
|
|
|
|
|
print STDERR "\nTHIS OUTPUT IS EXPECTED\n"; |
21
|
|
|
|
|
|
|
print STDERR "DIFFERENCES\n"; |
22
|
|
|
|
|
|
|
print STDERR $diff; |
23
|
|
|
|
|
|
|
print STDERR "\nTHIS OUTPUT WAS EXPECTED\n"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create a config from scratch |
28
|
|
|
|
|
|
|
my $conf3 = HH::Unispool::Config->new(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Create a filter and add it to the configuration |
31
|
|
|
|
|
|
|
my $flt = HH::Unispool::Config::Entry::Filter->new( { |
32
|
|
|
|
|
|
|
name => 'cat', |
33
|
|
|
|
|
|
|
file => '/usr/bin/cat', |
34
|
|
|
|
|
|
|
} ); |
35
|
|
|
|
|
|
|
$conf3->add_filter($flt); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Create the _Network_ system and add it to the configuration |
38
|
|
|
|
|
|
|
my $sysn = HH::Unispool::Config::Entry::System->new( { |
39
|
|
|
|
|
|
|
name => '_Network_', |
40
|
|
|
|
|
|
|
} ); |
41
|
|
|
|
|
|
|
$conf3->add_system($sysn); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Add a type 8 remote system to _Network_ |
44
|
|
|
|
|
|
|
my $rsys = HH::Unispool::Config::Entry::RemoteSystem::8->new( { |
45
|
|
|
|
|
|
|
name => 'foo', |
46
|
|
|
|
|
|
|
os => HH::Unispool::Config::OS->new( { os => 'Solaris' } ), |
47
|
|
|
|
|
|
|
remote_node_name => 'foo.bar.org', |
48
|
|
|
|
|
|
|
} ); |
49
|
|
|
|
|
|
|
$sysn->add_remote_system($rsys); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Add a type 5 device to _Network_ |
52
|
|
|
|
|
|
|
my $dev = HH::Unispool::Config::Entry::Device::5->new( { |
53
|
|
|
|
|
|
|
name => 'lp', |
54
|
|
|
|
|
|
|
filter_name => 'cat', |
55
|
|
|
|
|
|
|
remote_device_name => 'lp', |
56
|
|
|
|
|
|
|
remote_system_name => 'foo', |
57
|
|
|
|
|
|
|
description => 'lp', |
58
|
|
|
|
|
|
|
} ); |
59
|
|
|
|
|
|
|
$sysn->add_device($dev); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Create the foo.bar.org system and add it to the configuration |
62
|
|
|
|
|
|
|
my $sysf = HH::Unispool::Config::Entry::System->new( { |
63
|
|
|
|
|
|
|
name => 'foo.bar.org', |
64
|
|
|
|
|
|
|
local_system_name => 'foo', |
65
|
|
|
|
|
|
|
network_name => 'foo.bar.org', |
66
|
|
|
|
|
|
|
os => HH::Unispool::Config::OS->new( { os => 'Solaris' } ), |
67
|
|
|
|
|
|
|
type => 'cs', |
68
|
|
|
|
|
|
|
} ); |
69
|
|
|
|
|
|
|
$conf3->add_system($sysf); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Add a type 6 device to foo.bar.org |
72
|
|
|
|
|
|
|
$dev = HH::Unispool::Config::Entry::Device::6->new( { |
73
|
|
|
|
|
|
|
name => 'lp1', |
74
|
|
|
|
|
|
|
filter_name => 'cat', |
75
|
|
|
|
|
|
|
remote_node_name => 'lp1.foo.bar.org', |
76
|
|
|
|
|
|
|
description => 'lp1', |
77
|
|
|
|
|
|
|
} ); |
78
|
|
|
|
|
|
|
$sysf->add_device($dev); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Add another type 6 device to foo.bar.org |
81
|
|
|
|
|
|
|
$dev = HH::Unispool::Config::Entry::Device::6->new( { |
82
|
|
|
|
|
|
|
name => 'lp2', |
83
|
|
|
|
|
|
|
filter_name => 'cat', |
84
|
|
|
|
|
|
|
remote_node_name => 'lp2.foo.bar.org', |
85
|
|
|
|
|
|
|
description => 'lp2', |
86
|
|
|
|
|
|
|
} ); |
87
|
|
|
|
|
|
|
$sysf->add_device($dev); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Add another type 3 device to foo.bar.org |
90
|
|
|
|
|
|
|
$dev = HH::Unispool::Config::Entry::Device::3->new( { |
91
|
|
|
|
|
|
|
name => 'lp', |
92
|
|
|
|
|
|
|
filter_name => 'cat', |
93
|
|
|
|
|
|
|
member_device_name => [ qw( lp1 lp2 ) ], |
94
|
|
|
|
|
|
|
description => 'lp', |
95
|
|
|
|
|
|
|
} ); |
96
|
|
|
|
|
|
|
$sysf->add_device($dev); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# Write the configuration |
99
|
|
|
|
|
|
|
$conf3->write('t/config.sample.3.out'); |
100
|
|
|
|
|
|
|
1; |