From 9523cd77033b9ab2332cffa84bc4cac2b2a9eaad Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 4 Feb 2025 14:17:51 +1000 Subject: [PATCH] Add missing IOS router settings in node configurator --- src/app/cartography/models/node.ts | 31 +++- .../ios/configurator-ios.component.html | 146 +++++++++++++++++- .../ios/configurator-ios.component.ts | 63 +++++++- src/app/services/ios-configuration.service.ts | 97 +++++++++++- 4 files changed, 329 insertions(+), 8 deletions(-) diff --git a/src/app/cartography/models/node.ts b/src/app/cartography/models/node.ts index b7adb8ca..7b5cfbdb 100644 --- a/src/app/cartography/models/node.ts +++ b/src/app/cartography/models/node.ts @@ -14,10 +14,12 @@ export class Properties { headless: boolean; linked_clone: boolean; on_close: string; - aux_type: boolean; - aux: number; ram: number; + system_id: string; + npe?: string; + midplane?: string; nvram: number; + image: string; usage: string; use_any_adapter: boolean; vmname: string; @@ -48,8 +50,20 @@ export class Properties { kernel_image: string; kernel_image_md5sum?: any; mac_address: string; + mac_addr: string; options: string; platform: string; + chassis?: string; + iomem?: number; + disk0: number; + disk1: number; + idlepc: string; + idlemax: number; + idlesleep: number; + exec_area: number; + mmap: boolean; + sparsemem: boolean; + auto_delete_disks: boolean; process_priority: string; qemu_path: string; environment: string; @@ -58,6 +72,17 @@ export class Properties { memory: number; tpm: boolean; uefi: boolean; + slot0?: string; + slot1?: string; + slot2?: string; + slot3?: string; + slot4?: string; + slot5?: string; + slot6?: string; + slot7?: string; + wic0?: string; + wic1?: string; + wic2?: string; } export class Node { @@ -67,6 +92,8 @@ export class Node { console_auto_start: boolean; console_host: string; console_type: string; + aux: number; + aux_type: boolean; custom_adapters?: any[]; ethernet_adapters?: any; serial_adapters?: any; diff --git a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html index 456b11a6..0e119bef 100644 --- a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html +++ b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html @@ -7,11 +7,31 @@

Configurator for IOS router {{ name }}


+ Platform: {{ node.properties.platform }} + (chassis: {{ node.properties.chassis }}) +

+ + +
+ + + + {{ type }} + + + + + + + {{ type }} + + + @@ -36,23 +56,145 @@

Configurator for IOS router {{ name }}

- MB + MiB
- MB + MiB + + + % + + + + MiB + + + + MiB + + Automatically delete NVRAM and disk files
+
+ + +
+
Adapters
+
+
+ + + {{ "" }} + + + {{ option }} + + +
+
+
+
+
WICs
+
+
+ + + {{ "" }} + + + {{ option }} + + +
+
+
+
+ + + + + System + + + + +
+ + + +
+
+
+ + + Optimizations + +
+ + + +
+ + + + + + ms + + + + MiB + + Enable mmap support
+ Enable sparse memory support
+
+
diff --git a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts index 0d14c702..187e666d 100644 --- a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts +++ b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts @@ -18,7 +18,14 @@ export class ConfiguratorDialogIosComponent implements OnInit { name: string; generalSettingsForm: UntypedFormGroup; memoryForm: UntypedFormGroup; + advancedSettingsForm: UntypedFormGroup; consoleTypes: string[] = []; + NPETypes: string[] = []; + MidplaneTypes: string[] = []; + networkAdaptersForNode: string[] = []; + wicsForNode: string[] = []; + adapterMatrix = {}; + wicMatrix = {}; constructor( public dialogRef: MatDialogRef, @@ -29,12 +36,20 @@ export class ConfiguratorDialogIosComponent implements OnInit { ) { this.generalSettingsForm = this.formBuilder.group({ name: new UntypedFormControl('', Validators.required), + path: new UntypedFormControl('', Validators.required), }); this.memoryForm = this.formBuilder.group({ ram: new UntypedFormControl('', Validators.required), nvram: new UntypedFormControl('', Validators.required), }); + + const mac_regex = /^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$|^$/ + const idlepc_regex = /^(0x[0-9a-fA-F]+)?$|^$/; + this.advancedSettingsForm = this.formBuilder.group({ + mac_addr: new UntypedFormControl('', Validators.pattern(mac_regex)), + idlepc: new UntypedFormControl('', Validators.pattern(idlepc_regex)), + }); } ngOnInit() { @@ -42,15 +57,61 @@ export class ConfiguratorDialogIosComponent implements OnInit { this.node = node; this.name = node.name; this.getConfiguration(); + this.fillSlotsData(); }); } getConfiguration() { this.consoleTypes = this.configurationService.getConsoleTypes(); + this.NPETypes = this.configurationService.getNPETypes(); + this.MidplaneTypes = this.configurationService.getMidplaneTypes(); + this.adapterMatrix = this.configurationService.getAdapterMatrix(); + this.wicMatrix = this.configurationService.getWicMatrix(); + } + + fillSlotsData() { + + // load network adapters + for (let i = 0; i <= 6; i++) { + if (this.node.properties[`slot${i}`]) { + this.networkAdaptersForNode[i] = this.node.properties[`slot${i}`]; + } + } + + // load WICs + for (let i = 0; i <= 3; i++) { + if (this.node.properties[`wic${i}`]) { + this.wicsForNode[i] = this.node.properties[`wic${i}`]; + } + } + } + + saveSlotsData() { + + // save network adapters + for (let i = 0; i <= 6; i++) { + if (this.adapterMatrix[this.node.properties.platform][this.node.properties.chassis || ''][i]) { + if (this.networkAdaptersForNode[i] === undefined) + this.node.properties[`slot${i}`] = "" + else + this.node.properties[`slot${i}`] = this.networkAdaptersForNode[i]; + } + } + + // save WICs + for (let i = 0; i <= 3; i++) { + if (this.wicMatrix[this.node.properties.platform][i]) { + if (this.wicsForNode[i] === undefined) + this.node.properties[`wic${i}`] = "" + else + this.node.properties[`wic${i}`] = this.wicsForNode[i]; + } + } } onSaveClick() { - if (this.generalSettingsForm.valid && this.memoryForm.valid) { + if (this.generalSettingsForm.valid && this.memoryForm.valid && this.advancedSettingsForm.valid) { + this.saveSlotsData(); this.nodeService.updateNode(this.controller, this.node).subscribe(() => { this.toasterService.success(`Node ${this.node.name} updated.`); this.onCancelClick(); diff --git a/src/app/services/ios-configuration.service.ts b/src/app/services/ios-configuration.service.ts index 145cf924..3013cea2 100644 --- a/src/app/services/ios-configuration.service.ts +++ b/src/app/services/ios-configuration.service.ts @@ -2,9 +2,6 @@ import { Injectable } from '@angular/core'; @Injectable() export class IosConfigurationService { - c1700_wics = ['WIC-1T', 'WIC-2T', 'WIC-1ENET']; - c2600_wics = ['WIC-1T', 'WIC-2T']; - c3700_wics = ['WIC-1T', 'WIC-2T']; c2600_nms = ['NM-1FE-TX', 'NM-1E', 'NM-4E', 'NM-16ESW']; c3600_nms = ['NM-1FE-TX', 'NM-1E', 'NM-4E', 'NM-16ESW', 'NM-4T']; @@ -12,6 +9,10 @@ export class IosConfigurationService { c7200_pas = ['PA-A1', 'PA-FE-TX', 'PA-2FE-TX', 'PA-GE', 'PA-4T+', 'PA-8T', 'PA-4E', 'PA-8E', 'PA-POS-OC3']; c7200_io = ['C7200-IO-FE', 'C7200-IO-2FE', 'C7200-IO-GE-E']; + c1700_wics = ['WIC-1T', 'WIC-2T', 'WIC-1ENET']; + c2600_wics = ['WIC-1T', 'WIC-2T']; + c3700_wics = ['WIC-1T', 'WIC-2T']; + getConsoleTypes() { return ['telnet', 'none']; } @@ -91,6 +92,96 @@ export class IosConfigurationService { }; } + getNPETypes() { + return ['npe-100', 'npe-150', 'npe-175', 'npe-200', 'npe-225', 'npe-300', 'npe-400', 'npe-g2']; + } + + getMidplaneTypes() { + return ['std', 'vxr']; + } + + getAdapterMatrix() { + + let adapter_matrix: any = {}; + for (let platform of ["c1700", "c2600", "c2691", "c3725", "c3745", "c3600", "c7200"]) { + adapter_matrix[platform] = {}; + } + + // 1700s have one interface on the MB, 2 sub-slots for WICs, and no NM slots + for (let chassis of ["1720", "1721", "1750", "1751", "1760"]) { + adapter_matrix["c1700"][chassis] = { 0: ["C1700-MB-1FE"] }; + } + + // Add a fake NM in slot 1 on 1751s and 1760s to provide two WIC slots + for (let chassis of ["1751", "1760"]) { + adapter_matrix["c1700"][chassis][1] = ["C1700-MB-WIC1"]; + } + + // 2600s have one or more interfaces on the MB, 2 subslots for WICs, and an available NM slot 1 + for (let chassis of ["2620", "2610XM", "2620XM", "2650XM"]) { + adapter_matrix["c2600"][chassis] = { 0: ["C2600-MB-1FE"], 1: this.c2600_nms }; + } + + for (let chassis of ["2621", "2611XM", "2621XM", "2651XM"]) { + adapter_matrix["c2600"][chassis] = { 0: ["C2600-MB-2FE"], 1: this.c2600_nms }; + } + + adapter_matrix["c2600"]["2610"] = { 0: ["C2600-MB-1E"], 1: this.c2600_nms }; + adapter_matrix["c2600"]["2611"] = { 0: ["C2600-MB-2E"], 1: this.c2600_nms }; + + // 2691s have two FEs on the motherboard and one NM slot + adapter_matrix["c2691"][""] = { 0: ["GT96100-FE"], 1: this.c3700_nms }; + + // 3620s have two generic NM slots + adapter_matrix["c3600"]["3620"] = {}; + for (let slot = 0; slot < 2; slot++) { + adapter_matrix["c3600"]["3620"][slot] = this.c3600_nms; + } + + // 3640s have four generic NM slots + adapter_matrix["c3600"]["3640"] = {}; + for (let slot = 0; slot < 4; slot++) { + adapter_matrix["c3600"]["3640"][slot] = this.c3600_nms; + } + + // 3660s have 2 FEs on the motherboard and 6 generic NM slots + adapter_matrix["c3600"]["3660"] = { 0: ["Leopard-2FE"] }; + for (let slot = 1; slot < 7; slot++) { + adapter_matrix["c3600"]["3660"][slot] = this.c3600_nms; + } + + // 3725s have 2 FEs on the motherboard and 2 generic NM slots + adapter_matrix["c3725"][""] = { 0: ["GT96100-FE"] }; + for (let slot = 1; slot < 3; slot++) { + adapter_matrix["c3725"][""][slot] = this.c3700_nms; + } + + // 3745s have 2 FEs on the motherboard and 4 generic NM slots + adapter_matrix["c3745"][""] = { 0: ["GT96100-FE"] }; + for (let slot = 1; slot < 5; slot++) { + adapter_matrix["c3745"][""][slot] = this.c3700_nms; + } + + // 7206s allow an IO controller in slot 0, and a generic PA in slots 1-6 + adapter_matrix["c7200"][""] = { 0: ["IO_C7200"] }; + for (let slot = 1; slot < 7; slot++) { + adapter_matrix["c7200"][""][slot] = this.c7200_pas; + } + + return adapter_matrix; + } + + getWicMatrix() { + let wic_matrix: any = {}; + + wic_matrix["c1700"] = { 0: this.c1700_wics, 1: this.c1700_wics }; + wic_matrix["c2600"] = { 0: this.c2600_wics, 1: this.c2600_wics, 2: this.c2600_wics }; + wic_matrix["c2691"] = { 0: this.c3700_wics, 1: this.c3700_wics, 2: this.c3700_wics }; + wic_matrix["c3725"] = { 0: this.c3700_wics, 1: this.c3700_wics, 2: this.c3700_wics }; + wic_matrix["c3745"] = { 0: this.c3700_wics, 1: this.c3700_wics, 2: this.c3700_wics }; + return wic_matrix; + } + getNetworkModules() { return { c1700: {