smart_proxy_ipam 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_proxy_ipam/phpipam/phpipam_client.rb +13 -6
- data/lib/smart_proxy_ipam/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557b60d8a66e595502b01b96675bcfd85c1c6e40df80fd824d1aa57e7a11d29f
|
4
|
+
data.tar.gz: e1488f94cfa129ccbd3da7006c535bc4632b4206511a25cd7c81778c27bf7dcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f9b9a41c0367c7aaa4abd902a2db04faf8026a9c61d28b001b5b57ef94169a6b219ea799fb2819a7209a081d304f393098b452e72fbcefb67c98a3aa845e779
|
7
|
+
data.tar.gz: ca812b143249eb666d02c2af202576024e0b2993332b7563b897950b40b7ef4ba0944b844b7eea9aa83c3c7074c55a3baa392aa59835c5b40c0ed3e7d7a56180
|
@@ -176,12 +176,16 @@ module Proxy::Phpipam
|
|
176
176
|
#
|
177
177
|
# Groups of subnets are cached under the External IPAM Group name. For example,
|
178
178
|
# "IPAM Group Name" would be the section name in phpIPAM. All IP's cached for subnets
|
179
|
-
# that do not have an External IPAM group specified, they are cached under the "" key.
|
179
|
+
# that do not have an External IPAM group specified, they are cached under the "" key. IP's
|
180
|
+
# are cached using one of two possible keys:
|
181
|
+
# 1). Mac Address
|
182
|
+
# 2). UUID (Used when Mac Address not specified)
|
180
183
|
#
|
181
184
|
# {
|
182
185
|
# "": {
|
183
186
|
# "100.55.55.0/24":{
|
184
|
-
# "00:0a:95:9d:68:10": {"ip": "100.55.55.1", "timestamp": "2019-09-17 12:03:43 -D400"}
|
187
|
+
# "00:0a:95:9d:68:10": {"ip": "100.55.55.1", "timestamp": "2019-09-17 12:03:43 -D400"},
|
188
|
+
# "906d8bdc-dcc0-4b59-92cb-665935e21662": {"ip": "100.55.55.2", "timestamp": "2019-09-17 11:43:22 -D400"}
|
185
189
|
# },
|
186
190
|
# },
|
187
191
|
# "IPAM Group Name": {
|
@@ -223,18 +227,21 @@ module Proxy::Phpipam
|
|
223
227
|
logger.debug("Adding IP #{ip} to cache for subnet #{cidr} in section #{section_name}")
|
224
228
|
@@m.synchronize do
|
225
229
|
# Clear cache data which has the same mac and ip with the new one
|
230
|
+
|
231
|
+
mac_addr = (mac.nil? || mac.empty?) ? SecureRandom.uuid : mac
|
226
232
|
section_hash = @@ip_cache[section_name.to_sym]
|
233
|
+
|
227
234
|
section_hash.each do |key, values|
|
228
|
-
if values.keys.include?
|
229
|
-
@@ip_cache[section_name.to_sym][key].delete(
|
235
|
+
if values.keys.include? mac_addr.to_sym
|
236
|
+
@@ip_cache[section_name.to_sym][key].delete(mac_addr.to_sym)
|
230
237
|
end
|
231
238
|
@@ip_cache[section_name.to_sym].delete(key) if @@ip_cache[section_name.to_sym][key].nil? or @@ip_cache[section_name.to_sym][key].empty?
|
232
239
|
end
|
233
240
|
|
234
241
|
if section_hash.key?(cidr.to_sym)
|
235
|
-
@@ip_cache[section_name.to_sym][cidr.to_sym][
|
242
|
+
@@ip_cache[section_name.to_sym][cidr.to_sym][mac_addr.to_sym] = {:ip => ip.to_s, :timestamp => Time.now.to_s}
|
236
243
|
else
|
237
|
-
@@ip_cache = @@ip_cache.merge({section_name.to_sym => {cidr.to_sym => {
|
244
|
+
@@ip_cache = @@ip_cache.merge({section_name.to_sym => {cidr.to_sym => {mac_addr.to_sym => {:ip => ip.to_s, :timestamp => Time.now.to_s}}}})
|
238
245
|
end
|
239
246
|
end
|
240
247
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_ipam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Smart proxy plugin for IPAM integration with various IPAM providers
|
14
14
|
email: chrisjsmith001@gmail.com
|