Beispiel #1
0
        public Olt(int id, string name, string snmpIPAddress, string snmpPort, string snmpVersion, string snmpCommunity, string snmpTimeout, IOltFormatChecks oltFormatChecks, IStringLocalizer <Olt> localizer)
        {
            _oltFormatChecks = oltFormatChecks;
            _localizer       = localizer;

            Id            = oltFormatChecks.CheckOltIdFormat(id);
            Name          = oltFormatChecks.CheckOltNameFormat(name);
            SnmpIPAddress = oltFormatChecks.CheckOltSnmpIpAddressFormat(snmpIPAddress);
            SnmpPort      = oltFormatChecks.CheckOltSnmpPortFormat(snmpPort);
            SnmpVersion   = oltFormatChecks.CheckOltSnmpVersionFormat(snmpVersion);
            SnmpCommunity = oltFormatChecks.CheckOltSnmpCommunityFormat(snmpCommunity);
            SnmpTimeout   = oltFormatChecks.CheckOltSnmpTimeoutFormat(snmpTimeout);
        }
        public DataService(IOptions <DevicesConfiguration> devicesConfiguration, ILoggerFactory loggerFactory, IOltFormatChecks oltFormatChecks, IResponseDescriptionDictionaries responseDescriptionDictionaries, IStringLocalizer <DataService> localizerDataService, IStringLocalizer <Olt> localizerOlt, IMapper mapper)
        {
            _devicesConfiguration            = devicesConfiguration.Value;
            _loggerFactory                   = loggerFactory;
            _localizerDataService            = localizerDataService;
            _responseDescriptionDictionaries = responseDescriptionDictionaries;
            _mapper = mapper;
            var logger = _loggerFactory.CreateLogger(_localizerDataService["SNMP Data Service"]);

            try
            {
                foreach (var device in _devicesConfiguration.Devices)
                {
                    configuredOlts.Add(new Olt(device.Id, device.Name, device.IpAddress, device.SnmpPort, device.SnmpVersion, device.SnmpCommunity, device.SnmpTimeout, oltFormatChecks, localizerOlt));
                }
            }
            catch (Exception exception)
            {
                logger.LogError(_localizerDataService["enviroment configuration: "] + exception.Message);
            }
        }