1Net::BGP::NLRI(3) User Contributed Perl Documentation Net::BGP::NLRI(3)
2
3
4
6 Net::BGP::NLRI - Class encapsulating BGP-4 NLRI information
7
9 use Net::BGP::NLRI qw( :origin );
10
11 # Constructor
12 $nlri = Net::BGP::NLRI->new(
13 Aggregator => [ 64512, '10.0.0.1' ],
14 AtomicAggregate => 1,
15 AsPath => Net::BGP::ASPath->new("64512 64513 64514"),
16 Communities => [ qw( 64512:10000 64512:10001 ) ],
17 LocalPref => 100,
18 MED => 200,
19 NextHop => '10.0.0.1',
20 Origin => INCOMPLETE,
21 );
22
23 # Object Copy
24 $clone = $nlri->clone();
25
26 # Accessor Methods
27 $aggregator_ref = $nlri->aggregator($aggregator_ref);
28 $atomic_aggregate = $nlri->atomic_aggregate($atomic_aggregate);
29 $as_path = $nlri->as_path($as_path);
30 $communities_ref = $nlri->communities($communities_ref);
31 $local_pref = $nlri->local_pref($local_pref);
32 $med = $nlri->med($med);
33 $next_hop = $nlri->next_hop($next_hop);
34 $origin = $nlri->origin($origin);
35 $string = $nlri->asstring;
36
37 # Preference comparisons
38 if ($nlri1 < $nlri2) { ... };
39 if ($nlri1 > $nlri2) { ... };
40 if ($nlri1 == $nlri2) { ... };
41 if ($nlri1 != $nlri2) { ... };
42 @sorted = sort { $a <=> $b } ($nlri1, $nlri2, $nlri3, ... );
43
44 # Comparison
45 if ($nlri1 eq $nlri2) { ... };
46 if ($nlri1 ne $nlri2) { ... };
47
49 This module encapsulates the data used by BGP-4 to represent network
50 reachability information. It provides a constructor, and accessor
51 methods for each of the well-known path attributes. An BGP-4 UPDATE
52 message includes this information along with a list of networks for
53 which the information should be used (and a list of network no longer
54 accessible). See Net::BGP::Update for more infomration.
55
57 new() - create a new Net::BGP::NLRI object
58
59 $nlri = Net::BGP::NLRI->new(
60 Aggregator => [ 64512, '10.0.0.1' ],
61 AsPath => Net::BGP::ASPath->new("64512 64513 64514"),
62 AtomicAggregate => 1,
63 Communities => [ qw( 64512:10000 64512:10001 ) ],
64 LocalPref => 100,
65 MED => 200,
66 NextHop => '10.0.0.1',
67 Origin => INCOMPLETE,
68 );
69
70 This is the constructor for Net::BGP::NLRI objects. It returns a
71 reference to the newly created object. The following named parameters
72 may be passed to the constructor. See RFC 1771 for the semantics of
73 each path attribute.
74
75 Aggregator
76 This parameter corresponds to the AGGREGATOR path attribute. It is
77 expressed as an array reference, the first element of which is the AS
78 number (in the range of an 16-bit unsigned integer) of the route
79 aggregator, and the second element is the aggregator's IP address
80 expressed in dotted-decimal notation as a string. It may be omitted, in
81 which case no AGGREGATOR path attribute will be attached to the UPDATE
82 message.
83
84 AsPath
85 This parameter corresponds to the AS_PATH path attribute. The AS_PATH
86 is expressed as an Net::BGP::ASPath object. If expressed otherwise, a
87 Net::BGP::ASPath object is tried constructed using the argument.
88
89 AtomicAggregate
90 This parameter corresponds to the ATOMIC_AGGREGATE path attribute. It
91 is a boolean value so any value which perl interprets as true/false may
92 be used. It may be omitted, in which case no ATOMIC_AGGREGATE path
93 attribute will be attached to the UPDATE message.
94
95 Communities
96 This parameter corresponds to the COMMUNITIES attribute defined in RFC
97 1997. It is expressed as an array reference of communities which apply
98 to the route(s). The communities are encoded in a special format:
99 AAAA:CCCC, where AAAA corresponds to the 16-bit unsigned integer AS
100 number, and CCCC is a 16-bit unsigned integer of arbitrary value. But
101 see RFC 1997 for the semantics of several reserved community values.
102 This attribute may be omitted, in which case no COMMUNITIES attribute
103 will be attached to the UPDATE message.
104
105 LocalPref
106 This parameter corresponds to the LOCAL_PREF path attribute. It is
107 expressed as a 32-bit unsigned integer scalar value. It may be omitted,
108 in which case no LOCAL_PREF path attribute will be attached to the
109 UPDATE message.
110
111 MED
112 This parameter corresponds to the MULTI_EXIT_DISC path attribute. It is
113 expressed as a 32-bit unsigned integer scalar value. It may be omitted,
114 in which case no MULTI_EXIT_DISC path attribute will be attached to the
115 UPDATE message.
116
117 NextHop
118 This parameter corresponds to the NEXT_HOP path attribute. It is
119 expressed as a dotted-decimal IP address as a perl string. This path
120 attribute is mandatory and the parameter must always be provided to the
121 constructor.
122
123 Origin
124 This parameter corresponds to the ORIGIN path attribute. It is
125 expressed as an integer scalar value, which can take the following
126 enumerated values: IGP, EGP, or INCOMPLETE. The preceding symbols can
127 be imported into the program namespace individually or by the :origin
128 export tag. This path attribute is mandatory and the parameter must
129 always be provided to the constructor.
130
132 clone() - clone a Net::BGP::NLRI object
133
134 $clone = $nlri->clone();
135
136 This method creates an exact copy of the Net::BGP::NLRI object with
137 Path Attributes fields matching those of the original object.
138
140 aggregator()
141
142 as_path()
143
144 atomic_aggregate()
145
146 communities()
147
148 local_pref()
149
150 med()
151
152 next_hop()
153
154 origin()
155
156 These accessor methods return the value(s) of the associated path
157 attribute fields if called with no arguments. If called with arguments,
158 they set the associated field. The representation of parameters and
159 return values is the same as described for the corresponding named
160 constructor parameters above.
161
162 asstring()
163
164 This accessor method returns a print-friendly string with some, but not
165 all, of the information containted in the object.
166
168 The module exports the following symbols according to the rules and
169 conventions of the Exporter module.
170
171 :origin
172 IGP, EGP, INCOMPLETE
173
175 RFC 1771, RFC 1997, Net::BGP, Net::BGP::Process, Net::BGP::Peer,
176 Net::BGP::Notification, Net::BGP::ASPath, Net::BGP::Update
177
179 Stephen J. Scheck <sscheck@cpan.org>
180
181
182
183perl v5.32.1 2021-01-27 Net::BGP::NLRI(3)