devnet workshop best rest in openstack · devnet workshop – best rest in openstack charles eckel,...

19

Upload: vanthu

Post on 22-Jul-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

DevNet Workshop –Best REST in OpenStack

Charles Eckel, Open Source Developer Evangelist, @eckelcu

Vikram Hosakote, Sr. Software Engineer

DEVNET-2004

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco Spark

Questions? Use Cisco Spark to communicate with the speaker after the session

1. Find this session in the Cisco Live Mobile App

2. Click “Join the Discussion”

3. Install Spark or go directly to the space

4. Enter messages/questions in the space

How

cs.co/ciscolivebot#DEVNET-2004

• What are REST APIs?

• How do REST APIs work in OpenStack?

• Using APIs to create virtual objects (network, subnet, router, virtual machine)

• Q&A

Agenda

What are REST APIs?

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

REpresentational State Transfer (REST) APIs

Any state needed to handle request is contained in request itself, as part of the URI, query-string parameters, body, or headers

Endpoint - 192.168.20.3:9696/v1/person/1234/details

Returned JSON:

{

‘FirstName’ : ‘Vikram’,

‘LastName’ : ‘Hosakote’,

‘Company’ : ‘Cisco Systems’,

‘City’ : ‘Boston’,

‘Team’ : ‘Cloud and Data center’

}

DEVNET-2004 6

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Types of REST Requests

Methods (HTTP verbs):

• POST (create)

• GET (read)

• PUT (update/replace)

• PATCH (update/modify)

• DELETE (delete)

DEVNET-2004 7

How do REST APIs work in OpenStack?

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

REST APIs in OpenStack

DEVNET-2004 9

Using APIs to create virtual objects (network, port, virtual machine, router)

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

OpenStack virtual objects

• Network (neutron)

• Subnet (neutron)

• Router (neutron)

• Virtual Machine (nova)

DEVNET-2004 11

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

OpenStack virtual objects

When we create each virtual object, we will:

• Check the output in the OpenStack GUI (horizon)

• Analyze the captured REST API packet (HTTP) in WireShark

DEVNET-2004 12

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Useful OpenStack REST API links

• Neutron:

• https://docs.openstack.org/user-guide/sdk-neutron-apis.html

• https://docs.openstack.org/developer/python-neutronclient/usage/library.html

• https://github.com/openstack/python-neutronclient/blob/master/doc/source/usage/library.rst

• Nova:

• https://docs.openstack.org/developer/python-novaclient/api.html

• https://docs.openstack.org/developer/python-novaclient/ref/v2/servers.html

• https://docs.openstack.org/developer/python-novaclient/ref/v2/quotas.html

DEVNET-2004 13

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Useful OpenStack REST API links

• Workshop steps:

https://github.com/vhosakot/Cisco-Live-Workshop/blob/master/best-

rest/scripts/steps.RST

• Script/library used in the workshop:

https://github.com/vhosakot/Cisco-Live-Workshop/blob/master/best-

rest/scripts/api_setup.py

DEVNET-2004 14

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Cisco Spark

Questions? Use Cisco Spark to communicate with the speaker after the session

1. Find this session in the Cisco Live Mobile App

2. Click “Join the Discussion”

3. Install Spark or go directly to the space

4. Enter messages/questions in the space

How

cs.co/ciscolivebot#DEVNET-2004

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

• Please complete your Online Session Evaluations after each session

• Complete 4 Session Evaluations & the Overall Conference Evaluation (available from Thursday) to receive your Cisco Live T-shirt

• All surveys can be completed via the Cisco Live Mobile App or the Communication Stations

Don’t forget: Cisco Live sessions will be available for viewing on-demand after the event at www.ciscolive.com/global/on-demand-library/.

Complete Your Online Session Evaluation

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public

Continue Your Education

• Become a DevNet Member:

• https://developer.cisco.com/join

• Access OpenStack resources

• https://developer.cisco.com/site/openstack/

• Visit our Open Source Dev Center:

• https://developer.cisco.com/site/opensource/

DEVNET-2004 17

Thank you