Cisco Nexus 1000V for KVM OpenStack REST API Configuration Guide, Release 5.x First Published: August 01, 2014 Americas Headquarters Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA http://www.cisco.com Tel: 408 526-4000 800 553-NETS (6387) Fax: 408 527-0883
THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS. THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED WITH THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED WARRANTY, CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY. The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB's public domain version of the UNIX operating system. All rights reserved. Copyright 1981, Regents of the University of California. NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED AS IS" WITH ALL FAULTS. CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental. Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL: http:// www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R) 2014 Cisco Systems, Inc. All rights reserved.
CONTENTS Preface Preface v Audience v Document Conventions v Related Documentation for Cisco Nexus 1000V for KVM Software vi Documentation Feedback vii Obtaining Documentation and Submitting a Service Request vii CHAPTER 1 Overview 1 Information About the Cisco Nexus 1000V OpenStack REST API 1 Finding Supported OpenStack Resource Names 2 List of Available OpenStack Resource Names for the Cisco Nexus 1000V 2 CHAPTER 2 Cisco Nexus 1000V OpenStack API Functions 5 Get the List of Policy Profiles 5 Get Information About a Policy Profile 6 Create a Network Profile 8 Get a List of Network Profiles 9 Get Information About a Network Profile 10 Update a Network Profile 12 Delete a Network Profile 13 Create a Network 14 Create a Port 16 iii
Contents iv
Preface This preface contains the following sections: Audience, page v Document Conventions, page v Related Documentation for Cisco Nexus 1000V for KVM Software, page vi Documentation Feedback, page vii Obtaining Documentation and Submitting a Service Request, page vii Audience This publication is for network administrators who configure and maintain Cisco Nexus devices. Document Conventions Command descriptions use the following conventions: Convention bold Bold text indicates the commands and keywords that you enter literally as shown. Italic Italic text indicates arguments for which the user supplies the values. [x] Square brackets enclose an optional element (keyword or argument). [x y] Square brackets enclosing keywords or arguments separated by a vertical bar indicate an optional choice. x y Braces enclosing keywords or arguments separated by a vertical bar indicate a required choice. v
Related Documentation for Cisco Nexus 1000V for KVM Software Preface Convention [x y z] variable string Nested set of square brackets or braces indicate optional or required choices within optional or required elements. Braces and a vertical bar within square brackets indicate a required choice within an optional element. Indicates a variable for which you supply values, in context where italics cannot be used. A nonquoted set of characters. Do not use quotation marks around the string or the string will include the quotation marks. Examples use the following conventions: Convention screen font boldface screen font italic screen font < > [ ]!, # Terminal sessions and information the switch displays are in screen font. Information you must enter is in boldface screen font. Arguments for which you supply values are in italic screen font. Nonprinting characters, such as passwords, are in angle brackets. Default responses to system prompts are in square brackets. An exclamation point (!) or a pound sign (#) at the beginning of a line of code indicates a comment line. This document uses the following conventions: Note Means reader take note. Notes contain helpful suggestions or references to material not covered in the manual. Caution Means reader be careful. In this situation, you might do something that could result in equipment damage or loss of data. Related Documentation for Cisco Nexus 1000V for KVM Software This section lists the documents used with the Cisco Nexus 1000V for KVM software: vi
Preface Documentation Feedback General Information Cisco Nexus 1000V for KVM Release Notes Install and Upgrade Cisco Nexus 1000V for KVM Software Installation Guide Configuration Guides Cisco Nexus 1000V for KVM High-Availability Configuration Guide Cisco Nexus 1000V for KVM Interface Configuration Guide Cisco Nexus 1000V for KVM Layer 2 Configuration Guide Cisco Nexus 1000V for KVM License Configuration Guide Cisco Nexus 1000V for KVM Virtual Network Configuration Guide Cisco Nexus 1000V for KVM Port Profile Configuration Guide Cisco Nexus 1000V for KVM REST API Configuration Guide Cisco Nexus 1000V for KVM Security Configuration Guide Cisco Nexus 1000V for KVM System Management Configuration Guide Cisco Nexus 1000V for KVM Verified Scalability Guide Cisco Nexus 1000V for KVM VXLAN Configuration Guide Reference Guides Cisco Nexus 1000V for KVM Command Reference Cisco Nexus 1000V for KVM OpenStack REST API Reference Troubleshooting and Alerts Cisco Nexus 1000V for KVM Troubleshooting Guide Documentation Feedback To provide technical feedback on this document, or to report an error or omission, please send your comments to: We appreciate your feedback. Obtaining Documentation and Submitting a Service Request For information on obtaining documentation, using the Cisco Bug Search Tool (BST), submitting a service request, and gathering additional information, see What's New in Cisco Product Documentation, at: http:// www.cisco.com/c/en/us/td/docs/general/whatsnew/whatsnew.html. Subscribe to What's New in Cisco Product Documentation, which lists all new and revised Cisco technical documentation, as an RSS feed and deliver content directly to your desktop using a reader application. The RSS feeds are a free service. vii
Obtaining Documentation and Submitting a Service Request Preface viii
CHAPTER 1 Overview This chapter contains the following sections: Information About the Cisco Nexus 1000V OpenStack REST API, page 1 Finding Supported OpenStack Resource Names, page 2 List of Available OpenStack Resource Names for the Cisco Nexus 1000V, page 2 Information About the Cisco Nexus 1000V OpenStack REST API Note OpenStack supports configuring all of the core Neutron resources, such as the network, subnet, and port, by using the REST APIs. The Cisco plug-in for OpenStack supports all of these core resources and also the resources that Cisco added to support Nexus 1000v, such as cisco-network-profile and cisco-policy-profile. Accessing the core OpenStack resources through the REST APIs is thoroughly documented on the OpenStack Website. This document describes the resources that Cisco newly added or extended. The REST APIs can be accessed by using a Web browser or using the curl tool. Accessing the REST APIs for OpenStack is a two step process. You must authenticate with the Keystone service and obtain an authorization token. You use this token with the curl command to access the Neutron resources. To authenticate with the Keystone service: curl -k -X 'POST' -v http://controller s_public_ip:keystone s_public_port/v2.0/tokens \ -d '"auth":"passwordcredentials":"username": "username", "password":"password", \ "tenantid":"tenant-id"' -H 'Content-type: application/json' To request access to the Neutron resources: curl -H "X-Auth-Token:Token" \ http://controller's_public_port:neutron's_public_port/v2.0/networks The following example authenticates with the Keystone service and fetches all of the networks configured on Neutron in JSON format: $ curl -k -X 'POST' -v http://192.168.10.25:5000/v2.0/tokens -d \ '"auth":"passwordcredentials":"username": "admin", "password":"pw1", \ 1
Finding Supported OpenStack Resource Names Overview "tenantid":"36c7867df9d24ab38fef45475a0a0c17"' -H 'Content-type: application/json' $ curl -H "X-Auth-Token: 5788dc57e14036c7867df9d24ab38fef45475a0" \ -X GET http://192.168.10.25:9696/v2.0/networks "networks": [ "status": "ACTIVE", "subnets": [], "name": "extnet", "provider:physical_network": "net1", "admin_state_up": true, "tenant_id": "36c7867df9d24ab38fef45475a0a0c17", "provider:network_type": "vlan", "router:external": true, "n1kv:profile_id": "cb027858-d3e7-4c73-a631-5788dc57e140", "shared": false, "id": "081e4573-2cf5-4abc-97a4-cb4860e642e4", "provider:segmentation_id": 14 ] Finding Supported OpenStack Resource Names Every OpenStack REST API function is associated with a resource name To find the list of Cisco Nexus 1000V OpenStack resource names, use the following command: curl -H "X-Auth-Token:Authorization_token" -X GET http://172.23.231.25:9696/v2.0/ You get the following output: "resources": [ "links": ["href": "http://172.23.231.25:9696/v2.0/subnets", "rel": "self"], "name": "subnet", "collection": "subnets", "links": ["href": "http://172.23.231.25:9696/v2.0/networks", "rel": "self"], "name": "network", "collection": "networks", "links": ["href": "http://172.23.231.25:9696/v2.0/ports", "rel": "self"], "name": "port", "collection": "ports" ] List of Available OpenStack Resource Names for the Cisco Nexus 1000V Table 1: Available Resource Names Namespace cisco-policy-profile-list cisco-policy-profile-show cisco-network-profile-create Retrieves the list of policy profiles of a Cisco Nexus 1000V switch. Retrieves information about a port profile of a Cisco Nexus 1000V switch. Creates a network profile on a Cisco Nexus 1000V switch. 2
Overview List of Available OpenStack Resource Names for the Cisco Nexus 1000V Namespace cisco-network-profile-list cisco-network-profile-show cisco-network-profile-update cisco-network-profile-delete net-create port-create Retrieves a list of network profiles from a Cisco Nexus 1000V switch. Gets information about a network profile on a Cisco Nexus 1000V switch. Updates a network profile on a Cisco Nexus 1000V switch. Deletes a network profile from a Cisco Nexus 1000V switch. Creates a network on a Cisco Nexus 1000V switch. Creates a port on a Cisco Nexus 1000V switch. 3
List of Available OpenStack Resource Names for the Cisco Nexus 1000V Overview 4
CHAPTER 2 Cisco Nexus 1000V OpenStack API Functions This chapter provides information about the Cisco Nexus 1000V OpenStack application programming interface (API) functions. The Cisco Nexus 1000V resource name is generic across all hypervisors. The functions that support write (create, update, and delete) operations are explicitly marked as writeable. All others are read-only functions. The chapter contains the following topics: Get the List of Policy Profiles, page 5 Get Information About a Policy Profile, page 6 Create a Network Profile, page 8 Get a List of Network Profiles, page 9 Get Information About a Network Profile, page 10 Update a Network Profile, page 12 Delete a Network Profile, page 13 Create a Network, page 14 Create a Port, page 16 Get the List of Policy Profiles Name cisco-policy-profile-list Retrieves the list of policy profiles from a Cisco Nexus 1000V switch. Type Request 5
Get Information About a Policy Profile Cisco Nexus 1000V OpenStack API Functions Response Format JSON Accept Header application/json Verb and URI GET /v2.0/policy_profiles.json User Agent python-neutronclient Response Sample "date": "Fri, 13 Sep 2013 00:29:06 GMT", "status": "200", "content-length": "84", "content-type": "application/json; charset=utf-8", "content-location": "http://172.23.180.45:9696/v2.0/policy_profiles.json" "policy_profiles": [ "id": "452788f5-109d-4963-9153-1c5b181c8a0d", "name": "pp1" ] Response Property content-location id name or Get Information About a Policy Profile Name cisco-policy-profile-show Retrieves information about a policy profile from a Cisco Nexus 1000V switch. 6
Cisco Nexus 1000V OpenStack API Functions Get Information About a Policy Profile Type Request Response Format JSON Accept Header application/json Verb and URI GET /v2.0/policy_profiles/452788f5-109d-4963-9153-1c5b181c8a0d.json Note Retrieve the policy profile ID as shown in Get the List of Policy Profiles, on page 5, specifying the profile name in the command line. For example: GET /v2.0/policy_profiles.json?fields=id&name=pp1. User Agent python-neutronclient Response Sample "date": "Fri, 13 Sep 2013 00:33:32 GMT", "status": "200", "content-length": "81", "content-type": "application/json; charset=utf-8", "content-location": "http://172.23.180.45:9696/v2.0/policy_profiles/452788f5-109d-4963-9153-1c5b181c8a0d.json" "policy_profile": "id": "452788f5-109d-4963-9153-1c5b181c8a0d", "name": "pp1" Response Property content-location id name or 7
Create a Network Profile Cisco Nexus 1000V OpenStack API Functions Create a Network Profile Name cisco-network-profile-create Creates a network profile on a Cisco Nexus 1000V switch. Type Request Response Format JSON Accept Header application/json Verb and URI POST /v2.0/network_profiles.json User Agent python-neutronclient Response Sample "network_profile": "segment_range": "100-200", "segment_type": "vlan", "physical_network": "physnet1", "name": "VlanNetProf" "date": "Fri, 13 Sep 2013 00:57:15 GMT", "status": "201", "content-length": "220", "content-type": "application/json; charset=utf-8" "network_profile": "segment_range": "100-200", "segment_type": "vlan", "name": "VlanNetProf", "sub_type": null, "physical_network": "physnet1", "id": "58f722ca-489c-4abf-b74f-7bcc2e988d89", "multicast_ip_range": null 8
Cisco Nexus 1000V OpenStack API Functions Get a List of Network Profiles Response Property segment_range segment_type name sub_type physical_network id multicast_ip_range or Get a List of Network Profiles Name cisco-network-profile-list Retrieves a list of network profiles from a Cisco Nexus 1000V switch. Type Request Response Format JSON Accept Header application/json Verb and URI GET /v2.0/network_profiles.json User Agent python-neutronclient 9
Get Information About a Network Profile Cisco Nexus 1000V OpenStack API Functions Response Sample "date": "Fri, 13 Sep 2013 00:59:07 GMT", "status": "200", "content-length": "223", "content-type": "application/json; charset=utf-8", "content-location": "http://172.23.180.45:9696/v2.0/network_profiles.json" "network_profiles": [ "segment_range": "100-200", "segment_type": "vlan", "name": "VlanNetProf", "sub_type": null, "physical_network": "physnet1", "id": "58f722ca-489c-4abf-b74f-7bcc2e988d89", "multicast_ip_range": null ] Response Property content-location segment_range segment_type name sub_type physical_network id multicast_ip_range or Get Information About a Network Profile Name cisco-network-profile-show Gets information about a network profile on a Cisco Nexus 1000V switch. 10
Cisco Nexus 1000V OpenStack API Functions Get Information About a Network Profile Type Request Response Format JSON Accept Header application/json Verb and URI GET /v2.0/network_profiles/58f722ca-489c-4abf-b74f-7bcc2e988d89.json Note Retrieve the network profile ID as shown in Get a List of Network Profiles, on page 9, specifying the profile name in the command line. For example: GET /v2.0/network_profiles.json?fields=id&name=vlannetprof. User Agent python-neutronclient Response Sample "date": "Fri, 13 Sep 2013 01:00:03 GMT", "status": "200", "content-length": "220", "content-type": "application/json; charset=utf-8", "content-location": "http://172.23.180.45:9696/v2.0/network_profiles/58f722ca-489c-4abf-b74f-7bcc2e988d89.json" "network_profile": "segment_range": "100-200", "segment_type": "vlan", "name": "VlanNetProf", "sub_type": null, "physical_network": "physnet1", "id": "58f722ca-489c-4abf-b74f-7bcc2e988d89", "multicast_ip_range": null Response Property content-location segment_range segment_type name or 11
Update a Network Profile Cisco Nexus 1000V OpenStack API Functions Property sub_type physical_network id multicast_ip_range or Update a Network Profile Name cisco-network-profile-update Updates a network profile on a Cisco Nexus 1000V switch. Type Request Response Format JSON Accept Header application/json Verb and URI PUT /v2.0/network_profiles/27d1d0a0-f4fa-462a-977f-4a92cd206616.json Note Retrieve the network profile ID as shown in Get a List of Network Profiles, on page 9, specifying the profile name in the command line. For example: GET /v2.0/network_profiles.json?fields=id&name=vmnp2. User Agent python-neutronclient Response Sample "network_profile": "name": "vmnp2" 12
Cisco Nexus 1000V OpenStack API Functions Delete a Network Profile "date": " Mon, 28 Oct 2013 14:56:29 GMT", "status": "200", "content-length": "208", "content-type": "application/json; charset=utf-8" "network_profile": "segment_range": "700-705", "segment_type": "vlan", "name": "VlanNetProf", "sub_type": null, "physical_network": "p1", "id": "58f722ca-489c-4abf-b74f-7bcc2e988d89", "multicast_ip_range": null Response Property segment_range segment_type name sub_type physical_network id multicast_ip_range or Delete a Network Profile Name cisco-network-profile-delete Deletes a network profile from a Cisco Nexus 1000V switch. Type Request 13
Create a Network Cisco Nexus 1000V OpenStack API Functions Response Format JSON Accept Header application/json Verb and URI DELETE /v2.0/network_profiles/58f722ca-489c-4abf-b74f-7bcc2e988d89.json Note Retrieve the network profile ID as shown in Get a List of Network Profiles, on page 9, specifying the profile name in the command line. For example: GET /v2.0/network_profiles.json?fields=id&name=vlannetprof. User Agent python-neutronclient Response Sample "date": "Fri, 13 Sep 2013 01:02:01 GMT", "status": "204", "content-length": "0" Response Property content-length or Create a Network Name net-create Creates a network on a Cisco Nexus 1000V switch. Type Request Response Format JSON 14
Cisco Nexus 1000V OpenStack API Functions Create a Network Accept Header application/json Verb and URI POST /v2.0/networks.json User Agent python-neutronclient Response Sample "network": "n1kv:profile_id": "89b77e10-d363-4ee7-81b8-3e3e9ced5b08", "name": "VlanNet1", "admin_state_up": true "date": "Fri, 13 Sep 2013 01:05:57 GMT", "status": "201", "content-length": "396", "content-type": "application/json; charset=utf-8" "network": "status": "ACTIVE", "subnets": [], "name": "VlanNet1", "provider:physical_network": "physnet1", "admin_state_up": true, "tenant_id": "4e56ea94b54442bab13dafcec9f52ebe", "provider:network_type": "vlan", "router:external": false, "n1kv:profile_id": "89b77e10-d363-4ee7-81b8-3e3e9ced5b08", "shared": false, "id": "036a0a93-d7ef-4920-8ea1-bfe813aa21f4", "provider:segmentation_id": 100 Response Property status subnets name provider:physical_network admin_state_up tenant_id provider:network_type or 15
Create a Port Cisco Nexus 1000V OpenStack API Functions Property router:external n1kv:profile_id shared id provider:segmentation_id or Create a Port Name port-create Creates a port on a Cisco Nexus 1000V switch. Type Request Response Format JSON Accept Header application/json Verb and URI GET /v2.0/networks.json?fields=id&name=vlannet1 User Agent python-neutronclient Response Sample "date": "Fri, 13 Sep 2013 01:10:14 GMT", "status": "200", "content-length": "62", "content-type": "application/json; charset=utf-8", "content-location": "http://172.23.180.45:9696/v2.0/networks.json?fields=id&name=vlannet1" "networks": [ 16
Cisco Nexus 1000V OpenStack API Functions Create a Port "id": "036a0a93-d7ef-4920-8ea1-bfe813aa21f4" ] Response Property content-location id or Type Request Response Format JSON Accept Header application/json Verb and URI POST /v2.0/ports.json User Agent python-neutronclient Response Sample "port": "network_id": "036a0a93-d7ef-4920-8ea1-bfe813aa21f4", "n1kv:profile_id": "452788f5-109d-4963-9153-1c5b181c8a0d", "admin_state_up": true "date": "Fri, 13 Sep 2013 01:10:14 GMT", "status": "201", "content-length": "472", "content-type": "application/json; charset=utf-8" "port": "status": "ACTIVE", "name": "", "admin_state_up": true, "network_id": "036a0a93-d7ef-4920-8ea1-bfe813aa21f4", "tenant_id": "4e56ea94b54442bab13dafcec9f52ebe", "binding:vif_type": "ovs", "device_owner": "", "n1kv:profile_id": "452788f5-109d-4963-9153-1c5b181c8a0d", "mac_address": "fa:16:3e:0a:b8:ca", "fixed_ips": [ 17
Create a Port Cisco Nexus 1000V OpenStack API Functions "subnet_id": "9244aacc-8d0c-4fbd-8811-6f023cf8288a", "ip_address": "10.10.10.3" ], "id": "e94ad622-eda7-4030-83dd-303bff7a557a", "device_id": "" Response Property name admin_state_up network_id tenant_id binding:vif_type device_owner n1kv:profile_id mac_address subnet_id ip_address id device_id or 18