File Coverage

blib/lib/SNMP/Insight/MIB/QBridge.pm
Criterion Covered Total %
statement 9 13 69.2
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 23 56.5


line stmt bran cond sub pod time code
1             package SNMP::Insight::MIB::QBridge;
2              
3             #ABSTRACT: Support for data in Q-BRIDGE-MIB
4              
5 1     1   1150 use Moose::Role;
  1         2  
  1         7  
6              
7             our $VERSION = '0.002'; #TRIAL VERSION:
8              
9 1     1   3858 use SNMP::Insight::Moose::MIB;
  1         2  
  1         7  
10              
11 1     1   2409 use namespace::autoclean;
  1         2  
  1         6  
12             with 'SNMP::Insight::MIB', 'SNMP::Insight::MIB::Bridge';
13              
14             mib_oid "1.3.6.1.2.1.17.7";
15             mib_name "Q-BRIDGE-MIB";
16              
17             warn "QBridge stub: to be implemented";
18              
19             # Q-BRIDGE-MIB is a subtree of BRIDGE-MIB
20              
21             # split Dot1qTpFdbEntry index into FDB ID and MAC Address.
22             #sub munge_qtpfdb_index {
23             # my $idx = shift;
24             # my @values = split( /\./, $idx );
25             # my $fdb_id = shift(@values);
26             # return ( $fdb_id, join( ':', map { sprintf "%02x", $_ } @values ) );
27             #}
28              
29             has_table "dot1qVlanCurrentTable" => (
30             oid => "1.4.2",
31              
32             # should be a complex index, use this just for syntax check
33             index => 'dot1qVlanCurrentEgressPorts',
34             columns => {
35             dot1qVlanCurrentEgressPorts => [ 4, 'munge_port_list' ],
36             dot1qVlanCurrentUntaggedPorts => [ 5, 'munge_port_list' ],
37             dot1qVlanStatus => 6,
38             }
39             );
40              
41             sub munge_vlan_static_row_status {
42 0     0 1   my $val = shift;
43 0 0         $val or return;
44              
45 0           my %row_status = (
46             1 => 'active',
47             2 => 'notInService',
48             3 => 'notReady',
49             4 => 'createAndGo',
50             5 => 'createAndWait',
51             6 => 'destroy'
52             );
53              
54 0   0       return $row_status{$val} || $val;
55             }
56              
57             has_table "dot1qVlanStaticTable" => (
58             oid => "1.4.3",
59             index => 'dot1qVlanStaticName',
60             columns => {
61             dot1qVlanStaticName => 1,
62             dot1qVlanStaticEgressPorts => [ 2, 'munge_port_list' ],
63             dot1qVlanForbiddenEgressPorts => [ 3, 'munge_port_list' ],
64             dot1qVlanStaticUntaggedPorts => [ 4, 'munge_port_list' ],
65             dot1qVlanStaticRowStatus => [ 5, 'munge_vlan_static_row_status' ],
66             }
67             );
68              
69             has_table "dot1qPortVlanTable" => (
70             oid => "1.4.5",
71              
72             # for syntax check
73             index => 'dot1dBasePort',
74             columns => {
75             dot1qPvid => 1,
76             dot1qPortAcceptableFrameTypes => 2,
77             dot1qPortIngressFiltering => 3,
78             },
79             );
80              
81             1;
82              
83             # Local Variables:
84             # mode: cperl
85             # indent-tabs-mode: nil
86             # cperl-indent-level: 4
87             # cperl-indent-parens-as-block: t
88             # End:
89              
90             __END__
91              
92             =pod
93              
94             =head1 NAME
95              
96             SNMP::Insight::MIB::QBridge - Support for data in Q-BRIDGE-MIB
97              
98             =head1 VERSION
99              
100             version 0.002
101              
102             =head1 ATTRIBUTES
103              
104             =head2 dot1qVlanCurrentTable
105              
106             A table containing current configuration information
107             for each VLAN currently configured into the device by
108             (local or network) management, or dynamically created
109             as a result of GVRP requests received.
110              
111             =head2 dot1qVlanStaticTable
112              
113             A table containing static configuration information for each VLAN
114             configured into the device by (local or network) management. All
115             entries are permanent and will be restored after the device is reset
116              
117             =head2 dot1qPortVlanTable
118              
119             A table containing per port control and status information for VLAN
120             configuration in the device.
121              
122             =head1 FUNCTIONS
123              
124             =head2 munge_vlan_static_row_status
125              
126             Munger for dot1qVlanStaticRowStatus
127              
128             =head1 AUTHOR
129              
130             Gabriele Mambrini <g.mambrini@gmail.com>
131              
132             =head1 COPYRIGHT AND LICENSE
133              
134             This software is copyright (c) 2015 by Gabriele Mambrini.
135              
136             This is free software; you can redistribute it and/or modify it under
137             the same terms as the Perl 5 programming language system itself.
138              
139             =cut