nuagenetworks / monolithe

generic and extendable code generator from specifications.
BSD 3-Clause "New" or "Revised" License
16 stars 28 forks source link

vspk-js: userlabel in NUAttribute #46

Closed killanch closed 7 years ago

killanch commented 7 years ago

@natabal pls review

Sample generated code NUWirelessPort.js:

import NUAttribute from 'service/NUAttribute';
import ServiceClassRegistry from 'service/ServiceClassRegistry';
import NUAbstractNamedEntity from './abstract/NUAbstractNamedEntity';
import { NUWirelessPortWifiFrequencyBandEnum, NUWirelessPortWifiModeEnum,
    NUWirelessPortPortTypeEnum, NUWirelessPortCountryCodeEnum, NUWirelessPortFrequencyChannelEnum }
    from './enums';

/* Represents WirelessPort entity
   Represents a wireless (WiFi) interface configured on a Network Service Gateway (NSG) instance.
   The WirelessPort instance may map to a physical WiFi card or a WiFi port.
*/
export default class NUWirelessPort extends NUAbstractNamedEntity {
    constructor(...args) {
        super(...args);
        this.defineProperties({
            genericConfig: '4096',
            physicalName: null,
            wifiFrequencyBand: NUWirelessPortWifiFrequencyBandEnum.FREQ_2_4_GHZ,
            wifiMode: NUWirelessPortWifiModeEnum.WIFI_B_G_N,
            portType: NUWirelessPortPortTypeEnum.ACCESS,
            countryCode: null,
            frequencyChannel: NUWirelessPortFrequencyChannelEnum.CH_0,
        });
    }

    static attributeDescriptors = {
        ...NUAbstractNamedEntity.attributeDescriptors,
        genericConfig: new NUAttribute({
            localName: 'genericConfig',
            attributeType: NUAttribute.ATTR_TYPE_STRING,
            userlabel: 'Generic Config',
        }),
        physicalName: new NUAttribute({
            localName: 'physicalName',
            attributeType: NUAttribute.ATTR_TYPE_STRING,
            isRequired: true,
            isUnique: true,
            isReadOnly: true,
            canOrder: true,
            canSearch: true,
            userlabel: 'Physical Name',
        }),
        wifiFrequencyBand: new NUAttribute({
            localName: 'wifiFrequencyBand',
            attributeType: NUAttribute.ATTR_TYPE_ENUM,
            isRequired: true,
            canOrder: true,
            canSearch: true,
            choices: [NUWirelessPortWifiFrequencyBandEnum.FREQ_2_4_GHZ,
                NUWirelessPortWifiFrequencyBandEnum.FREQ_5_0_GHZ],
            userlabel: 'WiFi Frequency Band',
        }),
        wifiMode: new NUAttribute({
            localName: 'wifiMode',
            attributeType: NUAttribute.ATTR_TYPE_ENUM,
            isRequired: true,
            canOrder: true,
            canSearch: true,
            choices: [NUWirelessPortWifiModeEnum.WIFI_A, NUWirelessPortWifiModeEnum.WIFI_A_AC,
                NUWirelessPortWifiModeEnum.WIFI_A_N, NUWirelessPortWifiModeEnum.WIFI_A_N_AC,
                NUWirelessPortWifiModeEnum.WIFI_B_G, NUWirelessPortWifiModeEnum.WIFI_B_G_N],
            userlabel: 'WiFi Mode',
        }),
        portType: new NUAttribute({
            localName: 'portType',
            attributeType: NUAttribute.ATTR_TYPE_ENUM,
            isRequired: true,
            canOrder: true,
            canSearch: true,
            choices: [NUWirelessPortPortTypeEnum.ACCESS],
            userlabel: 'Type',
        }),
        countryCode: new NUAttribute({
            localName: 'countryCode',
            attributeType: NUAttribute.ATTR_TYPE_ENUM,
            isRequired: true,
            canOrder: true,
            canSearch: true,
            choices: [NUWirelessPortCountryCodeEnum.AT, NUWirelessPortCountryCodeEnum.AU,
                NUWirelessPortCountryCodeEnum.BE, NUWirelessPortCountryCodeEnum.BR,
                NUWirelessPortCountryCodeEnum.CA, NUWirelessPortCountryCodeEnum.CH,
                NUWirelessPortCountryCodeEnum.CN, NUWirelessPortCountryCodeEnum.CY,
                NUWirelessPortCountryCodeEnum.CZ, NUWirelessPortCountryCodeEnum.DE,
                NUWirelessPortCountryCodeEnum.DK, NUWirelessPortCountryCodeEnum.EE,
                NUWirelessPortCountryCodeEnum.ES, NUWirelessPortCountryCodeEnum.FI,
                NUWirelessPortCountryCodeEnum.FR, NUWirelessPortCountryCodeEnum.GB,
                NUWirelessPortCountryCodeEnum.GR, NUWirelessPortCountryCodeEnum.HK,
                NUWirelessPortCountryCodeEnum.HU, NUWirelessPortCountryCodeEnum.ID,
                NUWirelessPortCountryCodeEnum.IE, NUWirelessPortCountryCodeEnum.IL,
                NUWirelessPortCountryCodeEnum.IN, NUWirelessPortCountryCodeEnum.IT,
                NUWirelessPortCountryCodeEnum.JP, NUWirelessPortCountryCodeEnum.KR,
                NUWirelessPortCountryCodeEnum.LT, NUWirelessPortCountryCodeEnum.LU,
                NUWirelessPortCountryCodeEnum.LV, NUWirelessPortCountryCodeEnum.MY,
                NUWirelessPortCountryCodeEnum.NL, NUWirelessPortCountryCodeEnum.NO,
                NUWirelessPortCountryCodeEnum.NZ, NUWirelessPortCountryCodeEnum.PH,
                NUWirelessPortCountryCodeEnum.PL, NUWirelessPortCountryCodeEnum.PT,
                NUWirelessPortCountryCodeEnum.SE, NUWirelessPortCountryCodeEnum.SG,
                NUWirelessPortCountryCodeEnum.SI, NUWirelessPortCountryCodeEnum.SK,
                NUWirelessPortCountryCodeEnum.TH, NUWirelessPortCountryCodeEnum.TW,
                NUWirelessPortCountryCodeEnum.US, NUWirelessPortCountryCodeEnum.ZA],
            userlabel: 'Country',
        }),
        frequencyChannel: new NUAttribute({
            localName: 'frequencyChannel',
            attributeType: NUAttribute.ATTR_TYPE_ENUM,
            isRequired: true,
            canOrder: true,
            canSearch: true,
            choices: [NUWirelessPortFrequencyChannelEnum.CH_0,
                NUWirelessPortFrequencyChannelEnum.CH_1,
                NUWirelessPortFrequencyChannelEnum.CH_10,
                NUWirelessPortFrequencyChannelEnum.CH_100,
                NUWirelessPortFrequencyChannelEnum.CH_104,
                NUWirelessPortFrequencyChannelEnum.CH_108,
                NUWirelessPortFrequencyChannelEnum.CH_11,
                NUWirelessPortFrequencyChannelEnum.CH_112,
                NUWirelessPortFrequencyChannelEnum.CH_116,
                NUWirelessPortFrequencyChannelEnum.CH_12,
                NUWirelessPortFrequencyChannelEnum.CH_120,
                NUWirelessPortFrequencyChannelEnum.CH_124,
                NUWirelessPortFrequencyChannelEnum.CH_128,
                NUWirelessPortFrequencyChannelEnum.CH_13,
                NUWirelessPortFrequencyChannelEnum.CH_132,
                NUWirelessPortFrequencyChannelEnum.CH_136,
                NUWirelessPortFrequencyChannelEnum.CH_14,
                NUWirelessPortFrequencyChannelEnum.CH_140,
                NUWirelessPortFrequencyChannelEnum.CH_144,
                NUWirelessPortFrequencyChannelEnum.CH_149,
                NUWirelessPortFrequencyChannelEnum.CH_153,
                NUWirelessPortFrequencyChannelEnum.CH_157,
                NUWirelessPortFrequencyChannelEnum.CH_161,
                NUWirelessPortFrequencyChannelEnum.CH_165,
                NUWirelessPortFrequencyChannelEnum.CH_2,
                NUWirelessPortFrequencyChannelEnum.CH_3,
                NUWirelessPortFrequencyChannelEnum.CH_36,
                NUWirelessPortFrequencyChannelEnum.CH_4,
                NUWirelessPortFrequencyChannelEnum.CH_40,
                NUWirelessPortFrequencyChannelEnum.CH_44,
                NUWirelessPortFrequencyChannelEnum.CH_48,
                NUWirelessPortFrequencyChannelEnum.CH_5,
                NUWirelessPortFrequencyChannelEnum.CH_52,
                NUWirelessPortFrequencyChannelEnum.CH_56,
                NUWirelessPortFrequencyChannelEnum.CH_6,
                NUWirelessPortFrequencyChannelEnum.CH_60,
                NUWirelessPortFrequencyChannelEnum.CH_64,
                NUWirelessPortFrequencyChannelEnum.CH_7,
                NUWirelessPortFrequencyChannelEnum.CH_8,
                NUWirelessPortFrequencyChannelEnum.CH_9],
            userlabel: 'Frequency Channel',
        }),
    }

    get RESTName() {
        return 'wirelessports';
    }
}

ServiceClassRegistry.register(NUWirelessPort);