summaryrefslogtreecommitdiffstats
path: root/server/lib/external-backends/backends/infoblox-backend.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/external-backends/backends/infoblox-backend.js')
-rw-r--r--server/lib/external-backends/backends/infoblox-backend.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/server/lib/external-backends/backends/infoblox-backend.js b/server/lib/external-backends/backends/infoblox-backend.js
index 6c80392..0571841 100644
--- a/server/lib/external-backends/backends/infoblox-backend.js
+++ b/server/lib/external-backends/backends/infoblox-backend.js
@@ -64,6 +64,20 @@ class InfobloxBackend extends ExternalBackends {
})
}
+ async checkDomain (credentials) {
+ const c = this.mapCredentials(credentials)
+
+ const ipam = new Infoblox({
+ ip: c.url,
+ apiVersion: c.version
+ })
+ const login = await ipam.login(c.username, c.password)
+ if (!login) return { error: 'LOGIN_FAILED' }
+
+ const domainList = await ipam.getDomain()
+ return domainList
+ }
+
async checkIp (credentials, ipv4) {
const c = this.mapCredentials(credentials)
@@ -96,7 +110,7 @@ class InfobloxBackend extends ExternalBackends {
return response
}
- async setIp (credentials, ipv4, mac, name, setNextIp = false) {
+ async setIp (credentials, ipv4, domain, mac, name, setNextIp = false) {
const c = this.mapCredentials(credentials)
const ipam = new Infoblox({
@@ -116,7 +130,8 @@ class InfobloxBackend extends ExternalBackends {
return { error: 'ERROR_INFOBLOX', msg: 'No network found. Missing permissions?' }
}
}
- const domain = (await ipam.getDomain())[0]
+ // If the domain is not set, take the first available one.
+ if (!domain) domain = (await ipam.getDomain())[0]
// Set fixed ip if the name is not set (Automatic registration)
let path = ''