foreman_netbox 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +50 -0
- data/Rakefile +50 -0
- data/app/contracts/foreman_netbox/device_contract.rb +42 -0
- data/app/contracts/foreman_netbox/params/interface_params.rb +16 -0
- data/app/contracts/foreman_netbox/params/ip_address_params.rb +15 -0
- data/app/contracts/foreman_netbox/params/tenant_params.rb +13 -0
- data/app/contracts/foreman_netbox/virtual_machine_contract.rb +29 -0
- data/app/interactors/foreman_netbox/concerns/facts.rb +11 -0
- data/app/interactors/foreman_netbox/concerns/primary_ips.rb +25 -0
- data/app/interactors/foreman_netbox/delete_host/delete_device.rb +20 -0
- data/app/interactors/foreman_netbox/delete_host/delete_virtual_machine.rb +20 -0
- data/app/interactors/foreman_netbox/delete_host/organizer.rb +12 -0
- data/app/interactors/foreman_netbox/sync_host/organizer.rb +35 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/create.rb +36 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/find.rb +41 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/organizer.rb +30 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/save_netbox_url.rb +29 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_role/create.rb +32 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_role/find.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_role/organizer.rb +20 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/create.rb +34 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/find.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/organizer.rb +22 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/sync_manufacturer/create.rb +34 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/sync_manufacturer/find.rb +40 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/sync_manufacturer/organizer.rb +22 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/update.rb +33 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/create.rb +37 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/delete.rb +36 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/find.rb +30 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/organizer.rb +23 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/create.rb +46 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/delete.rb +40 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/find.rb +32 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/organizer.rb +24 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/update.rb +39 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/update.rb +38 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_site/create.rb +32 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_site/find.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_site/organizer.rb +25 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/sync_site/update.rb +35 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/update.rb +85 -0
- data/app/interactors/foreman_netbox/sync_host/sync_device/validate.rb +25 -0
- data/app/interactors/foreman_netbox/sync_host/sync_tenant/create.rb +30 -0
- data/app/interactors/foreman_netbox/sync_host/sync_tenant/find.rb +26 -0
- data/app/interactors/foreman_netbox/sync_host/sync_tenant/organizer.rb +19 -0
- data/app/interactors/foreman_netbox/sync_host/sync_tenant/update.rb +33 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/create.rb +34 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/find.rb +34 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/organizer.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/save_netbox_url.rb +31 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/create.rb +35 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/find.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/organizer.rb +22 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/sync_cluster_type/create.rb +34 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/sync_cluster_type/find.rb +32 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/sync_cluster_type/organizer.rb +22 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/update.rb +35 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/create.rb +33 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/delete.rb +36 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/find.rb +30 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/organizer.rb +23 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/create.rb +46 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/delete.rb +40 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/find.rb +28 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/organizer.rb +24 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/update.rb +39 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/update.rb +38 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/update.rb +82 -0
- data/app/interactors/foreman_netbox/sync_host/sync_virtual_machine/validate.rb +25 -0
- data/app/jobs/foreman_netbox/sync_host_job.rb +19 -0
- data/app/lib/foreman_netbox/api.rb +12 -0
- data/app/models/concerns/foreman_netbox/host_extensions.rb +27 -0
- data/app/models/concerns/foreman_netbox/location_extensions.rb +13 -0
- data/app/models/concerns/foreman_netbox/nic/base_extensions.rb +23 -0
- data/app/models/concerns/foreman_netbox/user_usergroup_common_extensions.rb +18 -0
- data/app/models/foreman_netbox/netbox_facet.rb +34 -0
- data/app/models/orchestration/netbox.rb +64 -0
- data/app/models/setting/netbox.rb +32 -0
- data/app/services/foreman_netbox/cached_netbox_parameters.rb +103 -0
- data/app/services/foreman_netbox/netbox_parameters.rb +185 -0
- data/app/services/foreman_netbox/netbox_parameters_comparator.rb +96 -0
- data/app/views/hosts/_netbox_tab.html.erb +28 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20200527135812_create_netbox_facet.rb +12 -0
- data/db/migrate/20200604141933_add_sync_info_to_netbox_facet.rb +8 -0
- data/db/migrate/20200708093607_add_raw_data_to_netbox_facet.rb +7 -0
- data/lib/foreman_netbox.rb +6 -0
- data/lib/foreman_netbox/engine.rb +64 -0
- data/lib/foreman_netbox/version.rb +5 -0
- data/lib/tasks/foreman_netbox_tasks.rake +67 -0
- data/test/factories/host.rb +17 -0
- data/test/factories/netbox_facet.rb +17 -0
- data/test/fixtures/facts/k8s_physical_host.json +328 -0
- data/test/fixtures/facts/rhel_physical_host.json +512 -0
- data/test/fixtures/facts/rhel_virtual_host.json +455 -0
- data/test/fixtures/netbox_device_raw_data.json +330 -0
- data/test/fixtures/netbox_virtual_machine_raw_data.json +241 -0
- data/test/integration/foreman_netbox/sync_k8s_physical_host_test.rb +81 -0
- data/test/integration/foreman_netbox/sync_rhel_physical_host_test.rb +81 -0
- data/test/integration/foreman_netbox/sync_rhel_virtual_host_test.rb +93 -0
- data/test/interactors/foreman_netbox/sync_host/organizer_test.rb +78 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/create_test.rb +65 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/find_test.rb +105 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/save_netbox_url_test.rb +39 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_role/create_test.rb +45 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_role/find_test.rb +58 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/create_test.rb +55 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/find_test.rb +63 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/sync_manufacturer/create_test.rb +48 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/sync_manufacturer/find_test.rb +105 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_device_type/update_test.rb +54 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/create_test.rb +51 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/delete_test.rb +41 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/find_test.rb +53 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/create_test.rb +80 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/delete_test.rb +72 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/find_test.rb +51 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/sync_ip_addresses/update_test.rb +64 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_interfaces/update_test.rb +92 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_site/create_test.rb +51 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_site/find_test.rb +59 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/sync_site/update_test.rb +54 -0
- data/test/interactors/foreman_netbox/sync_host/sync_device/update_test.rb +188 -0
- data/test/interactors/foreman_netbox/sync_host/sync_tenant/create_test.rb +50 -0
- data/test/interactors/foreman_netbox/sync_host/sync_tenant/find_test.rb +58 -0
- data/test/interactors/foreman_netbox/sync_host/sync_tenant/update_test.rb +59 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/create_test.rb +74 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/find_test.rb +77 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/save_netbox_url_test.rb +39 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/create_test.rb +54 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/find_test.rb +58 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/sync_cluster_type/create_test.rb +50 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/sync_cluster_type/find_test.rb +65 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_cluster/update_test.rb +54 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/create_test.rb +53 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/delete_test.rb +37 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/find_test.rb +53 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/create_test.rb +80 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/delete_test.rb +73 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/find_test.rb +51 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/sync_ip_addresses/update_test.rb +64 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/sync_interfaces/update_test.rb +88 -0
- data/test/interactors/foreman_netbox/sync_host/sync_virtual_machine/update_test.rb +171 -0
- data/test/jobs/foreman_netbox/sync_host_job_test.rb +14 -0
- data/test/models/foreman_netbox/location_test.rb +42 -0
- data/test/models/foreman_netbox/netbox_facet_test.rb +219 -0
- data/test/models/foreman_netbox/nics/base_test.rb +81 -0
- data/test/models/foreman_netbox/usergroup_test.rb +23 -0
- data/test/models/host/managed_test.rb +63 -0
- data/test/services/foreman_netbox/netbox_attributes_test.rb +278 -0
- data/test/services/foreman_netbox/netbox_parameters_comparator_test.rb +136 -0
- data/test/test_plugin_helper.rb +25 -0
- metadata +343 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanNetbox
|
4
|
+
class NetboxParametersComparator
|
5
|
+
def self.call(old_hash, new_hash)
|
6
|
+
new(old_hash, new_hash).call
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(old_hash, new_hash)
|
10
|
+
@old_hash = old_hash
|
11
|
+
@new_hash = new_hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
keys_diff.deep_merge(diff_old)
|
16
|
+
.deep_merge(diff_new)
|
17
|
+
.compact
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :old_hash, :new_hash
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def added_keys
|
25
|
+
new_hash.keys - old_hash.keys
|
26
|
+
end
|
27
|
+
|
28
|
+
def removed_keys
|
29
|
+
old_hash.keys - new_hash.keys
|
30
|
+
end
|
31
|
+
|
32
|
+
def keys_diff
|
33
|
+
result = {}
|
34
|
+
|
35
|
+
result[:added] = added_keys.each_with_object({}) { |key, memo| memo[key] = new_hash[key] } if added_keys.any?
|
36
|
+
result[:removed] = removed_keys.each_with_object({}) { |key, memo| memo[key] = old_hash[key] } if removed_keys.any?
|
37
|
+
|
38
|
+
result
|
39
|
+
end
|
40
|
+
|
41
|
+
def diff_old
|
42
|
+
old_hash.except(*removed_keys).each_with_object({}) do |(key, old_value), memo|
|
43
|
+
if old_value.is_a?(Hash)
|
44
|
+
new_value = new_hash.fetch(key, {})
|
45
|
+
diff = ForemanNetbox::NetboxParametersComparator.call(old_value, new_value)
|
46
|
+
|
47
|
+
next unless diff.keys.any?
|
48
|
+
|
49
|
+
memo[key] = diff
|
50
|
+
elsif old_value.is_a?(Array)
|
51
|
+
next unless !new_hash[key] && key != :tags
|
52
|
+
|
53
|
+
memo[key] = { added: [], removed: old_value }
|
54
|
+
else
|
55
|
+
new_value = new_hash.fetch(key, nil)
|
56
|
+
|
57
|
+
next if old_value == new_value
|
58
|
+
|
59
|
+
memo[key] = { old: old_value, new: new_value }
|
60
|
+
end
|
61
|
+
end.compact
|
62
|
+
end
|
63
|
+
|
64
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
65
|
+
def diff_new
|
66
|
+
new_hash.except(*added_keys).each_with_object({}) do |(key, new_value), memo|
|
67
|
+
if new_value.is_a?(Hash)
|
68
|
+
old_value = old_hash.fetch(key, {})
|
69
|
+
|
70
|
+
next if old_value == new_value
|
71
|
+
|
72
|
+
diff = ForemanNetbox::NetboxParametersComparator.call(old_value, new_value)
|
73
|
+
|
74
|
+
next unless diff.keys.any?
|
75
|
+
|
76
|
+
memo[key] = diff
|
77
|
+
elsif new_value.is_a?(Array)
|
78
|
+
old_value = old_hash.fetch(key, [])
|
79
|
+
added = new_value.reject { |item| old_value.find { |x| x == item } }
|
80
|
+
removed = key == :tags ? [] : old_value.reject { |item| new_value.find { |x| x == item } }
|
81
|
+
|
82
|
+
next unless added.any? || removed.any?
|
83
|
+
|
84
|
+
memo[key] = { added: added, removed: removed }
|
85
|
+
else
|
86
|
+
old_value = old_hash.fetch(key, nil)
|
87
|
+
|
88
|
+
next if old_value == new_value
|
89
|
+
|
90
|
+
memo[key] = { old: old_value, new: new_value }
|
91
|
+
end
|
92
|
+
end.compact
|
93
|
+
end
|
94
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<table id="netbox_table" class="<%= table_css_classes %>">
|
2
|
+
<tr>
|
3
|
+
<td><%= _('Last Synchronization') %></td>
|
4
|
+
<td><%= date_time_relative(@host.netbox_facet.synchronized_at) %></td>
|
5
|
+
</tr>
|
6
|
+
<tr>
|
7
|
+
<td><%= _('Status') %></td>
|
8
|
+
<td>
|
9
|
+
<% if @host.netbox_facet.synchronization_success? %>
|
10
|
+
<%= icon_text('ok', '', kind: 'pficon') %>
|
11
|
+
<%= content_tag(:span, _('OK'), class: 'status-ok') %>
|
12
|
+
<% else %>
|
13
|
+
<%= icon_text('error-circle-o', '', kind: 'pficon') %>
|
14
|
+
<%= content_tag(:span, @host.netbox_facet.synchronization_error, class: 'status-error') %>
|
15
|
+
<% end %>
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td><%= _('Link') %></td>
|
20
|
+
<td>
|
21
|
+
<% if @host.netbox_facet.url %>
|
22
|
+
<%= link_to(@host.netbox_facet.url, @host.netbox_facet.url, target: :_blank) %>
|
23
|
+
<% else %>
|
24
|
+
<%= content_tag(:span, _('No Netbox object is associated with this host'), class: 'status-warn') %>
|
25
|
+
<% end %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
28
|
+
</table>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateNetboxFacet < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :netbox_facets do |t|
|
6
|
+
t.references :host, null: false, foreign_key: true, index: true, unique: true
|
7
|
+
t.string :url, unique: true
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry-validation'
|
4
|
+
require 'netbox-client-ruby'
|
5
|
+
require 'interactor'
|
6
|
+
|
7
|
+
module ForemanNetbox
|
8
|
+
class Engine < ::Rails::Engine
|
9
|
+
engine_name 'foreman_netbox'
|
10
|
+
|
11
|
+
config.autoload_paths += Dir["#{config.root}/app/interactors"]
|
12
|
+
|
13
|
+
initializer 'foreman_netbox.load_default_settings', before: :load_config_initializers do
|
14
|
+
require_dependency File.expand_path('../../app/models/setting/netbox.rb', __dir__) if begin
|
15
|
+
Setting.table_exists?
|
16
|
+
rescue StandardError
|
17
|
+
(false)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Add any db migrations
|
22
|
+
initializer 'foreman_netbox.load_app_instance_data' do |app|
|
23
|
+
ForemanNetbox::Engine.paths['db/migrate'].existent.each do |path|
|
24
|
+
app.config.paths['db/migrate'] << path
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
initializer 'foreman_netbox.register_plugin', :before => :finisher_hook do |_app|
|
29
|
+
Foreman::Plugin.register :foreman_netbox do
|
30
|
+
requires_foreman '>= 1.24'
|
31
|
+
|
32
|
+
# Netbox Facet
|
33
|
+
register_facet(ForemanNetbox::NetboxFacet, :netbox_facet) do
|
34
|
+
set_dependent_action :destroy
|
35
|
+
end
|
36
|
+
|
37
|
+
# extend host show page
|
38
|
+
extend_page('hosts/show') do |context|
|
39
|
+
context.add_pagelet :main_tabs,
|
40
|
+
name: N_('Netbox'),
|
41
|
+
partial: 'hosts/netbox_tab',
|
42
|
+
onlyif: proc { |host| host.netbox_facet.synchronized_at }
|
43
|
+
end
|
44
|
+
|
45
|
+
logger :import, enabled: true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
config.to_prepare do
|
50
|
+
::Host::Managed.include(ForemanNetbox::HostExtensions)
|
51
|
+
::Location.include(ForemanNetbox::LocationExtensions)
|
52
|
+
::Nic::Base.include(ForemanNetbox::Nic::BaseExtensions)
|
53
|
+
::User.include(ForemanNetbox::UserUsergroupCommonExtensions)
|
54
|
+
::Usergroup.include(ForemanNetbox::UserUsergroupCommonExtensions)
|
55
|
+
|
56
|
+
NetboxClientRuby.configure do |config|
|
57
|
+
config.netbox.api_base_url = Setting::Netbox['netbox_url']
|
58
|
+
config.netbox.auth.token = Setting::Netbox['netbox_api_token']
|
59
|
+
end
|
60
|
+
rescue StandardError => e
|
61
|
+
Rails.logger.warn "ForemanNetbox: skipping engine hook (#{e})\n#{e.backtrace.join("\n")}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
namespace :foreman_netbox do
|
6
|
+
namespace :sync do
|
7
|
+
desc 'Example Task'
|
8
|
+
task full: :environment do
|
9
|
+
User.as_anonymous_admin do
|
10
|
+
Host::Managed.where(managed: true).each do |host|
|
11
|
+
unless host.netbox_facet.netbox_params_diff.empty?
|
12
|
+
puts "Nothing to push for #{host.name}"
|
13
|
+
next
|
14
|
+
end
|
15
|
+
|
16
|
+
puts "Pushing #{host.name} to Netbox"
|
17
|
+
result = host.push_to_netbox
|
18
|
+
|
19
|
+
if result.success?
|
20
|
+
puts "#{host.name} pushed"
|
21
|
+
else
|
22
|
+
puts "Failed to push #{host.name}: #{result.error}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Tests
|
31
|
+
namespace :test do
|
32
|
+
desc 'Test ForemanNetbox'
|
33
|
+
Rake::TestTask.new(:foreman_netbox) do |t|
|
34
|
+
test_dir = File.join(File.dirname(__FILE__), '../..', 'test')
|
35
|
+
t.libs << ['test', test_dir]
|
36
|
+
t.pattern = "#{test_dir}/**/*_test.rb"
|
37
|
+
t.verbose = true
|
38
|
+
t.warning = false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
namespace :foreman_netbox do
|
43
|
+
task rubocop: :environment do
|
44
|
+
begin
|
45
|
+
require 'rubocop/rake_task'
|
46
|
+
RuboCop::RakeTask.new(:rubocop_foreman_netbox) do |task|
|
47
|
+
task.patterns = ["#{ForemanNetbox::Engine.root}/app/**/*.rb",
|
48
|
+
"#{ForemanNetbox::Engine.root}/lib/**/*.rb",
|
49
|
+
"#{ForemanNetbox::Engine.root}/test/**/*.rb"]
|
50
|
+
end
|
51
|
+
rescue StandardError
|
52
|
+
puts 'Rubocop not loaded.'
|
53
|
+
end
|
54
|
+
|
55
|
+
Rake::Task['rubocop_foreman_netbox'].invoke
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
Rake::Task[:test].enhance ['test:foreman_netbox']
|
60
|
+
|
61
|
+
load 'tasks/jenkins.rake'
|
62
|
+
|
63
|
+
# rubocop:disable Style/IfUnlessModifier
|
64
|
+
if Rake::Task.task_defined?(:'jenkins:unit')
|
65
|
+
Rake::Task['jenkins:unit'].enhance ['test:foreman_netbox', 'foreman_netbox:rubocop']
|
66
|
+
end
|
67
|
+
# rubocop:enable Style/IfUnlessModifier
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.modify do
|
4
|
+
factory :host do
|
5
|
+
trait :with_netbox_facet do
|
6
|
+
association :netbox_facet, factory: :netbox_facet, strategy: :build
|
7
|
+
end
|
8
|
+
|
9
|
+
trait :with_device_netbox_facet do
|
10
|
+
association :netbox_facet, factory: %i[netbox_facet with_device_raw_data]
|
11
|
+
end
|
12
|
+
|
13
|
+
trait :with_virtual_machine_netbox_facet do
|
14
|
+
association :netbox_facet, factory: %i[netbox_facet with_virtual_machine_raw_data]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :netbox_facet, class: 'ForemanNetbox::NetboxFacet' do
|
5
|
+
host
|
6
|
+
synchronized_at { Time.zone.now }
|
7
|
+
sequence(:url) { |n| "https://netbox.example.com/#{n}" }
|
8
|
+
|
9
|
+
trait :with_device_raw_data do
|
10
|
+
raw_data { JSON.parse(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'netbox_device_raw_data.json'))) }
|
11
|
+
end
|
12
|
+
|
13
|
+
trait :with_virtual_machine_raw_data do
|
14
|
+
raw_data { JSON.parse(File.read(File.join(File.dirname(__FILE__), '..', 'fixtures', 'netbox_virtual_machine_raw_data.json'))) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,328 @@
|
|
1
|
+
{
|
2
|
+
"networking::interfaces::tunl0": null,
|
3
|
+
"networking::interfaces::tunl0::mtu": "1440",
|
4
|
+
"networking::interfaces::tunl0::network": "100.192.4.1",
|
5
|
+
"networking::interfaces::tunl0::netmask": "255.255.255.255",
|
6
|
+
"networking::interfaces::tunl0::ip": "100.192.4.1",
|
7
|
+
"networking::interfaces::tunl0::bindings": "[{\"address\"=>\"100.192.4.1\", \"netmask\"=>\"255.255.255.255\", \"network\"=>\"100.192.4.1\"}]",
|
8
|
+
"processors": null,
|
9
|
+
"os::release": null,
|
10
|
+
"os": null,
|
11
|
+
"networking::interfaces": null,
|
12
|
+
"networking::interfaces::bond0": null,
|
13
|
+
"networking": null,
|
14
|
+
"disks::sda": null,
|
15
|
+
"disks::nvme1n1": null,
|
16
|
+
"disks": null,
|
17
|
+
"disks::nvme0n1": null,
|
18
|
+
"productname": "PowerEdge R640",
|
19
|
+
"processors::isa": "x86_64",
|
20
|
+
"processors::models": "[\"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\", \"Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz\"]",
|
21
|
+
"processors::physicalcount": "2",
|
22
|
+
"processors::count": "80",
|
23
|
+
"os::release::patch": "0",
|
24
|
+
"os::release::minor": "5",
|
25
|
+
"os::release::major": "7",
|
26
|
+
"os::release::full": "7.5.1804",
|
27
|
+
"os::architecture": "x86_64",
|
28
|
+
"os::family": "RedHat",
|
29
|
+
"operatingsystemrelease": "1967.4.0",
|
30
|
+
"operatingsystemmajrelease": "1967",
|
31
|
+
"operatingsystem": "CoreOS",
|
32
|
+
"networking::primary": "bond0",
|
33
|
+
"networking::network6": "fe80::",
|
34
|
+
"networking::network": "172.22.255.0",
|
35
|
+
"networking::netmask6": "ffff:ffff:ffff:ffff::",
|
36
|
+
"networking::netmask": "255.255.255.0",
|
37
|
+
"networking::ip6": "fc00::",
|
38
|
+
"networking::ip": "172.22.255.185",
|
39
|
+
"networking::interfaces::bond0::mtu": "1500",
|
40
|
+
"networking::interfaces::bond0::mac": "aa:bb:cc:dd:ee:fe",
|
41
|
+
"networking::interfaces::bond0::network6": "fe80::",
|
42
|
+
"networking::interfaces::bond0::network": "172.22.255.0",
|
43
|
+
"networking::interfaces::bond0::netmask6": "ffff:ffff:ffff:ffff::",
|
44
|
+
"networking::interfaces::bond0::netmask": "255.255.255.0",
|
45
|
+
"networking::interfaces::bond0::ip6": "fc00::",
|
46
|
+
"networking::interfaces::bond0::ip": "172.22.255.185",
|
47
|
+
"networking::interfaces::bond0::bindings6": "[{\"address\"=>\"fc00::\", \"netmask\"=>\"ffff:ffff:ffff:ffff::\", \"network\"=>\"fc00::\"}]",
|
48
|
+
"networking::interfaces::bond0::bindings": "[{\"address\"=>\"172.22.255.185\", \"netmask\"=>\"255.255.255.0\", \"network\"=>\"172.22.255.0\"}]",
|
49
|
+
"networking::domain": "prod.location.de.local",
|
50
|
+
"machineid": "123456789abcdefghijklmnopqrstuvwxyz",
|
51
|
+
"domain": "prod.location.de.local",
|
52
|
+
"disks::sda::vendor": "ATA",
|
53
|
+
"disks::sda::model": "DELLBOSS VD",
|
54
|
+
"disks::sda::size": "223.51 GB",
|
55
|
+
"disks::sda::size_bytes": "239990276096",
|
56
|
+
"disks::nvme1n1::vendor": "Error: open /sys/block/nvme1n1/device/vendor: no such file or directory",
|
57
|
+
"disks::nvme1n1::model": "Dell Express Flash PM1725a 6.4TB SFF",
|
58
|
+
"disks::nvme1n1::size": "5.82 TB",
|
59
|
+
"disks::nvme1n1::size_bytes": "6401252745216",
|
60
|
+
"disks::nvme0n1::vendor": "Error: open /sys/block/nvme0n1/device/vendor: no such file or directory",
|
61
|
+
"disks::nvme0n1::model": "Dell Express Flash PM1725a 6.4TB SFF",
|
62
|
+
"disks::nvme0n1::size": "5.82 TB",
|
63
|
+
"disks::nvme0n1::size_bytes": "6401252745216",
|
64
|
+
"architecture": "x86_64",
|
65
|
+
"dhcp_servers": null,
|
66
|
+
"discovery_proxy_type": "proxy",
|
67
|
+
"discovery_proxy_uri": "https://foremansp.prod.location.de.local:8443",
|
68
|
+
"nmprimary_ip6_route": "dst = ff00::/8, nh = ::, mt = 256, table=255",
|
69
|
+
"nmprimary_ip6_address": "fc80::/64",
|
70
|
+
"nmprimary_dhcp4_option_requested_ntp_servers": "1",
|
71
|
+
"nmprimary_dhcp4_option_dhcp_server_identifier": "172.23.35.145",
|
72
|
+
"nmprimary_dhcp4_option_requested_host_name": "1",
|
73
|
+
"nmprimary_dhcp4_option_requested_nis_domain": "1",
|
74
|
+
"nmprimary_dhcp4_option_requested_routers": "1",
|
75
|
+
"nmprimary_dhcp4_option_requested_ms_classless_static_routes": "1",
|
76
|
+
"nmprimary_dhcp4_option_routers": "172.22.255.254",
|
77
|
+
"nmprimary_dhcp4_option_requested_domain_name_servers": "1",
|
78
|
+
"nmprimary_dhcp4_option_domain_name_servers": "172.23.1.210 10.0.33.10",
|
79
|
+
"nmprimary_dhcp4_option_subnet_mask": "255.255.255.0",
|
80
|
+
"nmprimary_dhcp4_option_requested_nis_servers": "1",
|
81
|
+
"nmprimary_dhcp4_option_dhcp_message_type": "5",
|
82
|
+
"nmprimary_dhcp4_option_requested_static_routes": "1",
|
83
|
+
"nmprimary_dhcp4_option_requested_subnet_mask": "1",
|
84
|
+
"nmprimary_dhcp4_option_ip_address": "172.22.255.185",
|
85
|
+
"nmprimary_dhcp4_option_requested_broadcast_address": "1",
|
86
|
+
"nmprimary_dhcp4_option_requested_interface_mtu": "1",
|
87
|
+
"nmprimary_dhcp4_option_broadcast_address": "172.22.255.255",
|
88
|
+
"nmprimary_dhcp4_option_next_server": "172.23.35.29",
|
89
|
+
"nmprimary_dhcp4_option_expiry": "1553551269",
|
90
|
+
"nmprimary_dhcp4_option_requested_wpad": "1",
|
91
|
+
"nmprimary_dhcp4_option_requested_classless_static_routes": "1",
|
92
|
+
"nmprimary_dhcp4_option_requested_rfc3442_classless_static_routes": "1",
|
93
|
+
"nmprimary_dhcp4_option_requested_domain_name": "1",
|
94
|
+
"nmprimary_dhcp4_option_filename": "pxelinux.0",
|
95
|
+
"nmprimary_dhcp4_option_requested_domain_search": "1",
|
96
|
+
"nmprimary_dhcp4_option_network_number": "172.22.255.0",
|
97
|
+
"nmprimary_ip4_dns": "172.23.1.210",
|
98
|
+
"nmprimary_ip4_route": "dst = 0.0.0.0/0, nh = 172.22.255.254, mt = 100",
|
99
|
+
"nmprimary_ip4_gateway": "172.22.255.254",
|
100
|
+
"nmprimary_ip4_address": "172.22.255.185/24",
|
101
|
+
"nmprimary_general_vpn": "no",
|
102
|
+
"nmprimary_general_default6": "no",
|
103
|
+
"nmprimary_general_default": "yes",
|
104
|
+
"nmprimary_general_state": "activated",
|
105
|
+
"nmprimary_general_devices": "p3p1",
|
106
|
+
"nmprimary_general_uuid": "aaaaaaaa-bbbb-cccc-eeee-ffffffffffff",
|
107
|
+
"nmprimary_general_name": "primary",
|
108
|
+
"nmprimary_proxy_browser-only": "no",
|
109
|
+
"nmprimary_proxy_method": "none",
|
110
|
+
"nmprimary_vlan_flags": "1",
|
111
|
+
"nmprimary_vlan_id": "0",
|
112
|
+
"nmprimary_ipv6_dhcp-send-hostname": "yes",
|
113
|
+
"nmprimary_ipv6_addr-gen-mode": "eui64",
|
114
|
+
"nmprimary_ipv6_ip6-privacy": "-1",
|
115
|
+
"nmprimary_ipv6_may-fail": "yes",
|
116
|
+
"nmprimary_ipv6_never-default": "no",
|
117
|
+
"nmprimary_ipv6_ignore-auto-dns": "no",
|
118
|
+
"nmprimary_ipv6_ignore-auto-routes": "no",
|
119
|
+
"nmprimary_ipv6_route-table": "0",
|
120
|
+
"nmprimary_ipv6_route-metric": "-1",
|
121
|
+
"nmprimary_ipv6_dns-priority": "0",
|
122
|
+
"nmprimary_ipv6_method": "ignore",
|
123
|
+
"nmprimary_ipv4_may-fail": "yes",
|
124
|
+
"nmprimary_ipv4_never-default": "no",
|
125
|
+
"nmprimary_ipv4_dhcp-send-hostname": "no",
|
126
|
+
"nmprimary_ipv4_ignore-auto-dns": "no",
|
127
|
+
"nmprimary_ipv4_ignore-auto-routes": "no",
|
128
|
+
"nmprimary_ipv4_route-table": "0",
|
129
|
+
"nmprimary_ipv4_route-metric": "-1",
|
130
|
+
"nmprimary_ipv4_dns-priority": "0",
|
131
|
+
"nmprimary_ipv4_method": "auto",
|
132
|
+
"nmprimary_802-3-ethernet_wake-on-lan": "default",
|
133
|
+
"nmprimary_802-3-ethernet_mtu": "auto",
|
134
|
+
"nmprimary_802-3-ethernet_mac-address": "aa:bb:cc:dd:ee:ff",
|
135
|
+
"nmprimary_802-3-ethernet_auto-negotiate": "no",
|
136
|
+
"nmprimary_802-3-ethernet_speed": "0",
|
137
|
+
"nmprimary_connection_lldp": "default",
|
138
|
+
"nmprimary_connection_metered": "unknown",
|
139
|
+
"nmprimary_connection_autoconnect-slaves": "-1",
|
140
|
+
"nmprimary_connection_read-only": "no",
|
141
|
+
"nmprimary_connection_auth-retries": "-1",
|
142
|
+
"nmprimary_connection_autoconnect-retries": "-1",
|
143
|
+
"nmprimary_connection_autoconnect-priority": "1",
|
144
|
+
"nmprimary_connection_autoconnect": "yes",
|
145
|
+
"nmprimary_connection_type": "802-3-ethernet",
|
146
|
+
"nmprimary_connection_uuid": "aaaaaaaa-bbbb-cccc-eeee-ffffffffffff",
|
147
|
+
"nmprimary_connection_id": "primary",
|
148
|
+
"ipmi_1_gateway": "172.23.111.254",
|
149
|
+
"ipmi_1_macaddress": "aa:bb:cc:dd:ee:ff",
|
150
|
+
"ipmi_1_subnet_mask": "255.255.255.0",
|
151
|
+
"ipmi_1_ptr": "machine-prod-cons.location.de.local",
|
152
|
+
"ipmi_1_ipaddress": "172.23.111.92",
|
153
|
+
"ipmi_1_ipaddress_source": "Static Address",
|
154
|
+
"ipmi_gateway": "172.23.111.254",
|
155
|
+
"ipmi_macaddress": "aa:bb:cc:dd:ee:ff",
|
156
|
+
"ipmi_subnet_mask": "255.255.255.0",
|
157
|
+
"ipmi_ptr": "machine-prod-cons.location.de.local",
|
158
|
+
"ipmi_ipaddress": "172.23.111.92",
|
159
|
+
"ipmi_ipaddress_source": "Static Address",
|
160
|
+
"ipmi_enabled": "true",
|
161
|
+
"link_p3p2": "true",
|
162
|
+
"auto_negotiation_p3p2": "false",
|
163
|
+
"port_p3p2": "Direct Attach Copper",
|
164
|
+
"duplex_p3p2": "full",
|
165
|
+
"speed_p3p2": "25000",
|
166
|
+
"link_p3p1": "true",
|
167
|
+
"auto_negotiation_p3p1": "false",
|
168
|
+
"port_p3p1": "Direct Attach Copper",
|
169
|
+
"duplex_p3p1": "full",
|
170
|
+
"speed_p3p1": "25000",
|
171
|
+
"link_em4": "false",
|
172
|
+
"auto_negotiation_em4": "true",
|
173
|
+
"port_em4": "Twisted Pair",
|
174
|
+
"duplex_em4": "unknown! (255)",
|
175
|
+
"link_em3": "false",
|
176
|
+
"auto_negotiation_em3": "true",
|
177
|
+
"port_em3": "Twisted Pair",
|
178
|
+
"duplex_em3": "unknown! (255)",
|
179
|
+
"link_em2": "false",
|
180
|
+
"wol_em2": "true",
|
181
|
+
"auto_negotiation_em2": "true",
|
182
|
+
"port_em2": "Twisted Pair",
|
183
|
+
"duplex_em2": "unknown! (255)",
|
184
|
+
"link_em1": "false",
|
185
|
+
"wol_em1": "true",
|
186
|
+
"auto_negotiation_em1": "true",
|
187
|
+
"port_em1": "Twisted Pair",
|
188
|
+
"duplex_em1": "unknown! (255)",
|
189
|
+
"uuid": "aaaaaaaa-bbbb-cccc-eeee-ffffffffffff",
|
190
|
+
"serialnumber": "abcdefg",
|
191
|
+
"manufacturer": "Dell Inc.",
|
192
|
+
"bios_release_date": "12/17/2018",
|
193
|
+
"bios_version": "1.6.13",
|
194
|
+
"bios_vendor": "Dell Inc.",
|
195
|
+
"boardserialnumber": "0123456789abcdefghijklmnopqrstuvwxyz",
|
196
|
+
"boardproductname": "abcdefg",
|
197
|
+
"boardmanufacturer": "Dell Inc.",
|
198
|
+
"fqdn": "fdi",
|
199
|
+
"uniqueid": "abcdefgh123",
|
200
|
+
"ipaddress": "172.22.255.185",
|
201
|
+
"macaddress": "aa:bb:cc:dd:ee:fe",
|
202
|
+
"network_p3p1": "172.22.255.0",
|
203
|
+
"hardwareisa": "x86_64",
|
204
|
+
"dhcp_servers::p3p1": "172.23.35.145",
|
205
|
+
"dhcp_servers::system": "172.23.35.145",
|
206
|
+
"processorcount": "80",
|
207
|
+
"processor79": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
208
|
+
"processor78": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
209
|
+
"processor77": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
210
|
+
"processor76": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
211
|
+
"processor75": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
212
|
+
"processor74": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
213
|
+
"processor73": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
214
|
+
"processor72": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
215
|
+
"processor71": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
216
|
+
"processor70": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
217
|
+
"processor69": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
218
|
+
"processor68": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
219
|
+
"processor67": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
220
|
+
"processor66": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
221
|
+
"processor65": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
222
|
+
"processor64": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
223
|
+
"processor63": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
224
|
+
"processor62": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
225
|
+
"processor61": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
226
|
+
"processor60": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
227
|
+
"processor59": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
228
|
+
"processor58": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
229
|
+
"processor57": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
230
|
+
"processor56": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
231
|
+
"processor55": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
232
|
+
"processor54": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
233
|
+
"processor53": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
234
|
+
"processor52": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
235
|
+
"processor51": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
236
|
+
"processor50": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
237
|
+
"processor49": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
238
|
+
"processor48": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
239
|
+
"processor47": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
240
|
+
"processor46": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
241
|
+
"processor45": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
242
|
+
"processor44": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
243
|
+
"processor43": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
244
|
+
"processor42": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
245
|
+
"processor41": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
246
|
+
"processor40": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
247
|
+
"processor39": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
248
|
+
"processor38": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
249
|
+
"processor37": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
250
|
+
"processor36": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
251
|
+
"processor35": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
252
|
+
"processor34": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
253
|
+
"processor33": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
254
|
+
"processor32": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
255
|
+
"processor31": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
256
|
+
"processor30": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
257
|
+
"processor29": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
258
|
+
"processor28": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
259
|
+
"processor27": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
260
|
+
"processor26": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
261
|
+
"processor25": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
262
|
+
"processor24": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
263
|
+
"processor23": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
264
|
+
"processor22": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
265
|
+
"processor21": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
266
|
+
"processor20": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
267
|
+
"processor19": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
268
|
+
"processor18": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
269
|
+
"processor17": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
270
|
+
"processor16": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
271
|
+
"processor15": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
272
|
+
"processor14": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
273
|
+
"processor13": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
274
|
+
"processor12": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
275
|
+
"processor11": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
276
|
+
"processor10": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
277
|
+
"discovery_bootip": "172.22.255.185",
|
278
|
+
"discovery_bootif": "aa:bb:cc:dd:ee:ff:gg",
|
279
|
+
"discovery_release": "20180822.1",
|
280
|
+
"discovery_version": "3.5.1",
|
281
|
+
"hostname": "fdi",
|
282
|
+
"gid": "root",
|
283
|
+
"memorysize_mb": "515579.70",
|
284
|
+
"memorysize": "503.50 GB",
|
285
|
+
"blockdevices": "nvme0n1,nvme1n1,sda",
|
286
|
+
"blockdevice_nvme1n1_model": "Dell Express Flash PM1725a 6.4TB SFF",
|
287
|
+
"blockdevice_nvme1n1_size": "6401252745216",
|
288
|
+
"blockdevice_nvme0n1_model": "Dell Express Flash PM1725a 6.4TB SFF",
|
289
|
+
"blockdevice_nvme0n1_size": "6401252745216",
|
290
|
+
"blockdevice_sda_model": "DELLBOSS VD",
|
291
|
+
"blockdevice_sda_vendor": "ATA",
|
292
|
+
"blockdevice_sda_size": "239990276096",
|
293
|
+
"type": "Rack Mount Chassis",
|
294
|
+
"processor9": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
295
|
+
"processor8": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
296
|
+
"processor7": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
297
|
+
"processor6": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
298
|
+
"processor5": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
299
|
+
"processor4": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
300
|
+
"processor3": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
301
|
+
"processor2": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
302
|
+
"processor1": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
303
|
+
"processor0": "Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz",
|
304
|
+
"hardwaremodel": "x86_64",
|
305
|
+
"virtual": "physical",
|
306
|
+
"os::name": "CentOS",
|
307
|
+
"physicalprocessorcount": "2",
|
308
|
+
"facterversion": "2.4.1",
|
309
|
+
"id": "root",
|
310
|
+
"netmask": "255.255.255.0",
|
311
|
+
"ps": "ps -ef",
|
312
|
+
"mtu_p3p2": "1500",
|
313
|
+
"macaddress_p3p2": "aa:bb:cc:dd:ee:f1",
|
314
|
+
"mtu_p3p1": "1500",
|
315
|
+
"netmask_p3p1": "255.255.255.0",
|
316
|
+
"macaddress_p3p1": "aa:bb:cc:dd:ee:f2",
|
317
|
+
"ipaddress_p3p1": "172.22.255.185",
|
318
|
+
"mtu_em4": "1500",
|
319
|
+
"macaddress_em4": "aa:bb:cc:dd:ee:f3",
|
320
|
+
"mtu_em3": "1500",
|
321
|
+
"macaddress_em3": "aa:bb:cc:dd:ee:f4",
|
322
|
+
"mtu_em2": "1500",
|
323
|
+
"macaddress_em2": "aa:bb:cc:dd:ee:f5",
|
324
|
+
"mtu_em1": "1500",
|
325
|
+
"macaddress_em1": "aa:bb:cc:dd:ee:f6",
|
326
|
+
"interfaces": "em1,em2,em3,em4,lo,p3p1,p3p2",
|
327
|
+
"lib": "/usr/share/fdi/facts:/opt/extension/facts"
|
328
|
+
}
|