Search in sources :

Example 1 with UnsupportedOption

use of org.opendaylight.netconf.shaded.exificient.core.exceptions.UnsupportedOption in project netconf by opendaylight.

the class AbstractNetconfSession method startExiCommunication.

@Override
public final void startExiCommunication(final NetconfMessage startExiMessage) {
    final EXIParameters exiParams;
    try {
        exiParams = EXIParameters.fromXmlElement(XmlElement.fromDomDocument(startExiMessage.getDocument()));
    } catch (final UnsupportedOption e) {
        LOG.warn("Unable to parse EXI parameters from {} on session {}", startExiMessage, this, e);
        throw new IllegalArgumentException("Cannot parse options", e);
    }
    final NetconfEXICodec exiCodec = NetconfEXICodec.forParameters(exiParams);
    final NetconfMessageToEXIEncoder exiEncoder = NetconfMessageToEXIEncoder.create(exiCodec);
    final NetconfEXIToMessageDecoder exiDecoder;
    try {
        exiDecoder = NetconfEXIToMessageDecoder.create(exiCodec);
    } catch (EXIException e) {
        LOG.warn("Failed to instantiate EXI decodeer for {} on session {}", exiCodec, this, e);
        throw new IllegalStateException("Cannot instantiate encoder for options", e);
    }
    addExiHandlers(exiDecoder, exiEncoder);
    LOG.debug("Session {} EXI handlers added to pipeline", this);
}
Also used : EXIParameters(org.opendaylight.netconf.nettyutil.handler.exi.EXIParameters) NetconfEXICodec(org.opendaylight.netconf.nettyutil.handler.NetconfEXICodec) NetconfMessageToEXIEncoder(org.opendaylight.netconf.nettyutil.handler.NetconfMessageToEXIEncoder) NetconfEXIToMessageDecoder(org.opendaylight.netconf.nettyutil.handler.NetconfEXIToMessageDecoder) UnsupportedOption(org.opendaylight.netconf.shaded.exificient.core.exceptions.UnsupportedOption) EXIException(org.opendaylight.netconf.shaded.exificient.core.exceptions.EXIException)

Aggregations

NetconfEXICodec (org.opendaylight.netconf.nettyutil.handler.NetconfEXICodec)1 NetconfEXIToMessageDecoder (org.opendaylight.netconf.nettyutil.handler.NetconfEXIToMessageDecoder)1 NetconfMessageToEXIEncoder (org.opendaylight.netconf.nettyutil.handler.NetconfMessageToEXIEncoder)1 EXIParameters (org.opendaylight.netconf.nettyutil.handler.exi.EXIParameters)1 EXIException (org.opendaylight.netconf.shaded.exificient.core.exceptions.EXIException)1 UnsupportedOption (org.opendaylight.netconf.shaded.exificient.core.exceptions.UnsupportedOption)1