devnet-1166open sdn controller apis
TRANSCRIPT
Cisco Open SDN Controller APIsRaghurama Bhat – Principal Engineer
3© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
• Introduction
• Model Driven APIs
• RESTCONF
• Inventory
• Topology
• Openflow
• Demo
• Developer support
• Additional Resources
Agenda
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
The Cisco Open SDN Controller
• Based on OpenDaylight Helium
• Packaged as a Virtual Machine
• Key MD-SAL features pre-installed• OpenFlow, NETCONF/YANG, BGP/PCEP, etc.
• Integrated User Interface
• Supports single-node and 3-node cluster
• Limited Availability Release as of April 30th , 2015
• See the /dev/innovate pod here in DevNet
A commercial distribution of the OpenDaylight SDN Controller
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
• Open platform for network programmability
• Enables SDN for networks at any size and scale
• New “Helium” release delivers new user interface and a much simpler and customizable installation process
• Users can add value at any layer (Apps, Network Services, SB Plugins)
OpenDaylight Controller
Cisco Contributions
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
“Just for the YANG of it”
• YANG is a data modeling language• Documented in RFC6020• Designed to model NETCONF data (see RFC6241)
• OpenDaylight’s MD-SAL is “Model Driven Service Abstraction Layer”• “Model” == YANG Model
• OpenDaylight contains over 100 YANG models• YANG is used as our IDL
• Southbound plugins described by YANG Models• NETCONF plugin learns models from connected devices at run-time
Everything in MD-SAL is YANG modeled
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
RESTCONF
• REST protocol over HTTP
• For accessing data defined in YANG• Container or List• NOT leaf or leaf-list
• Using data stores defined in NETCONF
• YANG Modules are listed under • /restconf/<Module> in top-level API
• Data classification based on the YANG config statement
• Request and response data can be in XML or JSON format. XML has structure according to yang by XML-YANG and JSON by JSON-YANG
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
RESTCONF
• Two datastores are accessible:
• Config
• Data inserted by the Applications (REST Or Java)• /restconf/config/<Module>/<Xpath to Container>
• Operational
• State of the network elements fetched from the network• /restconf/operational/<Module>/<Xpath to Container>
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
RESTCONF URI
9
• It must start with <moduleName>:<nodeName> where <moduleName> is a name of the YANG module and <nodeName> is the name of the top level node in the module.
• Child nodes has to be specified in format:• <nodeName> - can be used every time expect case when node with the same name
was added via augmentation from external YANG model (Concretely: Module A has node A1 with child X. Module B augments node A1 by adding node X.)
• <moduleName>:<nodeName> - is valid every time
• <nodeName> has to be separated by /
• <nodeName> can represent a data node which is of list or container YANG built-in type. If the data node is a list, there must be defined keys of the list behind the data node name for example, <nodeName>/<valueOfKey1>/<valueOfKey2>.
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
OSC API Authentication scheme
10
• OSC uses a Token based authentication scheme
• Issue the following request to get a token• https://{{HOST}}/controller-auth?
grant_type=password&username={{user}}&password={{password}}&scope=sdn• Response: {"expires_in":86400000,"token_type":"Bearer","access_token":"a304e0f0-ad68-3d93-
8986-cd775f3b9949"}
• Subsequent requests need the Basic Authorization Header of the form: "token:<token>”
• Here is a fragment of Javascript to automate the processvar data = JSON.parse(responseBody);postman.setGlobalVariable("token", data.access_token);var creds = btoa("token:" + data.access_token);postman.setGlobalVariable("Authorization", "Basic " + creds);
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Open SDN Controller YANG Models/APIs
• Inventory
• Topology
• Openflow• Flow programming via Openflow Plugin RPC• Flow programming via Config Inventory
• BGP
• PCEP
• Any Additional Plugins
• Mounted NETCONF Devices
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 12
Inventory
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 13
Topology
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 14
OpenFlow Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 15
Open Flow Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 16
This example provides the details to program a flow that matches Ethernet packets with source MAC address 00:00:00:00:23:ae and destination MAC address 20:14:29:01:19:61 and sends them to port 2.
• Headers:• Content-type: application/xml
• Accept: application/xml
• Authentication: admin:admin
• URL: http://<controller-ip>:8181/restconf/config/opendaylight-inventory:nodes/node/{node-id}/table/{table-id}/flow/{flow-id}
• Example URL: http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1
• Method: PUT
L2 Flow Programming Sample
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 17
This example provides the details for programming a flow that matches IP packets (ethertype 0x800) with the destination address within the 10.0.10.0/24 subnet and sends them to port 1.
• Headers:• Content-type: application/xml
• Accept: application/xml
• Authentication: admin:admin
• URL: http://<controller-ip>:8181/restconf/config/opendaylight-inventory:nodes/node/{node-id}/table/{table-id}/flow/{flow-id}
• Example URL: http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/1
• Method: PUT
L3 Flow Programming Sample
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
18
REST APIs
RESTCONF APIs
For checking configuration and operational states
List of exposed Northbound APIs available via DevNet
and on platform
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
JAVA APIs
19
JAVA APIsFor network services
creation; event listening, specifications and
forming patterns
SAL Binding, Common, Connector and Core
APIs provided
List of exposed JAVA APIs available via
DevNet
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Java apps inside Cisco Open SDN Controller
• The controller creates Java APIs from YANG models at run-time• YANG model maps to Java classes (class per container, list, typedef etc.)
• Java APIs designed for performance• DTOs are immutable (write once/read many)• APIs are asynchronous (no need to spawn a thread to wait for each data item)
• Apps packaged as Karaf features• .kar files in the controller’s “deploy” directory will auto-install
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 21
The Tools
• A text editor, preferably an IDE like IntelliJ IDEA or Eclipse
• YANG – Modeling language (see RFC 6020)
• Java 1.7 – Programming language
• Maven >= 3.2.3 – Build tool
• OSGi – technology for building modular systems
• Karaf – technology for deploying and managing OSGi bundles
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Apache Karaf Container• Modular (Deploy only the
features/bundles you need)
• Hot Deployment
• Dynamic Configuration
• Powerful Extensible Shell Console + Remote Access
• Native OS Integration
• Logging
• Security Framework
• Supports any Component that can be wrapped as Jar
A:bundleB:bundle
Y:bundle
X:bundle
C:bundle
f1 f2
common
my-features.xml
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
The Service Development Process
23
YANG Model (s)
Yang Tools
Generated API
Service Implementation
Maven Build Tools
Karaf FeatureDefinition
Maven Build Tools
Maven Build Tools
1
2
3
OSGi API JAR
OSGi IMPL JAR Karaf KAR
4
Controller
5
• OSGi API JAR• OSGI IMPL JAR• Features.xml
Generate API
Deploy
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 24
Demo
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
SupportLearn / Build Validate Sell / Monetize
SDK on DevNet• Getting Started Guides• Reference Guides• Code samples• Videos• Etc
Integration Points• NB Rest APIs• Network Service JAVA APIs• OpenFlow 1.0 and 1.3
Interfaces• NetConf / YANG Interface• BGPLS Interface• PCEP Interface• OVSDB Interface
Community and Pay-As-You Go Support
Developer Sandbox
Interop Validation Testing• Application Specific Test Plans
• For Fee Testing
• Successful IVT completion allows use of Cisco Compatible logo
Solution Partner Program • Solution Marketplace listing
App Store (future)• Streamlined sales and
delivery of 3rd party apps (light-weight version of Solutions Plus program)
Mandatory Coordinated Customer Support
3rd Party Developer Enablement (DevNet Plan) Cisco Open SDN Controller Developer Lifecycle
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 26
Devnet Portal for Cisco Open SDN Controllerdeveloper.cisco.com/site/openSDN
Documentation
API Reference Guides
Video
Code samples
Sandbox environment
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
ODL/OSC Sessions in CLIVE 2015 San Diego
Thank you
28© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID