The DevNet Zone and Learning APIC-EM Brett Tiller - Developer Evangelist Agenda • Introduction to DevNet • DevNet Zone: Cisco Live Las Vegas • Learning APIC-EM • Digging into the Learning Labs • Q&A DevNet Introduction What is DevNet? Vibrant Developer Ecosystem Developer as the customer Catalyze & Accelerate Digitization DevNet is Cisco’s Developer Community and Innovation Ecosystem Cisco’s portfolio as a Platform for Innovation IoT SDN Cloud Collaboration Security Data Center DevOps Service Open Source © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Learning Labs Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 5 Sandboxes https://developer.cisco.com/site/devnet/sandbox/ Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 6 DevNet Zone: Cisco Live Las Vegas First DevNet Zone at Cisco Live US – May 2014 • Developer Education: 7,000 DevNet learning labs reviewed • Technology Showcase: 52 Theater presentations and demo pods with over 2000 attendees • 24 Hour Hackathon with over 100 participants • Press Review: Information Week rated two of the DevNet Zone activities in the “Seven Best Scenes at Cisco Live” © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public The DevNet Zone Approach • Play and Learn! • Work Shops • Technical Support • Engineering Death Match! • Demo Booths • Happy Hour! • Technology Presentations • Dueling Pianos! • Panel Discussions • Beer! • Classrooms Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 9 DevNet Zone Preview Classroom 2 In addition to learning, come see us for: • Hive Sculpture • Dueling Pianos during happy hour • Under the Hood • Engineering Deathmatch • And more! Classroom 1 Innovation Center Theater Learning Labs Hive Sculpture Work Shops Info Desk Dueling Piano Engineering Deathmatch Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 10 Free Events Before Cisco Live Get to Vegas Early! DevNet Springboard Event DevNet Hackathon • Concentrated two day event • Traditional two day Hackathon • Learn about network programmability and the interfaces needed to manage your network controllers and devices • Develop collaboration solutions incorporating Cisco technology and some 3rd party technologies too • Dive into APIC-EM, YANG data modeling, and RESTConf/NETConf protocols • Jump into Spark, Tropo, Shipped, and more • Prizes awarded • Help save the world’s honey bee population • Put what you learn into practice using network simulation platforms, learning labs and tools Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 11 DevNet Women in Tech Before and During Cisco Live! • Free Women-in-Tech Do’ers Workshop: July 10th Register for the DevNet Women in Tech Coffee Reception • Takes place before Cisco Live begins • Tuesday, July 12th at 7:30 am • For men and women that have never coded before, might be rusty, or a software coder that wants to take it to the next level • Session ID: DevNet-1213 • Learn More: https://developer.cisco.com/site/wome n-in-tech/ • Join the DevNet Women in Tech Online Community Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 12 Learning APIC-EM Digital Network Architecture © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public APIC-EM © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Put these URLs in a text document https://learninglabs.cisco.com https://sandboxapic.cisco.com:9443 https://github.com/CiscoDevNet http://www.python.org http://www.getpostman.com http://www.git-scm.com 17 © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Follow along with the Learning Lab https://learninglabs.cisco.com • Login with DevNet/Cisco.com ID • • Coding 101 Lab – REST Basics Coding 102 Lab - Calling REST APIs with Pythons • How to Set up Your Own Computer © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 18 So what is a REST Web Service? What is a Web Service? – A way for two systems to communicate through a defined interface. – Two major types of Web Services – REST or SOAP What is a REST Web Service? – REST is an architecture style for designing networked applications. – A REST web service is a web service that is as easy to call as making an HTTP request. – RESTful interfaces often offer the CRUD operations © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 19 What is so great about REST? Easy to use: • In mobile apps • In console apps • In web apps Cisco APIC-EM REST APIs • • • • Hosts Devices Users + more How does this work? © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 20 How does this work? Request 3rd Party App Response Get Hosts 3rd Party App List of Hosts © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 8 APIC-EM Example: Get Host Application Policy Infrastructure Controller (APIC) Enterprise Module (EM) GET http://{APIC-EMController}/api/v1/host 3rd Party App Request List of Hosts returned in JSON Response © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 22 Anatomy of a REST Request Method – GET, POST, PUT, DELETE URL – Example: http://{APIC-EMController}/api/v1/host Authentication – Basic HTTP, OAuth, none, Custom Custom Headers – HTTP Headers – Example: Content-Type: application/json Request Body – JSON or XML containing data needed to complete request © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 23 And what is in the Response? HTTP Status Codes – http://www.w3.org/Protocols/HTTP/HTRESP.html – 200 OK – 201 Created – 500 Internal Error Headers Body – JSON – XML © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 24 Using the API Reference Documentation © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Demo © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Create a ticket method url Request body 27 © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Ticket Returned in Response Body Request body (save this) 28 © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Use ticket in header in following calls Header Ticket 29 © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public method – Using Postman url REST Demo Response body © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 30 REST Demo – Using Postman Get Hosts – Method: GET – Headers: ‘X-Auth-Token’ (insert your ticket value) – URL: http://<APIC-EMController>/api/v1/host Get Devices – Method: GET – Headers: ‘X-Auth-Token’ (insert your ticket value) – URL: http://<APIC-EMController>/api/v1/network-device Get Users – Method: GET – Headers: ‘X-Auth-Token’ (insert your ticket value) – URL: http://<APIC-EMController>/api/v1/user © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 31 APIC-EM w/Python © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public First REST call from Python Source code file: create-ticket.py import requests import json url = 'https://sandboxapic.cisco.com:9443/api/v1/ticket’ payload = {"username":"admin","password":"C!sc0123"} header = {"content-type": "application/json”} response= requests.post(url,data=json.dumps(payload), headers=header, verify=False) print(response.text) © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 33 Coding-102-REST-python-ga Examples • create-ticket.py • • get-network-hosts.py • • returns links of hosts get-network-devices.py • • simple example to create ticket for authentication returns list of network devices manage-users.py • add and delete user © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 34 Functions group tasks together and make the code: • Reusable. • Easier to maintain • Easier to read def function-name(Parameter list): statements, i.e. the function body © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 35 Where to go from here? Network Programmability Springboard https://learninglabs.cisco.com/springboards developer.cisco.com Youtube Videos Cisco DevNet Github © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Labs to Do https://learninglabs.cisco.com • Coding 101- REST Basics • Coding 102 – Calling REST APIs from Python • Optional: APIC-EM APIs with Python 37 © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public Digging into the Learning Labs Learning Labs • https://learninglabs.cisco.com/ Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 39 Q & A?????????? Related Links • DevNet Hackathon: http://hackathon.cisco.com/event/hackathon-LasVegas-2016 • DevNet Springboard: http://hackathon.cisco.com/event/springboard-LasVegas2016 • DevNet Women in Tech: https://developer.cisco.com/site/women-in-tech/ • Sign up to receive Women in Tech updates • Get the latest DevNet Zone information on activities and sessions: http://www.ciscolive.com/us/activities/devnet-zone/ • Go Under the Hood with Cisco DevNet: www.cisco.com/go/underthehood Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 41 Thank you Technology Panel Discussions Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 44 Technology Presentations Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 45 Sneak Peek at the DevNet Zone at Cisco Live HINT: It’s all the buzz… For more on APIC-EM (classrooms and workshops) look for: • DevNet-2003: Coding 102 – REST API Basics using APIC-EM • DevNet-2034: Coding for Network Controllers – APIC-EM • DevNet-2036: APIC-EM API Deep Dive • DevNet-2037: APIC-EM API Hands-on Workshop Presentation ID © 2016 Cisco and/or its affiliates. All rights reserved. Cisco Public 48 Coding 101: REST Basics Coding 102: Calling REST APIs from Python Coding 201: Parsing XML Coding 202: Parsing JSON Coding 204: Reading data from a file using Python Coding 205: Writing data to a file using Python Coding 206: How to use the Python logging module Coding 207: Python - Putting it all together. DevNet Coding Skills Coding 101 - 207