Zenoss/Router/Network.pm untested

filter: Statementstmt 0.0% 0 / 78 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 113 CC 9 SCAR 16.8
CC
9
Cov
0%
network_discoverDevices
6.0
network_addNode
6.0
network_deleteNode
6.0
CRAP 5.4
1 package Zenoss::Router::Network;
2 use strict;
3  
4 use Moose::Role;
5 with 'Zenoss::Router::Tree', 'Zenoss::MetaHelper';
6 requires '_router_request', '_check_args';
7 __PACKAGE__->_INSTALL_META_METHODS;
8  
9 #**************************************************************************
10 # Attributes
11 #**************************************************************************
12 has 'NETWORK_LOCATION' => (
13 is => 'ro',
14 isa => 'Str',
15 default => 'zport/dmd/network_router',
16 init_arg => undef,
17 );
18  
19 has 'NETWORK_ACTION' => (
20 is => 'ro',
21 isa => 'Str',
22 default => 'NetworkRouter',
23 init_arg => undef,
24 );
25  
26 #**************************************************************************
27 # Public Functions
28 #**************************************************************************
29 #======================================================================
30 # network_discoverDevices
31 #======================================================================
32 sub network_discoverDevices {
33 my ($self, $args) = @_;
34 $args = {} if !$args;
35  
36 # Argument definition
37 my $definition = {
38 required => ['uid'],
39 };
40  
41 # Check the args
42 $self->_check_args($args, $definition);
43  
44 # Route the request
45 $self->_router_request(
46 {
47 location => $self->NETWORK_LOCATION,
48 action => $self->NETWORK_ACTION,
49 method => 'discoverDevices',
50 data => [$args],
51 }
52 );
53 } # END network_discoverDevices
54  
55 #======================================================================
56 # network_addNode
57 #======================================================================
58 sub network_addNode {
59 my ($self, $args) = @_;
60 $args = {} if !$args;
61  
62 # Argument definition
63 my $definition = {
64 required => ['newSubnet', 'contextUid'],
65 };
66  
67 # Check the args
68 $self->_check_args($args, $definition);
69  
70 # Route the request
71 $self->_router_request(
72 {
73 location => $self->NETWORK_LOCATION,
74 action => $self->NETWORK_ACTION,
75 method => 'addNode',
76 data => [$args],
77 }
78 );
79 } # END network_addNode
80  
81 #======================================================================
82 # network_deleteNode
83 #======================================================================
84 sub network_deleteNode {
85 my ($self, $args) = @_;
86 $args = {} if !$args;
87  
88 # Argument definition
89 my $definition = {
90 required => ['uid'],
91 };
92  
93 # Check the args
94 $self->_check_args($args, $definition);
95  
96 # Route the request
97 $self->_router_request(
98 {
99 location => $self->NETWORK_LOCATION,
100 action => $self->NETWORK_ACTION,
101 method => 'deleteNode',
102 data => [$args],
103 }
104 );
105 } # END network_deleteNode
106  
107 #======================================================================
108 # network_getTree
109 #======================================================================
110 sub network_getTree {
111 my ($self, $args) = @_;
112 $args = {} if !$args;
113  
114 # Argument definition
115 my $definition = {
116 defaults => {
117 id => '/zport/dmd/Networks',
118 },
119 };
120  
121 # Check the args
122 $self->_check_args($args, $definition);
123  
124 # Route the request
125 $self->_router_request(
126 {
127 location => $self->NETWORK_LOCATION,
128 action => $self->NETWORK_ACTION,
129 method => 'getTree',
130 data => [$args],
131 }
132 );
133 } # END network_getTree
134  
135 #======================================================================
136 # network_getInfo
137 #======================================================================
138 sub network_getInfo {
139 my ($self, $args) = @_;
140 $args = {} if !$args;
141  
142 # Argument definition
143 my $definition = {
144 required => ['uid'],
145 };
146  
147 # Check the args
148 $self->_check_args($args, $definition);
149  
150 # Route the request
151 $self->_router_request(
152 {
153 location => $self->NETWORK_LOCATION,
154 action => $self->NETWORK_ACTION,
155 method => 'getInfo',
156 data => [$args],
157 }
158 );
159 } # END network_getInfo
160  
161 #======================================================================
162 # network_setInfo
163 #======================================================================
164 sub network_setInfo {
165 my ($self, $args) = @_;
166 $args = {} if !$args;
167  
168 # Argument definition
169 my $definition = {
170 required => ['uid'],
171 };
172  
173 # Check the args
174 $self->_check_args($args, $definition);
175  
176 # Route the request
177 $self->_router_request(
178 {
179 location => $self->NETWORK_LOCATION,
180 action => $self->NETWORK_ACTION,
181 method => 'setInfo',
182 data => [$args],
183 }
184 );
185 } # END network_setInfo
186  
187 #======================================================================
188 # network_getIpAddresses
189 #======================================================================
190 sub network_getIpAddresses {
191 my ($self, $args) = @_;
192 $args = {} if !$args;
193  
194 # Argument definition
195 my $definition = {
196 defaults => {
197 start => 0,
198 limit => 50,
199 sort => 'name',
200 order => 'ASC',
201 },
202 required => ['uid'],
203 };
204  
205 # Check the args
206 $self->_check_args($args, $definition);
207  
208 # Route the request
209 $self->_router_request(
210 {
211 location => $self->NETWORK_LOCATION,
212 action => $self->NETWORK_ACTION,
213 method => 'getIpAddresses',
214 data => [$args],
215 }
216 );
217 } # END network_getIpAddresses
218  
219 #======================================================================
220 # network_removeIpAddresses
221 #======================================================================
222 sub network_removeIpAddresses {
223 my ($self, $args) = @_;
224 $args = {} if !$args;
225  
226 # Argument definition
227 my $definition = {
228 uids => ['uids'],
229 };
230  
231 # Check the args
232 $self->_check_args($args, $definition);
233  
234 # Route the request
235 $self->_router_request(
236 {
237 location => $self->NETWORK_LOCATION,
238 action => $self->NETWORK_ACTION,
239 method => 'removeIpAddresses',
240 data => [$args],
241 }
242 );
243 } # END network_removeIpAddresses
244  
245 #**************************************************************************
246 # Package end
247 #**************************************************************************
248 no Moose;
249  
250 1;
251  
252 __END__