Professional Documents
Culture Documents
s01t10 PDF
s01t10 PDF
Northbound API
Adam Radford Season 1, Talk 10
Distinguished System Engineer
@adamradford123 https://developer.cisco.com/netdevops/live
What are we going
to talk about?
• DNA Center
• Assuming some level of
familiarity
• DNA Center Platform API
• Examples:
• Lifecycle
• Webhook
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
DNA Center API
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
https://developer.cisco.com/site/dna-center-rest-api/
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Authentication request - POSTMAN
APIC-EM DNAC
Authentication POST JSON Body Basic Auth
request
Response ["response"]["serviceTicket"] ["Token"]
Roles:
Make network changes
Read only role
Make Assurance changes
Able to make all changes
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Day 0
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Automate Onboarding Rules
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Examples
./10_add_and_claim.py work_files/bigtest.csv
./12_delete.py 12345678910
./12_delete.py work_files/bigtest.csv
https://github.com/CiscoDevNet/DNAC-onboarding-tools
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Notes
• No current way to upload an .xls of template variables for PnP
provisioning rules, hence use API
• Composite templates are not supported for PnP
• Day 0 is typically a bootstrap config, pretty common across all
devices in all locations, but can be more specific. Operational
choice.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
PNP API Summary
Endpoint Verb Description
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Day 1
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Examples
./template.py
./template.py --help
https://github.com/CiscoDevNet/DNAC-TemplateProgrammer
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NOTES
• All templates are versioned. Need to save && Commit. (There is API
for this)
• Semantics of "forcePushTemplate". Default is NOT to re-apply a
template with same variables.
• Default provisioning behavior is to apply a single (or nested template)
to a device. Also includes site specific settings (aaa, ntp etc). API
just pushes template to device(s)
• Multiple device requires unique parameters for template (can
duplicate)
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Template API Summary
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Day 2
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Examples
./assurance.py
./assurance.py --raw
./assurnace.py --timestamp <epoc>
https://github.com/CiscoDevNet/DNAC-Assurance
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Client Enrichment
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
User Enrichment
Headers:
__runsync: True
entity_type: mac_address
entity_value: c8:4c:75:68:b2:c0
https://dnac/dna/intent/api/v1/user-enrichment GET
[ { "vlanId" : "1", "port" : null
"userDetails" : { "ssid" : null, },
"id" : "C8:4C:75:68:B2:C0", "frequency" : null, "connectedDevice" : [ {
"connectionStatus" : "CONNECTED", "channel" : null, "deviceDetails" : {
"hostType" : "WIRED", "apGroup" : null, "family" : "Switches and Hubs",
"userId" : null, "location" : "Sydney/NSD5", "type" : "Cisco Catalyst 9300 Switch",
"hostName" : null, "clientConnection" : "location" : null,
"hostOs" : null, "cat_9k_1.abc.inc", "errorCode" : null,
"hostVersion" : null, "connectedDevice" : [ ], "macAddress" : "f8:7b:20:67:62:80",
"subType" : "UNKNOWN", "issueCount" : 0, "role" : "ACCESS",
"lastUpdated" : 1528484918341, "rssi" : null, "apManagerInterfaceIp" : "",
"healthScore" : [ { "avgRssi" : null, "associatedWlcIp" : "",
"healthType" : "OVERALL", "snr" : null, "bootDateTime" : "2018-01-11 14:42:26",
"reason" : "", "avgSnr" : null, "collectionStatus" : "Managed",
"score" : 10 "dataRate" : null, "interfaceCount" : "41",
}, { "txBytes" : null, "lineCardCount" : "2",
"healthType" : "ONBOARDED", "rxBytes" : null, "lineCardId" : "1cd043ef-aaf7-4b2e-b720-
"reason" : "", "dnsSuccess" : null, 7af782b98b1c, a2b2467b-1692-46d4-8c64-e1765945efc1",
"score" : 4 "dnsFailure" : null, "managementIpAddress" : "10.10.22.66",
}, { "onboarding" : { "memorySize" : "889226872",
"healthType" : "CONNECTED", "averageRunDuration" : null, "platformId" : "C9300-24UX",
"reason" : "", "maxRunDuration" : null, "reachabilityFailureReason" : "",
"score" : 6 "averageAssocDuration" : null, "reachabilityStatus" : "Reachable",
} ], "maxAssocDuration" : null, "snmpContact" NOTES:
: "",
"hostMac" : "C8:4C:75:68:B2:C0", "averageAuthDuration" : null, "snmpLocation"Synchronous
: "", execution with header
"hostIpV4" : "10.10.22.98", "maxAuthDuration" : null, <cont>
"hostIpV6" : [ ], "averageDhcpDuration" : null,
__runsync
"authType" : null, "maxDhcpDuration" : null, Entity_type can be mac_address or
<cont> "aaaServerIp" : null, network_user_id
"dhcpServerIp" : null,
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Notes
• Be aware of __runsync == "true", otherwise need to GET result
• Header, not query param.
• Timestamp is in milli-epoch (divide by 1000 to get epoch seconds)
• Finite history for data (default 7 days)
• User Enrichment API use headers, not query param for mac_address
etc
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Assurance API Summary
Endpoint Verb Description
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Day N
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Examples
./list_images.py
https://github.com/CiscoDevNet/DNAC-Assurance
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Notes
• SWIM application can only upgrade to "golden image" by default.
Can specify golden images for site/role.
• SWIM events (Golden Image compliance) available as "event"
• Need to re-sync for DNA-Center to show device upgraded
• Default resync interval is 25mins
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
SWIM API Summary
Endpoint Verb Description
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
DNA Center Platform ITSM Integration Overview
Northbound
Rest API application
Analytics app
CSV
DaaS Tableau
PDF BI, Reporting app
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Polling vs Notification
Polling (Pull) Notification (Push)
request
response subscription
30sec
request
DNA
DNA response Center
Center Application Application
30sec
request
event response
response
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Available via Webhook
• SWIM compliance - generic
• Issues - generic
• SNOW Integration
• CMBD
• SWIM
• Issues
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
What did we Talk
about?
• DNA Center
• Device Lifecycle Augmented
via API
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Webinar Resource List
• Docs and Links
• https://developer.cisco.com/site/dna-center-rest-api/
• https://blogs.cisco.com/tag/dna-center
• Learning Labs
• Laptop Setup http://cs.co/lab-dev-setup
• DNA Center Learning Labs http://cs.co/lab-dnacenter
• DevNet Sandboxes
• DNA Center Always On http://cs.co/sbx-dnac-ao & https://sandboxdnac.cisco.com
• Code Samples
• http://cs.co/code-dnacenter
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
NetDevOps Live! Code Exchange Challenge
developer.cisco.com/codeexchange
Build a Python script that
leverages one of the DNA Center
APIs.
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Looking for more about NetDevOps?
• NetDevOps on DevNet
developer.cisco.com/netdevops
• NetDevOps Live!
developer.cisco.com/netdevops/live
• NetDevOps Blogs
blogs.cisco.com/tag/netdevops
• Network Programmability Basics Video Course
developer.cisco.com/video/net-prog-basics/
© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public
Got more questions? Stay in touch!