bgp4r 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/README.rdoc +21 -15
  2. data/bgp/common.rb +13 -12
  3. data/bgp/iana.rb +28 -205
  4. data/bgp/io.rb +0 -1
  5. data/bgp/messages/capability.rb +1 -1
  6. data/bgp/messages/message.rb +1 -1
  7. data/bgp/messages/open.rb +1 -1
  8. data/bgp/messages/route_refresh.rb +4 -7
  9. data/bgp/messages/update.rb +9 -6
  10. data/bgp/misc/live_feed.rb +1 -2
  11. data/bgp/neighbor/add_path_cap.rb +14 -13
  12. data/bgp/neighbor/neighbor.rb +30 -18
  13. data/bgp/nlris/inet.rb +9 -11
  14. data/bgp/nlris/label.rb +1 -1
  15. data/bgp/nlris/labeled.rb +31 -4
  16. data/bgp/nlris/nlri.rb +23 -183
  17. data/bgp/nlris/nsap.rb +101 -0
  18. data/bgp/nlris/prefix.rb +162 -24
  19. data/bgp/nlris/rd.rb +1 -1
  20. data/bgp/nlris/vpn.rb +23 -5
  21. data/bgp/optional_parameters/add_path.rb +11 -37
  22. data/bgp/optional_parameters/as4.rb +1 -1
  23. data/bgp/optional_parameters/capability.rb +1 -11
  24. data/bgp/optional_parameters/dynamic.rb +1 -1
  25. data/bgp/optional_parameters/graceful_restart.rb +35 -22
  26. data/bgp/optional_parameters/mbgp.rb +23 -37
  27. data/bgp/optional_parameters/orf.rb +1 -1
  28. data/bgp/optional_parameters/route_refresh.rb +1 -1
  29. data/bgp/orfs/prefix_orf.rb +3 -6
  30. data/bgp/path_attributes/aggregator.rb +1 -1
  31. data/bgp/path_attributes/as_path.rb +1 -1
  32. data/bgp/path_attributes/atomic_aggregate.rb +1 -1
  33. data/bgp/path_attributes/cluster_list.rb +1 -1
  34. data/bgp/path_attributes/communities.rb +1 -1
  35. data/bgp/path_attributes/extended_communities.rb +1 -1
  36. data/bgp/path_attributes/extended_community.rb +55 -26
  37. data/bgp/path_attributes/local_pref.rb +1 -1
  38. data/bgp/path_attributes/mp_reach.rb +178 -76
  39. data/bgp/path_attributes/mp_unreach.rb +11 -67
  40. data/bgp/path_attributes/multi_exit_disc.rb +1 -1
  41. data/bgp/path_attributes/next_hop.rb +1 -1
  42. data/bgp/path_attributes/origin.rb +1 -1
  43. data/bgp/path_attributes/originator_id.rb +1 -1
  44. data/bgp/path_attributes/path_attribute.rb +1 -1
  45. data/bgp4r.gemspec +130 -183
  46. data/examples/routegen +0 -1
  47. data/examples/test.rb +15 -0
  48. data/examples/test2.rb +116 -0
  49. data/examples/unit-testing/{malformed_update.rb → malformed_update_test.rb} +6 -6
  50. data/examples/unit-testing/{no_export.rb → no_export_test.rb} +6 -6
  51. data/examples/unit-testing/{prepend_aspath.rb → prepend_aspath_test.rb} +6 -6
  52. data/test/functional/add_path_test.rb +32 -0
  53. data/test/helpers/server.rb +11 -4
  54. data/test/{common_test.rb → unit/common_test.rb} +7 -10
  55. data/test/{iana_test.rb → unit/iana_test.rb} +7 -6
  56. data/test/{messages → unit/messages}/capability_test.rb +26 -9
  57. data/test/{messages → unit/messages}/route_refresh_test.rb +4 -4
  58. data/test/{messages → unit/messages}/update_test.rb +28 -17
  59. data/test/{neighbor → unit/neighbor}/add_path_cap_test.rb +41 -0
  60. data/test/{neighbor → unit/neighbor}/neighbor_test.rb +31 -13
  61. data/test/unit/nlris/labeled_test.rb +30 -0
  62. data/test/unit/nlris/nlri_test.rb +103 -0
  63. data/test/unit/nlris/nsap_test.rb +80 -0
  64. data/test/unit/nlris/prefix_test.rb +136 -0
  65. data/test/{optional_parameters → unit/optional_parameters}/capability_test.rb +0 -5
  66. data/test/unit/optional_parameters/graceful_restart_test.rb +41 -0
  67. data/test/{optional_parameters → unit/optional_parameters}/mbgp_test.rb +20 -0
  68. data/test/unit/path_attributes/aigp.rb +59 -0
  69. data/test/{path_attributes → unit/path_attributes}/extended_communities_test.rb +4 -0
  70. data/test/{path_attributes → unit/path_attributes}/extended_community_test.rb +9 -0
  71. data/test/unit/path_attributes/mp_reach_test.rb +563 -0
  72. data/test/{path_attributes → unit/path_attributes}/path_attribute_test.rb +1 -1
  73. metadata +128 -136
  74. data/examples/unit-testing/test.rb +0 -82
  75. data/examples/unit-testing/test1.rb +0 -82
  76. data/examples/unit-testing/test2.rb +0 -44
  77. data/test/nlris/ext_nlri_test.rb +0 -32
  78. data/test/nlris/nlri_test.rb +0 -130
  79. data/test/optional_parameters/graceful_restart_test.rb +0 -24
  80. data/test/path_attributes/mp_reach_test.rb +0 -305
  81. /data/examples/unit-testing/{unknown_transitive_attr.rb → unknown_transitive_attr_test.rb} +0 -0
  82. /data/test/{misc → functional}/live_feed_test.rb +0 -0
  83. /data/test/{messages → unit/messages}/keepalive_test.rb +0 -0
  84. /data/test/{messages → unit/messages}/markers_test.rb +0 -0
  85. /data/test/{messages → unit/messages}/message_test.rb +0 -0
  86. /data/test/{messages → unit/messages}/notification_test.rb +0 -0
  87. /data/test/{messages → unit/messages}/open_test.rb +0 -0
  88. /data/test/{nlris → unit/nlris}/inet_test.rb +0 -0
  89. /data/test/{nlris/labeled_test.rb → unit/nlris/label_test.rb} +0 -0
  90. /data/test/{nlris → unit/nlris}/rd_test.rb +0 -0
  91. /data/test/{optional_parameters → unit/optional_parameters}/add_path_test.rb +0 -0
  92. /data/test/{optional_parameters → unit/optional_parameters}/as4_test.rb +0 -0
  93. /data/test/{optional_parameters → unit/optional_parameters}/dynamic_test.rb +0 -0
  94. /data/test/{optional_parameters → unit/optional_parameters}/optional_parameter_test.rb +0 -0
  95. /data/test/{optional_parameters → unit/optional_parameters}/orf_test.rb +0 -0
  96. /data/test/{optional_parameters → unit/optional_parameters}/route_refresh_test.rb +0 -0
  97. /data/test/{orfs → unit/orfs}/prefix_orf_test.rb +0 -0
  98. /data/test/{path_attributes → unit/path_attributes}/aggregator_test.rb +0 -0
  99. /data/test/{path_attributes → unit/path_attributes}/as_path_test.rb +0 -0
  100. /data/test/{path_attributes → unit/path_attributes}/atomic_aggregate_test.rb +0 -0
  101. /data/test/{path_attributes → unit/path_attributes}/attribute_test.rb +0 -0
  102. /data/test/{path_attributes → unit/path_attributes}/cluster_list_test.rb +0 -0
  103. /data/test/{path_attributes → unit/path_attributes}/communities_test.rb +0 -0
  104. /data/test/{path_attributes → unit/path_attributes}/local_pref_test.rb +0 -0
  105. /data/test/{path_attributes → unit/path_attributes}/mp_unreach_test.rb +0 -0
  106. /data/test/{path_attributes → unit/path_attributes}/multi_exit_disc_test.rb +0 -0
  107. /data/test/{path_attributes → unit/path_attributes}/next_hop_test.rb +0 -0
  108. /data/test/{path_attributes → unit/path_attributes}/origin_test.rb +0 -0
  109. /data/test/{path_attributes → unit/path_attributes}/originator_id_test.rb +0 -0
data/bgp4r.gemspec CHANGED
@@ -1,206 +1,153 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{bgp4r}
8
- s.version = "0.0.12"
7
+ s.name = "bgp4r"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jean-Michel Esnault"]
12
- s.date = %q{2011-02-13}
13
- s.description = %q{BGP4R is a BGP-4 ruby library to create, send, and receive BGP messages in an object oriented manner}
14
- s.email = %q{bgp4r@esnault.org}
12
+ s.date = "2011-10-27"
13
+ s.description = "BGP4R is a BGP-4 ruby library to create, send, and receive BGP messages in an object oriented manner"
14
+ s.email = "bgp4r@esnault.org"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
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/prefix.rb",
44
- "bgp/nlris/rd.rb",
45
- "bgp/nlris/vpn.rb",
46
- "bgp/optional_parameters/add_path.rb",
47
- "bgp/optional_parameters/as4.rb",
48
- "bgp/optional_parameters/capabilities.rb",
49
- "bgp/optional_parameters/capability.rb",
50
- "bgp/optional_parameters/dynamic.rb",
51
- "bgp/optional_parameters/graceful_restart.rb",
52
- "bgp/optional_parameters/mbgp.rb",
53
- "bgp/optional_parameters/optional_parameter.rb",
54
- "bgp/optional_parameters/orf.rb",
55
- "bgp/optional_parameters/route_refresh.rb",
56
- "bgp/orfs/orf.rb",
57
- "bgp/orfs/prefix_orf.rb",
58
- "bgp/path_attributes/aggregator.rb",
59
- "bgp/path_attributes/as_path.rb",
60
- "bgp/path_attributes/atomic_aggregate.rb",
61
- "bgp/path_attributes/attribute.rb",
62
- "bgp/path_attributes/attributes.rb",
63
- "bgp/path_attributes/cluster_list.rb",
64
- "bgp/path_attributes/communities.rb",
65
- "bgp/path_attributes/extended_communities.rb",
66
- "bgp/path_attributes/extended_community.rb",
67
- "bgp/path_attributes/local_pref.rb",
68
- "bgp/path_attributes/mp_reach.rb",
69
- "bgp/path_attributes/mp_unreach.rb",
70
- "bgp/path_attributes/multi_exit_disc.rb",
71
- "bgp/path_attributes/next_hop.rb",
72
- "bgp/path_attributes/origin.rb",
73
- "bgp/path_attributes/originator_id.rb",
74
- "bgp/path_attributes/path_attribute.rb",
75
- "bgp4r.gemspec",
76
- "bgp4r.rb",
77
- "examples/a_live_feed",
78
- "examples/routegen",
79
- "examples/routegen.yml",
80
- "examples/simple.rb",
81
- "examples/unit-testing/malformed_update.rb",
82
- "examples/unit-testing/no_export.rb",
83
- "examples/unit-testing/prepend_aspath.rb",
84
- "examples/unit-testing/test.rb",
85
- "examples/unit-testing/test1.rb",
86
- "examples/unit-testing/test2.rb",
87
- "examples/unit-testing/unknown_transitive_attr.rb",
88
- "test/common_test.rb",
89
- "test/helpers/server.rb",
90
- "test/iana_test.rb",
91
- "test/messages/capability_test.rb",
92
- "test/messages/keepalive_test.rb",
93
- "test/messages/markers_test.rb",
94
- "test/messages/message_test.rb",
95
- "test/messages/notification_test.rb",
96
- "test/messages/open_test.rb",
97
- "test/messages/route_refresh_test.rb",
98
- "test/messages/update_test.rb",
99
- "test/misc/live_feed_test.rb",
100
- "test/misc/misc.rb",
101
- "test/neighbor/add_path_cap_test.rb",
102
- "test/neighbor/neighbor_test.rb",
103
- "test/nlris/ext_nlri_test.rb",
104
- "test/nlris/inet_test.rb",
105
- "test/nlris/labeled_test.rb",
106
- "test/nlris/nlri_test.rb",
107
- "test/nlris/rd_test.rb",
108
- "test/optional_parameters/add_path_test.rb",
109
- "test/optional_parameters/as4_test.rb",
110
- "test/optional_parameters/capability_test.rb",
111
- "test/optional_parameters/dynamic_test.rb",
112
- "test/optional_parameters/graceful_restart_test.rb",
113
- "test/optional_parameters/mbgp_test.rb",
114
- "test/optional_parameters/optional_parameter_test.rb",
115
- "test/optional_parameters/orf_test.rb",
116
- "test/optional_parameters/route_refresh_test.rb",
117
- "test/orfs/prefix_orf_test.rb",
118
- "test/path_attributes/aggregator_test.rb",
119
- "test/path_attributes/as_path_test.rb",
120
- "test/path_attributes/atomic_aggregate_test.rb",
121
- "test/path_attributes/attribute_test.rb",
122
- "test/path_attributes/cluster_list_test.rb",
123
- "test/path_attributes/communities_test.rb",
124
- "test/path_attributes/extended_communities_test.rb",
125
- "test/path_attributes/extended_community_test.rb",
126
- "test/path_attributes/local_pref_test.rb",
127
- "test/path_attributes/mp_reach_test.rb",
128
- "test/path_attributes/mp_unreach_test.rb",
129
- "test/path_attributes/multi_exit_disc_test.rb",
130
- "test/path_attributes/next_hop_test.rb",
131
- "test/path_attributes/origin_test.rb",
132
- "test/path_attributes/originator_id_test.rb",
133
- "test/path_attributes/path_attribute_test.rb"
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/optional_parameters/add_path.rb",
48
+ "bgp/optional_parameters/as4.rb",
49
+ "bgp/optional_parameters/capabilities.rb",
50
+ "bgp/optional_parameters/capability.rb",
51
+ "bgp/optional_parameters/dynamic.rb",
52
+ "bgp/optional_parameters/graceful_restart.rb",
53
+ "bgp/optional_parameters/mbgp.rb",
54
+ "bgp/optional_parameters/optional_parameter.rb",
55
+ "bgp/optional_parameters/orf.rb",
56
+ "bgp/optional_parameters/route_refresh.rb",
57
+ "bgp/orfs/orf.rb",
58
+ "bgp/orfs/prefix_orf.rb",
59
+ "bgp/path_attributes/aggregator.rb",
60
+ "bgp/path_attributes/as_path.rb",
61
+ "bgp/path_attributes/atomic_aggregate.rb",
62
+ "bgp/path_attributes/attribute.rb",
63
+ "bgp/path_attributes/attributes.rb",
64
+ "bgp/path_attributes/cluster_list.rb",
65
+ "bgp/path_attributes/communities.rb",
66
+ "bgp/path_attributes/extended_communities.rb",
67
+ "bgp/path_attributes/extended_community.rb",
68
+ "bgp/path_attributes/local_pref.rb",
69
+ "bgp/path_attributes/mp_reach.rb",
70
+ "bgp/path_attributes/mp_unreach.rb",
71
+ "bgp/path_attributes/multi_exit_disc.rb",
72
+ "bgp/path_attributes/next_hop.rb",
73
+ "bgp/path_attributes/origin.rb",
74
+ "bgp/path_attributes/originator_id.rb",
75
+ "bgp/path_attributes/path_attribute.rb",
76
+ "bgp4r.gemspec",
77
+ "bgp4r.rb",
78
+ "examples/a_live_feed",
79
+ "examples/routegen",
80
+ "examples/routegen.yml",
81
+ "examples/simple.rb",
82
+ "examples/test.rb",
83
+ "examples/test2.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
+ "test/functional/add_path_test.rb",
89
+ "test/functional/live_feed_test.rb",
90
+ "test/helpers/server.rb",
91
+ "test/misc/misc.rb",
92
+ "test/unit/common_test.rb",
93
+ "test/unit/iana_test.rb",
94
+ "test/unit/messages/capability_test.rb",
95
+ "test/unit/messages/keepalive_test.rb",
96
+ "test/unit/messages/markers_test.rb",
97
+ "test/unit/messages/message_test.rb",
98
+ "test/unit/messages/notification_test.rb",
99
+ "test/unit/messages/open_test.rb",
100
+ "test/unit/messages/route_refresh_test.rb",
101
+ "test/unit/messages/update_test.rb",
102
+ "test/unit/neighbor/add_path_cap_test.rb",
103
+ "test/unit/neighbor/neighbor_test.rb",
104
+ "test/unit/nlris/inet_test.rb",
105
+ "test/unit/nlris/label_test.rb",
106
+ "test/unit/nlris/labeled_test.rb",
107
+ "test/unit/nlris/nlri_test.rb",
108
+ "test/unit/nlris/nsap_test.rb",
109
+ "test/unit/nlris/prefix_test.rb",
110
+ "test/unit/nlris/rd_test.rb",
111
+ "test/unit/optional_parameters/add_path_test.rb",
112
+ "test/unit/optional_parameters/as4_test.rb",
113
+ "test/unit/optional_parameters/capability_test.rb",
114
+ "test/unit/optional_parameters/dynamic_test.rb",
115
+ "test/unit/optional_parameters/graceful_restart_test.rb",
116
+ "test/unit/optional_parameters/mbgp_test.rb",
117
+ "test/unit/optional_parameters/optional_parameter_test.rb",
118
+ "test/unit/optional_parameters/orf_test.rb",
119
+ "test/unit/optional_parameters/route_refresh_test.rb",
120
+ "test/unit/orfs/prefix_orf_test.rb",
121
+ "test/unit/path_attributes/aggregator_test.rb",
122
+ "test/unit/path_attributes/aigp.rb",
123
+ "test/unit/path_attributes/as_path_test.rb",
124
+ "test/unit/path_attributes/atomic_aggregate_test.rb",
125
+ "test/unit/path_attributes/attribute_test.rb",
126
+ "test/unit/path_attributes/cluster_list_test.rb",
127
+ "test/unit/path_attributes/communities_test.rb",
128
+ "test/unit/path_attributes/extended_communities_test.rb",
129
+ "test/unit/path_attributes/extended_community_test.rb",
130
+ "test/unit/path_attributes/local_pref_test.rb",
131
+ "test/unit/path_attributes/mp_reach_test.rb",
132
+ "test/unit/path_attributes/mp_unreach_test.rb",
133
+ "test/unit/path_attributes/multi_exit_disc_test.rb",
134
+ "test/unit/path_attributes/next_hop_test.rb",
135
+ "test/unit/path_attributes/origin_test.rb",
136
+ "test/unit/path_attributes/originator_id_test.rb",
137
+ "test/unit/path_attributes/path_attribute_test.rb"
134
138
  ]
135
- s.homepage = %q{http://github.com/jesnault/bgp4r/tree/master}
136
- s.rdoc_options = ["--charset=UTF-8"]
139
+ s.homepage = "http://github.com/jesnault/bgp4r/tree/master"
137
140
  s.require_paths = ["."]
138
141
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.6")
139
- s.rubyforge_project = %q{bgp4r}
140
- s.rubygems_version = %q{1.3.6}
141
- s.summary = %q{A BGP-4 Ruby Library}
142
- s.test_files = [
143
- "test/common_test.rb",
144
- "test/helpers",
145
- "test/helpers/server.rb",
146
- "test/iana_test.rb",
147
- "test/messages",
148
- "test/messages/capability_test.rb",
149
- "test/messages/keepalive_test.rb",
150
- "test/messages/markers_test.rb",
151
- "test/messages/message_test.rb",
152
- "test/messages/notification_test.rb",
153
- "test/messages/open_test.rb",
154
- "test/messages/route_refresh_test.rb",
155
- "test/messages/update_test.rb",
156
- "test/misc",
157
- "test/misc/live_feed_test.rb",
158
- "test/misc/misc.rb",
159
- "test/neighbor",
160
- "test/neighbor/add_path_cap_test.rb",
161
- "test/neighbor/neighbor_test.rb",
162
- "test/nlris",
163
- "test/nlris/ext_nlri_test.rb",
164
- "test/nlris/inet_test.rb",
165
- "test/nlris/labeled_test.rb",
166
- "test/nlris/nlri_test.rb",
167
- "test/nlris/rd_test.rb",
168
- "test/optional_parameters",
169
- "test/optional_parameters/add_path_test.rb",
170
- "test/optional_parameters/as4_test.rb",
171
- "test/optional_parameters/capability_test.rb",
172
- "test/optional_parameters/dynamic_test.rb",
173
- "test/optional_parameters/graceful_restart_test.rb",
174
- "test/optional_parameters/mbgp_test.rb",
175
- "test/optional_parameters/optional_parameter_test.rb",
176
- "test/optional_parameters/orf_test.rb",
177
- "test/optional_parameters/route_refresh_test.rb",
178
- "test/orfs",
179
- "test/orfs/prefix_orf_test.rb",
180
- "test/path_attributes",
181
- "test/path_attributes/aggregator_test.rb",
182
- "test/path_attributes/as_path_test.rb",
183
- "test/path_attributes/atomic_aggregate_test.rb",
184
- "test/path_attributes/attribute_test.rb",
185
- "test/path_attributes/cluster_list_test.rb",
186
- "test/path_attributes/communities_test.rb",
187
- "test/path_attributes/extended_communities_test.rb",
188
- "test/path_attributes/extended_community_test.rb",
189
- "test/path_attributes/local_pref_test.rb",
190
- "test/path_attributes/mp_reach_test.rb",
191
- "test/path_attributes/mp_unreach_test.rb",
192
- "test/path_attributes/multi_exit_disc_test.rb",
193
- "test/path_attributes/next_hop_test.rb",
194
- "test/path_attributes/origin_test.rb",
195
- "test/path_attributes/originator_id_test.rb",
196
- "test/path_attributes/path_attribute_test.rb"
197
- ]
142
+ s.rubyforge_project = "bgp4r"
143
+ s.rubygems_version = "1.8.10"
144
+ s.summary = "A BGP-4 Ruby Library"
145
+ 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/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.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"]
198
146
 
199
147
  if s.respond_to? :specification_version then
200
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
201
148
  s.specification_version = 3
202
149
 
203
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
150
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
204
151
  else
205
152
  end
206
153
  else
data/examples/routegen CHANGED
@@ -6,7 +6,6 @@
6
6
  #
7
7
  #++
8
8
 
9
- require 'rubygems'
10
9
  require 'bgp4r'
11
10
  require 'yaml'
12
11
  include BGP
data/examples/test.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'bgp4r'
2
+ include BGP
3
+ Log.create
4
+ n = Neighbor.new 4, 1, 180, '1.1.1.1','127.0.0.1', '127.0.0.1'
5
+ # n.start :auto_retry => true
6
+ n.start :port=> 8090
7
+
8
+ sleep(200)
9
+
10
+
11
+ __END__
12
+
13
+
14
+ @c = Neighbor.new(4, 100, 180, '0.0.0.2', '127.0.0.1', '127.0.0.1')
15
+ @c.add_cap add_path_cap2
data/examples/test2.rb ADDED
@@ -0,0 +1,116 @@
1
+
2
+ require 'rubygems'
3
+ require 'eventmachine'
4
+ require 'bgp4r'
5
+
6
+
7
+ include BGP
8
+
9
+ pa = Path_attribute.new(
10
+ Origin.new,
11
+ Next_hop.new('10.0.0.1'),
12
+ Local_pref.new(300),
13
+ Communities.new('10:1 10:2 10:3'),
14
+ As_path.new('100 200 300 400')
15
+ )
16
+
17
+ times = 133
18
+ pack=13
19
+ nlri = IPAddr.new '11.0.0.1/24'
20
+
21
+ nlris = Nlri.new
22
+
23
+ updates = Fiber.new do
24
+ (1..times.to_i).each do |n|
25
+ nlris << (nlri ^ n)
26
+ next unless (n % pack) == 0 or (n == times)
27
+ Fiber.yield Update.new(pa, nlris)
28
+ nlris = Nlri.new
29
+ end
30
+ end
31
+
32
+ p updates.resume
33
+ p updates.resume
34
+ p updates.resume
35
+
36
+
37
+
38
+
39
+
40
+ __END__
41
+
42
+
43
+ pa = Path_attribute.new(
44
+ Origin.new(@origin),
45
+ Next_hop.new(@nexthop),
46
+ Local_pref.new(@local_pref),
47
+ Communities.new(*(@communities.split.map { |com| com.to_i})),
48
+ As_path.new(*(@as_path.split.map { |as| as.to_i}))
49
+ )
50
+
51
+
52
+ nlris = Nlri.new
53
+ (1..@times.to_i).each do |n|
54
+ nlris << (@nlri ^ n)
55
+ next unless (n % @pack) == 0 or (n == @times)
56
+ neighbor.send_message Update.new(pa, nlris)
57
+ nlris = Nlri.new
58
+ end
59
+
60
+ words = Fiber.new do File.foreach("testfile") do |line|
61
+ line.scan(/\w+/) do |word| Fiber.yield word.downcase
62
+ end end
63
+ end
64
+ Prepared exclusively for Jean-Michel Esnault
65
+ FIBERS 176
66
+ counts = Hash.new(0) while word = words.resume
67
+ counts[word] += 1
68
+ end
69
+
70
+
71
+
72
+
73
+ __END__
74
+
75
+
76
+
77
+
78
+ Thread.abort_on_exception = true
79
+
80
+ Log.create
81
+
82
+ class Session
83
+ def initialize
84
+ end
85
+ def start(arg={})
86
+ options = {:duration=> 120, :as=> 1, :holdtime=> 180, :id=> '2.2.2.2', :peer=> '127.0.0.1'}.merge(arg)
87
+
88
+ Thread.new do
89
+ EM.run do
90
+ @c = EM.connect(options[:peer], 8090,
91
+ BGP::ConnectionHandler, 4,
92
+ options[:as], options[:holdtime], options[:id], options[:peer])
93
+ @c.add_observer(self)
94
+ end
95
+ end
96
+ end
97
+
98
+ def update(*args)
99
+ end
100
+
101
+ def stop
102
+ EM.stop
103
+ end
104
+ end
105
+
106
+ n = Session.new
107
+ n.start :duration=> 120, :as=> 1, :holdtime=> 10, :id=> '2.2.2.2', :peer=> '127.0.0.1'
108
+
109
+ p 'HERE ABOUT TO SLEEP'
110
+ sleep(20)
111
+ p $c
112
+ p "ABOUT TO SHUT DOWN EM"
113
+ n.stop
114
+
115
+
116
+ __END__
@@ -55,12 +55,12 @@ class TestBgp < Test::Unit::TestCase
55
55
 
56
56
  def recv(q, timeout=5)
57
57
  begin
58
- Timeout::timeout(timeout) do |t|
59
- msg = q.deq
60
- end
61
- rescue Timeout::Error => e
62
- nil
63
- end
58
+ Timeout::timeout(timeout) do |t|
59
+ msg = q.deq
60
+ end
61
+ rescue Timeout::Error => e
62
+ nil
63
+ end
64
64
  end
65
65
 
66
66
  def malformed_update
@@ -80,12 +80,12 @@ class TestBgp < Test::Unit::TestCase
80
80
 
81
81
  def recv(q, timeout=5)
82
82
  begin
83
- Timeout::timeout(timeout) do |t|
84
- msg = q.deq
85
- end
86
- rescue Timeout::Error => e
87
- nil
88
- end
83
+ Timeout::timeout(timeout) do |t|
84
+ msg = q.deq
85
+ end
86
+ rescue Timeout::Error => e
87
+ nil
88
+ end
89
89
  end
90
90
 
91
91
  def an_exportable_update
@@ -58,12 +58,12 @@ class TestBgp < Test::Unit::TestCase
58
58
 
59
59
  def recv(q, timeout=5)
60
60
  begin
61
- Timeout::timeout(timeout) do |t|
62
- msg = q.deq
63
- end
64
- rescue Timeout::Error => e
65
- nil
66
- end
61
+ Timeout::timeout(timeout) do |t|
62
+ msg = q.deq
63
+ end
64
+ rescue Timeout::Error => e
65
+ nil
66
+ end
67
67
  end
68
68
 
69
69
  def update1
@@ -0,0 +1,32 @@
1
+
2
+ require 'bgp4r'
3
+ require 'test/helpers/server'
4
+
5
+ include BGP
6
+ include BGP::OPT_PARM::CAP
7
+ include BGP::TestHelpers
8
+
9
+ require "test/unit"
10
+
11
+ require "bgp4r"
12
+
13
+ class TestAddPath < Test::Unit::TestCase
14
+
15
+ def test_local_and_remote_peers_can_send_and_or_receive_afi_1_safi_1_update_with_path_id
16
+ add_path_cap = BGP::OPT_PARM::CAP::Add_path.new
17
+ add_path_cap2 = BGP::OPT_PARM::CAP::Add_path.new
18
+ add_path_cap.add(:send_and_receive, 1, 1)
19
+ add_path_cap2.add(:send, 1, 1)
20
+ start_server(3456, add_path_cap)
21
+ @c = Neighbor.new(4, 100, 180, '0.0.0.2', '127.0.0.1', '127.0.0.1')
22
+ @c.add_cap add_path_cap2
23
+ @c.start :port=> 3456
24
+ assert ! @s.session_info.send_inet_unicast?, "Should *not* have the capability to send inet unicast reachability path info."
25
+ assert @s.session_info.recv_inet_unicast?, "Should have the capability to recv inet unicast reachability path info."
26
+ assert @c.session_info.send_inet_unicast?, "Should have the capability to send inet unicast reachability path info."
27
+ assert ! @c.session_info.recv_inet_unicast?, "Should *not* have the capability to recv inet unicast reachability path info."
28
+ assert ! @c.session_info.send_inet6_unicast?, "Should *not* have the capability to send inet6 unicast reachability path info."
29
+ assert ! @c.session_info.send_inet_multicast?, "Should *not* have the capability to send inet multicast reachability path info."
30
+ stop_server
31
+ end
32
+ end
@@ -1,20 +1,27 @@
1
1
  module BGP
2
2
  module TestHelpers
3
3
  def stop_server
4
+ # silence rake warnings....
5
+ @c ||=nil
6
+ @server ||=nil
7
+ @thread ||=nil
8
+ @s ||=nil
4
9
  @s.stop if @s
5
10
  @c.stop if @c
6
11
  @server.close if @server
7
12
  @thread.kill if @thread
13
+ rescue
8
14
  end
9
15
  def start_server(port, cap=nil)
10
16
  @server = TCPServer.new(port)
11
- @thread = Thread.new do
12
- while (session = @server.accept())
13
- @s = Neighbor.new(4, 100, 180, '0.0.0.1', '127.0.0.1', '127.0.0.1')
14
- @s.add_cap cap if cap
17
+ @s = Neighbor.new(4, 100, 180, '0.0.0.1', '127.0.0.1', '127.0.0.1')
18
+ @s.add_cap cap if cap
19
+ @thread = Thread.new(@s, @server) do |peer, sock|
20
+ while (session = sock.accept())
15
21
  @s.start_session(session)
16
22
  end
17
23
  end
24
+ rescue
18
25
  end
19
26
  end
20
27
  end