bgp4r 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/README.rdoc +1 -10
  2. data/bgp/io.rb +4 -2
  3. data/bgp/messages/capability.rb +176 -0
  4. data/bgp/messages/keepalive.rb +30 -0
  5. data/bgp/messages/markers.rb +10 -0
  6. data/bgp/messages/message.rb +85 -0
  7. data/bgp/messages/messages.rb +17 -0
  8. data/bgp/messages/notification.rb +116 -0
  9. data/bgp/messages/open.rb +117 -0
  10. data/bgp/messages/route_refresh.rb +181 -0
  11. data/bgp/messages/update.rb +148 -0
  12. data/bgp/neighbor.rb +20 -11
  13. data/bgp/nlris/inet.rb +18 -0
  14. data/bgp/{label.rb → nlris/label.rb} +1 -1
  15. data/bgp/nlris/labeled.rb +39 -0
  16. data/bgp/nlris/nlri.rb +154 -0
  17. data/bgp/{attributes.rb → nlris/nlris.rb} +11 -13
  18. data/bgp/nlris/prefix.rb +33 -0
  19. data/bgp/{rd.rb → nlris/rd.rb} +1 -1
  20. data/bgp/nlris/vpn.rb +68 -0
  21. data/bgp/optional_parameters/as4.rb +59 -0
  22. data/bgp/optional_parameters/capabilities.rb +13 -0
  23. data/bgp/optional_parameters/capability.rb +145 -0
  24. data/bgp/optional_parameters/dynamic.rb +37 -0
  25. data/bgp/optional_parameters/graceful_restart.rb +116 -0
  26. data/bgp/optional_parameters/mbgp.rb +97 -0
  27. data/bgp/optional_parameters/optional_parameter.rb +76 -0
  28. data/bgp/optional_parameters/orf.rb +90 -0
  29. data/bgp/optional_parameters/route_refresh.rb +36 -0
  30. data/bgp/{prefix_orf.rb → orfs/prefix_orf.rb} +4 -10
  31. data/bgp/{aggregator.rb → path_attributes/aggregator.rb} +2 -2
  32. data/bgp/{as_path.rb → path_attributes/as_path.rb} +2 -2
  33. data/bgp/{atomic_aggregate.rb → path_attributes/atomic_aggregate.rb} +2 -2
  34. data/bgp/{attribute.rb → path_attributes/attribute.rb} +2 -2
  35. data/bgp/path_attributes/attributes.rb +21 -0
  36. data/bgp/{cluster_list.rb → path_attributes/cluster_list.rb} +2 -2
  37. data/bgp/{communities.rb → path_attributes/communities.rb} +2 -2
  38. data/bgp/{extended_communities.rb → path_attributes/extended_communities.rb} +3 -3
  39. data/bgp/{extended_community.rb → path_attributes/extended_community.rb} +1 -1
  40. data/bgp/{local_pref.rb → path_attributes/local_pref.rb} +2 -2
  41. data/bgp/{mp_reach.rb → path_attributes/mp_reach.rb} +3 -69
  42. data/bgp/path_attributes/mp_unreach.rb +97 -0
  43. data/bgp/{multi_exit_disc.rb → path_attributes/multi_exit_disc.rb} +2 -2
  44. data/bgp/{next_hop.rb → path_attributes/next_hop.rb} +2 -2
  45. data/bgp/{origin.rb → path_attributes/origin.rb} +2 -2
  46. data/bgp/{originator_id.rb → path_attributes/originator_id.rb} +2 -2
  47. data/bgp/{path_attribute.rb → path_attributes/path_attribute.rb} +6 -7
  48. data/bgp4r.gemspec +127 -67
  49. data/bgp4r.rb +5 -25
  50. data/examples/routegen +1 -1
  51. data/examples/routegen.yml +21 -5
  52. data/examples/simple.rb +4 -4
  53. data/examples/unit-testing/malformed_update.rb +1 -1
  54. data/examples/unit-testing/unknown_transitive_attr.rb +18 -10
  55. data/test/messages/capability_test.rb +113 -0
  56. data/test/messages/keepalive_test.rb +34 -0
  57. data/test/messages/markers_test.rb +33 -0
  58. data/test/messages/message_test.rb +43 -0
  59. data/test/messages/notification_test.rb +49 -0
  60. data/test/messages/open_test.rb +98 -0
  61. data/test/messages/route_refresh_test.rb +77 -0
  62. data/test/messages/update_test.rb +133 -0
  63. data/test/neighbor_test.rb +8 -9
  64. data/test/nlris/inet_test.rb +43 -0
  65. data/test/{label_test.rb → nlris/labeled_test.rb} +1 -1
  66. data/test/{nlri_test.rb → nlris/nlri_test.rb} +5 -1
  67. data/test/{rd_test.rb → nlris/rd_test.rb} +1 -2
  68. data/test/optional_parameters/as4_test.rb +34 -0
  69. data/test/optional_parameters/capability_test.rb +69 -0
  70. data/test/optional_parameters/dynamic_test.rb +34 -0
  71. data/test/optional_parameters/graceful_restart_test.rb +23 -0
  72. data/test/optional_parameters/mbgp_test.rb +35 -0
  73. data/test/optional_parameters/optional_parameter_test.rb +51 -0
  74. data/test/optional_parameters/orf_test.rb +42 -0
  75. data/test/optional_parameters/route_refresh_test.rb +32 -0
  76. data/test/{prefix_orf_test.rb → orfs/prefix_orf_test.rb} +2 -1
  77. data/test/{aggregator_test.rb → path_attributes/aggregator_test.rb} +1 -1
  78. data/test/{as_path_test.rb → path_attributes/as_path_test.rb} +1 -1
  79. data/test/{atomic_aggregate_test.rb → path_attributes/atomic_aggregate_test.rb} +1 -1
  80. data/test/{attribute_test.rb → path_attributes/attribute_test.rb} +2 -2
  81. data/test/{cluster_list_test.rb → path_attributes/cluster_list_test.rb} +1 -1
  82. data/test/{communities_test.rb → path_attributes/communities_test.rb} +1 -1
  83. data/test/{extended_communities_test.rb → path_attributes/extended_communities_test.rb} +1 -1
  84. data/test/{extended_community_test.rb → path_attributes/extended_community_test.rb} +1 -1
  85. data/test/{local_pref_test.rb → path_attributes/local_pref_test.rb} +1 -1
  86. data/test/{mp_reach_test.rb → path_attributes/mp_reach_test.rb} +1 -37
  87. data/test/path_attributes/mp_unreach_test.rb +67 -0
  88. data/test/{multi_exit_disc_test.rb → path_attributes/multi_exit_disc_test.rb} +1 -1
  89. data/test/{next_hop_test.rb → path_attributes/next_hop_test.rb} +1 -1
  90. data/test/{origin_test.rb → path_attributes/origin_test.rb} +2 -1
  91. data/test/{originator_id_test.rb → path_attributes/originator_id_test.rb} +1 -1
  92. data/test/{path_attribute_test.rb → path_attributes/path_attribute_test.rb} +2 -2
  93. metadata +122 -67
  94. data/bgp/message.rb +0 -921
  95. data/bgp/nlri.rb +0 -303
  96. data/bgp/version.rb +0 -3
  97. data/examples/unit-testing/keepalive_set_to_zeo.rb +0 -64
  98. data/test/message_test.rb +0 -347
  99. /data/bgp/{orf.rb → orfs/orf.rb} +0 -0
@@ -0,0 +1,36 @@
1
+ #--
2
+ # Copyright 2008, 2009 Jean-Michel Esnault.
3
+ # All rights reserved.
4
+ # See LICENSE.txt for permissions.
5
+ #
6
+ #
7
+ # This file is part of BGP4R.
8
+ #
9
+ # BGP4R is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # BGP4R is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
+ #++
22
+
23
+ require 'bgp/optional_parameters/capability'
24
+
25
+ module BGP::OPT_PARM::CAP
26
+ class Route_refresh < BGP::OPT_PARM::Capability
27
+ def initialize(code=OPT_PARM::CAP_ROUTE_REFRESH)
28
+ super(code)
29
+ end
30
+ def to_s
31
+ super + "\n Route Refresh #{@code==128 ? "(Cisco) " : ""}(#{@code}), length: 2"
32
+ end
33
+ end
34
+ end
35
+
36
+ load "../../test/optional_parameters/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,19 +21,13 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/nlri'
25
- require 'bgp/orf'
24
+ require 'bgp/nlris/nlri'
25
+ require 'bgp/orfs/orf'
26
26
 
27
27
  module BGP
28
28
 
29
29
  class Prefix_entry < Orf::Entry
30
-
31
- @_seqn_ = -10
32
- class << self
33
- attr_accessor :_seqn_
34
- def seqn ; Address_prefix_orf_entry._seqn_ +=10 ;end
35
- end
36
-
30
+
37
31
  def initialize(*args)
38
32
  if args[0].is_a?(String) and args[0].is_packed?
39
33
  _parse_(*args)
@@ -184,7 +178,7 @@ class BGP::Prefix_orf < BGP::Orf
184
178
 
185
179
  end
186
180
 
187
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
181
+ load "../../test/orfs/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
188
182
 
189
183
  __END__
190
184
 
@@ -20,7 +20,7 @@
20
20
  # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
21
  #++
22
22
 
23
- require 'bgp/attribute'
23
+ require 'bgp/path_attributes/attribute'
24
24
 
25
25
  module BGP
26
26
 
@@ -101,4 +101,4 @@ module BGP
101
101
 
102
102
  end
103
103
 
104
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
104
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -20,7 +20,7 @@
20
20
  # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
21
  #++
22
22
 
23
- require 'bgp/attribute'
23
+ require 'bgp/path_attributes/attribute'
24
24
 
25
25
  module BGP
26
26
 
@@ -219,5 +219,5 @@ module BGP
219
219
 
220
220
  end
221
221
 
222
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
222
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
223
223
 
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -39,4 +39,4 @@ module BGP
39
39
 
40
40
  end
41
41
 
42
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
42
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -141,9 +141,9 @@ module BGP
141
141
 
142
142
  case mode
143
143
  when :brief
144
- sprintf "%s %4s %10s: [%s]%s", flags, "(#{@type})", attribute_name, shex, "#{value.size>0 ? " '#{value}'" :''}"
144
+ sprintf "%s %4s %10s: [%s]%s", flags, "(#{@type})", attribute_name, shex, "#{value.size>0 ? " '#{value}'" : ''}"
145
145
  when :hexlify
146
- s = sprintf "%s %4s %10s: [%s]%s", flags, "(#{@type})", attribute_name, shex, "#{value.size>0 ? " '#{value}" :''}"
146
+ s = sprintf "%s %4s %10s: [%s]%s", flags, "(#{@type})", attribute_name, shex, "#{value.size>0 ? " '#{value}" : ''}"
147
147
  s +="\n\n"
148
148
  if as4byte
149
149
  s += self.encode4.hexlify.join("\n")
@@ -0,0 +1,21 @@
1
+
2
+ module BGP
3
+ end
4
+
5
+ %w{
6
+ origin next_hop
7
+ local_pref
8
+ multi_exit_disc
9
+ as_path
10
+ communities
11
+ aggregator
12
+ atomic_aggregate
13
+ originator_id
14
+ cluster_list
15
+ mp_reach
16
+ mp_unreach
17
+ extended_communities
18
+ path_attribute
19
+ }.each do |attr|
20
+ BGP.autoload attr.capitalize.to_sym,"bgp/path_attributes/#{attr}"
21
+ end
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -114,4 +114,4 @@ module BGP
114
114
 
115
115
  end
116
116
 
117
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
117
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
 
27
27
  module BGP
@@ -136,4 +136,4 @@ module BGP
136
136
  end
137
137
 
138
138
  end
139
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
139
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,8 +21,8 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
25
- require 'bgp/extended_community'
24
+ require 'bgp/path_attributes/attribute'
25
+ require 'bgp/path_attributes/extended_community'
26
26
 
27
27
  module BGP
28
28
 
@@ -104,4 +104,4 @@ module BGP
104
104
 
105
105
  end
106
106
 
107
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
107
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
  require 'bgp/common'
25
- require 'bgp/attribute'
25
+ require 'bgp/path_attributes/attribute'
26
26
 
27
27
  module BGP
28
28
 
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -72,4 +72,4 @@ module BGP
72
72
  end
73
73
 
74
74
  end
75
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
75
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -20,76 +20,10 @@
20
20
  # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
21
  #++
22
22
 
23
-
24
- require 'bgp/attribute'
25
- require 'bgp/nlri'
23
+ require 'bgp/path_attributes/attribute'
24
+ require 'bgp/nlris/nlris'
26
25
 
27
26
  module BGP
28
-
29
- class Mp_unreach < Attr
30
-
31
- attr_reader :safi, :nlris
32
-
33
- def initialize(*args)
34
- @safi, @nlris= 1, []
35
- @flags, @type = OPTIONAL, MP_UNREACH
36
- if args[0].is_a?(String) and args[0].is_packed?
37
- parse(args[0])
38
- elsif args[0].is_a?(self.class)
39
- parse(args[0].encode, *args[1..-1])
40
- elsif args[0].is_a?(Hash) and args.size==1
41
- set(*args)
42
- else
43
- raise ArgumentError, "invalid argument"
44
- end
45
- end
46
-
47
- def afi
48
- @afi ||= @nlris[0].afi
49
- end
50
-
51
- def set(h)
52
- @safi = h[:safi]
53
- case @safi
54
- when 1,2
55
- @nlris = [h[:prefix]].flatten.collect { |p| p.is_a?(Prefix) ? p : Prefix.new(p) }
56
- when 4
57
- @nlris = [h[:nlri]].flatten.collect { |n|
58
- prefix = n[:prefix].is_a?(String) ? Prefix.new(n[:prefix]) : n[:prefix]
59
- Labeled.new(prefix, *n[:label])
60
- }
61
- when 128,129 ; @nlris = [h[:nlri]].flatten.collect { |n|
62
- prefix = n[:prefix].is_a?(Prefix) ? n[:prefix] : Prefix.new(n[:prefix])
63
- rd = n[:rd].is_a?(Rd) ? n[:rd] : Rd.new(*n[:rd])
64
- Labeled.new(Vpn.new(prefix,rd), *n[:label]) }
65
- else
66
- end
67
- end
68
-
69
- def mp_unreach
70
- "\n AFI #{IANA.afi(afi)} (#{afi}), SAFI #{IANA.safi(safi)} (#{safi})" +
71
- (['']+ @nlris.collect { |nlri| nlri.to_s }).join("\n ")
72
- end
73
-
74
- def to_s(method=:default)
75
- super(mp_unreach, method)
76
- end
77
-
78
- def parse(s)
79
- @flags, @type, len, value = super(s)
80
- @afi, @safi = value.slice!(0,3).unpack('nC')
81
- while value.size>0
82
- blen = value.slice(0,1).unpack('C')[0]
83
- @nlris << Nlri.factory(value.slice!(0,(blen+7)/8+1), @afi, @safi)
84
- end
85
- raise RuntimeError, "leftover afer parsing: #{value.unpack('H*')}" if value.size>0
86
- end
87
-
88
- def encode
89
- super([afi, @safi, @nlris.collect { |n| n.encode }.join].pack('nCa*'))
90
- end
91
-
92
- end
93
27
 
94
28
  class Mp_reach < Attr
95
29
 
@@ -205,4 +139,4 @@ module BGP
205
139
 
206
140
  end
207
141
 
208
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
142
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -0,0 +1,97 @@
1
+ #--
2
+ # Copyright 2008, 2009, 2010 Jean-Michel Esnault.
3
+ # All rights reserved.
4
+ # See LICENSE.txt for permissions.
5
+ #
6
+ #
7
+ # This file is part of BGP4R.
8
+ #
9
+ # BGP4R is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 3 of the License, or
12
+ # (at your option) any later version.
13
+ #
14
+ # BGP4R is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
+ #++
22
+
23
+ require 'bgp/path_attributes/attribute'
24
+ require 'bgp/nlris/nlris'
25
+
26
+ module BGP
27
+
28
+ class Mp_unreach < Attr
29
+
30
+ attr_reader :safi, :nlris
31
+
32
+ def initialize(*args)
33
+ @safi, @nlris= 1, []
34
+ @flags, @type = OPTIONAL, MP_UNREACH
35
+ if args[0].is_a?(String) and args[0].is_packed?
36
+ parse(args[0])
37
+ elsif args[0].is_a?(self.class)
38
+ parse(args[0].encode, *args[1..-1])
39
+ elsif args[0].is_a?(Hash) and args.size==1
40
+ set(*args)
41
+ else
42
+ raise ArgumentError, "invalid argument"
43
+ end
44
+ end
45
+
46
+ def afi
47
+ @afi ||= @nlris[0].afi
48
+ end
49
+
50
+ def set(h)
51
+ @safi = h[:safi]
52
+ h[:nlri] ||=[]
53
+ h[:prefix] ||=[]
54
+ @afi = h[:afi] if h[:afi]
55
+ case @safi
56
+ when 1,2
57
+ @nlris = [h[:prefix]].flatten.collect { |p| p.is_a?(Prefix) ? p : Prefix.new(p) }
58
+ when 4
59
+ @nlris = [h[:nlri]].flatten.collect { |n|
60
+ prefix = n[:prefix].is_a?(String) ? Prefix.new(n[:prefix]) : n[:prefix]
61
+ Labeled.new(prefix, *n[:label])
62
+ }
63
+ when 128,129 ; @nlris = [h[:nlri]].flatten.collect { |n|
64
+ prefix = n[:prefix].is_a?(Prefix) ? n[:prefix] : Prefix.new(n[:prefix])
65
+ rd = n[:rd].is_a?(Rd) ? n[:rd] : Rd.new(*n[:rd])
66
+ Labeled.new(Vpn.new(prefix,rd), *n[:label]) }
67
+ else
68
+ end
69
+ end
70
+
71
+ def mp_unreach
72
+ "\n AFI #{IANA.afi(afi)} (#{afi}), SAFI #{IANA.safi(safi)} (#{safi})" +
73
+ (['']+ @nlris.collect { |nlri| nlri.to_s }).join("\n ")
74
+ end
75
+
76
+ def to_s(method=:default)
77
+ super(mp_unreach, method)
78
+ end
79
+
80
+ def parse(s)
81
+ @flags, @type, len, value = super(s)
82
+ @afi, @safi = value.slice!(0,3).unpack('nC')
83
+ while value.size>0
84
+ blen = value.slice(0,1).unpack('C')[0]
85
+ @nlris << Nlri.factory(value.slice!(0,(blen+7)/8+1), @afi, @safi)
86
+ end
87
+ raise RuntimeError, "leftover afer parsing: #{value.unpack('H*')}" if value.size>0
88
+ end
89
+
90
+ def encode
91
+ super([afi, @safi, @nlris.collect { |n| n.encode }.join].pack('nCa*'))
92
+ end
93
+
94
+ end
95
+ end
96
+
97
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -73,4 +73,4 @@ module BGP
73
73
  end
74
74
 
75
75
  end
76
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
76
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -60,4 +60,4 @@ module BGP
60
60
  end
61
61
 
62
62
  end
63
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
63
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -84,5 +84,5 @@ module BGP
84
84
 
85
85
  end
86
86
 
87
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
87
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
88
88
 
@@ -21,7 +21,7 @@
21
21
  #++
22
22
 
23
23
 
24
- require 'bgp/attribute'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -70,4 +70,4 @@ module BGP
70
70
 
71
71
  end
72
72
 
73
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
73
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
@@ -20,8 +20,8 @@
20
20
  # along with BGP4R. If not, see <http://www.gnu.org/licenses/>.
21
21
  #++
22
22
 
23
-
24
- require 'bgp/attributes'
23
+ require 'bgp4r'
24
+ require 'bgp/path_attributes/attribute'
25
25
 
26
26
  module BGP
27
27
 
@@ -104,7 +104,7 @@ module BGP
104
104
  find(Extended_communities)
105
105
  when AS4_PATH, :as4_path
106
106
  find(As4_path)
107
- when AS4_AGGREGATOR, :as4_aggregator
107
+ when AS4_AGGREGATOR, :as4_aggregator
108
108
  end
109
109
  end
110
110
 
@@ -170,7 +170,7 @@ end
170
170
  module BGP
171
171
 
172
172
  class Attr
173
- UnknownAttr = Class.new(Attr) do
173
+ Unknown = Class.new(Attr) do
174
174
  attr_reader :type, :flags, :value
175
175
  def initialize(*args)
176
176
  if args.size>1
@@ -220,8 +220,7 @@ module BGP
220
220
  when EXTENDED_COMMUNITY
221
221
  Extended_communities.new(s)
222
222
  else
223
- # return a generic unknown attr.
224
- UnknownAttr.new(s)
223
+ Unknown.new(s)
225
224
  end
226
225
  end
227
226
 
@@ -229,4 +228,4 @@ module BGP
229
228
 
230
229
  end
231
230
 
232
- load "../test/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0
231
+ load "../../test/path_attributes/#{ File.basename($0.gsub(/.rb/,'_test.rb'))}" if __FILE__ == $0