mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-01 08:20:00 +00:00
Fix and improve IOS template configuration
This commit is contained in:
parent
80884a7929
commit
86db2e208c
@ -109,32 +109,24 @@
|
||||
</mat-step>
|
||||
|
||||
<mat-step label="Network adapters">
|
||||
<!-- <div *ngIf="chassis[iosNameForm.get('platform').value]">
|
||||
<div *ngFor="let index of [0,1,2,3,4,5,6,7]">
|
||||
<mat-select
|
||||
placeholder="Slot {{index}}"
|
||||
[(ngModel)]="networkAdaptersForTemplate[index]"
|
||||
[ngModelOptions]="{standalone: true}"
|
||||
*ngIf="networkAdapters[iosNameForm.get('chassis').value] && networkAdapters[iosNameForm.get('chassis').value][index]">
|
||||
<mat-option *ngFor="let option of networkAdapters[iosNameForm.get('chassis').value][index]" [value]="option">
|
||||
{{option}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div> -->
|
||||
<div *ngIf="selectedPlatform">
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6, 7]">
|
||||
<div *ngIf="iosNameForm.get('platform').value">
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6]">
|
||||
<mat-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="
|
||||
networkAdaptersForPlatform[iosNameForm.get('platform').value] &&
|
||||
networkAdaptersForPlatform[iosNameForm.get('platform').value][index]
|
||||
"
|
||||
*ngIf="adapterMatrix[iosNameForm.get('platform').value][iosNameForm.get('chassis').value || '']
|
||||
&& adapterMatrix[iosNameForm.get('platform').value][iosNameForm.get('chassis').value || ''][index]"
|
||||
>
|
||||
<mat-option
|
||||
*ngFor="let option of networkAdaptersForPlatform[iosNameForm.get('platform').value][index]"
|
||||
*ngIf="adapterMatrix[iosNameForm.get('platform').value][iosNameForm.get('chassis').value|| ''][index].length > 1 &&
|
||||
!adapterMatrix[iosNameForm.get('platform').value][iosNameForm.get('chassis').value|| ''][index][0].startsWith('C7200')"
|
||||
[value]=""
|
||||
>
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let option of adapterMatrix[iosNameForm.get('platform').value][iosNameForm.get('chassis').value || ''][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
@ -144,33 +136,33 @@
|
||||
</div>
|
||||
</mat-step>
|
||||
|
||||
<mat-step label="WIC modules">
|
||||
<div *ngIf="iosNameForm.get('platform').value">
|
||||
<div *ngFor="let index of [0, 1, 2, 3]">
|
||||
<mat-select
|
||||
placeholder="WIC {{ index }}"
|
||||
[(ngModel)]="networkModulesForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="
|
||||
networkModules[iosNameForm.get('platform').value] &&
|
||||
networkModules[iosNameForm.get('platform').value][index]
|
||||
"
|
||||
<mat-step label="WIC modules" *ngIf="iosNameForm.get('platform').value && wicMatrix[iosNameForm.get('platform').value]">
|
||||
<div *ngFor="let index of [0, 1, 2]">
|
||||
<mat-select
|
||||
placeholder="WIC {{ index }}"
|
||||
[(ngModel)]="wicsForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="wicMatrix[iosNameForm.get('platform').value] && wicMatrix[iosNameForm.get('platform').value][index]"
|
||||
>
|
||||
<mat-option [value]="">
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let option of wicMatrix[iosNameForm.get('platform').value][index]"
|
||||
[value]="option"
|
||||
>
|
||||
<mat-option
|
||||
*ngFor="let option of networkModules[iosNameForm.get('platform').value][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</mat-step>
|
||||
|
||||
<mat-step label="Idle-PC">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" [(ngModel)]="iosTemplate.idlepc" placeholder="Idle-PC" />
|
||||
</mat-form-field>
|
||||
<form [formGroup]="iosIdlePCForm">
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput type="text" formControlName="idlepc" [(ngModel)]="iosTemplate.idlepc" placeholder="Idle-PC" />
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-step>
|
||||
</mat-vertical-stepper>
|
||||
</div>
|
||||
|
@ -32,11 +32,8 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
iosImageForm: UntypedFormGroup;
|
||||
iosNameForm: UntypedFormGroup;
|
||||
iosMemoryForm: UntypedFormGroup;
|
||||
iosIdlePCForm: UntypedFormGroup;
|
||||
selectedPlatform: string;
|
||||
|
||||
networkAdaptersForTemplate: string[] = [];
|
||||
networkModulesForTemplate: string[] = [];
|
||||
|
||||
iosImages: IosImage[] = [];
|
||||
platforms: string[] = [];
|
||||
platformsWithEtherSwitchRouterOption = {};
|
||||
@ -44,9 +41,10 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
chassis = {};
|
||||
defaultRam = {};
|
||||
defaultNvram = {};
|
||||
networkAdapters = {};
|
||||
networkAdaptersForPlatform = {};
|
||||
networkModules = {};
|
||||
networkAdaptersForTemplate: string[] = [];
|
||||
wicsForTemplate: string[] = [];
|
||||
adapterMatrix = {};
|
||||
wicMatrix = {};
|
||||
|
||||
ciscoUrl: string = 'https://cfn.cloudapps.cisco.com/ITDIT/CFN/jsp/SearchBySoftware.jsp';
|
||||
uploader: FileUploader;
|
||||
@ -82,6 +80,10 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
this.iosMemoryForm = this.formBuilder.group({
|
||||
memory: new UntypedFormControl(null, [Validators.required]),
|
||||
});
|
||||
|
||||
this.iosIdlePCForm = this.formBuilder.group({
|
||||
idlepc: new UntypedFormControl(null, [Validators.pattern(this.iosConfigurationService.getIdlepcRegex())]),
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -120,19 +122,31 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.templateMocksService.getIosTemplate().subscribe((iosTemplate: IosTemplate) => {
|
||||
this.iosTemplate = iosTemplate;
|
||||
|
||||
this.networkModules = this.iosConfigurationService.getNetworkModules();
|
||||
this.networkAdaptersForPlatform = this.iosConfigurationService.getNetworkAdaptersForPlatform();
|
||||
this.networkAdapters = this.iosConfigurationService.getNetworkAdapters();
|
||||
this.platforms = this.iosConfigurationService.getAvailablePlatforms();
|
||||
this.platformsWithEtherSwitchRouterOption = this.iosConfigurationService.getPlatformsWithEtherSwitchRouterOption();
|
||||
this.platformsWithChassis = this.iosConfigurationService.getPlatformsWithChassis();
|
||||
this.chassis = this.iosConfigurationService.getChassis();
|
||||
this.defaultRam = this.iosConfigurationService.getDefaultRamSettings();
|
||||
this.adapterMatrix = this.iosConfigurationService.getAdapterMatrix();
|
||||
this.wicMatrix = this.iosConfigurationService.getWicMatrix();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fillDefaultSlots() {
|
||||
|
||||
console.log("Fill default slots");
|
||||
if (this.iosNameForm.get('platform').value) {
|
||||
for (let i = 0; i <= 6; i++) {
|
||||
let adapters = this.adapterMatrix[this.iosNameForm.get('platform').value][this.iosNameForm.get('chassis').value || ''][i];
|
||||
if (adapters && (adapters.length === 1 || adapters[0].startsWith('C7200'))) {
|
||||
console.log("Set default adapter for slot" + i + " to " + adapters[0]);
|
||||
this.networkAdaptersForTemplate[i] = adapters[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setControllerType(controllerType: string) {
|
||||
if (controllerType === 'local') {
|
||||
this.isLocalComputerChosen = true;
|
||||
@ -166,6 +180,7 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
if (
|
||||
!this.iosImageForm.invalid &&
|
||||
!this.iosMemoryForm.invalid &&
|
||||
!this.iosIdlePCForm.invalid &&
|
||||
this.iosNameForm.get('templateName').value &&
|
||||
this.iosNameForm.get('platform').value
|
||||
) {
|
||||
@ -184,7 +199,7 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
if (this.networkAdaptersForTemplate.length > 0) this.completeAdaptersData();
|
||||
if (this.networkModulesForTemplate.length > 0) this.completeModulesData();
|
||||
if (this.wicsForTemplate.length > 0) this.completeWicsData();
|
||||
this.iosTemplate.compute_id = 'local';
|
||||
|
||||
this.iosService.addTemplate(this.controller, this.iosTemplate).subscribe((template: IosTemplate) => {
|
||||
@ -196,44 +211,25 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
completeAdaptersData() {
|
||||
if (this.chassis[this.iosTemplate.platform]) {
|
||||
if (Object.keys(this.networkAdapters[this.iosTemplate.chassis])) {
|
||||
for (let i = 0; i < Object.keys(this.networkAdapters[this.iosTemplate.chassis]).length; i++) {
|
||||
if (!this.networkAdaptersForTemplate[i]) this.networkAdaptersForTemplate[i] = '';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.networkAdaptersForPlatform[this.iosNameForm.get('platform').value]) {
|
||||
for (
|
||||
let i = 0;
|
||||
i < Object.keys(this.networkAdaptersForPlatform[this.iosNameForm.get('platform').value]).length;
|
||||
i++
|
||||
) {
|
||||
if (!this.networkAdaptersForTemplate[i]) this.networkAdaptersForTemplate[i] = '';
|
||||
}
|
||||
for (let i = 0; i <= 6; i++) {
|
||||
if (this.adapterMatrix[this.iosTemplate.platform][this.iosTemplate.chassis || ''][i]) {
|
||||
if (this.networkAdaptersForTemplate[i] === undefined)
|
||||
this.iosTemplate[`slot${i}`] = ""
|
||||
else
|
||||
this.iosTemplate[`slot${i}`] = this.networkAdaptersForTemplate[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.networkAdaptersForTemplate[0]) this.iosTemplate.slot0 = this.networkAdaptersForTemplate[0];
|
||||
if (this.networkAdaptersForTemplate[1]) this.iosTemplate.slot1 = this.networkAdaptersForTemplate[1];
|
||||
if (this.networkAdaptersForTemplate[2]) this.iosTemplate.slot2 = this.networkAdaptersForTemplate[2];
|
||||
if (this.networkAdaptersForTemplate[3]) this.iosTemplate.slot3 = this.networkAdaptersForTemplate[3];
|
||||
if (this.networkAdaptersForTemplate[4]) this.iosTemplate.slot4 = this.networkAdaptersForTemplate[4];
|
||||
if (this.networkAdaptersForTemplate[5]) this.iosTemplate.slot5 = this.networkAdaptersForTemplate[5];
|
||||
if (this.networkAdaptersForTemplate[6]) this.iosTemplate.slot6 = this.networkAdaptersForTemplate[6];
|
||||
if (this.networkAdaptersForTemplate[7]) this.iosTemplate.slot7 = this.networkAdaptersForTemplate[7];
|
||||
}
|
||||
|
||||
completeModulesData() {
|
||||
if (Object.keys(this.networkModules[this.iosTemplate.platform])) {
|
||||
for (let i = 0; i < Object.keys(this.networkModules[this.iosTemplate.platform]).length; i++) {
|
||||
if (!this.networkModulesForTemplate[i]) this.networkModulesForTemplate[i] = '';
|
||||
completeWicsData() {
|
||||
for (let i = 0; i <= 3; i++) {
|
||||
if (this.wicMatrix[this.iosTemplate.platform][i]) {
|
||||
if (this.wicsForTemplate[i] === undefined)
|
||||
this.iosTemplate[`wic${i}`] = ""
|
||||
else
|
||||
this.iosTemplate[`wic${i}`] = this.wicsForTemplate[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.networkModulesForTemplate[0]) this.iosTemplate.wic0 = this.networkModulesForTemplate[0];
|
||||
if (this.networkModulesForTemplate[1]) this.iosTemplate.wic1 = this.networkModulesForTemplate[1];
|
||||
if (this.networkModulesForTemplate[2]) this.iosTemplate.wic2 = this.networkModulesForTemplate[2];
|
||||
}
|
||||
|
||||
goBack() {
|
||||
@ -252,25 +248,31 @@ export class AddIosTemplateComponent implements OnInit, OnDestroy {
|
||||
this.selectedPlatform = name;
|
||||
}
|
||||
|
||||
if (name === 'c1700') {
|
||||
this.iosNameForm.controls['chassis'].setValue('1720');
|
||||
if (name === 'c3620' || name === 'c3640' || name === 'c3660')
|
||||
this.iosNameForm.controls['chassis'].setValue(name.substring(1));
|
||||
else if (name === 'c1700') {
|
||||
this.iosNameForm.controls['chassis'].setValue('1760');
|
||||
} else if (name === 'c2600') {
|
||||
this.iosNameForm.controls['chassis'].setValue('2610');
|
||||
this.iosNameForm.controls['chassis'].setValue('2651XM');
|
||||
} else {
|
||||
this.iosNameForm.controls['chassis'].setValue('');
|
||||
}
|
||||
|
||||
this.iosMemoryForm.controls['memory'].setValue(this.defaultRam[name]);
|
||||
this.iosMemoryForm.controls['memory'].setValue(this.defaultRam[this.selectedPlatform]);
|
||||
this.fillDefaultSlots();
|
||||
}
|
||||
|
||||
onPlatformChosen() {
|
||||
this.iosTemplate.chassis = '';
|
||||
this.networkAdaptersForTemplate = [];
|
||||
this.networkModulesForTemplate = [];
|
||||
this.wicsForTemplate = [];
|
||||
if (!this.chassis[this.iosNameForm.get('platform').value])
|
||||
this.fillDefaultSlots();
|
||||
}
|
||||
|
||||
onChassisChosen() {
|
||||
this.networkAdaptersForTemplate = [];
|
||||
if (this.chassis[this.iosNameForm.get('platform').value])
|
||||
this.fillDefaultSlots();
|
||||
}
|
||||
|
||||
cancelUploading() {
|
||||
|
@ -169,60 +169,47 @@
|
||||
<mat-panel-title> Slots </mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<h6>Adapters</h6>
|
||||
<div *ngIf="iosTemplate.chassis && chassis[iosTemplate.platform]">
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6, 7]">
|
||||
<mat-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="networkAdapters[iosTemplate.chassis][index]"
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6]">
|
||||
<mat-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="adapterMatrix[iosTemplate.platform][iosTemplate.chassis || ''][index]"
|
||||
>
|
||||
<mat-option
|
||||
*ngIf="adapterMatrix[iosTemplate.platform][iosTemplate.chassis || ''][index].length > 1 &&
|
||||
!adapterMatrix[iosTemplate.platform][iosTemplate.chassis || ''][index][0].startsWith('C7200')"
|
||||
[value]=""
|
||||
>
|
||||
<mat-option *ngFor="let option of networkAdapters[iosTemplate.chassis][index]" [value]="option">
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let option of adapterMatrix[iosTemplate.platform][iosTemplate.chassis || ''][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
<br />
|
||||
<div *ngIf="wicMatrix[iosTemplate.platform]">
|
||||
<h6>WICs</h6>
|
||||
<div *ngFor="let index of [0, 1, 2]">
|
||||
<mat-select
|
||||
placeholder="WIC {{ index }}"
|
||||
[(ngModel)]="wicsForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="wicMatrix[iosTemplate.platform][index]"
|
||||
>
|
||||
<mat-option [value]="">
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let option of wicMatrix[iosTemplate.platform][index]" [value]="option">
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="iosTemplate.platform && !chassis[iosTemplate.platform]">
|
||||
<div *ngFor="let index of [0, 1, 2, 3, 4, 5, 6, 7]">
|
||||
<mat-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForTemplate[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="networkAdaptersForPlatform[iosTemplate.platform][index]"
|
||||
>
|
||||
<mat-option
|
||||
*ngFor="let option of networkAdaptersForPlatform[iosTemplate.platform][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</div>
|
||||
<br /><br />
|
||||
<h6>WICs</h6>
|
||||
<div *ngIf="iosTemplate.wic0 || iosTemplate.wic0 === ''">
|
||||
<mat-select placeholder="WIC 0" [(ngModel)]="iosTemplate.wic0" [ngModelOptions]="{ standalone: true }">
|
||||
<mat-option *ngFor="let option of networkModules[iosTemplate.platform][0]" [value]="option">
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
<div *ngIf="iosTemplate.wic1 || iosTemplate.wic1 === ''">
|
||||
<mat-select placeholder="WIC 1" [(ngModel)]="iosTemplate.wic1" [ngModelOptions]="{ standalone: true }">
|
||||
<mat-option *ngFor="let option of networkModules[iosTemplate.platform][1]" [value]="option">
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
<div *ngIf="iosTemplate.wic2 || iosTemplate.wic2 === ''">
|
||||
<mat-select placeholder="WIC 2" [(ngModel)]="iosTemplate.wic2" [ngModelOptions]="{ standalone: true }">
|
||||
<mat-option *ngFor="let option of networkModules[iosTemplate.platform][2]" [value]="option">
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel>
|
||||
<mat-expansion-panel-header>
|
||||
@ -240,8 +227,8 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
matInput
|
||||
formControlName="mac_addr"
|
||||
type="text"
|
||||
[(ngModel)]="iosTemplate.mac_addr"
|
||||
placeholder="Base MAC"
|
||||
@ -249,8 +236,8 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
matInput
|
||||
formControlName="idlepc"
|
||||
type="text"
|
||||
[(ngModel)]="iosTemplate.idlepc"
|
||||
placeholder="Idle-PC"
|
||||
|
@ -16,10 +16,7 @@ import { ToasterService } from '../../../../services/toaster.service';
|
||||
export class IosTemplateDetailsComponent implements OnInit {
|
||||
controller:Controller ;
|
||||
iosTemplate: IosTemplate;
|
||||
|
||||
isSymbolSelectionOpened: boolean = false;
|
||||
|
||||
networkAdaptersForTemplate: string[] = [];
|
||||
platforms: string[] = [];
|
||||
consoleTypes: string[] = [];
|
||||
categories = [];
|
||||
@ -28,9 +25,10 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
chassis = {};
|
||||
defaultRam = {};
|
||||
defaultNvram = {};
|
||||
networkAdapters = {};
|
||||
networkAdaptersForPlatform = {};
|
||||
networkModules = {};
|
||||
networkAdaptersForTemplate: string[] = [];
|
||||
wicsForTemplate: string[] = [];
|
||||
adapterMatrix = {};
|
||||
wicMatrix = {};
|
||||
|
||||
generalSettingsForm: UntypedFormGroup;
|
||||
memoryForm: UntypedFormGroup;
|
||||
@ -66,6 +64,8 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
idlemax: new UntypedFormControl('', Validators.required),
|
||||
idlesleep: new UntypedFormControl('', Validators.required),
|
||||
execarea: new UntypedFormControl('', Validators.required),
|
||||
idlepc: new UntypedFormControl('', Validators.pattern(this.iosConfigurationService.getIdlepcRegex())),
|
||||
mac_addr: new UntypedFormControl('', Validators.pattern(this.iosConfigurationService.getMacAddrRegex())),
|
||||
});
|
||||
}
|
||||
|
||||
@ -78,16 +78,12 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
this.getConfiguration();
|
||||
this.iosService.getTemplate(this.controller, template_id).subscribe((iosTemplate: IosTemplate) => {
|
||||
this.iosTemplate = iosTemplate;
|
||||
|
||||
this.fillAdaptersData();
|
||||
this.fillSlotsData();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
getConfiguration() {
|
||||
this.networkModules = this.iosConfigurationService.getNetworkModules();
|
||||
this.networkAdaptersForPlatform = this.iosConfigurationService.getNetworkAdaptersForPlatform();
|
||||
this.networkAdapters = this.iosConfigurationService.getNetworkAdapters();
|
||||
this.platforms = this.iosConfigurationService.getAvailablePlatforms();
|
||||
this.platformsWithEtherSwitchRouterOption = this.iosConfigurationService.getPlatformsWithEtherSwitchRouterOption();
|
||||
this.platformsWithChassis = this.iosConfigurationService.getPlatformsWithChassis();
|
||||
@ -95,35 +91,55 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
this.defaultRam = this.iosConfigurationService.getDefaultRamSettings();
|
||||
this.consoleTypes = this.iosConfigurationService.getConsoleTypes();
|
||||
this.categories = this.iosConfigurationService.getCategories();
|
||||
this.adapterMatrix = this.iosConfigurationService.getAdapterMatrix();
|
||||
this.wicMatrix = this.iosConfigurationService.getWicMatrix();
|
||||
}
|
||||
|
||||
fillAdaptersData() {
|
||||
if (this.iosTemplate.slot0) this.networkAdaptersForTemplate[0] = this.iosTemplate.slot0;
|
||||
if (this.iosTemplate.slot1) this.networkAdaptersForTemplate[1] = this.iosTemplate.slot1;
|
||||
if (this.iosTemplate.slot2) this.networkAdaptersForTemplate[2] = this.iosTemplate.slot2;
|
||||
if (this.iosTemplate.slot3) this.networkAdaptersForTemplate[3] = this.iosTemplate.slot3;
|
||||
if (this.iosTemplate.slot4) this.networkAdaptersForTemplate[4] = this.iosTemplate.slot4;
|
||||
if (this.iosTemplate.slot5) this.networkAdaptersForTemplate[5] = this.iosTemplate.slot5;
|
||||
if (this.iosTemplate.slot6) this.networkAdaptersForTemplate[6] = this.iosTemplate.slot6;
|
||||
if (this.iosTemplate.slot7) this.networkAdaptersForTemplate[7] = this.iosTemplate.slot7;
|
||||
fillSlotsData() {
|
||||
|
||||
// load network adapters
|
||||
for (let i = 0; i <= 6; i++) {
|
||||
if (this.iosTemplate[`slot${i}`]) {
|
||||
this.networkAdaptersForTemplate[i] = this.iosTemplate[`slot${i}`];
|
||||
}
|
||||
}
|
||||
|
||||
// load WICs
|
||||
for (let i = 0; i <= 3; i++) {
|
||||
if (this.iosTemplate[`wic${i}`]) {
|
||||
this.wicsForTemplate[i] = this.iosTemplate[`wic${i}`];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
completeAdaptersData() {
|
||||
if (this.networkAdaptersForTemplate[0]) this.iosTemplate.slot0 = this.networkAdaptersForTemplate[0];
|
||||
if (this.networkAdaptersForTemplate[1]) this.iosTemplate.slot1 = this.networkAdaptersForTemplate[1];
|
||||
if (this.networkAdaptersForTemplate[2]) this.iosTemplate.slot2 = this.networkAdaptersForTemplate[2];
|
||||
if (this.networkAdaptersForTemplate[3]) this.iosTemplate.slot3 = this.networkAdaptersForTemplate[3];
|
||||
if (this.networkAdaptersForTemplate[4]) this.iosTemplate.slot4 = this.networkAdaptersForTemplate[4];
|
||||
if (this.networkAdaptersForTemplate[5]) this.iosTemplate.slot5 = this.networkAdaptersForTemplate[5];
|
||||
if (this.networkAdaptersForTemplate[6]) this.iosTemplate.slot6 = this.networkAdaptersForTemplate[6];
|
||||
if (this.networkAdaptersForTemplate[7]) this.iosTemplate.slot7 = this.networkAdaptersForTemplate[7];
|
||||
saveSlotsData() {
|
||||
|
||||
// save network adapters
|
||||
for (let i = 0; i <= 6; i++) {
|
||||
if (this.adapterMatrix[this.iosTemplate.platform][this.iosTemplate.chassis || ''][i]) {
|
||||
if (this.networkAdaptersForTemplate[i] === undefined)
|
||||
this.iosTemplate[`slot${i}`] = ""
|
||||
else
|
||||
this.iosTemplate[`slot${i}`] = this.networkAdaptersForTemplate[i];
|
||||
}
|
||||
}
|
||||
|
||||
// save WICs
|
||||
for (let i = 0; i <= 3; i++) {
|
||||
if (this.wicMatrix[this.iosTemplate.platform][i]) {
|
||||
if (this.wicsForTemplate[i] === undefined)
|
||||
this.iosTemplate[`wic${i}`] = ""
|
||||
else
|
||||
this.iosTemplate[`wic${i}`] = this.wicsForTemplate[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onSave() {
|
||||
if (this.generalSettingsForm.invalid || this.memoryForm.invalid || this.advancedForm.invalid) {
|
||||
this.toasterService.error(`Fill all required fields`);
|
||||
} else {
|
||||
this.completeAdaptersData();
|
||||
this.saveSlotsData();
|
||||
|
||||
this.iosService.saveTemplate(this.controller, this.iosTemplate).subscribe((iosTemplate: IosTemplate) => {
|
||||
this.toasterService.success('Changes saved');
|
||||
|
@ -113,45 +113,44 @@
|
||||
<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-select
|
||||
placeholder="Slot {{ index }}"
|
||||
[(ngModel)]="networkAdaptersForNode[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="adapterMatrix[node.properties.platform][node.properties.chassis || ''][index]"
|
||||
>
|
||||
<mat-option
|
||||
*ngIf="adapterMatrix[node.properties.platform][node.properties.chassis || ''][index].length > 1 &&
|
||||
!adapterMatrix[node.properties.platform][node.properties.chassis || ''][index][0].startsWith('C7200')"
|
||||
[value]=""
|
||||
>
|
||||
<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>
|
||||
{{ "" }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let option of adapterMatrix[node.properties.platform][node.properties.chassis || ''][index]"
|
||||
[value]="option"
|
||||
>
|
||||
{{ option }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</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>
|
||||
<mat-select
|
||||
placeholder="WIC {{ index }}"
|
||||
[(ngModel)]="wicsForNode[index]"
|
||||
[ngModelOptions]="{ standalone: true }"
|
||||
*ngIf="wicMatrix[node.properties.platform][index]"
|
||||
>
|
||||
<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>
|
||||
</mat-tab>
|
||||
|
@ -44,11 +44,9 @@ export class ConfiguratorDialogIosComponent implements OnInit {
|
||||
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)),
|
||||
mac_addr: new UntypedFormControl('', Validators.pattern(this.configurationService.getMacAddrRegex())),
|
||||
idlepc: new UntypedFormControl('', Validators.pattern(this.configurationService.getIdlepcRegex())),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,7 @@ export class IosConfigurationService {
|
||||
c1700: 128,
|
||||
c2600: 128,
|
||||
c2691: 256,
|
||||
c3600: 192,
|
||||
c3620: 192,
|
||||
c3640: 192,
|
||||
c3660: 192,
|
||||
c3600: 256,
|
||||
c3725: 256,
|
||||
c3745: 256,
|
||||
c7200: 512,
|
||||
@ -163,7 +160,7 @@ export class IosConfigurationService {
|
||||
}
|
||||
|
||||
// 7206s allow an IO controller in slot 0, and a generic PA in slots 1-6
|
||||
adapter_matrix["c7200"][""] = { 0: ["IO_C7200"] };
|
||||
adapter_matrix["c7200"][""] = { 0: this.c7200_io };
|
||||
for (let slot = 1; slot < 7; slot++) {
|
||||
adapter_matrix["c7200"][""][slot] = this.c7200_pas;
|
||||
}
|
||||
@ -182,170 +179,11 @@ export class IosConfigurationService {
|
||||
return wic_matrix;
|
||||
}
|
||||
|
||||
getNetworkModules() {
|
||||
return {
|
||||
c1700: {
|
||||
0: this.c1700_wics,
|
||||
1: this.c1700_wics,
|
||||
},
|
||||
c2600: {
|
||||
0: this.c2600_wics,
|
||||
1: this.c2600_wics,
|
||||
2: this.c2600_wics,
|
||||
},
|
||||
c2691: {
|
||||
0: this.c3700_wics,
|
||||
1: this.c3700_wics,
|
||||
2: this.c3700_wics,
|
||||
},
|
||||
c3725: {
|
||||
0: this.c3700_wics,
|
||||
1: this.c3700_wics,
|
||||
2: this.c3700_wics,
|
||||
},
|
||||
c3745: {
|
||||
0: this.c3700_wics,
|
||||
1: this.c3700_wics,
|
||||
2: this.c3700_wics,
|
||||
},
|
||||
};
|
||||
getIdlepcRegex() {
|
||||
return /^(0x[0-9a-fA-F]+)?$|^$/;
|
||||
}
|
||||
|
||||
getNetworkAdapters() {
|
||||
return {
|
||||
'1720': {
|
||||
0: ['C1700-MB-1FE'],
|
||||
},
|
||||
'1721': {
|
||||
0: ['C1700-MB-1FE'],
|
||||
},
|
||||
'1750': {
|
||||
0: ['C1700-MB-1FE'],
|
||||
},
|
||||
'1751': {
|
||||
0: ['C1700-MB-1FE'],
|
||||
1: ['C1700-MB-WIC1'],
|
||||
},
|
||||
'1760': {
|
||||
0: ['C1700-MB-1FE'],
|
||||
1: ['C1700-MB-WIC1'],
|
||||
},
|
||||
'2610': {
|
||||
0: ['C2600-MB-1E'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2611': {
|
||||
0: ['C2600-MB-2E'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2620': {
|
||||
0: ['C2600-MB-1FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2621': {
|
||||
0: ['C2600-MB-2FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2610XM': {
|
||||
0: ['C2600-MB-1FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2611XM': {
|
||||
0: ['C2600-MB-2FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2620XM': {
|
||||
0: ['C2600-MB-1FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2621XM': {
|
||||
0: ['C2600-MB-2FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2650XM': {
|
||||
0: ['C2600-MB-1FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'2651XM': {
|
||||
0: ['C2600-MB-2FE'],
|
||||
1: this.c2600_nms,
|
||||
},
|
||||
'3620': {
|
||||
0: this.c3600_nms,
|
||||
1: this.c3600_nms,
|
||||
},
|
||||
'3640': {
|
||||
0: this.c3600_nms,
|
||||
1: this.c3600_nms,
|
||||
2: this.c3600_nms,
|
||||
3: this.c3600_nms,
|
||||
},
|
||||
'3660': {
|
||||
0: ['Leopard-2FE'],
|
||||
1: this.c3600_nms,
|
||||
2: this.c3600_nms,
|
||||
3: this.c3600_nms,
|
||||
4: this.c3600_nms,
|
||||
5: this.c3600_nms,
|
||||
6: this.c3600_nms,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
getNetworkAdaptersForPlatform() {
|
||||
let networkAdaptersForPlatform = {};
|
||||
networkAdaptersForPlatform['c2691'] = {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
};
|
||||
networkAdaptersForPlatform['c3725'] = {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
2: this.c3700_nms,
|
||||
};
|
||||
networkAdaptersForPlatform['c3745'] = {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
2: this.c3700_nms,
|
||||
3: this.c3700_nms,
|
||||
4: this.c3700_nms,
|
||||
};
|
||||
networkAdaptersForPlatform['c7200'] = {
|
||||
0: this.c7200_io,
|
||||
1: this.c7200_pas,
|
||||
2: this.c7200_pas,
|
||||
3: this.c7200_pas,
|
||||
4: this.c7200_pas,
|
||||
5: this.c7200_pas,
|
||||
6: this.c7200_pas,
|
||||
};
|
||||
|
||||
return {
|
||||
c2691: {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
},
|
||||
c3725: {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
2: this.c3700_nms,
|
||||
},
|
||||
c3745: {
|
||||
0: ['GT96100-FE'],
|
||||
1: this.c3700_nms,
|
||||
2: this.c3700_nms,
|
||||
3: this.c3700_nms,
|
||||
4: this.c3700_nms,
|
||||
},
|
||||
c7200: {
|
||||
0: this.c7200_io,
|
||||
1: this.c7200_pas,
|
||||
2: this.c7200_pas,
|
||||
3: this.c7200_pas,
|
||||
4: this.c7200_pas,
|
||||
5: this.c7200_pas,
|
||||
6: this.c7200_pas,
|
||||
},
|
||||
};
|
||||
getMacAddrRegex() {
|
||||
return /^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$|^$/;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user