quick-test.jsโข2.04 kB
#!/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);