Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -556,11 +556,13 @@ function createCardApiRouter() {
|
|||||||
* POST /enrich-batch
|
* POST /enrich-batch
|
||||||
*
|
*
|
||||||
* Batch lookup IPs in CARD to extract Granite loader fields. Fetches team
|
* Batch lookup IPs in CARD to extract Granite loader fields. Fetches team
|
||||||
* assets (paginated, across confirmed and unconfirmed dispositions) and
|
* assets (paginated, across confirmed, unconfirmed, and candidate
|
||||||
* matches against the provided IPs. Returns enrichment results for each IP.
|
* dispositions) and matches against the provided IPs. When no team is
|
||||||
|
* specified, searches both NTS-AEO-STEAM and NTS-AEO-ACCESS-ENG.
|
||||||
|
* Returns enrichment results for each IP.
|
||||||
*
|
*
|
||||||
* @body {string[]} ips - Non-empty array of IP address strings (max 200)
|
* @body {string[]} ips - Non-empty array of IP address strings (max 200)
|
||||||
* @body {string} [team="NTS-AEO-STEAM"] - Team name to search assets under
|
* @body {string} [team] - Team name to search assets under. Defaults to both NTS-AEO-STEAM and NTS-AEO-ACCESS-ENG if omitted.
|
||||||
* @response 200 - { results: object[], enriched_count: number, not_found_count: number, total: number }
|
* @response 200 - { results: object[], enriched_count: number, not_found_count: number, total: number }
|
||||||
* Each result: { ip: string, found: boolean, equip_inst_id: string|null, hostname: string|null, site_name?: string|null, mgmt_ip_asn?: string|null, responsible_team?: string|null, equipment_class?: string, equip_template?: string|null, equip_status?: string|null, serial_number?: string|null, error?: string }
|
* Each result: { ip: string, found: boolean, equip_inst_id: string|null, hostname: string|null, site_name?: string|null, mgmt_ip_asn?: string|null, responsible_team?: string|null, equipment_class?: string, equip_template?: string|null, equip_status?: string|null, serial_number?: string|null, error?: string }
|
||||||
* @response 400 - { error: string } — invalid or empty ips array, or exceeds 200
|
* @response 400 - { error: string } — invalid or empty ips array, or exceeds 200
|
||||||
@@ -586,13 +588,16 @@ function createCardApiRouter() {
|
|||||||
// Strategy: fetch team assets (paginated) and match against our target IPs.
|
// Strategy: fetch team assets (paginated) and match against our target IPs.
|
||||||
// The team assets endpoint returns the full enriched record with ncim_discovery,
|
// The team assets endpoint returns the full enriched record with ncim_discovery,
|
||||||
// card_flags, netops_granite_allips, etc.
|
// card_flags, netops_granite_allips, etc.
|
||||||
const teamName = team || 'NTS-AEO-STEAM';
|
const teams = team ? [team] : ['NTS-AEO-STEAM', 'NTS-AEO-ACCESS-ENG'];
|
||||||
const dispositions = ['confirmed', 'unconfirmed'];
|
const dispositions = ['confirmed', 'unconfirmed', 'candidate'];
|
||||||
let foundCount = 0;
|
let foundCount = 0;
|
||||||
|
|
||||||
for (const disposition of dispositions) {
|
for (const teamName of teams) {
|
||||||
if (foundCount >= targetIps.size) break;
|
if (foundCount >= targetIps.size) break;
|
||||||
|
|
||||||
|
for (const disposition of dispositions) {
|
||||||
|
if (foundCount >= targetIps.size) break;
|
||||||
|
|
||||||
let page = 1;
|
let page = 1;
|
||||||
const pageSize = 200;
|
const pageSize = 200;
|
||||||
let hasMore = true;
|
let hasMore = true;
|
||||||
@@ -635,6 +640,7 @@ function createCardApiRouter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Build results array in the same order as input IPs
|
// Build results array in the same order as input IPs
|
||||||
const results = [];
|
const results = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user