#!/usr/bin/env node
/**
* Quick Test Script
*
* This script provides a simple way to verify that the ACI MCP server
* components are working correctly.
*/
import { ACIApiService } from '../build/src/services/aciApi.js';
import { MockAPICServer } from '../build/test/mock-server.js';
console.log('π§ͺ ACI MCP Server Quick Test\n');
// Start mock server
console.log('π‘ Starting Mock APIC Server...');
const mockServer = new MockAPICServer(8443);
mockServer.start();
// Wait for server to start
await new Promise(resolve => setTimeout(resolve, 2000));
try {
// Test API service
console.log('π§ Testing ACI API Service...');
const config = {
apicUrl: 'http://localhost:8443',
username: 'admin',
password: 'admin',
validateCerts: false,
timeout: 5000
};
const aciApi = new ACIApiService(config);
// Test authentication
console.log('π Testing authentication...');
await aciApi.authenticate();
console.log('β
Authentication successful!');
// Test basic operations
console.log('π’ Testing list tenants...');
const tenants = await aciApi.listTenants();
console.log(`β
Found ${tenants.imdata?.length || 0} tenants`);
console.log('π Testing fabric health...');
const health = await aciApi.getFabricHealth();
console.log(`β
Fabric health: ${health.imdata?.[0]?.fabricHealthTotal?.attributes?.cur || 'Unknown'}`);
console.log('π¨ Testing faults...');
const faults = await aciApi.listFaults();
console.log(`β
Found ${faults.imdata?.length || 0} faults`);
console.log('π₯οΈ Testing nodes...');
const nodes = await aciApi.listNodes();
console.log(`β
Found ${nodes.imdata?.length || 0} nodes`);
console.log('\nπ All tests passed! The ACI MCP Server is working correctly.');
} catch (error) {
console.error('β Test failed:', error.message);
process.exit(1);
} finally {
console.log('\nπ Stopping mock server...');
mockServer.stop();
}
console.log('β¨ Quick test completed successfully!');
process.exit(0);