05-09-2017 06:55 AM - edited 03-01-2019 03:48 AM
Hi Expert,
While doing the service reconciliation, I am trying to re-deploy the service. If I invoke the re-deploy action with reconcile parameter, it is working fine but if I want to get dry-run output by passing “dry-run” parameter in addition, I am getting error “Too many values”.
Any idea about it?
try {
ConfXMLParam[] params = new ConfXMLParam[4];
params[0] = new ConfXMLParamStart(getPrefix(), "reconcile");
params[1] = new ConfXMLParamLeaf(getPrefix(), "keep-non-service-config");
params[2] = new ConfXMLParamStop(getPrefix(), "reconcile");
params[3] = new ConfXMLParamLeaf(getPrefix(), "dry-run");
String servicePath = createServicePath(serviceName, keyValues) + "re-deploy";
ConfXMLParam[] reDeployParamsOut = maapi.requestAction(params, servicePath);
05-09-2017 06:55 AM
Hello,
take a look in tailf-ncs-services.yang
Here you will see the action re-deploy modeled as:
tailf:action re-deploy {
tailf:info "Run/Dryrun the service logic again";
....
input {
container dry-run {
presence "";
leaf outformat {
type outformat3;
}
}
....
The dry-run node is a presence container, not a leaf, thus the following should work:ConfXMLParam[] params = new ConfXMLParam[5];
params[0] = new ConfXMLParamStart(getPrefix(), "reconcile");
params[1] = new ConfXMLParamLeaf(getPrefix(), "keep-non-service-config");
params[2] = new ConfXMLParamStop(getPrefix(), "reconcile");
params[3] = new ConfXMLParamStart(getPrefix(), "dry-run");
params[4] = new ConfXMLParamStop(getPrefix(), "dry-run");
String servicePath = createServicePath(serviceName, keyValues) + "re-deploy";
ConfXMLParam[] reDeployParamsOut = maapi.requestAction(params, servicePath);
05-09-2017 06:56 AM
Thanks! I have tried this way also but still same error. Please see the code tried by me:
ConfXMLParam[] params = new ConfXMLParam[5];
//ConfXMLParam[] params = new ConfXMLParam[6];
LOGGER.info("defined params:");
params[0] = new ConfXMLParamStart(getPrefix(), "reconcile");
LOGGER.info("Param started");
params[1] = new ConfXMLParamLeaf(getPrefix(), "keep-non-service-config");
LOGGER.info("Discard non service config");
params[2] = new ConfXMLParamStop(getPrefix(), "reconcile");
LOGGER.info("Param stoped");
params[3] = new ConfXMLParamStart(getPrefix(), "dry-run");
params[4] = new ConfXMLParamStop(getPrefix(), "dry-run");
String servicePath = createServicePath(serviceName, keyValues) + "re-deploy";
LOGGER.info("Re-deploy service path for requestAction: " + servicePath);
ConfXMLParam[] reDeployParamsOut = maapi.requestAction(params, servicePath);
In debug mode values for params and service path are:
Params -> [{[1481125183|reconcile], START}, {[1481125183|keep-non-service-config], LEAF}, {[1481125183|reconcile], STOP}, {[1481125183|dry-run], START}, {[1481125183|dry-run], STOP}]
Service path -> /services/l2vpn-p2p{1894730020:1004400020}/re-deploy
Error -> com.tailf.maapi.MaapiException: Too many values
05-09-2017 06:56 AM
Hi,
my bad. You have to follow the order of the parameters in YANG.
ConfXMLParam[] params = new ConfXMLParam[5];params[0] = new ConfXMLParamStart(getPrefix(), "dry-run");
params[1] = new ConfXMLParamStop(getPrefix(), "dry-run");
params[2] = new ConfXMLParamStart(getPrefix(), "reconcile");params[3] = new ConfXMLParamLeaf(getPrefix(), "keep-non-service-config");params[4] = new ConfXMLParamStop(getPrefix(), "reconcile");String servicePath = createServicePath(serviceName, keyValues) + "re-deploy";ConfXMLParam[] reDeployParamsOut = maapi.requestAction(params, servicePath);
05-09-2017 06:56 AM
Thanks a lot! It worked J
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide