-
Notifications
You must be signed in to change notification settings - Fork 1
/
Port.pm
56 lines (48 loc) · 1.58 KB
/
Port.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package Port;
use strict;
#use Data::Dumper;
use Log::Log4perl qw(get_logger);
sub new {
my $type = shift;
my $PortName = shift;
my $logger = get_logger('log6');
$logger->debug("called, PortName = \"$PortName\"");
# $logger->info("creating port object for $PortName");
my $this = {};
$this->{ArpMacCount} = 0;
$this->{AuxiliaryVlanNbr} = 0;
$this->{CdpCacheDeviceId} = '';
$this->{CdpCachePlatform} = '';
$this->{lldpRemSysName} = '';
#$this->{lldpRemChassisId} = '';
#$this->{lldpRemPortId} = '';
$this->{lldpRemPortDesc} = '';
$this->{lldpRemManAddr} = '';
$this->{DaysInactive} = 0;
$this->{Duplex} = 'unknown';
$this->{EtherChannel} = 0; # reference to an EtherChannel object, if this port is etherchanneled
$this->{IdleSince} = -1;
$this->{IfNbr} = 0;
$this->{IsConnectedToIpPhone} = 0;
$this->{IsSwitching} = 0; # ... as opposed to routing
$this->{IsTrunking} = 0;
$this->{IsVirtual} = 0;
$this->{Label} = '';
$this->{Mac} = {}; # a hash holding one or more MACs
$this->{Name} = $PortName;
$this->{PoeStatus} = 0;
$this->{Speed} = 0;
$this->{State} = 'Unknown';
$this->{Type} = 0;
$this->{Unused} = 0; # boolean: has the port been IdleSince for UnusadAfter days?
$this->{VlansOnTrunk} = ''; # if a port is a trunk, this contains all the vlans defined on the port
# $this->{VlanNbr} # explicitly not initialized, ports not in a VLAN don't have this
$logger->debug("returning");
return bless $this;
}
sub AddMac ($$) {
my $this = shift;
my $Mac = shift;
$this->{Mac}{$Mac}++;
}
1;