UNPKG

n8n-nodes-netdevices

Version:

n8n node to interact with network devices (Cisco, MikroTik, Arista, Extreme Networks, Dell, Juniper, HP, Aruba, Ubiquiti, Palo Alto, Fortinet - ISP, data center, campus, and edge)

103 lines 3.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArubaOsConnection = void 0; const cisco_connection_1 = require("../cisco/cisco-connection"); class ArubaOsConnection extends cisco_connection_1.CiscoConnection { constructor(credentials) { super(credentials); this.newline = '\r'; } async sessionPreparation() { await this.createCiscoShellChannel(); if (this.fastMode) { await this.setBasePrompt(); } else { await this.setBasePrompt(); await this.checkAndEnterEnableMode(); await this.disableArubaPaging(); } } async disableArubaPaging() { try { await this.writeChannel('no paging' + this.newline); await this.readChannel(2000); } catch (error) { } } async checkConfigMode() { try { await this.writeChannel(this.returnChar); const output = await this.readChannel(2000); return output.includes('(config) #'); } catch (error) { return false; } } async enterConfigMode() { if (await this.checkConfigMode()) { this.inConfigMode = true; return; } if (!this.inEnableMode) { await this.enterEnableMode(); } try { await this.writeChannel('configure term' + this.newline); const output = await this.readChannel(3000); if (output.includes('(config) #')) { this.inConfigMode = true; } else { throw new Error('Failed to enter configuration mode'); } } catch (error) { throw new Error(`Failed to enter configuration mode: ${error}`); } } async exitConfigMode() { if (!this.inConfigMode) { return; } try { await this.writeChannel('exit' + this.newline); const output = await this.readChannel(3000); if (output.includes('#') && !output.includes('(config) #')) { this.inConfigMode = false; } else { await this.writeChannel('end' + this.newline); const output2 = await this.readChannel(3000); if (output2.includes('#') && !output2.includes('(config) #')) { this.inConfigMode = false; } else { throw new Error('Failed to exit configuration mode'); } } } catch (error) { throw new Error(`Failed to exit configuration mode: ${error}`); } } async getCurrentConfig() { return await this.sendCommand('show running-config'); } async saveConfig() { return await this.sendCommand('write memory'); } async showAccessPoints() { return await this.sendCommand('show ap database'); } async showClients() { return await this.sendCommand('show user-table'); } async showController() { return await this.sendCommand('show switches'); } } exports.ArubaOsConnection = ArubaOsConnection; //# sourceMappingURL=aruba-os-connection.js.map