hybrid cloud automation using cisco cloudcenter api · hybrid cloud automation ... integration...

41

Upload: phungdat

Post on 04-Aug-2018

251 views

Category:

Documents


4 download

TRANSCRIPT

Hybrid Cloud Automation using Cisco CloudCenter API

Ray Doerr, Advanced Services Engineer

DEVNET-1651

© 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-1651

• CloudCenter Overview

• Introduction to REST API for CloudCenter

• CloudCenter automation - User and Tenant creation

• Private/Public Cloud Virtual Machine Deployment and Demo

• VMware

• OpenStack

• AWS (Amazon Web Services)

• Microsoft AzureRM

• Conclusion

Agenda

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 5DEVNET-1651

One REST-API script, Multiple Cloud Endpoints

CloudCenter

CloudCenter Overview

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

Hybrid Cloud Management with CloudCenter

Single Integrated Management Platform

Full Application Lifecycle Management

Portable Scalable Secure

Private Clouds

Datacenters

Public Clouds

Model

Manage

Deploy

DEVNET-1651 7

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

Deploy

Manage

Model

HooksScripts

Events

SecuritySSO

HSM

InfrastructureIPAM

DNS

Docker

Puppet, Chef

Components

User Content

Vendor Content

Content Integration

Tool Integration

Extendable

Cloud APIsDatacenter Private and

Public Cloud

Platform IntegrationITSM | Build Automation (Jenkins)

Secure

Multi-tenant

Extendable

Scalable

DEVNET-1651 8

Application Profile Graphical Modeler

“One Click” Deploy

Multi-Cloud Application Deployment

CloudCenter Manager Application Profile

Public

Cloud

Public

Cloud

Private

Cloud

Multi-Tier ApplicationMulti-Cloud Deployment

Introduction to REST API for CloudCenter

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12DEVNET-1651

API Overview

• CloudCenter API Version 1.0 (v1) - supports CloudCenter 3.x & 4.x

• CloudCenter API Version 2.0 (v2) - supports CloudCenter 4.6.0 and greater

• Structured responses with minimum details, provides resource links

• Improved search, sort and pagination filters

• Governance is referenced using tagIds, deployments are referenced using depEnvId, and so forth. Similarly, all other resources are referenced using the corresponding ID

• Documentation located at http://docs.cloudcenter.cisco.com/ under API

CloudCenter uses the REST API conventions below

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13DEVNET-1651

REST-API

• REST-API method (GET, POST, PUT and DELETE)

• REST-API URL consisting of:

• IP Address or Hostname of CloudCenter CCM or Load Balancer

• TCP Port that CloudCenter is listening on, defaults to 443

• REST-API resource, example: v1/users

• API Credentials (details on next slide)

• Username

• API Key

• Request Body (not required for all REST-API calls)

• JSON Data

Required Information

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14DEVNET-1651

REST-API

curl -k -X GET -H "Accept: application/json” –u cloudCenteradmin:40E45DBE57E35ECB "https://10.1.1.11:443/v1/users”

Example using curl

Or use you favorite application like Postman

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 15DEVNET-1651

API Credentials

• Select Admin->Users from the menu

• Click on “Manage API Key” for the User you want to use for API access

• From this window you should see the User Name and Key that will be required for API Access. Note: The User Name is generated by the system and not your Email address.

• You can also generate a new API Key from this window if required.

From CloudCenter GUI:

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16DEVNET-1651

API Credentials

• This is the Username and Key you will use for REST API calls

(continued)

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

Functional Groups of REST API’s

• User Management. Create/View/Update and Delete.

• Group Management. Create/View/Update and Delete.

• Tenant Management. Create/View/Update and Delete.

• Job Management, both v1 and v2. List/Submit/Stop/Resume/Suspend, etc.

• Application Management. List, Get, Delete, Export, Update(name, description and version only).

• Service Management. Create/View/Update and Delete.

• Cloud Management. Cloud Accounts, Cloud Regions, Image Mapping, Cloud Storage, etc.

• Deployment Environment. Create/View/Update and Delete.

• Inventory Management. List VM’s, Power On/Off or Reboot/Terminate VMs.

• Policy Management. Create/Enable/View/Update and Delete.

• Report Management, both v1 and v2

17DEVNET-1651

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

API Access using Python’s Request Module

18DEVNET-1651

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

JSON Output of Python Script

19DEVNET-1651

CloudCenter Automation- User and Tenant Creation

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 21DEVNET-1651

User Creation

• Create User without Activation requires:

• Authentication Credentials of Tenant Admin

• tenantId of Tenant Admin where this user will be created

URL: /v1/users

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 22DEVNET-1651

User Creation and Activation

• Create User with Activations requires:

• planId of Usage Plan to assign to this User

• contractId of Contact to assign to this User

• activateRegions, Array of regionId’s to assign to this User

URL: /v1/users

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 23DEVNET-1651

Tenant Creation

• userId is for the User that will be granted Tenant Admin for this new Tenant

• shortName is the Tenant ID you use for CloudCenter GUI login

User must already be created

Private/Public Cloud Virtual Machine Deployments

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 25DEVNET-1651

Creating a Deployment

Users

CloudsRegions

Applicati

on

Environ

ment

Policy

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 26DEVNET-1651

Get Applications

• Returns a list of Applications with Resource URL.

URL: /v1/apps

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 27DEVNET-1651

Get Application

• Gather the “id”, “metadatas” and “version”

• Collect the ”id” from serviceTiers list

• For each ServiceTier gather the Supported Clouds

URL: /v1/apps/<app-id>?version=x.y

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 28DEVNET-1651

Get Environments

• Gather the Environment “id”

• Gather ”regionId”, cloudAccountId” and “basicSettings” from the “associatedClouds” section

URL: /v1/environments

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 29DEVNET-1651

Get Supported Clouds InformationURL: /v1/apps/<app-id>/cloudConfigs/<cloud-id>

• InstanceType

• numOfCPUs

• memorySize

• localStorageSize

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 30DEVNET-1651

Get Supported Clouds Information

• URL: /v1/apps/<app-id>/cloudConfigs/<cloud-id>

• Gather the Instance details (VMware, OpenStack and AWS shown below)

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 31DEVNET-1651

VM Deployment

• Values that change per Cloud Endpoint are:

• environmentId

• cloudRegionId

• accountId

• instanceType

Common section of REST-API body for all Cloud Endpoints.

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 32DEVNET-1651

VM DeploymentJobs section of REST-API body, list to support MultiTier Apps

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 33DEVNET-1651

VM Deployment

• Here you can see the Parent Job with a single Child Job, since this was a single Tier application deployment

• Each Child Job will return the Resource URL that you can use to pool the status of that job.

Response

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 34DEVNET-1651

Polling Deployment StatusJob Status – Polling both Parent and Child Jobs

Job Submitted Job Completed

Demo

• CloudCenter Application Profile deployment using REST API

• Deploy to Private/Public Clouds

• VMware

• OpenStack

• AWS (Amazon Web Services)

• Microsoft AzureRM

© 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 36DEVNET-1651

One REST-API script, Multiple Cloud Endpoints

CloudCenter

© 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-1651

© 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 CiscoLive.com/Online.

Complete Your Online Session Evaluation

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

Continue Your Education

• Demos in the Cisco campus

• Walk-in Self-Paced Labs

• Tech Circle

• Meet the Engineer 1:1 meetings

• Related sessions

39DEVNET-1651

Thank you