08-24-2018 05:14 PM - edited 08-24-2018 05:17 PM
I have configured two paritions, VAL_SiteXform_PT and VAL_Dummy_PT. I want to add them to a new CSS. However the code only adds VAL_Dummy_PT. What am I missing? Code is below:
"use-strict";
const soap = require("strong-soap").soap;
const request = require("request");
const url = "AXLAPI.wsdl";
const specialRequest = request.defaults({ strictSSL: false });
const options = {
request: specialRequest
};
const requestArgs3 = {
css: {
name: "VAL_Device_CSS", description: "VAL CSS",
members: {
member: {
routePartitionName: "VAL_SiteXform_PT",
index: 0
},
member: {
routePartitionName: "VAL_Dummy_PT",
index: 1
}
}
}
};
soap.createClient(url, options, (err, client) => {
if (err) {
console.log(err.stack);
}
else {
client.setEndpoint("https://192.168.138.15:8443/axl/");
client.setSecurity(new soap.BasicAuthSecurity("axl", "cisco"));
let response = {};
let configServer = async () => {
try {
response = await client.addCss(requestArgs3);
console.log(JSON.stringify(response.result, null, 2));
} catch (err) {
console.log(err.stack);
}
}
configServer();
}
});
Solved! Go to Solution.
08-25-2018 07:22 PM - edited 08-25-2018 07:22 PM
That's not it. I figured out the problem. I'm using duplicate keys in the object. Javascript will use the last one that's why I only see "VAL_Dummy_PT." I had to change requestArg3 to:
const requestArgs3 = {
css: {
name: "VAL_Device_CSS", description: "VAL CSS",
members: {
member: []
}
}
};
requestArgs3.css.members.member.push({routePartitionName: "VAL_SiteXform_PT", index: 0});
requestArgs3.css.members.member.push({routePartitionName: "VAL_Dummy_PT", index: 1});
and it worked.
08-25-2018 07:04 PM
I think index starts from 1. Try to change the indexes to 1 and 2 for corresponding partitions.
08-25-2018 07:22 PM - edited 08-25-2018 07:22 PM
That's not it. I figured out the problem. I'm using duplicate keys in the object. Javascript will use the last one that's why I only see "VAL_Dummy_PT." I had to change requestArg3 to:
const requestArgs3 = {
css: {
name: "VAL_Device_CSS", description: "VAL CSS",
members: {
member: []
}
}
};
requestArgs3.css.members.member.push({routePartitionName: "VAL_SiteXform_PT", index: 0});
requestArgs3.css.members.member.push({routePartitionName: "VAL_Dummy_PT", index: 1});
and it worked.
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