Zenoss/Router/Mib.pm untested

filter: Statementstmt 0.0% 0 / 76 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 / 111 CC 9 SCAR 16.8
CC
9
Cov
0%
mib_getTree
6.0
mib_getOrganizerTree
6.0
mib_addNode
6.0
CRAP 5.4
1 package Zenoss::Router::Mib;
2 use strict;
3  
4 use Moose::Role;
5 requires '_router_request', '_check_args';
6  
7 #**************************************************************************
8 # Attributes
9 #**************************************************************************
10 has 'MIB_LOCATION' => (
11 is => 'ro',
12 isa => 'Str',
13 default => 'zport/dmd/mib_router',
14 init_arg => undef,
15 );
16  
17 has 'MIB_ACTION' => (
18 is => 'ro',
19 isa => 'Str',
20 default => 'MibRouter',
21 init_arg => undef,
22 );
23  
24 #**************************************************************************
25 # Public Functions
26 #**************************************************************************
27 #======================================================================
28 # mib_getTree
29 #======================================================================
30 sub mib_getTree {
31 my ($self, $args) = @_;
32 $args = {} if !$args;
33  
34 # Argument definition
35 my $definition = {
36 defaults => {
37 id => '/zport/dmd/Mibs'
38 }
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->DEVICE_LOCATION,
48 action => $self->DEVICE_ACTION,
49 method => 'getTree',
50 data => [$args],
51 }
52 );
53 } # END mib_getTree
54  
55 #======================================================================
56 # mib_getOrganizerTree
57 #======================================================================
58 sub mib_getOrganizerTree {
59 my ($self, $args) = @_;
60 $args = {} if !$args;
61  
62 # Argument definition
63 my $definition = {
64 required => ['id'],
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->DEVICE_LOCATION,
74 action => $self->DEVICE_ACTION,
75 method => 'getOrganizerTree',
76 data => [$args],
77 }
78 );
79 } # END mib_getOrganizerTree
80  
81 #======================================================================
82 # mib_addNode
83 #======================================================================
84 sub mib_addNode {
85 my ($self, $args) = @_;
86 $args = {} if !$args;
87  
88 # Argument definition
89 my $definition = {
90 required => ['contextUid', 'id', 'type'],
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->DEVICE_LOCATION,
100 action => $self->DEVICE_ACTION,
101 method => 'addNode',
102 data => [$args],
103 }
104 );
105 } # END mib_addNode
106  
107 #======================================================================
108 # mib_addMIB
109 #======================================================================
110 sub mib_addMIB {
111 my ($self, $args) = @_;
112 $args = {} if !$args;
113  
114 # Argument definition
115 my $definition = {
116 required => ['package'],
117 defaults => {
118 organizer => '/',
119 },
120 };
121  
122 # Check the args
123 $self->_check_args($args, $definition);
124  
125 # Route the request
126 $self->_router_request(
127 {
128 location => $self->DEVICE_LOCATION,
129 action => $self->DEVICE_ACTION,
130 method => 'addMIB',
131 data => [$args],
132 }
133 );
134 } # END mib_addMIB
135  
136 #======================================================================
137 # mib_deleteNode
138 #======================================================================
139 sub mib_deleteNode {
140 my ($self, $args) = @_;
141 $args = {} if !$args;
142  
143 # Argument definition
144 my $definition = {
145 required => ['uid'],
146 };
147  
148 # Check the args
149 $self->_check_args($args, $definition);
150  
151 # Route the request
152 $self->_router_request(
153 {
154 location => $self->DEVICE_LOCATION,
155 action => $self->DEVICE_ACTION,
156 method => 'deleteNode',
157 data => [$args],
158 }
159 );
160 } # END mib_deleteNode
161  
162 #======================================================================
163 # mib_moveNode
164 #======================================================================
165 sub mib_moveNode {
166 my ($self, $args) = @_;
167 $args = {} if !$args;
168  
169 # Argument definition
170 my $definition = {
171 required => ['uids', 'target'],
172 };
173  
174 # Check the args
175 $self->_check_args($args, $definition);
176  
177 # Route the request
178 $self->_router_request(
179 {
180 location => $self->DEVICE_LOCATION,
181 action => $self->DEVICE_ACTION,
182 method => 'moveNode',
183 data => [$args],
184 }
185 );
186 } # END mib_moveNode
187  
188 #======================================================================
189 # mib_getInfo
190 #======================================================================
191 sub mib_getInfo {
192 my ($self, $args) = @_;
193 $args = {} if !$args;
194  
195 # Argument definition
196 my $definition = {
197 required => ['uid'],
198 defaults => {
199 useFieldSets => JSON::true,
200 }
201 };
202  
203 # Check the args
204 $self->_check_args($args, $definition);
205  
206 # Route the request
207 $self->_router_request(
208 {
209 location => $self->DEVICE_LOCATION,
210 action => $self->DEVICE_ACTION,
211 method => 'getInfo',
212 data => [$args],
213 }
214 );
215 } # END mib_getInfo
216  
217 #======================================================================
218 # mib_setInfo
219 #======================================================================
220 sub mib_setInfo {
221 my ($self, $args) = @_;
222 $args = {} if !$args;
223  
224 # Argument definition
225 my $definition = {
226 required => ['uid'],
227 };
228  
229 # Check the args
230 $self->_check_args($args, $definition);
231  
232 # Route the request
233 $self->_router_request(
234 {
235 location => $self->DEVICE_LOCATION,
236 action => $self->DEVICE_ACTION,
237 method => 'setInfo',
238 data => [$args],
239 }
240 );
241 } # END mib_setInfo
242  
243 #**************************************************************************
244 # Package end
245 #**************************************************************************
246 no Moose;
247  
248 1;
249  
250 __END__