line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eixo::Zone::Artifact::NetworkBridge; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1630
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
8
|
use parent qw(Eixo::Zone::Artifact); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new{ |
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
0
|
|
return bless({ |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
name=>$_[1], |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
ctl=>$_[2], |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
ns=>undef, |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
f_created=>undef |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
}, $_[0]); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub integrity{ |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
0
|
0
|
|
($_[0]->{f_created}) ? $_[0]->exists : !$_[0]->exists; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub setAddr{ |
28
|
0
|
|
|
0
|
0
|
|
my ($self, $addr) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
die(ref($self) . "::setAddr: bridge not created") |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
unless($self->{f_created}); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my ($method, @extra) = $self->__getMethod("link_addr"); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self->{ctl}->$method($self->{name}, $addr, @extra); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub create{ |
41
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
return if($self->{f_created}); |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my ($method, @extra) = $self->__getMethod("bridge_create"); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$self->{ctl}->$method($self->{name}, @extra); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self->{f_created} = 1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub clean{ |
54
|
0
|
|
|
0
|
0
|
|
$_[0]->delete; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub delete{ |
58
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
return unless($self->{f_created}); |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my ($method, @extra) = $self->__getMethod("bridge_rm"); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->{ctl}->$method($self->{name}, @extra); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->{f_created} = undef; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub setns{ |
70
|
0
|
|
|
0
|
0
|
|
my ($self, $ns) = @_; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->{ns} = $ns; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
if($self->{f_created}){ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# we need to move it to its new namespace |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub addif{ |
83
|
0
|
|
|
0
|
0
|
|
my ($self, $if) = @_; |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
my ($method, @extra) = $self->__getMethod("bridge_addif"); |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$self->{ctl}->$method($self->{name}, $if, @extra); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub exists{ |
91
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my ($method, @extra) = $self->__getMethod("bridge_exists"); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->{ctl}->$method($self->{name}, @extra); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub __getMethod{ |
100
|
0
|
|
|
0
|
|
|
my ($self, $method) = @_; |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
if(my $ns = $self->{ns}){ |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
$method . "_ns", $ns; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
else{ |
108
|
0
|
|
|
|
|
|
$method; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|