cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1246
Views
0
Helpful
2
Replies

Add multiple partitions in a CSS

hwalia282
Level 1
Level 1

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();
    }
});

 

1 Accepted Solution

Accepted Solutions

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.

View solution in original post

2 Replies 2

luoht
Level 1
Level 1

I think index starts from 1.  Try to change the indexes to 1 and 2 for corresponding partitions.

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.