Browse Source

UI: Add SNMP device transport configuration

pull/4761/head
Vladyslav_Prykhodko 5 years ago
parent
commit
fe3378eab1
  1. 9
      common/data/src/main/java/org/thingsboard/server/common/data/device/data/SnmpDeviceTransportConfiguration.java
  2. 4
      ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-communication-config.component.ts
  3. 3
      ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-mapping.component.scss
  4. 2
      ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-transport-configuration.component.ts
  5. 36
      ui-ngx/src/app/modules/home/pages/device/data/device-data.component.ts
  6. 44
      ui-ngx/src/app/modules/home/pages/device/data/device-transport-configuration.component.ts
  7. 121
      ui-ngx/src/app/modules/home/pages/device/data/snmp-device-transport-configuration.component.html
  8. 112
      ui-ngx/src/app/modules/home/pages/device/data/snmp-device-transport-configuration.component.ts
  9. 60
      ui-ngx/src/app/shared/models/device.models.ts
  10. 25
      ui-ngx/src/assets/locale/locale.constant-en_US.json

9
common/data/src/main/java/org/thingsboard/server/common/data/device/data/SnmpDeviceTransportConfiguration.java

@ -51,6 +51,13 @@ public class SnmpDeviceTransportConfiguration implements DeviceTransportConfigur
private String privacyPassphrase;
private String engineId;
public SnmpDeviceTransportConfiguration() {
this.host = "localhost";
this.port = 161;
this.protocolVersion = SnmpProtocolVersion.V2C;
this.community = "public";
}
@Override
public DeviceTransportType getType() {
return DeviceTransportType.SNMP;
@ -76,7 +83,7 @@ public class SnmpDeviceTransportConfiguration implements DeviceTransportConfigur
isValid = StringUtils.isNotBlank(username) && StringUtils.isNotBlank(securityName)
&& contextName != null && authenticationProtocol != null
&& StringUtils.isNotBlank(authenticationPassphrase)
&& privacyProtocol != null && privacyPassphrase != null && engineId != null;
&& privacyProtocol != null && StringUtils.isNotBlank(privacyPassphrase) && engineId != null;
break;
}
}

4
ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-communication-config.component.ts

@ -179,7 +179,7 @@ export class SnmpDeviceProfileCommunicationConfigComponent implements OnInit, On
if (isUndefinedOrNull(value)) {
value = {
spec: this.getFirstUnusedSeverity(),
queryingFrequencyMs: 0,
queryingFrequencyMs: 5000,
mappings: null
};
}
@ -196,7 +196,7 @@ export class SnmpDeviceProfileCommunicationConfigComponent implements OnInit, On
).subscribe(spec => {
if (this.isShowFrequency(spec)) {
form.addControl('queryingFrequencyMs',
this.fb.control(0, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]));
this.fb.control(5000, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]));
} else {
form.removeControl('queryingFrequencyMs');
}

3
ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-mapping.component.scss

@ -40,6 +40,9 @@
.mat-form-field-underline {
bottom: 0;
}
.mat-form-field-subscript-wrapper{
margin-top: 1.8em;
}
}
}
}

2
ui-ngx/src/app/modules/home/components/profile/device/snpm/snmp-device-profile-transport-configuration.component.ts

@ -86,7 +86,7 @@ export class SnmpDeviceProfileTransportConfigurationComponent implements OnInit,
ngOnInit(): void {
this.snmpDeviceProfileTransportConfigurationFormGroup = this.fb.group({
timeoutMs: [0, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]],
timeoutMs: [500, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]],
retries: [0, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]],
communicationConfigs: [null, Validators.required],
});

36
ui-ngx/src/app/modules/home/pages/device/data/device-data.component.ts

@ -15,7 +15,16 @@
///
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
Validator,
Validators
} from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@app/core/core.state';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
@ -29,13 +38,20 @@ import {
selector: 'tb-device-data',
templateUrl: './device-data.component.html',
styleUrls: [],
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DeviceDataComponent),
multi: true
}]
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DeviceDataComponent),
multi: true
},
{
provide: NG_VALIDATORS,
useExisting: forwardRef(() => DeviceDataComponent),
multi: true
},
]
})
export class DeviceDataComponent implements ControlValueAccessor, OnInit {
export class DeviceDataComponent implements ControlValueAccessor, OnInit, Validator {
deviceDataFormGroup: FormGroup;
@ -97,6 +113,12 @@ export class DeviceDataComponent implements ControlValueAccessor, OnInit {
this.deviceDataFormGroup.patchValue({transportConfiguration: value?.transportConfiguration}, {emitEvent: false});
}
validate(): ValidationErrors | null {
return this.deviceDataFormGroup.valid ? null : {
deviceDataForm: false
};
}
private updateModel() {
let deviceData: DeviceData = null;
if (this.deviceDataFormGroup.valid) {

44
ui-ngx/src/app/modules/home/pages/device/data/device-transport-configuration.component.ts

@ -15,27 +15,39 @@
///
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
Validator,
Validators
} from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@app/core/core.state';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import {
DeviceTransportConfiguration,
DeviceTransportType
} from '@shared/models/device.models';
import { DeviceTransportConfiguration, DeviceTransportType } from '@shared/models/device.models';
import { deepClone } from '@core/utils';
@Component({
selector: 'tb-device-transport-configuration',
templateUrl: './device-transport-configuration.component.html',
styleUrls: [],
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DeviceTransportConfigurationComponent),
multi: true
}]
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DeviceTransportConfigurationComponent),
multi: true
},
{
provide: NG_VALIDATORS,
useExisting: forwardRef(() => DeviceTransportConfigurationComponent),
multi: true
}]
})
export class DeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit {
export class DeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit, Validator {
deviceTransportType = DeviceTransportType;
@ -92,7 +104,15 @@ export class DeviceTransportConfigurationComponent implements ControlValueAccess
if (configuration) {
delete configuration.type;
}
this.deviceTransportConfigurationFormGroup.patchValue({configuration}, {emitEvent: false});
setTimeout(() => {
this.deviceTransportConfigurationFormGroup.patchValue({configuration}, {emitEvent: false});
}, 0);
}
validate(): ValidationErrors | null {
return this.deviceTransportConfigurationFormGroup.valid ? null : {
deviceTransportConfiguration: false
};
}
private updateModel() {

121
ui-ngx/src/app/modules/home/pages/device/data/snmp-device-transport-configuration.component.html

@ -15,10 +15,119 @@
limitations under the License.
-->
<form [formGroup]="snmpDeviceTransportConfigurationFormGroup" style="padding-bottom: 16px;">
<tb-json-object-edit
[required]="required"
label="{{ 'device-profile.transport-type-snmp-hint' | translate }}"
formControlName="configuration">
</tb-json-object-edit>
<form [formGroup]="snmpDeviceTransportConfigurationFormGroup" style="padding-bottom: 16px;" fxLayoutGap="8px" fxLayout="column">
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.host</mat-label>
<input matInput formControlName="host" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('host').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('host').hasError('pattern')">
{{ 'device-profile.snmp.host-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.port</mat-label>
<input matInput formControlName="port" type="number" min="0" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('port').hasError('required')">
{{ 'device-profile.snmp.port-required' | translate }}
</mat-error>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('port').hasError('pattern') ||
snmpDeviceTransportConfigurationFormGroup.get('port').hasError('min')">
{{ 'device-profile.snmp.port-format' | translate }}
</mat-error>
</mat-form-field>
</div>
<mat-form-field class="mat-block" floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.protocol-version</mat-label>
<mat-select formControlName="protocolVersion" required>
<mat-option *ngFor="let snmpDeviceProtocolVersion of snmpDeviceProtocolVersions" [value]="snmpDeviceProtocolVersion">
{{ snmpDeviceProtocolVersion | lowercase }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('protocolVersion').hasError('required')">
{{ 'device-profile.snmp.protocol-version-required' | translate }}
</mat-error>
</mat-form-field>
<section *ngIf="!isV3protocolVersion()">
<mat-form-field class="mat-block">
<mat-label translate>device-profile.snmp.community</mat-label>
<input matInput formControlName="community" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('community').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('community').hasError('pattern')">
{{ 'device-profile.snmp.community-required' | translate }}
</mat-error>
</mat-form-field>
</section>
<section *ngIf="isV3protocolVersion()">
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.user-name</mat-label>
<input matInput formControlName="username" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('username').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('username').hasError('pattern')">
{{ 'device-profile.snmp.user-name-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.security-name</mat-label>
<input matInput formControlName="securityName" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('securityName').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('securityName').hasError('pattern')">
{{ 'device-profile.snmp.security-name-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.authentication-protocol</mat-label>
<mat-select formControlName="authenticationProtocol" required>
<mat-option *ngFor="let snmpAuthenticationProtocol of snmpAuthenticationProtocols" [value]="snmpAuthenticationProtocol">
{{ snmpAuthenticationProtocolTranslation.get(snmpAuthenticationProtocol) }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('authenticationProtocol').hasError('required')">
{{ 'device-profile.snmp.authentication-protocol-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.authentication-passphrase</mat-label>
<input matInput formControlName="authenticationPassphrase" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').hasError('pattern')">
{{ 'device-profile.snmp.authentication-passphrase-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex floatLabel="always" hideRequiredMarker>
<mat-label translate>device-profile.snmp.privacy-protocol</mat-label>
<mat-select formControlName="privacyProtocol" required>
<mat-option *ngFor="let snmpPrivacyProtocol of snmpPrivacyProtocols" [value]="snmpPrivacyProtocol">
{{ snmpPrivacyProtocolTranslation.get(snmpPrivacyProtocol) }}
</mat-option>
</mat-select>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('privacyProtocol').hasError('required')">
{{ 'device-profile.snmp.privacy-protocol-required' | translate }}
</mat-error>
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.privacy-passphrase</mat-label>
<input matInput formControlName="privacyPassphrase" required>
<mat-error *ngIf="snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').hasError('required') ||
snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').hasError('pattern')">
{{ 'device-profile.snmp.privacy-passphrase-required' | translate }}
</mat-error>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="8px" fxLayout.xs="column">
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.context-name</mat-label>
<input matInput formControlName="contextName">
</mat-form-field>
<mat-form-field fxFlex>
<mat-label translate>device-profile.snmp.engine-id</mat-label>
<input matInput formControlName="engineId">
</mat-form-field>
</div>
</section>
</form>

112
ui-ngx/src/app/modules/home/pages/device/data/snmp-device-transport-configuration.component.ts

@ -14,31 +14,57 @@
/// limitations under the License.
///
import {Component, forwardRef, Input, OnInit} from '@angular/core';
import {ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators} from '@angular/forms';
import {Store} from '@ngrx/store';
import {AppState} from '@app/core/core.state';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
ValidationErrors,
Validator,
Validators
} from '@angular/forms';
import { Store } from '@ngrx/store';
import { AppState } from '@app/core/core.state';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import {
DeviceTransportConfiguration,
DeviceTransportType,
SnmpDeviceTransportConfiguration
SnmpAuthenticationProtocol,
SnmpAuthenticationProtocolTranslationMap,
SnmpDeviceProtocolVersion,
SnmpDeviceTransportConfiguration,
SnmpPrivacyProtocol,
SnmpPrivacyProtocolTranslationMap
} from '@shared/models/device.models';
import { isDefinedAndNotNull } from '@core/utils';
@Component({
selector: 'tb-snmp-device-transport-configuration',
templateUrl: './snmp-device-transport-configuration.component.html',
styleUrls: [],
providers: [{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => SnmpDeviceTransportConfigurationComponent),
multi: true
}]
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => SnmpDeviceTransportConfigurationComponent),
multi: true
}, {
provide: NG_VALIDATORS,
useExisting: forwardRef(() => SnmpDeviceTransportConfigurationComponent),
multi: true
}]
})
export class SnmpDeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit {
export class SnmpDeviceTransportConfigurationComponent implements ControlValueAccessor, OnInit, Validator {
snmpDeviceTransportConfigurationFormGroup: FormGroup;
snmpDeviceProtocolVersions = Object.values(SnmpDeviceProtocolVersion);
snmpAuthenticationProtocols = Object.values(SnmpAuthenticationProtocol);
snmpAuthenticationProtocolTranslation = SnmpAuthenticationProtocolTranslationMap;
snmpPrivacyProtocols = Object.values(SnmpPrivacyProtocol);
snmpPrivacyProtocolTranslation = SnmpPrivacyProtocolTranslationMap;
private requiredValue: boolean;
get required(): boolean {
@ -53,8 +79,7 @@ export class SnmpDeviceTransportConfigurationComponent implements ControlValueAc
@Input()
disabled: boolean;
private propagateChange = (v: any) => {
};
private propagateChange = (v: any) => { };
constructor(private store: Store<AppState>,
private fb: FormBuilder) {
@ -69,13 +94,33 @@ export class SnmpDeviceTransportConfigurationComponent implements ControlValueAc
ngOnInit() {
this.snmpDeviceTransportConfigurationFormGroup = this.fb.group({
configuration: [null, Validators.required]
host: ['', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
port: [null, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]],
protocolVersion: [SnmpDeviceProtocolVersion.V2C, Validators.required],
community: ['public', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
username: ['', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
securityName: ['public', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
contextName: [null],
authenticationProtocol: [SnmpAuthenticationProtocol.SHA_512, Validators.required],
authenticationPassphrase: ['', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
privacyProtocol: [SnmpPrivacyProtocol.DES, Validators.required],
privacyPassphrase: ['', [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*')]],
engineId: ['']
});
this.snmpDeviceTransportConfigurationFormGroup.get('protocolVersion').valueChanges.subscribe((protocol: SnmpDeviceProtocolVersion) => {
this.updateDisabledFormValue(protocol);
});
this.snmpDeviceTransportConfigurationFormGroup.valueChanges.subscribe(() => {
this.updateModel();
});
}
validate(): ValidationErrors | null {
return this.snmpDeviceTransportConfigurationFormGroup.valid ? null : {
snmpDeviceTransportConfiguration: false
};
}
setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled;
if (this.disabled) {
@ -86,13 +131,46 @@ export class SnmpDeviceTransportConfigurationComponent implements ControlValueAc
}
writeValue(value: SnmpDeviceTransportConfiguration | null): void {
this.snmpDeviceTransportConfigurationFormGroup.patchValue({configuration: value}, {emitEvent: false});
if (isDefinedAndNotNull(value)) {
this.snmpDeviceTransportConfigurationFormGroup.patchValue(value, {emitEvent: false});
if (this.snmpDeviceTransportConfigurationFormGroup.enabled) {
this.updateDisabledFormValue(value.protocolVersion || SnmpDeviceProtocolVersion.V2C);
}
}
}
isV3protocolVersion(): boolean {
return this.snmpDeviceTransportConfigurationFormGroup.get('protocolVersion').value === SnmpDeviceProtocolVersion.V3;
}
private updateDisabledFormValue(protocol: SnmpDeviceProtocolVersion) {
if (protocol === SnmpDeviceProtocolVersion.V3) {
this.snmpDeviceTransportConfigurationFormGroup.get('community').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('username').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('securityName').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('contextName').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('authenticationProtocol').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('privacyProtocol').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('engineId').enable({emitEvent: false});
} else {
this.snmpDeviceTransportConfigurationFormGroup.get('community').enable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('username').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('securityName').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('contextName').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('authenticationProtocol').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('authenticationPassphrase').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('privacyProtocol').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('privacyPassphrase').disable({emitEvent: false});
this.snmpDeviceTransportConfigurationFormGroup.get('engineId').disable({emitEvent: false});
}
}
private updateModel() {
let configuration: DeviceTransportConfiguration = null;
if (this.snmpDeviceTransportConfigurationFormGroup.valid) {
configuration = this.snmpDeviceTransportConfigurationFormGroup.getRawValue().configuration;
configuration = this.snmpDeviceTransportConfigurationFormGroup.value;
configuration.type = DeviceTransportType.SNMP;
}
this.propagateChange(configuration);

60
ui-ngx/src/app/shared/models/device.models.ts

@ -362,7 +362,7 @@ export function createDeviceProfileTransportConfiguration(type: DeviceTransportT
break;
case DeviceTransportType.SNMP:
const snmpTransportConfiguration: SnmpDeviceProfileTransportConfiguration = {
timeoutMs: 0,
timeoutMs: 500,
retries: 0,
communicationConfigs: null
};
@ -394,7 +394,12 @@ export function createDeviceTransportConfiguration(type: DeviceTransportType): D
transportConfiguration = {...lwm2mTransportConfiguration, type: DeviceTransportType.LWM2M};
break;
case DeviceTransportType.SNMP:
const snmpTransportConfiguration: SnmpDeviceTransportConfiguration = {};
const snmpTransportConfiguration: SnmpDeviceTransportConfiguration = {
host: 'localhost',
port: 161,
protocolVersion: SnmpDeviceProtocolVersion.V2C,
community: 'public'
};
transportConfiguration = {...snmpTransportConfiguration, type: DeviceTransportType.SNMP};
break;
}
@ -572,8 +577,57 @@ export interface Lwm2mDeviceTransportConfiguration {
[key: string]: any;
}
export enum SnmpDeviceProtocolVersion {
V1 = 'V1',
V2C = 'V2C',
V3 = 'V3'
}
export enum SnmpAuthenticationProtocol {
SHA_1 = 'SHA_1',
SHA_224 = 'SHA_224',
SHA_256 = 'SHA_256',
SHA_384 = 'SHA_384',
SHA_512 = 'SHA_512',
MD5 = 'MD%'
}
export const SnmpAuthenticationProtocolTranslationMap = new Map<SnmpAuthenticationProtocol, string>([
[SnmpAuthenticationProtocol.SHA_1, 'SHA-1'],
[SnmpAuthenticationProtocol.SHA_224, 'SHA-224'],
[SnmpAuthenticationProtocol.SHA_256, 'SHA-256'],
[SnmpAuthenticationProtocol.SHA_384, 'SHA-384'],
[SnmpAuthenticationProtocol.SHA_512, 'SHA-512'],
[SnmpAuthenticationProtocol.MD5, 'MD5']
]);
export enum SnmpPrivacyProtocol {
DES = 'DES',
AES_128 = 'AES_128',
AES_192 = 'AES_192',
AES_256 = 'AES_256'
}
export const SnmpPrivacyProtocolTranslationMap = new Map<SnmpPrivacyProtocol, string>([
[SnmpPrivacyProtocol.DES, 'DES'],
[SnmpPrivacyProtocol.AES_128, 'AES-128'],
[SnmpPrivacyProtocol.AES_192, 'AES-192'],
[SnmpPrivacyProtocol.AES_256, 'AES-256'],
]);
export interface SnmpDeviceTransportConfiguration {
[key: string]: any;
host?: string;
port?: number;
protocolVersion?: SnmpDeviceProtocolVersion;
community?: string;
username?: string;
securityName?: string;
contextName?: string;
authenticationProtocol?: SnmpAuthenticationProtocol;
authenticationPassphrase?: string;
privacyProtocol?: SnmpPrivacyProtocol;
privacyPassphrase?: string;
engineId?: string;
}
export type DeviceTransportConfigurations = DefaultDeviceTransportConfiguration &

25
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -1301,16 +1301,35 @@
"snmp": {
"add-communication-config": "Add communication config",
"add-mapping": "Add mapping",
"authentication-passphrase": "Authentication passphrase",
"authentication-passphrase-required": "Authentication passphrase is required.",
"authentication-protocol": "Authentication protocol",
"authentication-protocol-required": "Authentication protocol is required.",
"communication-configs": "Communication configs",
"community": "Community string",
"community-required": "Community string is required.",
"context-name": "Context name",
"data-key": "Data key",
"data-key-required": "Data key is required.",
"data-type": "Data type",
"data-type-required": "Data type is required.",
"engine-id": "Engine ID",
"host": "Host",
"host-required": "Host is required.",
"oid": "OID",
"oid-pattern": "Invalid OID format.",
"oid-required": "OID is required.",
"please-add-communication-config": "Please add communication config",
"please-add-mapping-config": "Please add mapping config",
"port": "Port",
"port-format": "Invalid port format.",
"port-required": "Port is required.",
"privacy-passphrase": "Privacy passphrase",
"privacy-passphrase-required": "Privacy passphrase is required.",
"privacy-protocol": "Privacy protocol",
"privacy-protocol-required": "Privacy protocol is required.",
"protocol-version": "Protocol version",
"protocol-version-required": "Protocol version is required.",
"querying-frequency": "Querying frequency, ms",
"querying-frequency-invalid-format": "Querying frequency must be a positive integer.",
"querying-frequency-required": "Querying frequency is required.",
@ -1319,9 +1338,13 @@
"retries-required": "Retries is required.",
"scope": "Scope",
"scope-required": "Scope is required.",
"security-name": "Security name",
"security-name-required": "Security name is required.",
"timeout-ms": "Timeout, ms",
"timeout-ms-invalid-format": "Timeout must be a positive integer.",
"timeout-ms-required": "Timeout is required."
"timeout-ms-required": "Timeout is required.",
"user-name": "User name",
"user-name-required": "User name is required."
}
},
"dialog": {

Loading…
Cancel
Save