Search in sources :

Example 1 with DeviceRegistrationDataDto

use of com.alliander.osgp.dto.valueobjects.DeviceRegistrationDataDto in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850ChannelHandlerServer method processRegistrationMessage.

private void processRegistrationMessage(final RegisterDeviceRequest message, final String correlationId) {
    this.logMessage(message);
    String deviceIdentification = message.getDeviceIdentification();
    String deviceType = Ssld.SSLD_TYPE;
    final IED ied = IED.FLEX_OVL;
    String ipAddress = message.getIpAddress();
    // set, the values will be used to set an IP address for a device.
    if (this.testDeviceId != null && this.testDeviceId.equals(deviceIdentification) && this.testDeviceIp != null) {
        LOGGER.info("Using testDeviceId: {} and testDeviceIp: {}", this.testDeviceId, this.testDeviceIp);
        deviceIdentification = this.testDeviceId;
        deviceType = Ssld.SSLD_TYPE;
        ipAddress = this.testDeviceIp;
    }
    final DeviceRegistrationDataDto deviceRegistrationData = new DeviceRegistrationDataDto(ipAddress, deviceType, true);
    final RequestMessage requestMessage = new RequestMessage(correlationId, "no-organisation", deviceIdentification, ipAddress, deviceRegistrationData);
    LOGGER.info("Sending register device request to OSGP with correlation ID: " + correlationId);
    this.osgpRequestMessageSender.send(requestMessage, DeviceFunctionDto.REGISTER_DEVICE.name());
    try {
        this.deviceRegistrationService.disableRegistration(deviceIdentification, InetAddress.getByName(ipAddress), ied, ied.getDescription());
        LOGGER.info("Disabled registration for device: {}, at IP address: {}", deviceIdentification, ipAddress);
    } catch (final Exception e) {
        LOGGER.error("Failed to disable registration for device: {}, at IP address: {}", deviceIdentification, ipAddress, e);
    }
}
Also used : RequestMessage(com.alliander.osgp.shared.infra.jms.RequestMessage) IED(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.IED) DeviceRegistrationDataDto(com.alliander.osgp.dto.valueobjects.DeviceRegistrationDataDto)

Example 2 with DeviceRegistrationDataDto

use of com.alliander.osgp.dto.valueobjects.DeviceRegistrationDataDto in project Protocol-Adapter-OSLP by OSGP.

the class DeviceRegistrationService method sendDeviceRegisterRequest.

public void sendDeviceRegisterRequest(final InetAddress inetAddress, final String deviceType, final boolean hasSchedule, final String deviceIdentification) {
    final DeviceRegistrationDataDto deviceRegistrationData = new DeviceRegistrationDataDto(inetAddress.getHostAddress().toString(), deviceType, hasSchedule);
    final RequestMessage requestMessage = new RequestMessage("no-correlationUid", "no-organisation", deviceIdentification, deviceRegistrationData);
    this.osgpRequestMessageSender.send(requestMessage, "REGISTER_DEVICE");
}
Also used : RequestMessage(com.alliander.osgp.shared.infra.jms.RequestMessage) DeviceRegistrationDataDto(com.alliander.osgp.dto.valueobjects.DeviceRegistrationDataDto)

Aggregations

DeviceRegistrationDataDto (com.alliander.osgp.dto.valueobjects.DeviceRegistrationDataDto)2 RequestMessage (com.alliander.osgp.shared.infra.jms.RequestMessage)2 IED (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.IED)1