mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-07 10:36:41 +00:00
Add missing IOS router settings in node configurator
This commit is contained in:
parent
042eb79e36
commit
9523cd7703
@ -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;
|
||||
|
@ -7,11 +7,31 @@
|
||||
<mat-tab-group *ngIf="name">
|
||||
<mat-tab label="General settings">
|
||||
<br />
|
||||
<mat-label>Platform: {{ node.properties.platform }}</mat-label>
|
||||
<mat-label *ngIf="node.properties.chassis"> (chassis: {{ node.properties.chassis }})</mat-label>
|
||||
<br /><br />
|
||||
<form [formGroup]="generalSettingsForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" formControlName="name" [(ngModel)]="node.name" placeholder="Name" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" formControlName="path" [(ngModel)]="node.properties.image" placeholder="IOS image path"/>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-form-field class="select" *ngIf="node.properties.midplane">
|
||||
<mat-select placeholder="Midplane" [(ngModel)]="node.properties.midplane">
|
||||
<mat-option *ngFor="let type of MidplaneTypes" [value]="type">
|
||||
{{ type }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="select" *ngIf="node.properties.npe">
|
||||
<mat-select placeholder="NPE" [(ngModel)]="node.properties.npe">
|
||||
<mat-option *ngFor="let type of NPETypes" [value]="type">
|
||||
{{ type }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="select">
|
||||
<mat-select placeholder="Console type" [(ngModel)]="node.console_type">
|
||||
<mat-option *ngFor="let type of consoleTypes" [value]="type">
|
||||
@ -36,23 +56,145 @@
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
formControlName="ram"
|
||||
[(ngModel)]="node.properties.ram"
|
||||
placeholder="RAM size"
|
||||
/>
|
||||
<span matSuffix>MB</span>
|
||||
<span matSuffix>MiB</span>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
formControlName="nvram"
|
||||
[(ngModel)]="node.properties.nvram"
|
||||
placeholder="NVRAM size"
|
||||
/>
|
||||
<span matSuffix>MB</span>
|
||||
<span matSuffix>MiB</span>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-form-field class="form-field" *ngIf="node.properties.iomem">
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
[(ngModel)]="node.properties.iomem"
|
||||
placeholder="I/O memory"
|
||||
/>
|
||||
<span matSuffix>%</span>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
[(ngModel)]="node.properties.disk0"
|
||||
placeholder="PCMCIA disk0"
|
||||
/>
|
||||
<span matSuffix>MiB</span>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
min="0"
|
||||
[(ngModel)]="node.properties.disk1"
|
||||
placeholder="PCMCIA disk1"
|
||||
/>
|
||||
<span matSuffix>MiB</span>
|
||||
</mat-form-field>
|
||||
<mat-checkbox [(ngModel)]="node.properties.auto_delete_disks"> Automatically delete NVRAM and disk files </mat-checkbox><br />
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Slots">
|
||||
<br />
|
||||
<h6>Adapters</h6>
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6]">
|
||||
<div *ngIf="adapterMatrix[node.properties.platform][node.properties.chassis || ''][index]">
|
||||
<mat-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForNode[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
>
|
||||
<mat-option
|
||||
*ngIf="adapterMatrix[node.properties.platform][node.properties.chassis || ''][index].length > 1"
|
||||
[value]=""
|
||||
>
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let option of adapterMatrix[node.properties.platform][node.properties.chassis || ''][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div *ngIf="wicMatrix[node.properties.platform]">
|
||||
<h6>WICs</h6>
|
||||
<div *ngFor="let index of [0, 1, 2]">
|
||||
<div *ngIf="wicMatrix[node.properties.platform][index]">
|
||||
<mat-select
|
||||
placeholder="WIC {{ index }}"
|
||||
[(ngModel)]="wicsForNode[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
>
|
||||
<mat-option [value]="">
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let option of wicMatrix[node.properties.platform][index]" [value]="option">
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Advanced">
|
||||
<mat-card>
|
||||
<mat-card-title></mat-card-title>
|
||||
<mat-card-subtitle> System </mat-card-subtitle>
|
||||
<mat-card-content>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" [(ngModel)]="node.properties.system_id" placeholder="System ID" />
|
||||
</mat-form-field>
|
||||
<form [formGroup]="advancedSettingsForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="mac_addr" type="text" [(ngModel)]="node.properties.mac_addr" placeholder="Base MAC" />
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-title></mat-card-title>
|
||||
<mat-card-subtitle> Optimizations </mat-card-subtitle>
|
||||
<mat-card-content>
|
||||
<form [formGroup]="advancedSettingsForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" formControlName="idlepc" [(ngModel)]="node.properties.idlepc" placeholder="Idle-PC" />
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="number" min="0" [(ngModel)]="node.properties.idlemax" placeholder="Idlemax" />
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="number" min="0" [(ngModel)]="node.properties.idlesleep" placeholder="Idlesleep" />
|
||||
<span matSuffix>ms</span>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="number" min="0" [(ngModel)]="node.properties.exec_area" placeholder="Exec area" />
|
||||
<span matSuffix>MiB</span>
|
||||
</mat-form-field>
|
||||
<mat-checkbox [(ngModel)]="node.properties.mmap"> Enable mmap support </mat-checkbox><br />
|
||||
<mat-checkbox [(ngModel)]="node.properties.sparsemem"> Enable sparse memory support </mat-checkbox><br />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Usage">
|
||||
|
@ -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<ConfiguratorDialogIosComponent>,
|
||||
@ -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();
|
||||
|
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user