vtysh 0.3.0 → 0.3.2
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.
- checksums.yaml +4 -4
- data/lib/vtysh/diff.rb +22 -2
- data/lib/vtysh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62c5e8dbb9d45551d43f6ac68445fa4e4a6943638be57c341a36bb0e1e205c0c
|
|
4
|
+
data.tar.gz: 3ec8a30a7efdd26158d091901d757e95f103758e53e9ad9143bf79a8a58832c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1871a6cf2ac84e722189a5ed99838cb63dfbb01a90fd3f1177c89c2cec2512b8977a40601dde43788b586cbc6c106932db4ef8c6758098216eec127cc8db496
|
|
7
|
+
data.tar.gz: 8cdf921bcad92f66b14e3887006172edc580ff7cd104010f5c0eed72d38289e983f18c44fe00f14eab17cc14cd11f35c7ac030d6768eed691c46f92bc6369d3c
|
data/lib/vtysh/diff.rb
CHANGED
|
@@ -187,7 +187,22 @@ module Vtysh
|
|
|
187
187
|
removals = commands.select { |c| c.include?("no ") }
|
|
188
188
|
rest = commands - peer_groups - remote_as - listen_range - removals
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
# A removal whose slot is reclaimed by an addition must run first, or FRR
|
|
191
|
+
# rejects the addition as overlapping the value it supersedes.
|
|
192
|
+
slots = (commands - removals).map { |c| slot_key(c) }.compact
|
|
193
|
+
superseded, other = removals.partition { |c| slots.include?(slot_key(c)) }
|
|
194
|
+
|
|
195
|
+
(peer_groups + remote_as + superseded + listen_range + rest + other).uniq
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Identifies commands that occupy one logical slot, so the "no" form and the
|
|
199
|
+
# form replacing it hash alike. Nil when the command owns no exclusive slot.
|
|
200
|
+
def self.slot_key(command)
|
|
201
|
+
parts = command.scan(/-c "([^"]+)"/).flatten
|
|
202
|
+
slot = case parts.last.to_s.sub(/\Ano /, "")
|
|
203
|
+
when /\Abgp listen range \S+ peer-group (\S+)\z/ then "listen-range:#{$1}"
|
|
204
|
+
end
|
|
205
|
+
slot && (parts[0..-2] + [slot]).join("|")
|
|
191
206
|
end
|
|
192
207
|
|
|
193
208
|
# --- Parsing ---
|
|
@@ -199,7 +214,12 @@ module Vtysh
|
|
|
199
214
|
config.each_line do |line|
|
|
200
215
|
line = line.strip
|
|
201
216
|
next if line.empty? || line.start_with?('#', '!')
|
|
202
|
-
next if line.start_with?('ip route ')
|
|
217
|
+
next if line.start_with?('ip route ') # managed by config_db STATIC_ROUTE
|
|
218
|
+
next if line.start_with?('hostname ') # managed by system hostname
|
|
219
|
+
next if line == 'ip nht resolve-via-default' # bgpcfgd managed
|
|
220
|
+
next if line == 'ipv6 nht resolve-via-default' # bgpcfgd managed
|
|
221
|
+
next if line == 'ip protocol bgp route-map RM_SET_SRC' # bgpcfgd managed
|
|
222
|
+
next if line =~ /^(no )?set src / # bgpcfgd managed (inside RM_SET_SRC)
|
|
203
223
|
next if line =~ /^frr (version|defaults)/ || line == 'no service integrated-vtysh-config' || line.start_with?('agentx')
|
|
204
224
|
|
|
205
225
|
if line =~ /^exit(-address-family|-vrf)?$/
|
data/lib/vtysh/version.rb
CHANGED