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.js29
1 files changed, 26 insertions, 3 deletions
diff --git a/server/lib/external-backends/backends/infoblox-backend.js b/server/lib/external-backends/backends/infoblox-backend.js
index f980b8b..9d070ac 100644
--- a/server/lib/external-backends/backends/infoblox-backend.js
+++ b/server/lib/external-backends/backends/infoblox-backend.js
@@ -25,7 +25,7 @@ class InfobloxBackend extends ExternalBackends {
*
* return: { success: <boolean>, status: '<STATUS_CODE_IF_ERROR>', error: '<ERROR_MESSAGE>' }
*/
- async checkConnection (credentials) {
+ checkConnection (credentials) {
var c = this.mapCredentials(credentials)
var ipam = new Infoblox({
@@ -34,13 +34,36 @@ class InfobloxBackend extends ExternalBackends {
})
return ipam.login(c.username, c.password).then(response => {
if (response) {
- console.log('wefkin')
return { success: true }
} else {
- return { success: false, error: 'TEST' }
+ return { success: false, error: 'Login failed' }
}
})
}
+
+ /*
+ * Gets the client via IP, because only fixed pcs can be found via mac. But we also want so support leased pc's?
+ *
+ */
+ async getClient (credentials, client) {
+ var c = this.mapCredentials(credentials)
+
+ var ipam = new Infoblox({
+ ip: c.url,
+ apiVersion: c.version
+ })
+
+ return ipam.login(c.username, c.password).then(response => {
+ if (response) {
+ return ipam.getHost('10.21.9.228').then(response => {
+ return JSON.parse(response)
+ })
+ } else {
+ return { success: false, error: 'Login failed' }
+ }
+ })
+ }
+
// ############################################################################
// ####################### helper/optional functions #########################
// Helper function, to map the array of credential objects into a single js object.