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

NDFC API for Network Creation

bunjiega
Level 1
Level 1

I am trying to use the NDFC API to create some networks (I have a lot to create and am trying to automate).

Creating networks from the GUI is straightforward. (In the fabric -> Actions -> Create Network)

But from the API, I basically can't figure out how to do it.
I think the endpoint I need is   "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/v2/fabrics/{fabric-name}/networks" .
But this doesn't take certain fields that the GUI takes, for example, IPv4 Gateway, Description, VLAN Name, etc.

Is there another endpoint to use in combination with this? Or does anyone have an example of how they did it?
Documentation is very dry and doesn't really explain things.

I am using python for this.

 

This is what the endpoint above is expecting, but as you can see, it doesn't have all that the GUI has, and is even is expecting some things the GUI doesn't ask for.

 

 

{
    "fabric": "string",
    "networkName": "string",
    "displayName": "string",
    "networkId": 0,
    "networkTemplate": "string",
    "networkExtensionTemplate": "string",
    "networkTemplateConfig": "string",
    "vrf": "string",
    "tenantName": "string",                           <---No idea what this is referencing
    "serviceNetworkTemplate": "string",       <---Not sure why you need this, I'm not creating service networks
    "interfaceGroups": "string",
    "hierarchicalKey": "string"                       <---No idea what this is referencing
}

 

 

 

Thanks!!

1 Accepted Solution

Accepted Solutions

John Cui
Cisco Employee
Cisco Employee

Hi Jeremy,

As you already found, all supported NDFC REST APIs are posted at https://developer.cisco.com/docs/nexus-dashboard-fabric-controller/latest/#!api-reference-lan

I also noticed there's no any information/parameter of Network - IPv4 Gateway, Description, VLAN Name included yet.

So I don't think we could configure these info with API for now.

And for the meaning of some fields you mentioned, an easy way to check that information you can try use GET method for an existing Network object, then you will get some related information on that.

For creating Network, you could leave other fields empty, just input the fabric name, then have a try. 

Hope this helps.

If you find my reply solved your question or issue, kindly click the 'Accept as Solution' button and vote it as helpful.

You can also learn more about Cisco NDFC through our live Ask the Experts (ATXs) session. Check out this ATXs Resources [https://community.cisco.com/t5/data-center-and-cloud-knowledge/cisco-aci-ask-the-experts-resources/ta-p/4394491] to view the latest schedule for upcoming sessions, as well as the useful references, e.g. online guides, FAQs.

Thanks,

John 

View solution in original post

2 Replies 2

John Cui
Cisco Employee
Cisco Employee

Hi Jeremy,

As you already found, all supported NDFC REST APIs are posted at https://developer.cisco.com/docs/nexus-dashboard-fabric-controller/latest/#!api-reference-lan

I also noticed there's no any information/parameter of Network - IPv4 Gateway, Description, VLAN Name included yet.

So I don't think we could configure these info with API for now.

And for the meaning of some fields you mentioned, an easy way to check that information you can try use GET method for an existing Network object, then you will get some related information on that.

For creating Network, you could leave other fields empty, just input the fabric name, then have a try. 

Hope this helps.

If you find my reply solved your question or issue, kindly click the 'Accept as Solution' button and vote it as helpful.

You can also learn more about Cisco NDFC through our live Ask the Experts (ATXs) session. Check out this ATXs Resources [https://community.cisco.com/t5/data-center-and-cloud-knowledge/cisco-aci-ask-the-experts-resources/ta-p/4394491] to view the latest schedule for upcoming sessions, as well as the useful references, e.g. online guides, FAQs.

Thanks,

John 

https://www.youtube.com/watch?v=Dg5FuiqFAKg

I found the about to be useful.

 

I have been able to create networks via postman with the following url and  body..

https://{{nd}}/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/fabrics/{{fabric-name}}/networks

 

{
"fabric""{{fabric-name}}",
"networkName""{{network-name}}",
"displayName""{{network-name}}",
"networkId"{{vxlan-id}},
"networkTemplate""{{networkTemplate}}",
"networkExtensionTemplate""{{networkExtensionTemplate}}",
"networkTemplateConfig""",
"vrf""{{vrf-name}}",
"type""{{type}}"
}
 
"networkTemplateConfig""", is where you can set the template values.  the empty string here would be replaces with a json string of key value pairs.  the key would be the key you see when you get an export of the object.
 
i was able to see the following keys in my network export.  You dont need them, just the ones you want to set.
 
fabric,vrf,displayName,networkId,networkTemplate,networkExtensionTemplate,networkName,secondaryGW3,suppressArp,secondaryGW2,secondaryGW1,loopbackId,enableL3OnBorder,type,SVI_NETFLOW_MONITOR,enableIR,rtBothAuto,isLayer2Only,ENABLE_NETFLOW,dhcpServerAddr3,gatewayIpV6Address,dhcpServerAddr2,tag,nveId,secondaryGW4,vlanId,gatewayIpAddress,vlanName,mtu,intfDescription,mcastGroup,trmEnabled,VLAN_NETFLOW_MONITOR,dhcpServers
 
"networkTemplateConfig": "networkTemplateConfig": "{\"gatewayIpAddress\":\"{{gatewayIpAddress}}\",\"vlanName\":\"{{network-name}}\",\"intfDescription\":\"{{network-name}}\",\"mtu\":\"{{mtu}}\",\"enableL3OnBorder\":{{enableL3OnBorder}}, \"vlanId\":\"{{vlanId}}\"}",

 

 

In this video, you are the Network manager and you have been asked to deploy dozens of networks across several nodes, and several interfaces, now. You know you can do this using the NDFC user interface and we have seen this with Module 2. NDFC is very easy to use to deploy an overlay network ...