ospfv2 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +674 -0
  3. data/LICENSE.txt +53 -0
  4. data/README +50 -0
  5. data/bin/ospfv2 +112 -105
  6. data/changelog.txt +7 -0
  7. data/gemspec +17 -0
  8. data/lib/ie/external_route.rb +9 -0
  9. data/lib/ie/id.rb +3 -4
  10. data/lib/ie/ie.rb +12 -0
  11. data/lib/ie/ls_age.rb +35 -5
  12. data/lib/ie/ls_type.rb +40 -37
  13. data/lib/ie/opaque_id.rb +46 -0
  14. data/lib/ie/opaque_type.rb +96 -0
  15. data/lib/ie/options.rb +5 -3
  16. data/lib/ie/router_link.rb +30 -7
  17. data/lib/ie/router_link_type.rb +116 -27
  18. data/lib/ie/sequence_number.rb +7 -3
  19. data/lib/infra/ospf_common.rb +1 -12
  20. data/lib/infra/ospf_io.rb +14 -8
  21. data/lib/infra/ospf_socket.rb +14 -14
  22. data/lib/infra/parse_options.rb +69 -25
  23. data/lib/ls_db/advertised_routers.rb +1 -1
  24. data/lib/ls_db/link_state_database.rb +74 -39
  25. data/lib/ls_db/link_state_database_build.rb +3 -3
  26. data/lib/ls_db/link_state_database_links.rb +7 -2
  27. data/lib/ls_db/lsdb_ios.rb +59 -0
  28. data/lib/lsa/external.rb +35 -2
  29. data/lib/lsa/lsa.rb +128 -35
  30. data/lib/lsa/lsa_factory.rb +20 -7
  31. data/lib/lsa/network.rb +44 -9
  32. data/lib/lsa/router.rb +14 -2
  33. data/lib/lsa/summary.rb +16 -3
  34. data/lib/lsa/tlv/color.rb +47 -0
  35. data/lib/lsa/tlv/link.rb +122 -0
  36. data/lib/lsa/tlv/link_id.rb +55 -0
  37. data/lib/lsa/tlv/link_type.rb +44 -0
  38. data/lib/lsa/tlv/local_interface.rb +56 -0
  39. data/lib/lsa/tlv/maximum_bandwidth.rb +55 -0
  40. data/lib/lsa/tlv/maximum_reservable_bandwidth.rb +52 -0
  41. data/lib/lsa/tlv/remote_interface.rb +58 -0
  42. data/lib/lsa/tlv/router_address.rb +57 -0
  43. data/lib/lsa/tlv/tlv.rb +32 -0
  44. data/lib/lsa/tlv/tlv_factory.rb +72 -0
  45. data/lib/lsa/tlv/traffic_engineering_metric.rb +52 -0
  46. data/lib/lsa/tlv/unreserved_bandwidth.rb +55 -0
  47. data/lib/lsa/traffic_engineering.rb +95 -0
  48. data/lib/neighbor/neighbor.rb +9 -9
  49. data/lib/packet/link_state_update.rb +16 -14
  50. data/lib/packet/ospf_packet.rb +13 -9
  51. data/test/unit/ie/au_type_test.rb +18 -0
  52. data/test/unit/ie/external_route_test.rb +51 -0
  53. data/test/unit/ie/id_test.rb +22 -0
  54. data/test/unit/ie/interface_mtu_test.rb +23 -0
  55. data/test/unit/ie/ls_age_test.rb +46 -0
  56. data/test/unit/ie/ls_type_test.rb +41 -0
  57. data/test/unit/ie/metric_test.rb +24 -0
  58. data/test/unit/ie/mt_metric_test.rb +27 -0
  59. data/test/unit/ie/opaque_id_test.rb +22 -0
  60. data/test/unit/ie/opaque_type_test.rb +22 -0
  61. data/test/unit/ie/options_test.rb +142 -0
  62. data/test/unit/ie/ospf_version_test.rb +0 -0
  63. data/test/unit/ie/packet_type_test.rb +33 -0
  64. data/test/unit/ie/router_link_factory_test.rb +26 -0
  65. data/test/unit/ie/router_link_test.rb +276 -0
  66. data/test/unit/ie/router_link_type_test.rb +24 -0
  67. data/test/unit/ie/sequence_number_test.rb +31 -0
  68. data/test/unit/ie/tos_metric_test.rb +27 -0
  69. data/test/unit/infra/ospf_common_test.rb +42 -0
  70. data/test/unit/infra/parse_options_test.rb +58 -0
  71. data/test/unit/infra/timer_test.rb +94 -0
  72. data/test/unit/ls_db/all +10 -0
  73. data/test/unit/ls_db/link_state_database_build_test.rb +140 -0
  74. data/test/unit/ls_db/link_state_database_links_tests.rb +74 -0
  75. data/test/unit/ls_db/link_state_database_test.rb +444 -0
  76. data/test/unit/ls_db/links_test.rb +49 -0
  77. data/test/unit/lsa/all +10 -0
  78. data/test/unit/lsa/external_test.rb +218 -0
  79. data/test/unit/lsa/lsa_factory_test.rb +314 -0
  80. data/test/unit/lsa/lsa_test.rb +191 -0
  81. data/test/unit/lsa/network_test.rb +107 -0
  82. data/test/unit/lsa/router_test.rb +614 -0
  83. data/test/unit/lsa/summary_test.rb +135 -0
  84. data/test/unit/lsa/tlv/color_test.rb +39 -0
  85. data/test/unit/lsa/tlv/link_id_test.rb +14 -0
  86. data/test/unit/lsa/tlv/link_test.rb +413 -0
  87. data/test/unit/lsa/tlv/link_type_test.rb +16 -0
  88. data/test/unit/lsa/tlv/local_interface_test.rb +15 -0
  89. data/test/unit/lsa/tlv/maximum_bandwidth_test.rb +14 -0
  90. data/test/unit/lsa/tlv/maximum_reservable_bandwidth_test.rb +13 -0
  91. data/test/unit/lsa/tlv/remote_interface_test.rb +14 -0
  92. data/test/unit/lsa/tlv/router_address_test.rb +16 -0
  93. data/test/unit/lsa/tlv/tlv_factory_test.rb +89 -0
  94. data/test/unit/lsa/tlv/traffic_engineering_metric_test.rb +15 -0
  95. data/test/unit/lsa/traffic_engineering_test.rb +65 -0
  96. data/test/unit/neighbor/neighbor_test.rb +82 -0
  97. data/test/unit/packet/all +10 -0
  98. data/test/unit/packet/database_description_test.rb +114 -0
  99. data/test/unit/packet/hello_test.rb +107 -0
  100. data/test/unit/packet/link_state_ack_test.rb +64 -0
  101. data/test/unit/packet/link_state_request_test.rb +168 -0
  102. data/test/unit/packet/link_state_update_test.rb +62 -0
  103. data/test/unit/packet/ospf_packet_test.rb +91 -0
  104. metadata +106 -51
  105. data/lib/infra/to_s.rb +0 -38
  106. data/lib/lsa/lsa_base.rb +0 -430
  107. data/lib/lsa/opaque.rb +0 -143
@@ -1,143 +0,0 @@
1
- # A.2. The Opaque LSA
2
- #
3
- # Opaque LSAs are Type 9, 10, and 11 link state advertisements. These
4
- # advertisements MAY be used directly by OSPF or indirectly by some
5
- # application wishing to distribute information throughout the OSPF
6
- # domain. The function of the Opaque LSA option is to provide for
7
- # future OSPF extensibility.
8
- #
9
- # Opaque LSAs contain some number of octets (of application-specific
10
- # data) padded to 32-bit alignment. Like any other LSA, the Opaque LSA
11
- # uses the link-state database distribution mechanism for flooding this
12
- # information throughout the topology. However, the Opaque LSA has a
13
- # flooding scope associated with it so that the scope of flooding may
14
- # be link-local (type-9), area-local (type-10), or the entire OSPF
15
- # routing domain (type-11). Section 3 of this document describes the
16
- # flooding procedures for the Opaque LSA.
17
- #
18
- #
19
- #
20
- #
21
- #
22
- #
23
- #
24
- #
25
- #
26
- # Berger, et al. Standards Track [Page 14]
27
- #
28
- # RFC 5250 OSPF Opaque LSA Option July 2008
29
- #
30
- #
31
- # 0 1 2 3
32
- # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
33
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34
- # | LS age | Options | 9, 10, or 11 |
35
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36
- # | Opaque Type | Opaque ID |
37
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
38
- # | Advertising Router |
39
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40
- # | LS Sequence Number |
41
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42
- # | LS checksum | Length |
43
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44
- # | |
45
- # + +
46
- # | Opaque Information |
47
- # + +
48
- # | ... |
49
- #
50
- # Link-State Type
51
- #
52
- # The link-state type of the Opaque LSA identifies the LSA's range
53
- # of topological distribution. This range is referred to as the
54
- # flooding scope. The following explains the flooding scope of each
55
- # of the link-state types.
56
- #
57
- # o A value of 9 denotes a link-local scope. Opaque LSAs with a
58
- # link-local scope MUST NOT be flooded beyond the local
59
- # (sub)network.
60
- #
61
- # o A value of 10 denotes an area-local scope. Opaque LSAs with an
62
- # area-local scope MUST NOT be flooded beyond their area of
63
- # origin.
64
- #
65
- # o A value of 11 denotes that the LSA is flooded throughout the
66
- # Autonomous System (e.g., has the same scope as type-5 LSAs).
67
- # Opaque LSAs with AS-wide scope MUST NOT be flooded into stub
68
- # areas or NSSAs.
69
- #
70
- # Syntax of the Opaque LSA's Link-State ID
71
- #
72
- # The link-state ID of the Opaque LSA is divided into an Opaque Type
73
- # field (the first 8 bits) and an Opaque ID (the remaining 24 bits).
74
- # See section 7 of this document for a description of Opaque type
75
- # allocation and assignment.
76
- #
77
- #
78
-
79
- module OSPFv2
80
- class Opaque_Base < Lsa
81
- end
82
- end
83
-
84
- __END__
85
-
86
-
87
- 3. The Opaque LSA
88
-
89
- Opaque LSAs are types 9, 10, and 11 link state advertisements.
90
- Opaque LSAs consist of a standard LSA header followed by a 32-bit
91
- aligned application-specific information field. Standard link-state
92
- database flooding mechanisms are used for distribution of Opaque
93
- LSAs. The range of topological distribution (i.e., the flooding
94
- scope) of an Opaque LSA is identified by its link-state type. This
95
- section documents the flooding of Opaque LSAs.
96
-
97
- The flooding scope associated with each Opaque link-state type is
98
- defined as follows.
99
-
100
- o Link-state type-9 denotes a link-local scope. Type-9 Opaque LSAs
101
- are not flooded beyond the local (sub)network.
102
-
103
- o Link-state type-10 denotes an area-local scope. Type-10 Opaque
104
- LSAs are not flooded beyond the borders of their associated area.
105
-
106
- o Link-state type-11 denotes that the LSA is flooded throughout the
107
- Autonomous System (AS). The flooding scope of type-11 LSAs are
108
- equivalent to the flooding scope of AS-External (type-5) LSAs.
109
- Specifically, type-11 Opaque LSAs are 1) flooded throughout all
110
- transit areas, 2) not flooded into stub areas or Not-So-Stubby
111
- Areas (NSSAs), see [NSSA], from the backbone, and 3) not
112
- originated by routers into their connected stub areas or NSSAs.
113
- As with type-5 LSAs, if a type-11 Opaque LSA is received in a stub
114
- area or NSSA from a neighboring router within the stub area or
115
- NSSA, the LSA is rejected.
116
-
117
- The link-state ID of the Opaque LSA is divided into an Opaque type
118
- field (the first 8 bits) and a type-specific ID (the remaining 24
119
- bits). The packet format of the Opaque LSA is given in Appendix A.
120
- Section 7 describes Opaque type allocation and assignment.
121
-
122
- The responsibility for proper handling of the Opaque LSA's flooding
123
- scope is placed on both the sender and receiver of the LSA. The
124
- receiver must always store a valid received Opaque LSA in its link-
125
- state database. The receiver must not accept Opaque LSAs that
126
- violate the flooding scope (e.g., a type-11 (domain-wide) Opaque LSA
127
-
128
-
129
-
130
-
131
-
132
- Berger, et al. Standards Track [Page 4]
133
-
134
- RFC 5250 OSPF Opaque LSA Option July 2008
135
-
136
-
137
- is not accepted in a stub area or NSSA). The flooding scope affects
138
- both the synchronization of the link-state database and the flooding
139
- procedure.
140
-
141
- The following describes the modifications to these procedures that
142
- are necessary to insure conformance to the Opaque LSA's Scoping
143
- Rules.