n8n-nodes-arubacentralnextgen
Version:
n8n community node for Aruba Central NextGen API integration with modern monitoring and management capabilities
1,165 lines • 66.3 kB
JavaScript
"use strict";
// methods/monitoring/accessPoints/accessPoints.methods.ts
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAllAPs = getAllAPs;
exports.getAPDetails = getAPDetails;
exports.getTopAPsByWirelessUsage = getTopAPsByWirelessUsage;
exports.getAPThroughputTrends = getAPThroughputTrends;
exports.getAPCPUUtilization = getAPCPUUtilization;
exports.getAPMemoryUtilization = getAPMemoryUtilization;
exports.getAPPowerConsumption = getAPPowerConsumption;
exports.getRadioDetails = getRadioDetails;
exports.getRadioPerformance = getRadioPerformance;
exports.getAPsWithIssues = getAPsWithIssues;
exports.getAPPortFrameTrends = getAPPortFrameTrends;
exports.getAllRadios = getAllRadios;
exports.getRadioChannelUtilization = getRadioChannelUtilization;
exports.getRadioChannelQuality = getRadioChannelQuality;
exports.getRadioNoiseFloor = getRadioNoiseFloor;
exports.getRadioTransmissionInfo = getRadioTransmissionInfo;
exports.getAPPortCRCErrors = getAPPortCRCErrors;
exports.getAPPortCollisionErrors = getAPPortCollisionErrors;
exports.getAPRadioThroughputTrend = getAPRadioThroughputTrend;
exports.getAPPortThroughputTrend = getAPPortThroughputTrend;
exports.getAPRadiosList = getAPRadiosList;
exports.getAPPortsList = getAPPortsList;
exports.getAllWLANs = getAllWLANs;
exports.getWLANByName = getWLANByName;
exports.getAPWLANsList = getAPWLANsList;
exports.getAPWLANThroughputTrend = getAPWLANThroughputTrend;
exports.getAPTunnelsList = getAPTunnelsList;
exports.getAPTunnelDetails = getAPTunnelDetails;
exports.getAPTunnelThroughputTrend = getAPTunnelThroughputTrend;
exports.getAPTunnelPacketLossTrend = getAPTunnelPacketLossTrend;
exports.getAPTunnelJitterTrend = getAPTunnelJitterTrend;
exports.getAPTunnelLatencyTrend = getAPTunnelLatencyTrend;
exports.getAPTunnelMOSScoreTrend = getAPTunnelMOSScoreTrend;
exports.getWLANThroughputTrend = getWLANThroughputTrend;
// Import helpers directly instead of using the barrel file to avoid circular dependencies
const apiRequest_1 = require("../../../helpers/apiRequest");
const responseFormatter_1 = require("../../../helpers/responseFormatter");
const pagination_1 = require("../../../helpers/pagination");
const filterBuilder_1 = require("../../../helpers/filterBuilder");
const logger = __importStar(require("../../../helpers/logger"));
/**
* Get a list of all Access Points
*/
async function getAllAPs() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllAPs operation', undefined, this);
}
try {
// Get parameters from node
const returnAll = this.getNodeParameter('returnAll', 0, false);
const limit = this.getNodeParameter('limit', 0, 20);
const filters = this.getNodeParameter('filters', 0, {});
// Build filter string if filters are provided
let queryParams = {};
if (Object.keys(filters).length > 0) {
const filterString = (0, filterBuilder_1.buildODataFilter)(filters);
if (filterString) {
queryParams.filter = filterString;
}
}
// Use pagination helper
const endpoint = '/network-monitoring/v1alpha1/aps';
const response = await pagination_1.handlePagination.call(this, endpoint, queryParams, returnAll, limit, 'items');
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllAPs operation', error);
throw error;
}
}
/**
* Get details for a specific Access Point
*/
async function getAPDetails() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPDetails operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPDetails operation', error);
throw error;
}
}
/**
* Get top APs by wireless usage
*/
async function getTopAPsByWirelessUsage() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getTopAPsByWirelessUsage operation', undefined, this);
}
try {
// Get parameters from node
const siteId = this.getNodeParameter('siteId', 0);
const limit = this.getNodeParameter('limit', 0, 10);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!siteId) {
throw new Error('Site ID is required');
}
// Build query parameters
const queryParams = {
'site-id': siteId,
limit,
};
// Add time range if provided
if (timeRange.startTime) {
queryParams['start-time'] = timeRange.startTime;
}
if (timeRange.endTime) {
queryParams['end-time'] = timeRange.endTime;
}
// Make API request
const endpoint = '/network-monitoring/v1alpha1/top-aps-by-wireless-usage';
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getTopAPsByWirelessUsage operation', error);
throw error;
}
}
/**
* Get AP Throughput Trends
*/
async function getAPThroughputTrends() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPThroughputTrends operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const interfaceType = this.getNodeParameter('interfaceType', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build query parameters
const queryParams = {
'interface-type': interfaceType,
};
// Build filter for time range if provided
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/throughput-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPThroughputTrends operation', error);
throw error;
}
}
/**
* Get AP CPU Utilization
*/
async function getAPCPUUtilization() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPCPUUtilization operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/cpu-utilization-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPCPUUtilization operation', error);
throw error;
}
}
/**
* Get AP Memory Utilization
*/
async function getAPMemoryUtilization() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPMemoryUtilization operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/memory-utilization-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPMemoryUtilization operation', error);
throw error;
}
}
/**
* Get AP Power Consumption
*/
async function getAPPowerConsumption() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPowerConsumption operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/power-consumption-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPowerConsumption operation', error);
throw error;
}
}
/**
* Get Radio Details
*/
async function getRadioDetails() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioDetails operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const options = this.getNodeParameter('options', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Get the base AP details first to find radio information
const apEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}`;
const apDetails = await apiRequest_1.apiRequest.call(this, 'GET', apEndpoint);
// Find the specified radio
const radioDetails = apDetails.radios.find((radio) => radio.radioNumber === radioNumber);
if (!radioDetails) {
throw new Error(`Radio number ${radioNumber} not found on access point ${serialNumber}`);
}
// Create a results object to hold all the radio information
const results = {
...radioDetails,
serialNumber: apDetails.serialNumber,
deviceName: apDetails.deviceName,
};
// Get additional metrics if requested
const timeRange = {}; // Default to last 3 hours
// If channel utilization is requested
if (options.includeChannelUtilization) {
const channelUtilEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-utilization-trends`;
const channelUtilization = await apiRequest_1.apiRequest.call(this, 'GET', channelUtilEndpoint, {}, {});
results.channelUtilizationTrends = channelUtilization;
}
// If channel quality is requested
if (options.includeChannelQuality) {
const channelQualityEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-quality-trends`;
const channelQuality = await apiRequest_1.apiRequest.call(this, 'GET', channelQualityEndpoint, {}, {});
results.channelQualityTrends = channelQuality;
}
// If noise floor is requested
if (options.includeNoiseFloor) {
const noiseFloorEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/noise-floor-trends`;
const noiseFloor = await apiRequest_1.apiRequest.call(this, 'GET', noiseFloorEndpoint, {}, {});
results.noiseFloorTrends = noiseFloor;
}
// If frame trends are requested
if (options.includeFrameTrends) {
const frameTrendsEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/frames-trends`;
const frameTrends = await apiRequest_1.apiRequest.call(this, 'GET', frameTrendsEndpoint, {}, {});
results.frameTrends = frameTrends;
}
return [{ json: results }];
}
catch (error) {
logger.error('Error in getRadioDetails operation', error);
throw error;
}
}
/**
* Get comprehensive radio performance metrics
*/
async function getRadioPerformance() {
var _a, _b, _c, _d, _e, _f, _g, _h;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioPerformance operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range queries
let timeFilter = '';
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
timeFilter = filterParts.join(' and ');
}
}
// Build query parameters
const queryParams = {};
if (timeFilter) {
queryParams.filter = timeFilter;
}
// Get the base AP details to find radio information
const apEndpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}`;
const apDetails = await apiRequest_1.apiRequest.call(this, 'GET', apEndpoint);
// Get radio details
const radioDetails = apDetails.radios.find((radio) => radio.radioNumber === radioNumber);
if (!radioDetails) {
throw new Error(`Radio number ${radioNumber} not found on access point ${serialNumber}`);
}
if (debugMode) {
logger.debug(`Found radio ${radioNumber} on AP ${serialNumber}`, { band: radioDetails.band }, this);
}
// Create a comprehensive result object
const result = {
serialNumber,
deviceName: apDetails.deviceName,
radioNumber,
band: radioDetails.band,
channel: radioDetails.channel,
bandwidth: radioDetails.bandwidth,
status: radioDetails.status,
mode: radioDetails.mode,
power: radioDetails.power,
};
// Fetch all metrics in parallel for efficiency
if (debugMode) {
logger.debug(`Fetching performance metrics for radio ${radioNumber}`, undefined, this);
}
const [channelUtilization, channelQuality, noiseFloor, frameTrends, throughputTrends] = await Promise.all([
apiRequest_1.apiRequest.call(this, 'GET', `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-utilization-trends`, {}, queryParams),
apiRequest_1.apiRequest.call(this, 'GET', `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-quality-trends`, {}, queryParams),
apiRequest_1.apiRequest.call(this, 'GET', `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/noise-floor-trends`, {}, queryParams),
apiRequest_1.apiRequest.call(this, 'GET', `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/frames-trends`, {}, queryParams),
apiRequest_1.apiRequest.call(this, 'GET', `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/throughput-trends`, {}, queryParams),
]);
// Organize data into a structured format
result.channelUtilization = {
current: radioDetails.channelUtilization || 'N/A',
trends: channelUtilization,
};
result.noiseFloor = {
current: radioDetails.noiseFloor || 'N/A',
trends: noiseFloor,
};
result.channelQuality = {
current: radioDetails.channelQuality || 'N/A',
trends: channelQuality,
};
result.frameMetrics = {
errors: radioDetails.errors || 'N/A',
drops: radioDetails.drops || 'N/A',
retries: radioDetails.retries || 'N/A',
trends: frameTrends,
};
// Calculate current throughput from the most recent data point if available
let currentTxThroughput = 0;
let currentRxThroughput = 0;
if (((_b = (_a = throughputTrends === null || throughputTrends === void 0 ? void 0 : throughputTrends.graph) === null || _a === void 0 ? void 0 : _a.samples) === null || _b === void 0 ? void 0 : _b.length) > 0) {
const latestSample = throughputTrends.graph.samples[throughputTrends.graph.samples.length - 1];
const txIndex = throughputTrends.graph.keys.indexOf('tx');
const rxIndex = throughputTrends.graph.keys.indexOf('rx');
if (txIndex !== -1) {
currentTxThroughput = latestSample.data[txIndex];
}
if (rxIndex !== -1) {
currentRxThroughput = latestSample.data[rxIndex];
}
}
result.throughput = {
tx: currentTxThroughput,
rx: currentRxThroughput,
trends: throughputTrends,
};
// Calculate additional derived metrics
// Channel utilization breakdown if available
if (((_d = (_c = channelUtilization === null || channelUtilization === void 0 ? void 0 : channelUtilization.graph) === null || _c === void 0 ? void 0 : _c.keys) === null || _d === void 0 ? void 0 : _d.includes('tx')) &&
((_f = (_e = channelUtilization === null || channelUtilization === void 0 ? void 0 : channelUtilization.graph) === null || _e === void 0 ? void 0 : _e.keys) === null || _f === void 0 ? void 0 : _f.includes('rx')) &&
((_h = (_g = channelUtilization === null || channelUtilization === void 0 ? void 0 : channelUtilization.graph) === null || _g === void 0 ? void 0 : _g.keys) === null || _h === void 0 ? void 0 : _h.includes('interference'))) {
// Add channel utilization breakdown
const txIndex = channelUtilization.graph.keys.indexOf('tx');
const rxIndex = channelUtilization.graph.keys.indexOf('rx');
const interfIndex = channelUtilization.graph.keys.indexOf('interference');
if (channelUtilization.graph.samples.length > 0) {
const latestSample = channelUtilization.graph.samples[channelUtilization.graph.samples.length - 1];
result.channelUtilization.breakdown = {
tx: latestSample.data[txIndex],
rx: latestSample.data[rxIndex],
interference: latestSample.data[interfIndex],
timestamp: latestSample.timestamp,
};
}
}
if (debugMode) {
logger.debug(`Successfully collected all performance metrics for radio ${radioNumber}`, undefined, this);
}
return [{ json: result }];
}
catch (error) {
logger.error('Error in getRadioPerformance operation', error);
throw error;
}
}
/**
* Get APs with Performance Issues
*/
async function getAPsWithIssues() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPsWithIssues operation', undefined, this);
}
try {
// Get parameters from node
const siteId = this.getNodeParameter('siteId', 0);
const options = this.getNodeParameter('issueDetectionOptions', 0, {});
if (!siteId) {
throw new Error('Site ID is required');
}
// Set default thresholds
const highChannelUtilizationThreshold = options.highChannelUtilizationThreshold || 80;
const lowChannelQualityThreshold = options.lowChannelQualityThreshold || 50;
const highErrorRateThreshold = options.highErrorRateThreshold || 5;
const highCPUUtilizationThreshold = options.highCPUUtilizationThreshold || 80;
if (debugMode) {
logger.debug(`Using detection thresholds`, {
highChannelUtilizationThreshold,
lowChannelQualityThreshold,
highErrorRateThreshold,
highCPUUtilizationThreshold,
}, this);
}
// Get all APs for the site
const endpoint = '/network-monitoring/v1alpha1/aps';
const queryParams = {
filter: `siteId eq '${siteId}'`,
limit: 100, // Get a substantial number of APs
};
const apResponse = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (!apResponse.items || !apResponse.items.length) {
if (debugMode) {
logger.debug(`No APs found for site ${siteId}`, undefined, this);
}
return [{ json: { message: `No APs found for site ${siteId}`, apsWithIssues: [] } }];
}
if (debugMode) {
logger.debug(`Found ${apResponse.items.length} APs for site ${siteId}`, undefined, this);
}
// Only check online APs
const onlineAPs = apResponse.items.filter((ap) => ap.status === 'ONLINE');
if (debugMode) {
logger.debug(`${onlineAPs.length} APs are currently online`, undefined, this);
}
// Array to store APs with issues
const apsWithIssues = [];
// Function to check if a string percentage is above a threshold
const isAboveThreshold = (value, threshold) => {
if (!value)
return false;
const numericValue = parseFloat(value.replace('%', ''));
return !isNaN(numericValue) && numericValue >= threshold;
};
// Function to check if a string percentage is below a threshold
const isBelowThreshold = (value, threshold) => {
if (!value)
return false;
const numericValue = parseFloat(value.replace('%', ''));
return !isNaN(numericValue) && numericValue <= threshold;
};
// Check each online AP for potential issues
for (const ap of onlineAPs) {
const issues = [];
const issueDetails = {};
// Get AP details with radios
const apDetailEndpoint = `/network-monitoring/v1alpha1/aps/${ap.serialNumber}`;
const apDetails = await apiRequest_1.apiRequest.call(this, 'GET', apDetailEndpoint);
// Check radio metrics
if (apDetails.radios && apDetails.radios.length > 0) {
for (const radio of apDetails.radios) {
// Check channel utilization
if (isAboveThreshold(radio.channelUtilization, highChannelUtilizationThreshold)) {
issues.push(`High channel utilization on ${radio.band} radio`);
issueDetails[`${radio.band} utilization`] = radio.channelUtilization;
}
// Check channel quality
if (isBelowThreshold(radio.channelQuality, lowChannelQualityThreshold)) {
issues.push(`Low channel quality on ${radio.band} radio`);
issueDetails[`${radio.band} quality`] = radio.channelQuality;
}
// Check error rate
if (isAboveThreshold(radio.errors, highErrorRateThreshold)) {
issues.push(`High error rate on ${radio.band} radio`);
issueDetails[`${radio.band} errors`] = radio.errors;
}
}
}
// Get CPU utilization for the AP
try {
const cpuEndpoint = `/network-monitoring/v1alpha1/aps/${ap.serialNumber}/cpu-utilization-trends`;
const cpuResponse = await apiRequest_1.apiRequest.call(this, 'GET', cpuEndpoint);
// Check the latest CPU utilization sample
if (cpuResponse.graph &&
cpuResponse.graph.samples &&
cpuResponse.graph.samples.length > 0) {
const latestSample = cpuResponse.graph.samples[cpuResponse.graph.samples.length - 1];
const cpuIndex = cpuResponse.graph.keys.indexOf('cpu');
if (cpuIndex !== -1 && latestSample.data[cpuIndex] >= highCPUUtilizationThreshold) {
issues.push('High CPU utilization');
issueDetails['CPU utilization'] = `${latestSample.data[cpuIndex]}%`;
}
}
}
catch (error) {
// Non-critical error, just log it and continue
if (debugMode) {
logger.debug(`Could not get CPU data for AP ${ap.serialNumber}`, { error: error.message }, this);
}
}
// If any issues were found, add this AP to the list
if (issues.length > 0) {
apsWithIssues.push({
serialNumber: ap.serialNumber,
deviceName: ap.deviceName,
model: ap.model,
issues: issues,
issueDetails: issueDetails,
ipAddress: ap.ipv4,
macAddress: ap.macAddress,
siteId: ap.siteId,
siteName: ap.siteName,
});
}
}
if (debugMode) {
logger.debug(`Found ${apsWithIssues.length} APs with potential issues`, undefined, this);
}
return responseFormatter_1.formatResponse.call(this, {
count: apsWithIssues.length,
items: apsWithIssues,
});
}
catch (error) {
logger.error('Error in getAPsWithIssues operation', error);
throw error;
}
}
/**
* Get Access Point Port Frame Trends
*/
async function getAPPortFrameTrends() {
var _a, _b, _c;
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPortFrameTrends operation', undefined, this);
}
try {
// Get required parameters
const serialNumber = this.getNodeParameter('serialNumber', 0);
const portIndex = this.getNodeParameter('portIndex', 0);
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
// Validate required parameters
if (!serialNumber) {
throw new Error('Serial number is required');
}
if (!portIndex) {
throw new Error('Port index is required');
}
if (debugMode) {
logger.debug('Retrieved parameters', { serialNumber, portIndex, additionalFields }, this);
}
// Prepare query parameters
const queryParams = {};
// Add site ID if provided
if (additionalFields.siteId) {
queryParams['site-id'] = additionalFields.siteId;
}
// Build time filter if provided
if (additionalFields.timeFilter && additionalFields.timeFilter.range) {
const { startTime, endTime } = additionalFields.timeFilter.range;
const filterExpressions = [];
if (startTime) {
// Convert to ISO string if needed
const startTimeISO = new Date(startTime).toISOString();
filterExpressions.push(`timestamp gt ${startTimeISO}`);
}
if (endTime) {
// Convert to ISO string if needed
const endTimeISO = new Date(endTime).toISOString();
filterExpressions.push(`timestamp lt ${endTimeISO}`);
}
if (filterExpressions.length > 0) {
queryParams.filter = filterExpressions.join(' and ');
if (debugMode) {
logger.debug('Generated time filter', { filter: queryParams.filter }, this);
}
}
}
// Build the endpoint with path parameters
const endpoint = `/network-monitoring/v1alpha1/aps/${encodeURIComponent(serialNumber)}/ports/${encodeURIComponent(portIndex)}/frames-trends`;
if (debugMode) {
logger.debug(`Making API request to: ${endpoint}`, queryParams, this);
}
// Make API call
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
if (debugMode) {
logger.debug('API response received', {
metric: response.metric,
id: response.id,
type: response.type,
samplesCount: ((_b = (_a = response.graph) === null || _a === void 0 ? void 0 : _a.samples) === null || _b === void 0 ? void 0 : _b.length) || 0,
keys: ((_c = response.graph) === null || _c === void 0 ? void 0 : _c.keys) || [],
}, this);
}
// Format and return the response
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPortFrameTrends operation', error);
throw error;
}
}
/**
* Get a list of all radios
*/
async function getAllRadios() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllRadios operation', undefined, this);
}
try {
// Get parameters from node
const returnAll = this.getNodeParameter('returnAll', 0, false);
const limit = this.getNodeParameter('limit', 0, 20);
const filters = this.getNodeParameter('filters', 0, {});
// Build filter string if filters are provided
let queryParams = {};
if (Object.keys(filters).length > 0) {
const filterString = (0, filterBuilder_1.buildODataFilter)(filters);
if (filterString) {
queryParams.filter = filterString;
}
}
// Use pagination helper
const endpoint = '/network-monitoring/v1alpha1/radios';
const response = await pagination_1.handlePagination.call(this, endpoint, queryParams, returnAll, limit, 'items');
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAllRadios operation', error);
throw error;
}
}
/**
* Get channel utilization information for a specific radio
*/
async function getRadioChannelUtilization() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioChannelUtilization operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-utilization-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getRadioChannelUtilization operation', error);
throw error;
}
}
/**
* Get channel quality information for a specific radio
*/
async function getRadioChannelQuality() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioChannelQuality operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/channel-quality-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getRadioChannelQuality operation', error);
throw error;
}
}
/**
* Get noise floor information for a specific radio
*/
async function getRadioNoiseFloor() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioNoiseFloor operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/noise-floor-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getRadioNoiseFloor operation', error);
throw error;
}
}
/**
* Get transmission information for a specific radio
*/
async function getRadioTransmissionInfo() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getRadioTransmissionInfo operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/frames-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getRadioTransmissionInfo operation', error);
throw error;
}
}
/**
* Get Access Point Port CRC Errors
*/
async function getAPPortCRCErrors() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPortCRCErrors operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const portIndex = this.getNodeParameter('portIndex', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
if (!portIndex) {
throw new Error('Port Index is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${encodeURIComponent(serialNumber)}/ports/${encodeURIComponent(portIndex)}/crc-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPortCRCErrors operation', error);
throw error;
}
}
/**
* Get Access Point Port Collision Errors
*/
async function getAPPortCollisionErrors() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPortCollisionErrors operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const portIndex = this.getNodeParameter('portIndex', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
if (!portIndex) {
throw new Error('Port Index is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${encodeURIComponent(serialNumber)}/ports/${encodeURIComponent(portIndex)}/collisions-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPortCollisionErrors operation', error);
throw error;
}
}
/**
* Get Access Point Radio Throughput Trend
*/
async function getAPRadioThroughputTrend() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPRadioThroughputTrend operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const radioNumber = this.getNodeParameter('radioNumber', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios/${radioNumber}/throughput-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPRadioThroughputTrend operation', error);
throw error;
}
}
/**
* Get Access Point Port Throughput Trend
*/
async function getAPPortThroughputTrend() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPortThroughputTrend operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
const portIndex = this.getNodeParameter('portIndex', 0);
const timeRange = this.getNodeParameter('timeRange', 0, {});
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
if (!portIndex) {
throw new Error('Port Index is required');
}
// Build filter for time range if provided
let queryParams = {};
if (timeRange.startTime || timeRange.endTime) {
const filterParts = [];
if (timeRange.startTime) {
filterParts.push(`timestamp gt ${timeRange.startTime}`);
}
if (timeRange.endTime) {
filterParts.push(`timestamp lt ${timeRange.endTime}`);
}
if (filterParts.length > 0) {
queryParams.filter = filterParts.join(' and ');
}
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${encodeURIComponent(serialNumber)}/ports/${encodeURIComponent(portIndex)}/throughput-trends`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint, {}, queryParams);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPortThroughputTrend operation', error);
throw error;
}
}
/**
* Get a list of radios for a specific access point
*/
async function getAPRadiosList() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPRadiosList operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/radios`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPRadiosList operation', error);
throw error;
}
}
/**
* Get a list of ports for a specific access point
*/
async function getAPPortsList() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAPPortsList operation', undefined, this);
}
try {
// Get parameters from node
const serialNumber = this.getNodeParameter('serialNumber', 0);
if (!serialNumber) {
throw new Error('AP Serial Number is required');
}
// Make API request
const endpoint = `/network-monitoring/v1alpha1/aps/${serialNumber}/ports`;
const response = await apiRequest_1.apiRequest.call(this, 'GET', endpoint);
return responseFormatter_1.formatResponse.call(this, response);
}
catch (error) {
logger.error('Error in getAPPortsList operation', error);
throw error;
}
}
/**
* Get a list of all WLANs
*/
async function getAllWLANs() {
const debugMode = logger.isDebugMode(this);
if (debugMode) {
logger.debug('Starting getAllWLANs operation', undefined, this);
}
try {
// Get parameters from node
const returnAll = this.ge