Sending end user parameters to the controller
Dear All, I would like to send end user parameter such as buffer level to the controller so that the controller can decide when to apply the routing algorithm. Kind regards,
Dear All, I would like to send end user parameter such as buffer level to the controller so that the controller can decide when to apply the routing algorithm. Kind regards,
You can make getters and setters via RPC in the yang files of your projects:
rpc set-polling-frequency {
description "Sets the amount of seconds between each poll instance";
input {
leaf nb-of-seconds {
type uint32;
default "20";
description "Number of seconds between each poll instance";
}
}
}
rpc get-polling-frequency {
description "Gets the amount of seconds between each poll instance";
output {
leaf nb-of-seconds {
type uint32;
default "20";
description "Number of seconds between each poll instance";
}
}
}
And in your code:
... implements [PluginName]Service ...
@Override
public Future<RpcResult<Void>> setPollingFrequency(SetPollingFrequencyInput input) {
if (input == null || input.getNbOfSeconds() == null) {
return Futures.immediateFuture(RpcResultBuilder.<Void> failed().withError(
ErrorType.APPLICATION, "oops").build());
}
pollingFrequency.set(input.getNbOfSeconds());
return Futures.immediateFuture(RpcResultBuilder.<Void> success().build());
}
@Override
public Future<RpcResult<GetPollingStartThresholdOutput>> getPollingStartThreshold() {
BigInteger value = BigInteger.valueOf(pollingStartThreshold.get());
GetPollingStartThresholdOutput output = new GetPollingStartThresholdOutputBuilder()
.setNbOfBytes(value).build();
return Futures.immediateFuture(RpcResultBuilder.success(output).build());
}
Afterwards you will be able to make REST requests (e.g. via YangMan), or RPC-calls between your plugins. An added bonus is that they are easy to unit test.
This thread is public, all members of ask.opendaylight.org can read this page.
Asked: 2017-10-06 14:33:48 -0700
Seen: 31 times
Last updated: Oct 07 '17
© 2014 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a trademark of The OpenDaylight Project, Inc.
Linux Foundation is a registered trademark of The Linux Foundation.
Linux is a registered trademark of Linus Torvalds.
Please see our brand guidelines, trademark guidelines, terms of service and privacy policy.