Upload
cisco-devnet
View
1.172
Download
1
Embed Size (px)
Citation preview
Using the Cisco Open SDN Controller Restconf APIs
Giles Heron – Principal Engineer
3© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
• The Cisco Open SDN Controller• YANG, and Model Driven APIs• RESTCONF• 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, logging, clustering support• Standalone node or 3-node cluster
• Limited Availability Release as of April 30th, 2015
• Various demos here at DevNet
Cisco’s 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
• Selection of southbound protocols (not just OpenFlow)
• 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 Helium contains over 300 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
YANG and XML• YANG assumes an XML encoding of instantiated information
• Defines XML rendering rules• Relies on XML encoding for certain advanced features (e.g. expression of constraints
using Xpath)• Facilitates describing XML document hierarchies• Nicely aligned with NETCONF
• YANG itself is not XML• Emphasis on readability
• Familiar structure to C/C++ or Java programmers• XML notation exists: YIN (Yang-Independent Notation)
• Semantic equivalence • Syntactic conversions YANG <-> YIN
• Alternative encodings defined (e.g. JSON for RESTconf)
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
YANG
• Data modeling language• Configuration data• State data
• Tree structure
• Data and Types
acme-box module
properties container
interfaces container
name: string, config
name: string, config
interface: list, key = name
oper-state: enum, config
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
ODL
Transport
RemoteOperations
MgmtServices
Mgmt info(encoding)
Mgmt info(definition)
XML-encoded content
YANG modules
NETCONF operations
XMLRPC
TLS,SSH
JSON JAVA DTO
I2RS
?
HTTP
RESTCONF
TCP
YANG - NETCONF, RESTCONF, I2RS & IDL
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Controller
YANG IDL – OpenDaylight MD-SAL
MD-SAL
DOM BrokerBA-BI Connector
Mapping Service
Codec Registry
Schema Service
Codec Generator
Binding-Aware Broker Data Store
Binding-Aware to Binding-Independent Data Translation
Binding-Aware PluginBinding-Independent
Plugin/Client (NETCONF/RESTCONF)
Forwarding Rules Manager, Stats Manager, BGP-LS/PCEP
RESTCONF Clients
Internal Clients
YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
RESTCONF
• REST protocol over HTTP• GET, POST, PUT, DELETE etc.
• 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• Config/state classification based on the YANG config statement• Supports XML and JSON
• “Python Programmers Against XML!”
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Resource URI Map/restconf /config /<top-level-data-nodes> (configuration data) /operational /<top-level-data-nodes> (operational data) /modules /module /name /revision /namespace /feature /deviation /operations /<custom protocol operations> /streams /stream /name /description /replay-support /replay-log-creation-time /events /version (field)
Event streams, subscribe using “get”,
can specify filters
Meta-information:Capabilities etc
Meta-information:Supported RPCs
YANG-defined
data
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
RESTCONF
• Two datastores are accessible:• Config
• /restconf/config/<Module>:<Top Level Container>/….• Operational
• /restconf/operational/<Module>:<Top Level Container>/…
• URL grows as you go down through the models• Can Access any Container or List
• Also support for RPCs• /restconf/operations/<Module>:<RPC> (HTTP POST only)
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
OSC API Authentication scheme
14
• 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
Mounting Remote DatastoresOpenDaylight Controller Config
MD-SAL
NETCONF
NETCONF
• Mounted under e.g. http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/controller-config
• Data can be accessed using …/yang-ext:mount/…
• …/yang-ext:mount/config:modules is used to configure the various plug-ins
Config Store
RESTCONF
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Mounting Remote DatastoresOpenDaylight NETCONF Node “Discovery”
MD-SAL
NETCONF
RESTCONF
Node Inventory
• Nodes added by POSTing to config:modules
• ODL connects to each node
• ODL learns capabilities (YANG modules) and stores to model cache• Cache at ~/cache/schema. Filenames of form [email protected].
Model Cache
XR1 XR2 OpenWRT
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Mounting Remote DatastoresOpenDaylight NETCONF Node Configuration
MD-SAL
NETCONF
RESTCONF
Node Inventory
• Nodes configured by POSTing or PUTting to e.g.:• http://localhost:8181/restconf/config/o
pendaylight-inventory:nodes/node/XR2/yang-ext:mount/Cisco-IOS-XR-ifmgr-cfg:interface-configurations/interface-configuration/act/Loopback0/
• Can retrieve config (or operational stats) using GET
Model Cache
XR1 XR2 OpenWRT
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID
Open SDN Controller YANG Models/APIs
• Inventory• Mounted NETCONF Devices• BGP• PCEP• Topology• OpenFlow
REST API Auto generated from the YANG Models
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 19
Demo
© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID 20
Devnet Portal for Cisco Open SDN Controllerdeveloper.cisco.com/site/openSDN
Documentation
API Reference Guides
Video
Code samples
Sandbox environment
Thank you
21© 2015 Cisco and/or its affiliates. All rights reserved. Cisco PublicPresentation ID