DFA REST APIs for OpenStack

Introduction

This section explains how the DFA REST APIs were used to integrate OpenStack with DFA. It’s not very different from how any application can be integrated with DFA using the DFA REST APIs.

The DFA plugins that are patched into the OpenStack, implement this documented interaction between OpenStack and DFA. The following steps explain how the Project, Network and VM creations in Openstack are communicated to DFA.


Step 1 Logon to the REST API to get a security token

This step is not seen by the Project user. See Logon to get a token.

Step 2 Create a Project

This is the organization and partition in DFA schema terminology. See Create Project (organization and partition).

Step 3 Get the network config-profile list for a given Project.

This step is not seen by the Project user but these profiles will become available to the project user from a drop-down menu in Horizon during network creation. See Get Network Profile list.

Step 4 Create a network for that Project specifying one of the available network config-profiles. See Create a network for that Tenant.

Step 5 Get the network config-profile contents

This step is not see by the Project user. See Get the profile info.

Step 6 Launch the Virtual Machine.

The network config-profile contents will be sent to the OVS where the VM is attached. See Launch a VM.

Step 7 Logout. See log out.


 

Logon to get a token

https://10.77.247.111/rest/logon

POST /rest/logon

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Authorization: Basic YWRtaW46YWRtaW4xMjM=

Content-Length: 28

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

Cache-Control: no-cache

{"expirationTime": 1000000}

HTTP/1.1 200 OK

Content-Type: application/json

{ "token" : " NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ " }

Create Project (organization and partition)

The OpenStack Project name will be mapped to both Organization and Partition in DCNM.

Create an organization

http://10.77.247.111/rest/auto-config/organizations

POST /rest/auto-config/organizations

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

Cache-Control: no-cache

{

"organizationName" : "organization1",

"description" : "organization1",

"orchestrationSource" : "OpenStack Controller 5",

}

202 Accepted

Content-Type: application/json

{

"organizationName" : "organization1"

}

Create a Partition

http://10.77.247.111/rest/auto-config/organizations/organization1/partitions

POST /rest/auto-config/organizations/organization1/partitions

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

Cache-Control: no-cache

{

"partitionName": "partition1",

"description": "partition1",

"serviceNodeIpAddress": "3.3.3.3",

"organizationName": "organization1",

"dnsServer": "10.10.10.1",

"secondaryDNSServer": "20.20.20.1",

"dciId": "23",

"dciExtensionStatus": "Not Extended",

"vrfProfileName": "vrf-common-universal",

"vrfName": "organization1:partition1",

"configArg": "$vrfName=organization1:partition1;

$include_vrfSegmentId=; $include_serviceNodeIpAddress=;

$include_borderLeafRt=aa4:nn;$asn="

}

Status Code: 202 Accepted

Content-Type: application/json

{

"partitionName": "partition1"

}

The partition extension is controlled by two options (fields) in request:

enableDCIExtension
dciId
 

When disabling extension, the 'enableDCIExtension' needs to be set 'false' or 'dciId' value to be '0'. When enabling extension, the 'eanbleDCIExtension' needs to be 'true' and 'dciId' value to be non-zero.

Get Network Profile list

Using this REST API, OpenStack gets a list of network config-profiles and display them on a Horizon dashboard pull-down menu for the project user to select one when creating a network.

http://10.77.247.111/rest/auto-config/profiles

POST /rest/auto-config/profiles

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

202 Accepted

Content-Type: application/json

[

{

"profileName": "defaultNetworkUniversalTfProfile",

"profileType": "FPVLAN",

"profileSubType": "network:universal"

},

{

"profileName": "defaultNetworkUniversalEfProfile",

"profileType": "FPVLAN",

"profileSubType": "network:universal"

},

{

"profileName": "defaultNetworkUniversalTfGblVlanProfile",

"profileType": "FPVLAN",

"profileSubType": "network:universal"

},

{

"profileName": "defaultNetworkUniversalEfGblVlanProfile",

"profileType": "FPVLAN",

"profileSubType": "network:universal"

}

]

Create a network for that Tenant

POST /rest/auto-config/organizations/organization1/partitions/organization1/networks

http://10.77.247.111/rest/auto-config/organizations/ organization1/partitions/organization1/networks

POST /rest/auto-config/organizations/organization1/partitions/organization1/networks

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

Cache-Control: no-cache

{

"segmentId": "444444",

"profileName": "defaultNetworkUniversalTfProfile",

"networkName": "organization1_net",

"networkRole": "Host Network",

"netmaskLength": "24",

"gateway": "13.13.13.1",

"gatewayIpv6Address": "12::aa",

"prefixLength": "16",

"configArg": "$vlanId=;$segmentId=444444;

$vrfName=organization1:partition1; $gatewayIpAddress=13.13.13.1;

$netMaskLength=24;$dhcpServerAddr=10.10.10.1;

$vrfDhcp=;$gatewayIpv6Address=12::aa;

$prefixLength=16;$mtuValue=22",

"organizationName": "organization1",

"partitionName": "partition1",

"vSwitchControllerId": "2.2.2.2",

"staticIpStart": "3.3.3.1",

"staticIpEnd": "3.3.3.10",

"dhcpScope": {

"subnet": "13.13.13.0/24",

"gateway": "13.13.13.1",

"ipRange": "13.13.13.1-13.13.13.20"

},

"vrfName": "organization1:partition1"

}

202 Accepted

Content-Type: application/json

{

"segmentId": "444444"

}

Get the profile info

http://10.77.247.111/rest/auto-config/profiles/ defaultNetworkIpv4EfEdgeServiceProfile

GET /rest/auto-config/profiles/ POST /rest/auto-config/profiles/ defaultNetworkIpv4EfEdgeServiceProfile

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

202 Accepted

Content-Type: application/json

{

"profileName": "defaultNetworkUniversalTfProfile",

"profileType": "FPVLAN",

"profileSubType": "network:universal",

"description": "Universal profile for a network in DFA traditional forwarding mode.",

"configCommands": "vlan $vlanId\r vn-segment

$segmentId\r mode fabricpath\r interface vlan

$vlanId\r vrf member $vrfName\r ip address

$gatewayIpAddress/$netMaskLength tag 12345\r ip dhcp relay address

$dhcpServerAddr use-vrf $vrfDhcp\r ipv6 address

$gatewayIpv6Address/$prefixLength tag 12345\r fabric forwarding mode anycast-gateway\r mtu

$mtuValue\r no shutdown\r include profile any\r!",

"forwardingMode": "anycast-gateway",

"params": [

"$vlanId",

"$segmentId",

"$vrfName",

"$gatewayIpAddress",

"$netMaskLength",

"$dhcpServerAddr",

"$vrfDhcp",

"$gatewayIpv6Address",

"$prefixLength",

"$mtuValue"

]

}

Launch a VM

The VM launch is communicated to the OVS and LLDPad of the physical host selected by OpenStack. The VM’s information along with the associated segment ID is used for establishing a VDP session between the LLDPad and DFA leaf switch and the subsequently acquired vlan ID from VDP is used to program data flows in OVS.

log out

POST /rest/logout

http://10.77.247.111/rest/logout

POST /rest/logout

Host: 10.77.247.111

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 115

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Dcnm-Token: NUVyu5Y0YHDv0tT6xFuIPd+Cu9OA1XCQ

Content-Length: 179

Cookie: JSESSIONID=4C975316B01A44215861475E1B5F9328

Pragma: no-cache

Cache-Control: no-cache

202 Accepted