1Net::BGP::Update(3) User Contributed Perl Documentation Net::BGP::Update(3)
2
3
4
6 Net::BGP::Update - Class encapsulating BGP-4 UPDATE message
7
9 use Net::BGP::Update qw( :origin );
10
11 # Constructor
12 $update = Net::BGP::Update->new(
13 NLRI => [ qw( 10/8 172.168/16 ) ],
14 Withdraw => [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ],
15 # For Net::BGP::NLRI
16 Aggregator => [ 64512, '10.0.0.1' ],
17 AsPath => [ 64512, 64513, 64514 ],
18 AtomicAggregate => 1,
19 Communities => [ qw( 64512:10000 64512:10001 ) ],
20 LocalPref => 100,
21 MED => 200,
22 NextHop => '10.0.0.1',
23 Origin => INCOMPLETE,
24 );
25
26 # Construction from a NLRI object:
27 $nlri = Net::BGP::NLRI->new( ... );
28 $update = Net::BGP::Update->new($nlri,$nlri_ref,$withdrawn_ref);
29
30 # Object Copy
31 $clone = $update->clone();
32
33 # Accessor Methods
34 $nlri_ref = $update->nlri($nlri_ref);
35 $withdrawn_ref = $update->withdrawn($withdrawn_ref);
36 $prefix_hash_ref = $update->ashash;
37
38 # Comparison
39 if ($update1 eq $update2) { ... }
40 if ($update1 ne $update2) { ... }
41
43 This module encapsulates the data contained in a BGP-4 UPDATE message.
44 It provides a constructor, and accessor methods for each of the message
45 fields and well-known path attributes of an UPDATE. Whenever a
46 Net::BGP::Peer sends an UPDATE message to its peer, it does so by
47 passing a Net::BGP::Update object to the peer object's update() method.
48 Similarly, when the peer receives an UPDATE message from its peer, the
49 UPDATE callback is called and passed a reference to a Net::BGP::Update
50 object. The callback function can then examine the UPDATE message
51 fields by means of the accessor methods.
52
54 new() - create a new Net::BGP::Update object
55
56 $update = Net::BGP::Update->new(
57 NLRI => [ qw( 10/8 172.168/16 ) ],
58 Withdraw => [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ],
59 # For Net::BGP::NLRI
60 Aggregator => [ 64512, '10.0.0.1' ],
61 AsPath => [ 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::Update 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 An alternative is to construct an object from a Net::BGP::NLRI object:
76
77 $nlri = Net::BGP::NLRI->new( ... );
78 $nlri_ref = [ qw( 10/8 172.168/16 ) ];
79 $withdrawn_ref = [ qw( 192.168.1/24 172.10/16 192.168.2.1/32 ) ];
80 $update = Net::BGP::Update->new($nlri,$nlri_ref,$withdrawn_ref);
81
82 The NLRI object will not be modified in any way.
83
84 NLRI
85 This parameter corresponds to the Network Layer Reachability
86 Information (NLRI) field of an UPDATE message. It represents the
87 route(s) being advertised in this particular UPDATE. It is expressed as
88 an array reference of route prefixes which are encoded in a special
89 format as perl strings: XXX.XXX.XXX.XXX/XX. The part preceding the
90 slash is a dotted-decimal notation IP prefix. Only as many octets as
91 are significant according to the mask need to be specified. The part
92 following the slash is the mask which is an integer in the range [0,32]
93 which indicates how many bits are significant in the prefix. At least
94 one of either the NLRI or Withdraw parameters is mandatory and must
95 always be provided to the constructor.
96
97 Withdraw
98 This parameter corresponds to the Withdrawn Routes field of an UPDATE
99 message. It represents route(s) advertised by a previous UPDATE message
100 which are now being withdrawn by this UPDATE. It is expressed in the
101 same way as the NLRI parameter. At least one of either the NLRI or
102 Withdraw parameters is mandatory and must always be provided to the
103 constructor.
104
106 clone() - clone a Net::BGP::Update object
107
108 $clone = $update->clone();
109
110 This method creates an exact copy of the Net::BGP::Update object, with
111 Withdrawn Routes, Path Attributes, and NLRI fields matching those of
112 the original object. This is useful for propagating a modified UPDATE
113 message when the original object needs to remain unchanged.
114
116 nlri()
117
118 withdrawn()
119
120 These accessor methods return the value(s) of the associated UPDATE
121 message field if called with no arguments. If called with arguments,
122 they set the associated field. The representation of parameters and
123 return values is the same as described for the corresponding named
124 constructor parameters above.
125
126 ashash()
127
128 This method returns a hash reference index on the prefixes in found in
129 the nlri and withdrawn fields. Withdrawn networks has undefined as
130 value, while nlri prefixes all has the same reference to a
131 Net::BGP::NLRI object matching the Update object self.
132
134 The module does not export anything.
135
137 RFC 1771, RFC 1997, Net::BGP, Net::BGP::Process, Net::BGP::Peer,
138 Net::BGP::Notification, Net::BGP::NLRI
139
141 Stephen J. Scheck <sscheck@cpan.org>
142
143
144
145perl v5.32.0 2020-07-28 Net::BGP::Update(3)