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)
64 lines • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EricssonMinilinkConnection = void 0;
const base_connection_1 = require("../base-connection");
const no_enable_1 = require("../no-enable");
class EricssonMinilinkConnection extends (0, no_enable_1.NoEnable)(base_connection_1.BaseConnection) {
constructor(credentials) {
super(credentials);
}
async sessionPreparation() {
await this.createShellChannel();
await this.specialLoginHandler();
await this.setBasePrompt();
}
async specialLoginHandler() {
const usernamePrompt = await this.readUntilPrompt('User:', 20000);
if (usernamePrompt.includes('User:')) {
await this.writeChannel(this.credentials.username + this.newline);
}
else {
throw new Error('Did not receive username prompt');
}
const passwordPrompt = await this.readUntilPrompt('Password:', 5000);
if (passwordPrompt.includes('Password:')) {
if (this.credentials.password) {
await this.writeChannel(this.credentials.password + this.newline);
}
else {
throw new Error('Password is required for this device');
}
}
else {
throw new Error('Did not receive password prompt');
}
}
async enterConfigMode() {
await this.writeChannel('config' + this.newline);
const output = await this.readUntilPrompt('(config)#');
if (!output.includes('(config)#')) {
throw new Error('Failed to enter config mode');
}
}
async exitConfigMode() {
await this.writeChannel('exit' + this.newline);
const output = await this.readUntilPrompt('>');
if (output.includes('(config)#')) {
throw new Error('Failed to exit config mode');
}
}
async saveConfig() {
return await this.sendCommand('write');
}
async checkAndEnterEnableMode() {
return;
}
async enterEnableMode() {
return;
}
async exitEnableMode() {
return '';
}
}
exports.EricssonMinilinkConnection = EricssonMinilinkConnection;
//# sourceMappingURL=ericsson-mltn-connection.js.map