foreman_ipam 0.0.3 → 0.0.4
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/README.md +12 -4
- data/Rakefile +9 -11
- data/app/controllers/foreman_ipam/dashboard_controller.rb +2 -3
- data/app/helpers/concerns/foreman_ipam/dashboard_helper_extensions.rb +6 -6
- data/app/models/concerns/foreman_ipam/dashboard_extensions.rb +11 -11
- data/app/views/foreman_ipam/dashboard/ipam.html.erb +3 -3
- data/config/initializers/phpipam.rb +1 -1
- data/lib/foreman_ipam/{phpipam_client.rb → phpipam.rb} +1 -2
- data/lib/foreman_ipam/version.rb +1 -1
- data/test/factories/foreman_ipam_factories.rb +3 -3
- data/test/unit/foreman_ipam_test.rb +8 -0
- metadata +7 -35
- data/test/unit/foreman_phpipam_test.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e739306ec83e70eb58edf95e5e86f7cba5a2c39cf66249f5d644763d5149b1c
|
4
|
+
data.tar.gz: fedbe687ef3cf81a41f2450266b06c9891b08b14c66dde80fe175a1698df2906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7a1eebfc19ffb3c85fc085f34feef61c9949811c5f2edf492408c44e69056a30098fda685bd129a2d30ac12b0a94793bf09c8493d841957c62b21abf2d25cf
|
7
|
+
data.tar.gz: 2b363b2c2edca37cc29698da4d905e353c1bba49f30320dd511c7fb484d4e49d9149d2ea51fd27dc3e1a0ac79d79999f329159782d8562c2a703b4b589d7f776
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# foreman_ipam
|
2
2
|
|
3
|
-
Foreman plugin for IPAM integration with
|
3
|
+
Foreman plugin for IPAM integration with various IPAM providers.
|
4
4
|
|
5
|
-
|
5
|
+
Currently supported Providers:
|
6
6
|
1. [phpIPAM](https://phpipam.net/).
|
7
7
|
|
8
|
-
Provides a basic
|
8
|
+
Provides a basic Dashboard for viewing phpIPAM sections and subnets. Also allows for obtaining of the next available IPv4 address for a given subnet(via [IPAM Smart Proxy Plugin](https://github.com/grizzthedj/smart_proxy_ipam)).
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -16,7 +16,7 @@ for how to install Foreman plugins.
|
|
16
16
|
|
17
17
|
Once plugin is installed, you can look at the phpIPAM Dashboard(at Infrastructure --> phpIPAM Dashboard), for a simple view of sections, subnets etc. and/or use phpIPAM to get the next available IP address for a subnet:
|
18
18
|
|
19
|
-
1. Create a subnet in Foreman of IPAM type "
|
19
|
+
1. Create a subnet in Foreman of IPAM type "IPAM". Click on the `Proxy` tab and associate the subnet with the IPAM proxy. _NOTE: This subnet must actually exist in phpIPAM. There is no phpIPAM integration on the subnet creation at this time._
|
20
20
|
2. Create a host in Foreman. When adding/editing interfaces, select the above subnet, and the next available IP(pulled from phpIPAM) for the selected subnet will be displayed in the IPv4 address field. _NOTE: This is not supported for IPv6._
|
21
21
|
|
22
22
|
## Local development
|
@@ -64,6 +64,14 @@ bundle exec smart-proxy start
|
|
64
64
|
11. Ensure that the `phpipam` feature is present on the proxy(http://proxy_url/features)
|
65
65
|
12. Create a Subnet, and associate the subnet to the `phpipam` proxy
|
66
66
|
|
67
|
+
## Run tests
|
68
|
+
|
69
|
+
From the Foreman core, run ...
|
70
|
+
|
71
|
+
```
|
72
|
+
bundle exec rails test:foreman_ipam
|
73
|
+
```
|
74
|
+
|
67
75
|
## TODO
|
68
76
|
|
69
77
|
- Support for ip ranges
|
data/Rakefile
CHANGED
@@ -20,8 +20,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
20
20
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
21
|
end
|
22
22
|
|
23
|
-
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
24
|
-
|
25
23
|
Bundler::GemHelper.install_tasks
|
26
24
|
|
27
25
|
require 'rake/testtask'
|
@@ -35,13 +33,13 @@ end
|
|
35
33
|
|
36
34
|
task default: :test
|
37
35
|
|
38
|
-
begin
|
39
|
-
|
40
|
-
|
41
|
-
rescue => _
|
42
|
-
|
43
|
-
end
|
36
|
+
# begin
|
37
|
+
# require 'rubocop/rake_task'
|
38
|
+
# RuboCop::RakeTask.new
|
39
|
+
# rescue => _
|
40
|
+
# puts 'Rubocop not loaded.'
|
41
|
+
# end
|
44
42
|
|
45
|
-
task :default do
|
46
|
-
|
47
|
-
end
|
43
|
+
# task :default do
|
44
|
+
# Rake::Task['rubocop'].execute
|
45
|
+
# end
|
@@ -2,13 +2,12 @@
|
|
2
2
|
module ForemanIpam
|
3
3
|
class DashboardController < ::DashboardController
|
4
4
|
def ipam
|
5
|
-
@response =
|
5
|
+
@response = Phpipam.proxy.get_sections
|
6
6
|
end
|
7
7
|
|
8
8
|
def subnets
|
9
|
-
@subnets =
|
9
|
+
@subnets = Phpipam.proxy.get_subnets(params[:section_id])
|
10
10
|
render :json => @subnets.to_json, :status => :ok
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
@@ -2,12 +2,12 @@ module ForemanIpam
|
|
2
2
|
module DashboardHelperExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
included do
|
6
|
-
|
7
|
-
end
|
5
|
+
# included do
|
6
|
+
# # execute callbacks
|
7
|
+
# end
|
8
8
|
|
9
|
-
# create or overwrite instance methods...
|
10
|
-
def instance_method_name
|
11
|
-
end
|
9
|
+
# # create or overwrite instance methods...
|
10
|
+
# def instance_method_name
|
11
|
+
# end
|
12
12
|
end
|
13
13
|
end
|
@@ -2,18 +2,18 @@ module ForemanIpam
|
|
2
2
|
module DashboardExtensions
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# included do
|
6
|
+
# # execute callbacks
|
7
|
+
# end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
# # create or overwrite instance methods...
|
10
|
+
# def instance_method_name
|
11
|
+
# end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# module ClassMethods
|
14
|
+
# # create or overwrite class methods...
|
15
|
+
# def class_method_name
|
16
|
+
# end
|
17
|
+
# end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1>IPAM Integration Dashboard</h1>
|
2
2
|
|
3
|
-
<% if @response %>
|
3
|
+
<% if @response && @response.length > 0 %>
|
4
4
|
<h2>phpIPAM</h2>
|
5
5
|
<h3>Sections:</h3>
|
6
6
|
<table class="<%= table_css_classes 'table-fixed' %>">
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<% else %>
|
27
27
|
<div class="alert alert-warning ">
|
28
28
|
<span class="pficon pficon-warning-triangle-o "></span>
|
29
|
-
<span class="text"><%= _("No sections found in the
|
29
|
+
<span class="text"><%= _("No sections found in the External IPAM instance.") %></span>
|
30
30
|
</div>
|
31
31
|
<% end %>
|
32
32
|
|
@@ -50,7 +50,7 @@
|
|
50
50
|
}
|
51
51
|
|
52
52
|
function displaySubnets(data) {
|
53
|
-
var subnets = data
|
53
|
+
var subnets = data;
|
54
54
|
subnet_container.innerHTML += `
|
55
55
|
<div class='col-md-2'><strong>Subnet</strong></div>
|
56
56
|
<div class='col-md-6'><strong>Description</strong></strong></div><br />
|
@@ -1 +1 @@
|
|
1
|
-
require_relative '../../lib/foreman_ipam/
|
1
|
+
require_relative '../../lib/foreman_ipam/phpipam'
|
data/lib/foreman_ipam/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_ipam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rubocop
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rdoc
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
41
13
|
description: Plugin for IPAM integration with various IPAM providers
|
42
14
|
email:
|
43
15
|
- chrisjsmith001@gmail.com
|
@@ -59,7 +31,7 @@ files:
|
|
59
31
|
- db/seeds.d/01-add-external-ipam-feature.rb
|
60
32
|
- lib/foreman_ipam.rb
|
61
33
|
- lib/foreman_ipam/engine.rb
|
62
|
-
- lib/foreman_ipam/
|
34
|
+
- lib/foreman_ipam/phpipam.rb
|
63
35
|
- lib/foreman_ipam/version.rb
|
64
36
|
- lib/tasks/foreman_ipam_tasks.rake
|
65
37
|
- locale/Makefile
|
@@ -68,8 +40,8 @@ files:
|
|
68
40
|
- locale/gemspec.rb
|
69
41
|
- test/factories/foreman_ipam_factories.rb
|
70
42
|
- test/test_plugin_helper.rb
|
71
|
-
- test/unit/
|
72
|
-
homepage: https://github.com/grizzthedj
|
43
|
+
- test/unit/foreman_ipam_test.rb
|
44
|
+
homepage: https://github.com/grizzthedj/foreman_ipam
|
73
45
|
licenses:
|
74
46
|
- GPL-3.0
|
75
47
|
metadata: {}
|
@@ -94,6 +66,6 @@ signing_key:
|
|
94
66
|
specification_version: 4
|
95
67
|
summary: Plugin for IPAM integration with various IPAM providers
|
96
68
|
test_files:
|
97
|
-
- test/unit/
|
69
|
+
- test/unit/foreman_ipam_test.rb
|
98
70
|
- test/factories/foreman_ipam_factories.rb
|
99
71
|
- test/test_plugin_helper.rb
|