use of io.lighty.netconf.device.action.actions.ResetAction in project lighty-netconf-simulator by PANTHEONtech.
the class ActionServiceDeviceProcessor method execute.
@Override
protected CompletableFuture<Response> execute(final Element requestXmlElement) {
final XmlElement fromDomElement = XmlElement.fromDomElement(requestXmlElement);
final Optional<Entry<Absolute, ActionDefinition>> actionEntry = findActionInElement(fromDomElement);
Preconditions.checkState(actionEntry.isPresent(), "Action is not present on the device.");
if (actionEntry.get().getValue().getQName().equals(Start.QNAME)) {
this.actionProcessor = new StartActionProcessor(new StartAction(), actionEntry.get().getKey(), actionEntry.get().getValue(), this.adapterContext.currentSerializer());
}
if (actionEntry.get().getValue().getQName().equals(Reset.QNAME)) {
this.actionProcessor = new ResetActionProcessor(new ResetAction(), actionEntry.get().getKey(), actionEntry.get().getValue(), this.adapterContext.currentSerializer());
}
Preconditions.checkState(this.actionProcessor != null, "Action is not implemented on the device.");
this.actionProcessor.init(getNetconfDeviceServices());
return this.actionProcessor.execute(requestXmlElement);
}
Aggregations