bgp4r 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bgp/neighbor/neighbor.rb +3 -2
- data/bgp4r.gemspec +10 -151
- data/changelog.txt +129 -0
- data/examples/ebgp-vyatta-ipv4-ipv6.rb +250 -0
- data/test/unit/all +10 -0
- metadata +23 -17
- data/test/unit/nlris/mapped_ipv4_test.rb +0 -19
- /data/examples/{bgp-vyatta-ipv6.rb → ibgp-vyatta-ipv6.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05332f8a257e4ce30b788aa004c3866aacf549c1
|
4
|
+
data.tar.gz: fc2bfc4f60b669dfd768a2694a791ff5eae2960c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40655ec95476a2b4dba344c72dfdc0dc3fc136a6b20455de647d0884cc2115957413131bbdec9817f9f491a6bd53b175ca3d709bee01c4dafe742cd60b753192
|
7
|
+
data.tar.gz: 2ee16cc41729f434807c02d5af2ebb5383f5437c8bfad96507821f8c46f49496e28a2974ba9e2dda6539c8a86c3be335055b7767fc0f9cffcb22d2ff158ca2ba
|
data/bgp/neighbor/neighbor.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright 2008, 2009 Jean-Michel Esnault.
|
2
|
+
# Copyright 2008, 2009, 2014 Jean-Michel Esnault.
|
3
3
|
# All rights reserved.
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#
|
@@ -57,7 +57,8 @@ module BGP
|
|
57
57
|
event_dispatch
|
58
58
|
end
|
59
59
|
|
60
|
-
def set(
|
60
|
+
def set(_h)
|
61
|
+
h = { :version=>4, :holdtime=>180 }.merge(_h)
|
61
62
|
[:version, :my_as, :holdtime, :id, :remote_addr, :local_addr].each do |name|
|
62
63
|
instance_variable_set("@#{name}", h[name]) if h.has_key?(name)
|
63
64
|
end
|
data/bgp4r.gemspec
CHANGED
@@ -1,159 +1,18 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
1
|
Gem::Specification.new do |s|
|
7
2
|
s.name = "bgp4r"
|
8
|
-
s.version = "0.0.
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
3
|
+
s.version = "0.0.17"
|
4
|
+
s.email = "jesnault@gmail.com"
|
11
5
|
s.authors = ["Jean-Michel Esnault"]
|
12
6
|
s.date = "2014-05-07"
|
13
|
-
s.description = "
|
14
|
-
s.
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
|
17
|
-
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
"COPYING",
|
21
|
-
"LICENSE.txt",
|
22
|
-
"README.rdoc",
|
23
|
-
"bgp/common.rb",
|
24
|
-
"bgp/iana.rb",
|
25
|
-
"bgp/io.rb",
|
26
|
-
"bgp/messages/capability.rb",
|
27
|
-
"bgp/messages/keepalive.rb",
|
28
|
-
"bgp/messages/markers.rb",
|
29
|
-
"bgp/messages/message.rb",
|
30
|
-
"bgp/messages/messages.rb",
|
31
|
-
"bgp/messages/notification.rb",
|
32
|
-
"bgp/messages/open.rb",
|
33
|
-
"bgp/messages/route_refresh.rb",
|
34
|
-
"bgp/messages/update.rb",
|
35
|
-
"bgp/misc/live_feed.rb",
|
36
|
-
"bgp/neighbor/add_path_cap.rb",
|
37
|
-
"bgp/neighbor/neighbor.rb",
|
38
|
-
"bgp/nlris/inet.rb",
|
39
|
-
"bgp/nlris/label.rb",
|
40
|
-
"bgp/nlris/labeled.rb",
|
41
|
-
"bgp/nlris/nlri.rb",
|
42
|
-
"bgp/nlris/nlris.rb",
|
43
|
-
"bgp/nlris/nsap.rb",
|
44
|
-
"bgp/nlris/prefix.rb",
|
45
|
-
"bgp/nlris/rd.rb",
|
46
|
-
"bgp/nlris/vpn.rb",
|
47
|
-
"bgp/nlris/mapped_ipv4.rb",
|
48
|
-
"bgp/optional_parameters/add_path.rb",
|
49
|
-
"bgp/optional_parameters/as4.rb",
|
50
|
-
"bgp/optional_parameters/capabilities.rb",
|
51
|
-
"bgp/optional_parameters/capability.rb",
|
52
|
-
"bgp/optional_parameters/dynamic.rb",
|
53
|
-
"bgp/optional_parameters/graceful_restart.rb",
|
54
|
-
"bgp/optional_parameters/mbgp.rb",
|
55
|
-
"bgp/optional_parameters/optional_parameter.rb",
|
56
|
-
"bgp/optional_parameters/orf.rb",
|
57
|
-
"bgp/optional_parameters/route_refresh.rb",
|
58
|
-
"bgp/orfs/orf.rb",
|
59
|
-
"bgp/orfs/prefix_orf.rb",
|
60
|
-
"bgp/path_attributes/aggregator.rb",
|
61
|
-
"bgp/path_attributes/aigp.rb",
|
62
|
-
"bgp/path_attributes/as_path.rb",
|
63
|
-
"bgp/path_attributes/atomic_aggregate.rb",
|
64
|
-
"bgp/path_attributes/attribute.rb",
|
65
|
-
"bgp/path_attributes/attributes.rb",
|
66
|
-
"bgp/path_attributes/cluster_list.rb",
|
67
|
-
"bgp/path_attributes/communities.rb",
|
68
|
-
"bgp/path_attributes/extended_communities.rb",
|
69
|
-
"bgp/path_attributes/extended_community.rb",
|
70
|
-
"bgp/path_attributes/local_pref.rb",
|
71
|
-
"bgp/path_attributes/mp_reach.rb",
|
72
|
-
"bgp/path_attributes/mp_unreach.rb",
|
73
|
-
"bgp/path_attributes/multi_exit_disc.rb",
|
74
|
-
"bgp/path_attributes/next_hop.rb",
|
75
|
-
"bgp/path_attributes/origin.rb",
|
76
|
-
"bgp/path_attributes/originator_id.rb",
|
77
|
-
"bgp/path_attributes/path_attribute.rb",
|
78
|
-
"bgp4r.gemspec",
|
79
|
-
"bgp4r.rb",
|
80
|
-
"examples/a_live_feed",
|
81
|
-
"examples/routegen",
|
82
|
-
"examples/routegen.yml",
|
83
|
-
"examples/simple.rb",
|
84
|
-
"examples/unit-testing/malformed_update_test.rb",
|
85
|
-
"examples/unit-testing/no_export_test.rb",
|
86
|
-
"examples/unit-testing/prepend_aspath_test.rb",
|
87
|
-
"examples/unit-testing/unknown_transitive_attr_test.rb",
|
88
|
-
"examples/bgp-vyatta-ipv6.rb",
|
89
|
-
"test/functional/add_path_test.rb",
|
90
|
-
"test/functional/live_feed_test.rb",
|
91
|
-
"test/helpers/server.rb",
|
92
|
-
"test/misc/misc.rb",
|
93
|
-
"test/unit/common_test.rb",
|
94
|
-
"test/unit/iana_test.rb",
|
95
|
-
"test/unit/messages/capability_test.rb",
|
96
|
-
"test/unit/messages/keepalive_test.rb",
|
97
|
-
"test/unit/messages/markers_test.rb",
|
98
|
-
"test/unit/messages/message_test.rb",
|
99
|
-
"test/unit/messages/notification_test.rb",
|
100
|
-
"test/unit/messages/open_test.rb",
|
101
|
-
"test/unit/messages/route_refresh_test.rb",
|
102
|
-
"test/unit/messages/update_test.rb",
|
103
|
-
"test/unit/neighbor/add_path_cap_test.rb",
|
104
|
-
"test/unit/neighbor/neighbor_test.rb",
|
105
|
-
"test/unit/nlris/inet_test.rb",
|
106
|
-
"test/unit/nlris/label_test.rb",
|
107
|
-
"test/unit/nlris/labeled_test.rb",
|
108
|
-
"test/unit/nlris/nlri_test.rb",
|
109
|
-
"test/unit/nlris/nsap_test.rb",
|
110
|
-
"test/unit/nlris/prefix_test.rb",
|
111
|
-
"test/unit/nlris/rd_test.rb",
|
112
|
-
"test/unit/nlris/vpn_test.rb",
|
113
|
-
"test/unit/nlris/mapped_ipv4_test.rb",
|
114
|
-
"test/unit/optional_parameters/add_path_test.rb",
|
115
|
-
"test/unit/optional_parameters/as4_test.rb",
|
116
|
-
"test/unit/optional_parameters/capability_test.rb",
|
117
|
-
"test/unit/optional_parameters/dynamic_test.rb",
|
118
|
-
"test/unit/optional_parameters/graceful_restart_test.rb",
|
119
|
-
"test/unit/optional_parameters/mbgp_test.rb",
|
120
|
-
"test/unit/optional_parameters/optional_parameter_test.rb",
|
121
|
-
"test/unit/optional_parameters/orf_test.rb",
|
122
|
-
"test/unit/optional_parameters/route_refresh_test.rb",
|
123
|
-
"test/unit/orfs/prefix_orf_test.rb",
|
124
|
-
"test/unit/path_attributes/aggregator_test.rb",
|
125
|
-
"test/unit/path_attributes/aigp_test.rb",
|
126
|
-
"test/unit/path_attributes/as_path_test.rb",
|
127
|
-
"test/unit/path_attributes/atomic_aggregate_test.rb",
|
128
|
-
"test/unit/path_attributes/attribute_test.rb",
|
129
|
-
"test/unit/path_attributes/cluster_list_test.rb",
|
130
|
-
"test/unit/path_attributes/communities_test.rb",
|
131
|
-
"test/unit/path_attributes/extended_communities_test.rb",
|
132
|
-
"test/unit/path_attributes/extended_community_test.rb",
|
133
|
-
"test/unit/path_attributes/local_pref_test.rb",
|
134
|
-
"test/unit/path_attributes/mp_reach_test.rb",
|
135
|
-
"test/unit/path_attributes/mp_unreach_test.rb",
|
136
|
-
"test/unit/path_attributes/multi_exit_disc_test.rb",
|
137
|
-
"test/unit/path_attributes/next_hop_test.rb",
|
138
|
-
"test/unit/path_attributes/origin_test.rb",
|
139
|
-
"test/unit/path_attributes/originator_id_test.rb",
|
140
|
-
"test/unit/path_attributes/path_attribute_test.rb",
|
141
|
-
]
|
142
|
-
s.homepage = "http://github.com/jesnault/bgp4r/tree/master"
|
7
|
+
s.description = "Best way to play with BGP protocol using ruby"
|
8
|
+
s.summary = "Best way to play with BGP protocol using ruby"
|
9
|
+
s.extra_rdoc_files = ["LICENSE.txt","README.rdoc"]
|
10
|
+
s.homepage = "http://github.com/jesnault/bgp4r"
|
11
|
+
s.rdoc_options = ["--quiet", "--title", "bgp4r", "--line-numbers"]
|
143
12
|
s.require_paths = ["."]
|
144
13
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.6")
|
145
|
-
s.
|
146
|
-
s.
|
147
|
-
s.
|
148
|
-
s.test_files = ["test/functional", "test/functional/add_path_test.rb", "test/functional/live_feed_test.rb", "test/helpers", "test/helpers/server.rb", "test/misc", "test/misc/misc.rb", "test/unit", "test/unit/common_test.rb", "test/unit/iana_test.rb", "test/unit/messages", "test/unit/messages/capability_test.rb", "test/unit/messages/keepalive_test.rb", "test/unit/messages/markers_test.rb", "test/unit/messages/message_test.rb", "test/unit/messages/notification_test.rb", "test/unit/messages/open_test.rb", "test/unit/messages/route_refresh_test.rb", "test/unit/messages/update_test.rb", "test/unit/neighbor", "test/unit/neighbor/add_path_cap_test.rb", "test/unit/neighbor/neighbor_test.rb", "test/unit/nlris", "test/unit/nlris/inet_test.rb", "test/unit/nlris/label_test.rb", "test/unit/nlris/labeled_test.rb", "test/unit/nlris/nlri_test.rb", "test/unit/nlris/nsap_test.rb", "test/unit/nlris/prefix_test.rb", "test/unit/nlris/rd_test.rb", "test/unit/nlris/vpn_test.rb", "test/unit/optional_parameters", "test/unit/optional_parameters/add_path_test.rb", "test/unit/optional_parameters/as4_test.rb", "test/unit/optional_parameters/capability_test.rb", "test/unit/optional_parameters/dynamic_test.rb", "test/unit/optional_parameters/graceful_restart_test.rb", "test/unit/optional_parameters/mbgp_test.rb", "test/unit/optional_parameters/optional_parameter_test.rb", "test/unit/optional_parameters/orf_test.rb", "test/unit/optional_parameters/route_refresh_test.rb", "test/unit/orfs", "test/unit/orfs/prefix_orf_test.rb", "test/unit/path_attributes", "test/unit/path_attributes/aggregator_test.rb", "test/unit/path_attributes/aigp_test.rb", "test/unit/path_attributes/as_path_test.rb", "test/unit/path_attributes/atomic_aggregate_test.rb", "test/unit/path_attributes/attribute_test.rb", "test/unit/path_attributes/cluster_list_test.rb", "test/unit/path_attributes/communities_test.rb", "test/unit/path_attributes/extended_communities_test.rb", "test/unit/path_attributes/extended_community_test.rb", "test/unit/path_attributes/local_pref_test.rb", "test/unit/path_attributes/mp_reach_test.rb", "test/unit/path_attributes/mp_unreach_test.rb", "test/unit/path_attributes/multi_exit_disc_test.rb", "test/unit/path_attributes/next_hop_test.rb", "test/unit/path_attributes/origin_test.rb", "test/unit/path_attributes/originator_id_test.rb", "test/unit/path_attributes/path_attribute_test.rb"]
|
149
|
-
|
150
|
-
if s.respond_to? :specification_version then
|
151
|
-
s.specification_version = 3
|
152
|
-
|
153
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
154
|
-
else
|
155
|
-
end
|
156
|
-
else
|
157
|
-
end
|
14
|
+
s.required_rubygems_version = '>= 1.3.6'
|
15
|
+
s.files = `git ls-files -z`.split("\x0")
|
16
|
+
s.test_files = `git ls-files test -z`.split("\x0")
|
158
17
|
end
|
159
18
|
|
data/changelog.txt
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
=== 0.0.17
|
2
|
+
* Get rid of Rakefile, VERSION.yml ...
|
3
|
+
* Simpler gem specification
|
4
|
+
* add ebgp example
|
5
|
+
|
6
|
+
=== 0.0.16
|
7
|
+
* Fixes
|
8
|
+
+ set encoding to binary
|
9
|
+
+ inc ipv6 subnet
|
10
|
+
+ fix unit tests
|
11
|
+
|
12
|
+
=== 0.0.15
|
13
|
+
* more support for building an update from a hash
|
14
|
+
+ Extended_communities
|
15
|
+
o revisit Extended_communities#to_hash()
|
16
|
+
o changed to_hash() to return
|
17
|
+
=> :extended_communities=> [ ec1, ec2, ..., ecn ]
|
18
|
+
|
19
|
+
+ revisit to_hash() for following attr.
|
20
|
+
o Originator_id
|
21
|
+
o Aggregator
|
22
|
+
o Multi_exit_disc
|
23
|
+
o Cluster_list
|
24
|
+
|
25
|
+
* make Path_attribute comparable to test for equality:
|
26
|
+
add following instance methods
|
27
|
+
Path_attributes#sort
|
28
|
+
Path_attributes#sort!
|
29
|
+
Path_attributes#<=>
|
30
|
+
|
31
|
+
* add getters for:
|
32
|
+
+ all known path attributes
|
33
|
+
+ all known extended communities
|
34
|
+
So one can write:
|
35
|
+
> puts upd.path_attribute.mp_reach.safi
|
36
|
+
=> 128
|
37
|
+
> puts upd.path_attribute.extended_communities.route_target
|
38
|
+
=> "Route target: 4:1"
|
39
|
+
> puts upd.path_attribute.mp_reach.nlris[0]
|
40
|
+
=> "Label Stack=16000 (bottom) RD=19:17, ID=1, IPv4=10.1.1.0/24"
|
41
|
+
|
42
|
+
=== 0.0.14 February 5, 2012
|
43
|
+
* add support for accumulated igp metric attribute
|
44
|
+
* add support for VPN default_route RD: 0/0
|
45
|
+
* add Update#to_hash() to return a hash representation of an update message.
|
46
|
+
|
47
|
+
=== 0.0.13 October 27, 2011
|
48
|
+
* add support for link bandwidth extended community
|
49
|
+
* refactor test, i.e changed test directory structure
|
50
|
+
* add afi 3, safi 1 support
|
51
|
+
|
52
|
+
=== 0.0.12 February 13, 2011
|
53
|
+
* add add-path capability support
|
54
|
+
|
55
|
+
=== 0.0.11 January 8, 2011
|
56
|
+
* stop using autoload
|
57
|
+
* fix Communities#has_no_<well_known_community>? predicates
|
58
|
+
eg
|
59
|
+
c.has_no_export_sub_confed?
|
60
|
+
|
61
|
+
=== 0.0.10 October 30, 2010
|
62
|
+
* add Path_attribute#has_a_<attr_name>? predicates
|
63
|
+
eg
|
64
|
+
pa.has_a_local_pref?
|
65
|
+
pa.has_a_aggregator?
|
66
|
+
pa.has_a_mp_reach?
|
67
|
+
|
68
|
+
* example that shows how to use
|
69
|
+
bgpdata.netsec.colostate.edu bgp xml feed with bgp4r
|
70
|
+
|
71
|
+
=== 0.0.9 October 12, 2010
|
72
|
+
* add support for Capability message
|
73
|
+
* add notification code 7 subcode 1,2,3,4
|
74
|
+
* refactoring capabilities adding dynamic capability opt parameter
|
75
|
+
|
76
|
+
=== 0.0.8 September 30, 2010
|
77
|
+
* add end of rib markers
|
78
|
+
eg
|
79
|
+
Mp_unreach.new(:afi=>1, :safi=>4).to_shex
|
80
|
+
=> '800f03000104'
|
81
|
+
Mp_unreach.new(:afi=>1, :safi=>128).to_shex
|
82
|
+
=> '800f03000180'
|
83
|
+
Mp_unreach.new(:afi=>1, :safi=>2).to_shex
|
84
|
+
=> '800f03000102'
|
85
|
+
|
86
|
+
* change optional parameter length encoding
|
87
|
+
as per draft-ietf-idr-ext-opt-param-01
|
88
|
+
|
89
|
+
=== 0.0.7 September 12, 2010
|
90
|
+
* refactoring
|
91
|
+
* more tests
|
92
|
+
* more examples
|
93
|
+
* Add Neighbor#is_<state>? predicates
|
94
|
+
|
95
|
+
=== 0.0.6 September 12, 2010
|
96
|
+
* Fix decoding updates with as4byte as in ruy 1.9
|
97
|
+
|
98
|
+
=== 0.0.5 August 14, 2010
|
99
|
+
|
100
|
+
* allow for appending Nlri to update object
|
101
|
+
eg,
|
102
|
+
|
103
|
+
u = Update.new
|
104
|
+
u << '100.0.0.0/13'
|
105
|
+
u << '99.0.0.0/12'
|
106
|
+
|
107
|
+
>> u.nlri.size
|
108
|
+
=> 2
|
109
|
+
|
110
|
+
>> puts u.nlri.to_s
|
111
|
+
=> 100.0.0.0/13
|
112
|
+
99.0.0.0/12
|
113
|
+
|
114
|
+
* allow for apending Attributes to an Update object
|
115
|
+
eg,
|
116
|
+
|
117
|
+
update = Update.new
|
118
|
+
update << Origin.new
|
119
|
+
update << Next_hop.new('10.0.0.1')
|
120
|
+
update << As_path.new(1,2,3,4,5,6,7,8)
|
121
|
+
|
122
|
+
=== 0.0.4 June 30, 2009
|
123
|
+
=== 0.0.3 June 29, 2009
|
124
|
+
=== 0.0.2 June 29, 2009
|
125
|
+
* example of how to code a simple route generator using bgp4r
|
126
|
+
|
127
|
+
=== 0.0.1 Fri Jun 26 2009
|
128
|
+
* Initial commit
|
129
|
+
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'bgp4r'
|
2
|
+
include BGP
|
3
|
+
|
4
|
+
def create_fiber(base_prefix, nprefix=22, npack=10)
|
5
|
+
fiber = Fiber.new do
|
6
|
+
ipaddr = IPAddr.new(base_prefix)
|
7
|
+
prefixes=[]
|
8
|
+
nprefix.times do |i|
|
9
|
+
prefixes << (ipaddr ^ i)
|
10
|
+
next unless (i%npack)==0
|
11
|
+
Fiber.yield prefixes
|
12
|
+
prefixes=[]
|
13
|
+
end
|
14
|
+
Fiber.yield prefixes unless prefixes.empty?
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
fiber
|
18
|
+
end
|
19
|
+
|
20
|
+
nexthop4='22.22.22.254'
|
21
|
+
nexthop6='2014:33::fe'
|
22
|
+
|
23
|
+
pa = Path_attribute.new(
|
24
|
+
Next_hop.new(nexthop4),
|
25
|
+
Origin.new(0),
|
26
|
+
Multi_exit_disc.new(0),
|
27
|
+
As_path.new(200),
|
28
|
+
)
|
29
|
+
|
30
|
+
ipv4_routes = create_fiber("13.11.0.0/26")
|
31
|
+
ipv6_routes = create_fiber("2014:13:11::0/49")
|
32
|
+
|
33
|
+
Log.create
|
34
|
+
Log.level=Logger::INFO
|
35
|
+
|
36
|
+
n4 = Neighbor.new :my_as=> 200, :remote_addr => '22.22.22.1', :id=> '20.20.20.20'
|
37
|
+
n6 = Neighbor.new :my_as=> 200, :remote_addr => '2014:22::1', :id=> '20.20.20.20'
|
38
|
+
|
39
|
+
[n4, n6].each do |n|
|
40
|
+
n.capability_mbgp_ipv4_unicast
|
41
|
+
n.capability_mbgp_ipv6_unicast
|
42
|
+
end
|
43
|
+
|
44
|
+
[n4,n6].each { |n| n.start }
|
45
|
+
|
46
|
+
while subnets = ipv4_routes.resume
|
47
|
+
n6.send_message Update.new pa.replace(Mp_reach.new(:afi=>1, :safi=>1, :nexthop=> nexthop4, :nlris=> subnets))
|
48
|
+
end
|
49
|
+
|
50
|
+
while subnets = ipv6_routes.resume
|
51
|
+
n4.send_message Update.new pa.replace(Mp_reach.new(:afi=>2, :safi=>1, :nexthop=> nexthop6, :nlris=> subnets))
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
sleep(300)
|
56
|
+
|
57
|
+
__END__
|
58
|
+
|
59
|
+
Produces:
|
60
|
+
|
61
|
+
vyatta@R1:~$ show ip bgp summary
|
62
|
+
BGP router identifier 1.1.1.1, local AS number 100
|
63
|
+
BGP table version is 42
|
64
|
+
1 BGP AS-PATH entries
|
65
|
+
0 BGP community entries
|
66
|
+
|
67
|
+
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
|
68
|
+
22.22.22.254 4 200 131 93 42 0 0 00:00:07 0
|
69
|
+
2014:22::fe 4 200 71 50 42 0 0 00:00:07 22
|
70
|
+
|
71
|
+
Total number of neighbors 2
|
72
|
+
vyatta@R1:~$
|
73
|
+
|
74
|
+
|
75
|
+
[jme@localhost bgp4r]$ ruby -I. examples/ebgp-vyatta-ipv4-ipv6.rb
|
76
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor Open Socket old state Idle new state Active
|
77
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor SendOpen
|
78
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor ev_send_open old state Active new state OpenSent
|
79
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor RecvOpen
|
80
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor RecvOpen old state OpenSent new state OpenConfirm
|
81
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor RecvKeepalive
|
82
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor SendKeepalive
|
83
|
+
I, [33:40#10776] INFO -- : BGP::Neighbor RecvKeepAlive old state OpenConfirm new state Established
|
84
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor version: 4, id: 20.20.20.20, as: 200, holdtime: 180, peer addr: 22.22.22.1, local addr: started
|
85
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor Open Socket old state Idle new state Active
|
86
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendOpen
|
87
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor ev_send_open old state Active new state OpenSent
|
88
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor RecvOpen
|
89
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor RecvOpen old state OpenSent new state OpenConfirm
|
90
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor RecvKeepalive
|
91
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendKeepalive
|
92
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor RecvKeepAlive old state OpenConfirm new state Established
|
93
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor version: 4, id: 20.20.20.20, as: 200, holdtime: 180, peer addr: 2014:22::1, local addr: started
|
94
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
95
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
96
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
97
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
98
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
99
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
100
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
101
|
+
I, [33:41#10776] INFO -- : BGP::Neighbor SendUpdate
|
102
|
+
I, [34:10#10776] INFO -- : BGP::Neighbor RecvKeepalive
|
103
|
+
I, [34:11#10776] INFO -- : BGP::Neighbor RecvKeepalive
|
104
|
+
|
105
|
+
|
106
|
+
vyatta@R1:~$ show ip bgp
|
107
|
+
BGP table version is 14, local router ID is 1.1.1.1
|
108
|
+
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, l - labeled
|
109
|
+
S Stale
|
110
|
+
Origin codes: i - IGP, e - EGP, ? - incomplete
|
111
|
+
|
112
|
+
Network Next Hop Metric LocPrf Weight Path
|
113
|
+
*> 13.11.0.0/26 22.22.22.254 0 0 200 i
|
114
|
+
*> 13.11.0.64/26 22.22.22.254 0 0 200 i
|
115
|
+
*> 13.11.0.128/26 22.22.22.254 0 0 200 i
|
116
|
+
*> 13.11.0.192/26 22.22.22.254 0 0 200 i
|
117
|
+
*> 13.11.1.0/26 22.22.22.254 0 0 200 i
|
118
|
+
*> 13.11.1.64/26 22.22.22.254 0 0 200 i
|
119
|
+
*> 13.11.1.128/26 22.22.22.254 0 0 200 i
|
120
|
+
*> 13.11.1.192/26 22.22.22.254 0 0 200 i
|
121
|
+
*> 13.11.2.0/26 22.22.22.254 0 0 200 i
|
122
|
+
*> 13.11.2.64/26 22.22.22.254 0 0 200 i
|
123
|
+
*> 13.11.2.128/26 22.22.22.254 0 0 200 i
|
124
|
+
*> 13.11.2.192/26 22.22.22.254 0 0 200 i
|
125
|
+
*> 13.11.3.0/26 22.22.22.254 0 0 200 i
|
126
|
+
*> 13.11.3.64/26 22.22.22.254 0 0 200 i
|
127
|
+
*> 13.11.3.128/26 22.22.22.254 0 0 200 i
|
128
|
+
*> 13.11.3.192/26 22.22.22.254 0 0 200 i
|
129
|
+
*> 13.11.4.0/26 22.22.22.254 0 0 200 i
|
130
|
+
*> 13.11.4.64/26 22.22.22.254 0 0 200 i
|
131
|
+
*> 13.11.4.128/26 22.22.22.254 0 0 200 i
|
132
|
+
*> 13.11.4.192/26 22.22.22.254 0 0 200 i
|
133
|
+
*> 13.11.5.0/26 22.22.22.254 0 0 200 i
|
134
|
+
*> 13.11.5.64/26 22.22.22.254 0 0 200 i
|
135
|
+
|
136
|
+
Total number of prefixes 22
|
137
|
+
vyatta@R1:~$
|
138
|
+
|
139
|
+
vyatta@R1:~$ show ipv6 bgp
|
140
|
+
BGP table version is 8, local router ID is 1.1.1.1
|
141
|
+
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, l - labeled
|
142
|
+
S Stale
|
143
|
+
Origin codes: i - IGP, e - EGP, ? - incomplete
|
144
|
+
|
145
|
+
Network Next Hop Metric LocPrf Weight Path
|
146
|
+
*> 2014:13:11::/49 2014:33::fe 0 0 200 i
|
147
|
+
*> 2014:13:11:8000::/49
|
148
|
+
2014:33::fe 0 0 200 i
|
149
|
+
*> 2014:13:12::/49 2014:33::fe 0 0 200 i
|
150
|
+
*> 2014:13:12:8000::/49
|
151
|
+
2014:33::fe 0 0 200 i
|
152
|
+
*> 2014:13:13::/49 2014:33::fe 0 0 200 i
|
153
|
+
*> 2014:13:13:8000::/49
|
154
|
+
2014:33::fe 0 0 200 i
|
155
|
+
*> 2014:13:14::/49 2014:33::fe 0 0 200 i
|
156
|
+
*> 2014:13:14:8000::/49
|
157
|
+
2014:33::fe 0 0 200 i
|
158
|
+
*> 2014:13:15::/49 2014:33::fe 0 0 200 i
|
159
|
+
*> 2014:13:15:8000::/49
|
160
|
+
2014:33::fe 0 0 200 i
|
161
|
+
*> 2014:13:16::/49 2014:33::fe 0 0 200 i
|
162
|
+
*> 2014:13:16:8000::/49
|
163
|
+
2014:33::fe 0 0 200 i
|
164
|
+
*> 2014:13:17::/49 2014:33::fe 0 0 200 i
|
165
|
+
*> 2014:13:17:8000::/49
|
166
|
+
2014:33::fe 0 0 200 i
|
167
|
+
*> 2014:13:18::/49 2014:33::fe 0 0 200 i
|
168
|
+
*> 2014:13:18:8000::/49
|
169
|
+
2014:33::fe 0 0 200 i
|
170
|
+
*> 2014:13:19::/49 2014:33::fe 0 0 200 i
|
171
|
+
*> 2014:13:19:8000::/49
|
172
|
+
2014:33::fe 0 0 200 i
|
173
|
+
*> 2014:13:1a::/49 2014:33::fe 0 0 200 i
|
174
|
+
*> 2014:13:1a:8000::/49
|
175
|
+
2014:33::fe 0 0 200 i
|
176
|
+
*> 2014:13:1b::/49 2014:33::fe 0 0 200 i
|
177
|
+
*> 2014:13:1b:8000::/49
|
178
|
+
2014:33::fe 0 0 200 i
|
179
|
+
|
180
|
+
Total number of prefixes 22
|
181
|
+
vyatta@R1:~$
|
182
|
+
|
183
|
+
|
184
|
+
=======================================================
|
185
|
+
|
186
|
+
[jme@localhost bgp4r]$ ifconfig p7p1 | grep inet
|
187
|
+
inet 22.22.22.254 netmask 255.255.255.0 broadcast 22.22.22.255
|
188
|
+
inet6 fe80::a00:27ff:fef4:4594 prefixlen 64 scopeid 0x20<link>
|
189
|
+
inet6 2014:22::fe prefixlen 64 scopeid 0x0<global>
|
190
|
+
|
191
|
+
|
192
|
+
=======================================================
|
193
|
+
|
194
|
+
vyatta@R1:~$ show configuration
|
195
|
+
interfaces {
|
196
|
+
ethernet eth0 {
|
197
|
+
address dhcp
|
198
|
+
duplex auto
|
199
|
+
hw-id 08:00:27:eb:d8:59
|
200
|
+
smp_affinity auto
|
201
|
+
speed auto
|
202
|
+
}
|
203
|
+
ethernet eth1 {
|
204
|
+
address 22.22.22.1/24
|
205
|
+
address 2014:22::1/48
|
206
|
+
duplex auto
|
207
|
+
hw-id 08:00:27:a2:42:17
|
208
|
+
smp_affinity auto
|
209
|
+
speed auto
|
210
|
+
}
|
211
|
+
loopback lo {
|
212
|
+
address 10.0.0.11/32
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
protocols {
|
217
|
+
bgp 100 {
|
218
|
+
neighbor 22.22.22.254 {
|
219
|
+
address-family {
|
220
|
+
ipv6-unicast {
|
221
|
+
}
|
222
|
+
}
|
223
|
+
remote-as 200
|
224
|
+
}
|
225
|
+
neighbor 2014:22::fe {
|
226
|
+
remote-as 200
|
227
|
+
}
|
228
|
+
parameters {
|
229
|
+
router-id 1.1.1.1
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
=======================================================
|
235
|
+
|
236
|
+
vyatta@R1:~$ show version
|
237
|
+
Version: VSE6.6R6S1
|
238
|
+
Description: Brocade Vyatta 5410 vRouter 6.6 R6S1
|
239
|
+
Copyright: 2006-2014 Vyatta, Inc.
|
240
|
+
Built by: autobuild@vyatta.com
|
241
|
+
Built on: Fri Jul 11 18:57:24 UTC 2014
|
242
|
+
Build ID: 1407111901-b191d5c
|
243
|
+
System type: Intel 64bit
|
244
|
+
Boot via: image
|
245
|
+
Hypervisor: VirtualBox
|
246
|
+
HW model: VirtualBox
|
247
|
+
HW S/N: 0
|
248
|
+
HW UUID: D4AE187C-C189-4D7D-ABEE-4F7EF8FF5C64
|
249
|
+
Uptime: 18:17:31 up 2:41, 2 users, load average: 0.00, 0.01, 0.05
|
250
|
+
|
data/test/unit/all
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bgp4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Michel Esnault
|
@@ -10,9 +10,8 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
email: bgp4r@esnault.org
|
13
|
+
description: Best way to play with BGP protocol using ruby
|
14
|
+
email: jesnault@gmail.com
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files:
|
@@ -40,13 +39,13 @@ files:
|
|
40
39
|
- bgp/nlris/inet.rb
|
41
40
|
- bgp/nlris/label.rb
|
42
41
|
- bgp/nlris/labeled.rb
|
42
|
+
- bgp/nlris/mapped_ipv4.rb
|
43
43
|
- bgp/nlris/nlri.rb
|
44
44
|
- bgp/nlris/nlris.rb
|
45
45
|
- bgp/nlris/nsap.rb
|
46
46
|
- bgp/nlris/prefix.rb
|
47
47
|
- bgp/nlris/rd.rb
|
48
48
|
- bgp/nlris/vpn.rb
|
49
|
-
- bgp/nlris/mapped_ipv4.rb
|
50
49
|
- bgp/optional_parameters/add_path.rb
|
51
50
|
- bgp/optional_parameters/as4.rb
|
52
51
|
- bgp/optional_parameters/capabilities.rb
|
@@ -79,7 +78,10 @@ files:
|
|
79
78
|
- bgp/path_attributes/path_attribute.rb
|
80
79
|
- bgp4r.gemspec
|
81
80
|
- bgp4r.rb
|
81
|
+
- changelog.txt
|
82
82
|
- examples/a_live_feed
|
83
|
+
- examples/ebgp-vyatta-ipv4-ipv6.rb
|
84
|
+
- examples/ibgp-vyatta-ipv6.rb
|
83
85
|
- examples/routegen
|
84
86
|
- examples/routegen.yml
|
85
87
|
- examples/simple.rb
|
@@ -87,11 +89,11 @@ files:
|
|
87
89
|
- examples/unit-testing/no_export_test.rb
|
88
90
|
- examples/unit-testing/prepend_aspath_test.rb
|
89
91
|
- examples/unit-testing/unknown_transitive_attr_test.rb
|
90
|
-
- examples/bgp-vyatta-ipv6.rb
|
91
92
|
- test/functional/add_path_test.rb
|
92
93
|
- test/functional/live_feed_test.rb
|
93
94
|
- test/helpers/server.rb
|
94
95
|
- test/misc/misc.rb
|
96
|
+
- test/unit/all
|
95
97
|
- test/unit/common_test.rb
|
96
98
|
- test/unit/iana_test.rb
|
97
99
|
- test/unit/messages/capability_test.rb
|
@@ -112,7 +114,6 @@ files:
|
|
112
114
|
- test/unit/nlris/prefix_test.rb
|
113
115
|
- test/unit/nlris/rd_test.rb
|
114
116
|
- test/unit/nlris/vpn_test.rb
|
115
|
-
- test/unit/nlris/mapped_ipv4_test.rb
|
116
117
|
- test/unit/optional_parameters/add_path_test.rb
|
117
118
|
- test/unit/optional_parameters/as4_test.rb
|
118
119
|
- test/unit/optional_parameters/capability_test.rb
|
@@ -140,34 +141,39 @@ files:
|
|
140
141
|
- test/unit/path_attributes/origin_test.rb
|
141
142
|
- test/unit/path_attributes/originator_id_test.rb
|
142
143
|
- test/unit/path_attributes/path_attribute_test.rb
|
143
|
-
homepage: http://github.com/jesnault/bgp4r
|
144
|
+
homepage: http://github.com/jesnault/bgp4r
|
144
145
|
licenses: []
|
145
146
|
metadata: {}
|
146
147
|
post_install_message:
|
147
|
-
rdoc_options:
|
148
|
+
rdoc_options:
|
149
|
+
- "--quiet"
|
150
|
+
- "--title"
|
151
|
+
- bgp4r
|
152
|
+
- "--line-numbers"
|
148
153
|
require_paths:
|
149
|
-
- .
|
154
|
+
- "."
|
150
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|
151
156
|
requirements:
|
152
|
-
- -
|
157
|
+
- - ">="
|
153
158
|
- !ruby/object:Gem::Version
|
154
159
|
version: 1.8.6
|
155
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
161
|
requirements:
|
157
|
-
- -
|
162
|
+
- - ">="
|
158
163
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
164
|
+
version: 1.3.6
|
160
165
|
requirements: []
|
161
|
-
rubyforge_project:
|
162
|
-
rubygems_version: 2.
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.2.2
|
163
168
|
signing_key:
|
164
|
-
specification_version:
|
165
|
-
summary:
|
169
|
+
specification_version: 4
|
170
|
+
summary: Best way to play with BGP protocol using ruby
|
166
171
|
test_files:
|
167
172
|
- test/functional/add_path_test.rb
|
168
173
|
- test/functional/live_feed_test.rb
|
169
174
|
- test/helpers/server.rb
|
170
175
|
- test/misc/misc.rb
|
176
|
+
- test/unit/all
|
171
177
|
- test/unit/common_test.rb
|
172
178
|
- test/unit/iana_test.rb
|
173
179
|
- test/unit/messages/capability_test.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright 2014 Jean-Michel Esnault.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# This file is part of BGP4R.
|
8
|
-
#
|
9
|
-
|
10
|
-
require "test/unit"
|
11
|
-
require 'bgp/nlris/mapped_ipv4'
|
12
|
-
|
13
|
-
class TestNlrisIpv4Mapped < Test::Unit::TestCase
|
14
|
-
include BGP
|
15
|
-
def test_ipv4_mapped
|
16
|
-
assert_equal('10.0.0.1', Ipv4_mapped.new('10.0.0.1').to_s)
|
17
|
-
assert_equal('00000000000000000000ffff0a000001', Ipv4_mapped.new('10.0.0.1').to_shex)
|
18
|
-
end
|
19
|
-
end
|
File without changes
|