Published On: August 6ᵗʰ, 2019 02:11

API Reference for Cisco Enterprise Network Function Virtualization Infrastructure Software

VM Image Registration APIs

Table 1. VM Registration APIs

Action

Method

Payload Required

API

Image registration

POST

Yes

/api/config/vm_lifecycle/images

Get image configuration

GET

No

/api/config/vm_lifecycle/images?deep

Get image status

GET

No

/api/operational/vm_lifecycle/opdata/images/image

/<image_name>?deep

Image Unregistration

DELETE

No

/api/config/vm_lifecycle/images/image/<image_name>

Example for Image Registration Payload


<image>
        <name>isrv9.16.03.01</name>
        <src>http://<filename_with_full-path-of-the-file>/isrv-universalk9.16.03.01.tar.gz</src>
</image>



<image>
        <name> mytiny2</name>
        <src>file:///data/mount/nfs_storage/repository/TinyCore-current.iso</src>
        <properties>
                <property>
                        <name>placement</name>
                        <value>nfs_storage</value>
                </property>
        </properties>
</image>

Added in NFVIS 3.12.x release:



<image>
        <name>isrv</name>
        <src>https://esc-soltest-124/nfvis/isrv-universalk9.16.03.01.tar.gz</src>
        <certificate_validation>true</certificate_validation>
        <certificate_string>"-----BEGIN CERTIFICATE-----
MIID2TCCAsGgAwIBAgIJAOySjdTedBEyMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD
VQQGEwJVUzELMAkGA1UECAwCQ0ExCzAJBgNVBAcMAlNKMQ4wDAYDVQQKDAVDaXNj
bzEMMAoGA1UECwwDRVNDMRgwFgYDVQQDDA9lc2Mtc29sdGVzdC0xMjQxITAfBgkq
hkiG9w0BCQEWEmFydmluZGtzQGNpc2NvLmNvbTAeFw0xOTA0MDUxMDQ3NDRaFw0y
MDA0MDQxMDQ3NDRaMIGCMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExCzAJBgNV
BAcMAlNKMQ4wDAYDVQQKDAVDaXNjbzEMMAoGA1UECwwDRVNDMRgwFgYDVQQDDA9l
c2Mtc29sdGVzdC0xMjQxITAfBgkqhkiG9w0BCQEWEmFydmluZGtzQGNpc2NvLmNv
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN+f6mSR3C5f7bm0622r
hy8IVmF64cjPEjJL7uVa0wid4ohqH7PYjZLlxecWjzwqboMBMX8f5dpqoCCfpIwV
aMDMNQPAWDkLB8D04GgHfZUGmbrKnC/9vzopfIr6zhIsuHU1UGfMu9V+gSK8/1Yd
DXsco4s+JOO+ke+sO+cxghKKzh36R+O6aYNlqNCE3vCIQ91abfx/8pOVGy7+T01g
t9y4v3nTIU0cGAvj6ag6QnQFacU75mYrdHq1SoDF6sJoQhUq3YmiAKVnEKp836sB
jHIDveWqgsj+0aiqHg8z4a6t0WTF1ssVES5mORVY7R2MLcYPtpGedWWW56emuGIe
sbUCAwEAAaNQME4wHQYDVR0OBBYEFBKP8tNQEJCEsof5DqaoDuv4VMWjMB8GA1Ud
IwQYMBaAFBKP8tNQEJCEsof5DqaoDuv4VMWjMAwGA1UdEwQFMAMBAf8wDQYJKoZI
hvcNAQELBQADggEBADg04m/U1H12lIacF9ZeItoxp62YDvjszrblj9iKQWxPzPr/
5kbafATak0rAZQ4tHwAGHD6uvmW5zeo5RUMFHDx/FHU+tzjP3dmwSnBAkhicZBu4
uG6ri3PWEPXUlgx/v7liiwYmgT8gCZ7ToD1XzR8x1fPAGwAL48xRmXqiW57cuHWN
RireQ+aIBr7IT61TjdiXnldnjfXcIHGRJStOqoE1QKD44Awq8oguhzOnIyOlZ/AQ
YTv1IYXBvKfDa91EdMS5k6hjeLWjMLYjHWrrB94elQonP6nGfKwD/Zfhsz+1KG6U
JmPyR3GTWwbpB8TmiD80hSXDJNxuHpTRdSO5BUc=
-----END CERTIFICATE-----"</certificate_string>
    </image>




<image>
        <name>isrv</name>
        <src>https://esc-soltest-124/nfvis/isrv-universalk9.16.03.01.tar.gz</src>
        <certificate_validation>true</certificate_validation>
        <certificate_file>file:///data/intdatastore/uploads/esc-soltest-124.cert</certificate_file>
    </image>


Table 2. Image Registration Payload Description

Property

Type

Description

Mandatory/Default Value

name String Name of the VM image Yes
src URL Full path of the VM image Yes
Added in NFVIS 3.12.x release
certificate_validation True/false Enable certificate validation by setting this tag to "true" Yes
certificate_string String Validate Web-server with the raw contents of a certificate file Yes
certificate_file URL Validate Web-server with a certificate file Yes

Example: POST Image Registration API



curl -v -u -k admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml
 -X POST https://<NFVIS_IP>/api/config/vm_lifecycle/images -d '<image><name>WinServer2012R2.iso</name><src><filename_with_full-path-of the-file>/WinServer2012R2.iso</src></image>'
\* About to connect() to 209.165.201.1 port 80 (#0)
\* Trying 209.165.201.1...
\* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
\* Server auth using Basic with user 'admin'
> POST /api/config/vm_lifecycle/images HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 87
>
\* upload completely sent off: 87 out of 87 bytes
< HTTP/1.1 201 Created
< Server:
< Location: [http://209.165.201.1/api/config/vm_lifecycle/images/image/WinServer2012R2.iso]
< Date: Thu, 10 Dec 2015 11:15:50 GMT
< Last-Modified: Thu, 10 Dec 2015 11:15:50 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-746150-710421
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
<
\* Connection #0 to host 209.165.201.1 left intact

Example: POST Image Registration to External Disk API


curl -k -v -u admin:Cisco123# -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X POST https://209.165.201.1/api/config/vm_lifecycle/images -d '<image><name>Linuxnew</name><src>file:///mnt/extdatastore2/uploads/TinyLinux.tar.gz</src><properties><property><name>placement</name><value>datastore3</value></property></properties></image>'
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 209.165.201.1...
* TCP_NODELAY set
* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=nfvis
* start date: Jun 12 19:40:33 2018 GMT
* expire date: Jun 11 19:40:33 2023 GMT
* issuer: CN=nfvis
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* Server auth using Basic with user 'admin'
> POST /api/config/vm_lifecycle/images HTTP/1.1
> Host: 209.165.201.1
> Authorization: Basic YWRtaW46Q2lzY28xMjMj
> User-Agent: curl/7.54.0
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 190
>
* upload completely sent off: 190 out of 190 bytes
< HTTP/1.1 201 Created
< Server: nginx
< Date: Tue, 12 Jun 2018 22:59:05 GMT
< Content-Type: text/html
< Content-Length: 0
< Location: https://172.25.221.106/api/config/vm_lifecycle/images/image/Linuxnew
< Connection: keep-alive
< Last-Modified: Tue, 12 Jun 2018 22:59:04 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1528-844344-814906
< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact

Example: GET Image Configuration API


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
GET https://209.165.201.1/api/config/vm_lifecycle/images?deep 
\* About to connect() to 209.165.201.1 port 80 (#0)
\* Trying 209.165.201.1...
\* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
\* Server auth using Basic with user 'admin'
> GET /api/config/vm_lifecycle/images?deep HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
>
< HTTP/1.1 200 OK
< Server:
< Date: Thu, 10 Dec 2015 11:16:10 GMT
< Last-Modified: Thu, 10 Dec 2015 11:15:50 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-746150-710421
< Content-Type: application/vnd.yang.data+xml
< Transfer-Encoding: chunked
< Pragma: no-cache
< 
<images xmlns="[http://www.cisco.com/esc/esc|http://www.cisco.com/nfvis/vm_lifecycle]" xmlns:y="[http://tail-f.com/ns/rest|http://tail-f.com/ns/rest]"&nbsp; xmlns:esc="[http://www.cisco.com/nfvis/vm_lifecycle|http://www.cisco.com/nfvis/vm_lifecycle]"> 
        <image>
        <name>isrv-9.16.03.01</name>
        <src>http://data/nfvos-pkg/isr/isrv-universalk9.16.03.01.tar.gz</src>
        </image>
</images>
\* Connection #0 to host 209.165.201.1 left intact





Example: GET Image Status API



curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
GET https://209.165.201.1/api/operational/vm_lifecycle/opdata/images/image/isrv-03.16.02?deep
/* About to connect() to 209.165.201.1 port 80 (#0)
/*   Trying 209.165.201.1...
/* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
/* Server auth using Basic with user 'admin'
> GET /api/operational/vm_lifecycle/opdata/images/image/isr-image?deep HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> < HTTP/1.1 200 OK
< Server:
< Date: Thu, 10 Dec 2015 11:16:22 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Content-Type: application/vnd.yang.data+xml< Transfer-Encoding: chunked
< Pragma: no-cache< 
<image xmlns="http://www.cisco.com/nfvis/vm_lifecycle" xmlns:y="http://tail-f.com/ns/rest"  xmlns:esc="http://www.cisco.com/nfvis/vm_lifecycle">  
<name>isrv.03.16.02</name>  
<image_id>585a1792-145c-4946-9929-e040d3002a59</image_id>  
<public>true</public>  
<state>IMAGE_ACTIVE_STATE</state></image>
/* Connection #0 to host 209.165.201.1 left intact




Note

The supported image states are:

  • IMAGE_UNDEF_STATE

  • IMAGE_CREATING_STATE

  • IMAGE_ACTIVE_STATE

  • IMAGE_DELETING_STATE

  • IMAGE_DELETED_STATE

  • IMAGE_ERROR_STATE


Example: DELETE Image Registration API


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
DELETE https://209.165.201.1/api/config/vm_lifecycle/images/image/isrv-3.16.0.1a                                                                                                           
/*About to connect() to 209.165.201.1 port 80 (#0)
/*   Trying 209.165.201.1...
/* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
/* Server auth using Basic with user 'admin'
> DELETE /api/config/vm_lifecycle/images/image/isr-image HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml>
< HTTP/1.1 204 No Content
< Server:
< Date: Thu, 10 Dec 2015 12:44:28 GMT
< Last-Modified: Thu, 10 Dec 2015 12:44:28 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-751468-864441
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
</* Connection #0 to host 209.165.201.1 left intact



Custom Flavor Creation APIs

After registering a VM, you can define custom flavors of the VM based on your requirements. These flavors are also known as profiles.

Table 3. Flavor Creation APIs

Action

Method

Payload Required

APIs

To create a flavor

POST

Yes

/api/config/vm_lifecycle/flavors

To get configuration details of a flavor

GET

No

  • /api/config/vm_lifecycle/flavors

  • /api/config/vm_lifecycle/flavors?deep

  • /api/config/vm_lifecycle

    /flavors/flavor/<flavor_name>?deep

To view the operational status of a flavor

GET

No

/api/operational/vm_lifecycle

/opdata/flavors/flavor/<flavor_name>?deep

To delete a flavor

DELETE

No

/api/config/vm_lifecycle/flavors/flavor/<flavor-name>

Example for Flavor Creation Payload



<flavor>
 <name>ISR_FLAVOR</name>
 <vcpus>2</vcpus>
 <memory_mb>4096</memory_mb>
 <root_disk_mb>0</root_disk_mb>
 <ephemeral_disk_mb>0</ephemeral_disk_mb>
 <swap_disk_mb>0</swap_disk_mb>
</flavor>

Table 4. Description for Flavor Creation Payload

Property

Type

Description

Mandatory/Default Value

name

String

Name of the flavor.

Yes

vcpus

Number

Number of virtual CPUs.

Yes

memory_mb

Number

Amount of memory in Mega Bytes.

Yes

root_disk_mb

Number

Virtual root disk size in gigabytes.

Yes

Note 

Added support in 3.7.1

ephemeral_disk_mb

Number

A temporary storage that is added to your instance.

No

swap_disk_mb

Number

The space used on a hard disk as RAM

No

Example: POST Flavor API



curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
POST https://209.165.201.1/api/config/vm_lifecycle/flavors -d '<flavor><name>windows</name><ephemeral_disk_mb>0</ephemeral_disk_mb><memory_mb>4096</memory_mb><root_disk_mb>12288</root_disk_mb><swap_disk_mb>0</swap_disk_mb><vcpus>2</vcpus></flavor>'
* About to connect() to 209.165.201.1 port 80 (#0)
* Trying 209.165.201.1...
* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /api/config/vm_lifecycle/flavors HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 188
>
* upload completely sent off: 188 out of 188 bytes
< HTTP/1.1 201 Created< Server:
< Location: http://209.165.201.1/api/config/vm_lifecycle/flavors/flavor/ISR_FLAVOR_demo
< Date: Fri, 11 Dec 2015 11:15:23 GMT
< Last-Modified: Fri, 11 Dec 2015 11:15:23 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-832523-873124
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact


Example: GET Flavor Configuration API


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
GET https://209.165.201.1/api/config/vm_lifecycle/flavors?deep
* About to connect() to 209.165.201.1 port 80 (#0)
* Trying 209.165.201.1...
* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> GET /api/config/vm_lifecycle/flavors?deep HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
>
< HTTP/1.1 200 OK
< Server:
< Date: Fri, 11 Dec 2015 11:11:31 GMT
< Last-Modified: Fri, 11 Dec 2015 01:32:26 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-797546-701321
< Content-Type: application/vnd.yang.data+xml
< Transfer-Encoding: chunked
< Pragma: no-cache
<
<flavors xmlns="http://www.cisco.com/nfvis/vm_lifecycle" xmlns:y="http://tail-f.com/ns/rest"  xmlns:esc="http://www.cisco.com/nfvis/vm_lifecycle">  
        <flavor>
        <name>ASAv10</name> 
  <description>ASAv10 profile</description>    
                <vcpus>1</vcpus>    
                <memory_mb>2048</memory_mb>   
         <root_disk_mb>8192</root_disk_mb> 
         <ephemeral_disk_mb>0</ephemeral_disk_mb>    
                <swap_disk_mb>0</swap_disk_mb>    
                <properties>      
                                <property>      
                  <name>source_image</name>        
                                <value>ASAv_IMAGE</value>      
                                </property>   
                 </properties> 
         </flavor>  
                <flavor> 
        <name>ASAv30</name>    
                        <description>ASAv30 profile</description>   
                 <vcpus>4</vcpus>    
                        <memory_mb>8192</memory_mb>    
                        <root_disk_mb>16384</root_disk_mb>    
                        <ephemeral_disk_mb>0</ephemeral_disk_mb>    
                        <swap_disk_mb>0</swap_disk_mb>    
                        <properties>      
                                        <property>        
                                        <name>source_image</name>
                          <value>ASAv_IMAGE</value>
     </property>
   </properties>  
  </flavor>  
</flavors>
* Connection #0 to host 209.165.201.1 left intact


Example: GET Flavor Status API



curl -k -v -u admin:admin -X 
GET https://209.165.201.1/api/operational/vm_lifecycle/flavors?deep
* About to connect() to 209.165.201.1 port 80 (#0)
* Trying 209.165.201.1...
* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> GET /api/operational/vm_lifecycle/flavors?deep HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept: */*>
< HTTP/1.1 200 OK< Server:
< Date: Fri, 11 Dec 2015 10:58:48 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Content-Type: application/vnd.yang.data+xml
< Transfer-Encoding: chunked
< Pragma: no-cache
<flavors xmlns="http://www.cisco.com/nfvis/vm_lifecycle" xmlns:y="http://tail-f.com/ns/rest"  xmlns:esc="http://www.cisco.com/nfvis/vm_lifecycle">  
        <flavor>    
                        <name>ASAv10</name>  
          <description>ASAv10 profile</description>    
                        <vcpus>1</vcpus>   
                 <memory_mb>2048</memory_mb>    
                        <root_disk_mb>8192</root_disk_mb>   
                 <ephemeral_disk_mb>0</ephemeral_disk_mb>   
                 <swap_disk_mb>0</swap_disk_mb>    
                                <properties>     
                                 <property>       
                                <name>source_image</name>       
                                <value>ASAv_IMAGE</value>      
                                        </property>    
                                </properties>  
        </flavor>  
        <flavor>   
                        <name>ASAv30</name>   
                        <description>ASAv30 profile</description>   
                 <vcpus>4</vcpus>    
                        <memory_mb>8192</memory_mb>   
                        <root_disk_mb>16384</root_disk_mb>   
                        <ephemeral_disk_mb>0</ephemeral_disk_mb>   
                        <swap_disk_mb>0</swap_disk_mb>    
                                <properties>      
                                        <property>      
                                <name>source_image</name>        
                                        <value>ASAv_IMAGE</value>      
                                        </property>
    </properties> 
        </flavor>  
</flavors>
* Connection #0 to host 209.165.201.1 left intact



VM Deployment APIs

Table 5. VM Deployment APIs

Action

Method

Payload Required

API

Deploy a VM

POST

Yes

/api/config/vm_lifecycle/tenants/tenant/admin/deployments

Get deployment configuration

GET

No

/api/config/vm_lifecycle/tenants/tenant/admin/deployments?deep

Get deployment status and details

GET

No

  • /api/operational/vm_lifecycle/tenants/tenant

    /admin/deployments?deep

  • /api/operational/vm_lifecycle/opdata/tenants/tenant/admin

    /deployments/(deployment_name),-,-?deep

Undeploy a VM

DELETE

No

/api/config/vm_lifecycle/tenants/tenant/admin/deployments

/deployment/<deployment_name>

Example: POST VM Deployment API for Cisco ISRv



curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H 
Content-Type:application/vnd.yang.data+xml -X POST https://209.165.201.1/api/config/vm_lifecycle/tenants
/tenant/admin/deployments --data
'<deployment>
<name>WINIsodep</name>
<vm_group>
                <name>WINIsovmgrp</name>
                <image>WinServer2012R2.iso</image>
                <flavor>windows</flavor>
                <bootup_time>-1</bootup_time>
                <recovery_wait_time>0</recovery_wait_time>
                <kpi_data>
                 <enabled>true</enabled>
                </kpi_data>
          <scaling>
                 <min_active>1</min_active>
                 <max_active>1</max_active>
                 <elastic>true</elastic>
          </scaling>
          <placement>
                 <type>zone_host</type>
                 <enforcement>strict</enforcement>
                 <host>datastore1</host>
          </placement>
          <recovery_policy>
                 <recovery_type>AUTO</recovery_type>
                 <action_on_recovery>REBOOT_ONLY</action_on_recovery>
          </recovery_policy>
</vm_group>
</deployment>'
                            
 
/* About to connect() to 209.165.201.1 port 80 (#0)
/* Trying 209.165.201.1...
/* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
/* Server auth using Basic with user 'admin'
> POST /api/config/vm_lifecycle/tenants/tenant/admin/deployments HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 1313
> Expect: 100-continue
> * Done waiting for 100-continue
< HTTP/1.1 201 Created
< Server:
< Location: http://209.165.201.1/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/WinServer2012R2
< Date: Thu, 10 Dec 2015 11:17:53 GMT
< Last-Modified: Thu, 10 Dec 2015 11:17:53 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-746273-842306
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
< 
/* Connection #0 to host 209.165.201.1 left intact


Note

To enable NIM support on a Cisco ISRv running on Cisco ENCS, you must use the following variable in the ISRv deployment payload.

<variable>
     <name>ngio</name>
     <val>enable</val>
</variable>
Table 6. Description for VM Deployment Payload

Property

Type

Description

Mandatory/Default Value

deployment name

string

Name of the deployment

Yes

vm_group name

vim_vm_name

string

Name of the VM group.

Yes

vm_group image

string

Image name that was used to register.

Yes

bootup_time

integer

Bootup time could vary depending on the VM image that you have chosen. For example, bootup time is 600 seconds for a Cisco ISRv image. If no monitoring is required for the VM, set the bootup time as -1.

Note 

A monitored VM must have a valid bootup time. The corresponding KPI fields are mandatory for the monitored VM. In the case of an unmonitored VM, KPI fields are optional.

Yes

placement type

string

Set VM deployment placement. For example deploying the VM on external datastore if the system has external datastore. Must set value to "zone_host" if deploying the VM on external data store or NFS.

No

placement host

string

Specify placement datastore. For example ENCS system has external datastore. Specify placement host. Allowed values are: datastore2, datastore3, nfs_storage

No

recovery_wait_time

integer

Time in seconds that this VM takes to perform a normal warm reboot. This will be used to avoid premature VM recovery in case VM becomes unresponsive due to operator reboot. This is important as VM recovery will results in loss of data that is stored on root disk. If speedy recovery is more important than the data on the root disk, this value can be optionally set to 0.

recovery_policy

action_on_recovery

string

The action performed during recovery.

Possible values: REBOOT_ONLY; REDEPLOY_ONLY; REBOOT_THEN_REDEPLOY

Yes (for monitored VMs)

interface nicid

integer

The network interface card ID.

Note 

At least one NIC ID is mandatory for monitored VMs. It is optional for unmonitored VMs.

Yes (for monitored VMs)

network

string

Name of the network attached to the NIC ID. All networks (such as LAN and WAN) except the internal management network require an IP address.

The vNIC attachment to the internal management network is only required for VMs, which require monitoring.

If this interface is for monitoring, network must be set to "int-mgmt-net"

Yes (for monitored VMs)

ip_address

string

IPv4 address

Yes

port_forwarding

-

Note 

If port forwarding is included, all elements under it are mandatory.

No

port type

enum

SSH, HTTPS, TCP, and Telnet

No

protocol

string

TCP

No

vnf_port

integer

Port number corresponding to the protocol used.

No

external_port_range

start end

integer

Unique port number to specify the start and end range.

No

scaling

container

Specifies how many instances of a particular type of VM need to be instantiated, and whether elastic scale-in and scale-out are required.

Yes

min_active

integer

Describes the minimum number of VMs to be activated.

Value currently supported: 1

Yes

max_active

integer

Describes the maximum number of VMs to be activated.

Value currently supported: 1

Yes

kpi_data

-

Key performance indicators data.

Yes (for monitored VMs)

event_name

string

Name of the event.

Yes (for monitored VMs)

metric_value

string

The metric threshold value of the KPI.

Yes (for monitored VMs)

metric_cond

enum

Specifies the direction of the metric value change for this KPI. There are four valid values:

  • GE & GT—An alarm is sent when the metric value increases from a lower position to equal or exceed the specified value.

  • LE & LT—An alarm is sent when the metric value decreases from a higher position to equal or go down the specified value.

Yes (for monitored VMs)

metric_type

integer

Supported metric types are INT8, UINT8, INT16, UINT16, INT32, UINT32, FLOAT, DOUBLE, and STRING .

Yes (for monitored VMs)

metric_collector

type

String

If the image boot-up time is provided, monitoring must be set to ICMPPing. This field type can be empty if boot-up time is -1.

Yes (for monitored VMs)

nicid>

Integer

The card ID of the interface through which this VM is monitored. It should be the ID specified in one of interfaces section in the payload.

Yes (for monitored VMs)

poll_frequency

Integer

Yes (for monitored VMs)

polling_unit

string

Yes (for monitored VMs)

continuous alarm

boolean

Continuous events needs to be generated.

Value supported: false, true

Yes (for monitored VMs)

rule

event_name

string

Name of the event.

No

action

string

  • Always log—Whether the event is pingable or not, the details are always logged.

  • TRUE servicebooted.sh—The action identified by this keyword in the dynamic mapping file is triggered when the VM moves from a non-pingable to a pingable state.

  • FALSE recover autohealing—The action identified by this keyword is triggered, and the VM is recovered without the administrator's intervention.

No

configuration

dst

string

If the VM supports the bootstrap configuration file in the VM package, and a token is included in the configuration file, this token must be filled in the bootstrap template during the VM deployment.

No

variable name

string

TECH_PACKAGE is the token for a Cisco ISRv image. This needs to be specified in the variable name. This varies with each VM.

Yes

Example: DELETE VM Deployment API


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
DELETE https://209.165.201.1/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISRdep1
/* About to connect() to 209.165.201.1 port 80 (#0)
/* Trying 209.165.201.1...
/* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
/* Server auth using Basic with user 'admin'
> DELETE /api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISRdep1 HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
>
< HTTP/1.1 204 No Content
< Server:
< Date: Thu, 10 Dec 2015 12:43:31 GMT
< Last-Modified: Thu, 10 Dec 2015 12:43:31 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Etag: 1449-751411-880440
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
<
/* Connection #0 to host 209.165.201.1 left intact



Examples for VM Deployment Payload with Bootstrap Configuration Options


Note

You need to specify the exact name of the VM bootstrap configuration file under the <dst> element in the deployment payload. This name can vary with each VM. For example, the Cisco ASAv bootstrap configuration file is "day0-config".


Option 1 Example: Deployment Payload for Bundling Bootstrap Configuration Files into the VM Package

In this method, the bootstrap configuration variables can be tokenized. You have to provide token values at the time of deployment using the deployment payload.

The following is the extract from the Cisco ASAv bootstrap configuration with tokenized variables. Tokenized variables are highlighted in this example.


ASA Version 9.4.1
firewall transparent
ssh version 2
!
interface management0/0
description vnf-mgmt-net
nameif vnf-mgmt
security-level 100
ip address ${VNF_MGMT_IP} ${VNF_MGMT_NETMASK}
no shutdown
!
interface GigabitEthernet0/0
description service-net
nameif outside
security-level 0
bridge-group 10
no shutdown
!
interface GigabitEthernet0/1
description lan-net
nameif inside
bridge-group 10
security-level 100
no shutdown
!
interface BVI10
ip address ${BRIDGE_IP} ${BRIDGE_MASK}
!
snmp-server enable
snmp-server community public
http server enable
http 0.0.0.0 0.0.0.0 management
crypto key generate rsa modulus 2048
username test password test123
ssh 0.0.0.0 0.0.0.0 management
aaa authentication ssh console LOCAL
route vnf-mgmt 0.0.0.0 0.0.0.0 ${VNF_MGMT_GW} 1
route outside 0.0.0.0 0.0.0.0 ${BRIDGE_GW} 1

The following is an example for the Cisco ASAv deployment payload with the tokenized variables.


<deployment>
        <name>ASAv</name>
        <vm_group>
                <name>FirwallGroup</name>
                <image>asavImage</image>
                <flavor>IASAv5l</flavor>
                <bootup_time>600</bootup_time>
                <recovery_wait_time>0</recovery_wait_time>
                <interfaces>
                        <interface>
                                <nicid>0</nicid>
                                <network>int-mgmt-net</network>
                                <port_forwarding>
                                        <port>
                                                <type>ssh</type>
                                                <protocol>tcp</protocol>
                                                <vnf_port>22</vnf_port>
                                                <external_port_range>
                                                        <start>20024</start>
                                                        <end>20024</end>
                                                </external_port_range>
                                        </port>
                                </port_forwarding>
                        </interface>
                        <interface>
                                <nicid>1</nicid>
                                <network>sc-net</network>
                        </interface>
                        <interface>
                                <nicid>2</nicid>
                                <network>lan-net</network>
                        </interface>
                </interfaces>
                <kpi_data>
                        <enabled>true</enabled>
                        <kpi>
                                <event_name>VM_ALIVE</event_name>
                                <metric_value>1</metric_value>
                                <metric_cond>GT</metric_cond>
                                <metric_type>UINT32</metric_type>
                                <metric_collector>
                                        <type>ICMPPing</type>
                                        <nicid>0</nicid>
                                        <poll_frequency>3</poll_frequency>
                                        <polling_unit>seconds</polling_unit>
                                        <continuous_alarm>false</continuous_alarm>
                                </metric_collector>
                        </kpi>
                </kpi_data>
                <rules>
                        <admin_rules>
                                <rule>
                                        <event_name>VM_ALIVE</event_name>
                                        <action>ALWAYS log</action>
                                        <action>FALSE recover autohealing</action>
                                        <action>TRUE servicebooted.sh</action>
                                </rule>
                        </admin_rules>
                        <user_rules/>
                </rules>
                <scaling>
                        <min_active>1</min_active>
                        <max_active>1</max_active>
                </scaling>
                <config_data>
                        <configuration>
                                <dst>day0-config</dst>
                                <variable>
                                        <name>VNF_MGMT_IP</name>
                                        <val>192.0.2.6</val>
                                </variable>
                                <variable>
                                        <name>VNF_MGMT_NETMASK</name>
                                        <val>255.255.255.0</val>
                                </variable>
                                <variable>
                                        <name>BRIDGE_IP</name>
                                        <val>192.0.2.10</val>
                                </variable>
                                <variable>
                                        <name>BRIDGE_MASK</name>
                                        <val>255.255.255.0</val>
                                </variable>
                                <variable>
                                        <name>VNF_MGMT_GW</name>
                                        <val>192.0.2.7</val>
                                </variable>
                                <variable>
                                        <name>BRIDGE_GW</name>
                                        <val>192.0.2.12</val>
                                </variable>
                        </configuration>
                </config_data>
        </vm_group>
</deployment> 

Option 2 Example: Bootstrap Configuration without Tokens in the Deployment Payload

In this example, the entire Cisco ASAv bootstrap configuration is copied under the <data> element.


<deployment>
        <name>ASAv</name>
        <vm_group>
                <name>ASAvGroup</name>
                <bootup_time>-1</bootup_time>
                <config_data>
                        <configuration>
                                <dst>day0-config</dst>
                                <data>
                                ASA Version 9.4.1
                                firewall transparent
                                ssh version 2
                                interface management0/0
                                description vnf-mgmt-net
                                nameif vnf-mgmt
                                security-level 100
                                ip address 11.20.0.3 255.255.255.0
                                no shutdown
                                interface GigabitEthernet0/0
                                description service-net
                                nameif outside
                                security-level 0
                                bridge-group 10
                                no shutdown
!
                                interface GigabitEthernet0/1
                                description lan-net
                                nameif inside
                                bridge-group 10
                                security-level 100
                                no shutdown
                                interface BVI10
                                ip address 12.20.0.3 255.255.255.0
!
                                snmp-server enable
                                snmp-server community public
                                http server enable
                                http 0.0.0.0 0.0.0.0 management
                                crypto key generate rsa modulus 2048
                                username test password test123
                                ssh 0.0.0.0 0.0.0.0 management
                                aaa authentication ssh console LOCAL
                                route vnf-mgmt 0.0.0.0 0.0.0.0 11.20.0.1 1
                                route outside 0.0.0.0 0.0.0.0 12.20.0.1 1
                                </data>
        <image>ASAvImage</image>
                <interfaces>
                        <interface>
                        <nicid>0</nicid>
                        <network>vnf-mgmt-net</network>
                        </interface>
                        <interface>
                        <nicid>1</nicid>
                        <ip_address>12.20.0.68</ip_address>
                        <network>sc-net</network>
                        </interface>
                </interfaces>
                <kpi_data>
                        <kpi>
                        <event_name>VM_ALIVE</event_name>
                        <metric_collector>
                        <continuous_alarm>false</continuous_alarm>
                        <nicid>0</nicid>
                        <poll_frequency>3</poll_frequency>
                        <polling_unit>seconds</polling_unit>
                        <type>ICMPPing</type>
                        </metric_collector>
                        <metric_cond>GT</metric_cond>
                        <metric_type>UINT32</metric_type>
                        <metric_value>1</metric_value>
                        </kpi>
                </kpi_data>
                <recovery_wait_time>0</recovery_wait_time>
                <rules>
                        <admin_rules>
                                <rule>
                                <event_name>VM_ALIVE</event_name>
                                <action>ALWAYS log</action>
                                <action>TRUE servicebooted.sh</action>
                                <action>FALSE recover autohealing</action>
                                </rule>
                        </admin_rules>
                </rules>
                <scaling>
                        <max_active>1</max_active>
                        <min_active>1</min_active>
                </scaling>
        </vm_group>
</deployment>

Option 3 Example: Deployment Payload with Local Bootstrap Configuration File

In this example, a reference to the Cisco ASAv local bootstrap configuration file is provided from the payload under the <configuration> element. If the bootstrap configuration file has tokens, you have to provide token values in the deployment payload under the configuration section.


<deployment>
    <name>asaV</name>
    <vm_group>
        <name>firewall_Group</name>
        <image>ASAvImage</image>
        <bootup_time>600</bootup_time>
        <recovery_wait_time>0</recovery_wait_time>
        <recovery_policy>
            <action_on_recovery>REBOOT_ONLY</action_on_recovery>
        </recovery_policy>
        <interfaces>
            <interface>
                <nicid>0</nicid>
                <network>int-mgmt-net</network>
                <port_forwarding>
                    <port>
                        <type>ssh</type>
                        <protocol>tcp</protocol>
                        <vnf_port>22</vnf_port>
                        <external_port_range>
                            <start>20022</start>
                            <end>20022</end>
                        </external_port_range>
                    </port>
                </port_forwarding>
            </interface>
           <interface>
                <nicid>1</nicid>
                <network>wan-net</network>
                <ip_address>172.19.181.42</ip_address>
            </interface>
            <interface>
                <nicid>2</nicid>
                <network>lan-net</network>
                <ip_address>192.168.0.20</ip_address>
            </interface>
        </interfaces>
        <scaling>
            <min_active>1</min_active>
            <max_active>1</max_active>
        </scaling>
        <kpi_data>
            <kpi>
                <event_name>VM_ALIVE</event_name>
                <metric_value>1</metric_value>
                <metric_cond>GT</metric_cond>
                <metric_type>UINT32</metric_type>
                <metric_collector>
                    <type>ICMPPing</type>
                    <nicid>0</nicid>
                    <poll_frequency>3</poll_frequency>
                    <polling_unit>seconds</polling_unit>
                    <continuous_alarm>false</continuous_alarm>
                </metric_collector>
            </kpi>
        </kpi_data>
        <rules>
      <admin_rules>
                <rule>
                    <event_name>VM_ALIVE</event_name>
                    <action>ALWAYS log</action>
                    <action>TRUE servicebooted.sh</action>
                    <action>FALSE recover autohealing</action>
                </rule>
            </admin_rules>
        </rules>
        <config_data>
           <configuration>
                <dst>day0-config</dst>
               <file>file://data/upload1/day0-config</file> 
           </configuration>
        </config_data>
    </vm_group>
</deployment>

Adding or Editing a vNIC Using the VM Deployment API

Using the VM deployment API, you can add, edit, or delete as many vNICs as you want. For these actions, you will have to use the PUT method of the VM deployment API. VM's vNIC can be updated when VM is active or stopped.


Note

Editing vNIC (add / delete / changing network) will reboot the VM is the VM does not support vNIC hot-add / hot-delete / hot-modify.


Example: Adding more than one vNIC

You should know the deployment name and the VM group name to use the PUT form of the VM deployment API. To get them, use the following commands before running the PUT form of the VM deployment API :

  • GET https://<server_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments—Provides the names of all VMs that are deployed.

  • GET https://<nfvis_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISR1—Provides the VM group name for a particular deployment.

Additional interfaces are passed into the same deployment URL as shown in this example. A new vNIC (NIC ID 2) is added to the deployed VM, ISR1.


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
PUT https://<nfvis_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISR1/vm_group/ISR-VM/interfaces --data 
'<interfaces>
    <interface>
        <nicid>0</nicid>
        <network>int-mgmt-net</network>
    </interface>
    <interface>
        <nicid>1</nicid>
        <network>sc-net</network>
    </interface>
    <interface>
        <nicid>2</nicid>
        <network>lan-net</network>
    </interface>
</interfaces>'


Example: Editing a vNIC

You can edit the attributes of an existing vNIC. In this example, the network is changed from sc-net to wan-net for NIC ID 1.


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
PUT https://<nfvis_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISR1/vm_group/ISR-VM/interfaces --data 
'<interfaces>
    <interface>
        <nicid>0</nicid>
        <network>int-mgmt-net</network>
    </interface>
    <interface>
        <nicid>1</nicid>
        <network>wan-net</network>
    </interface>
    <interface>
        <nicid>2</nicid>
        <network>lan-net</network>
    </interface>
</interfaces>'


Example: Deleting a vNIC

To delete a vNIC that is part of the VM deployed, remove the vNIC ID from the payload, and then run the PUT form of the VM deployment API. For example, assume that you want to remove vNIC 2 from the above configuration (ISR1 deployment), use the PUT form of the VM deployment API as shown in the example:


curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml -X 
PUT https://<nfvis_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISR1/vm_group/ISR-VM/interfaces --data 
'<interfaces>
    <interface>
        <nicid>0</nicid>
        <network>int-mgmt-net</network>
    </interface>
    <interface>
        <nicid>1</nicid>
        <network>sc-net</network>
    </interface>
  </interfaces>'                                  



See the Example: POST VM Deployment API for Cisco ISRv for details on the API command.

Changing the Flavor Using the VM Deployment API

Using this deployment API, you can change or update the flavor. Before changing an existing flavor to a new one, ensure that you have the new flavor created using the flavor creation API. VM's flavor change be updated when VM is active or stopped.

Example: Changing the Flavor

In this example, the existing flavor ID is changed to isr-flavor for the VM deployed as ISR1.

curl -k -v -u admin:admin -H Accept:application/vnd.yang.data+xml -H Content-Type:application/vnd.yang.data+xml
-X PUT https://<nfvis_ip>/api/config/vm_lifecycle/tenants/tenant/admin/deployments/deployment/ISR1/vm_group/ISR-VM/flavor --data
'<flavor>isr-flavor</flavor>'
 


Note

A VM is automatically power cycled when a flavor of the VM is changed.


See the Example: POST VM Deployment API for Cisco ISRv for details on the API command.

VM Action APIs


Note

You may want to get the VM name before running the VM operations API. To get the VM name, use the following operational status API:

/api/operational/vm_lifecycle/opdata/tenants/tenant/admin/deployments/<deploy name>,-,-?deep


Table 7. VM Operations APIs

Action

Method

Payload Required

APIs

To start a VM

POST

Yes

/api/operations/vmAction

To stop a VM

POST

Yes

/api/operations/vmAction

To reboot a VM

POST

Yes

/api/operations/vmAction

To enable VM monitoring

POST

Yes

/api/operations/vmAction

To disable VM monitoring

POST

Yes

/api/operations/vmAction

To backup a VM

POST

Yes

/api/operations/vmBackupAction

Example for VM Operations Payload

This section provides an example of operations payload for starting a VM. You can change the action type value to STOP, REBOOT, ENABLE_MONITOR or DISABLE_MONITOR as required.



<vmAction>

    <actionType>START</actionType>                          
    <vmName>ISR</vmName>     

 </vmAction>


Table 8. Description for VM Operations Payload

Property

Type

Description

Mandatory/Default Value

vmAction actionType

String Type of VM action. Value supported: STOP, START, REBOOT, ENABLE_MONITOR, DISABLE_MONITOR Yes

vmName

String Name of the VM instance. Yes

Example: POST Start VM API


curl -k -v -u "admin:admin" -H "Accept:application/vnd.yang.data+xml" -H "Content-Type:application/vnd.yang.data+xml" -X 
POST https://209.165.201.1/api/operations/vmAction --data '<vmAction><actionType>START</actionType><vmName>
 <vm-instance name></vmName></vmAction>'            
* About to connect() to 209.165.201.1 port 80 (#0)
* Trying 209.165.201.1...
* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /api/operations/vmAction HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 130
>
* upload completely sent off: 130 out of 130 bytes
< HTTP/1.1 204 No Content
< Server:
< Date: Fri, 11 Dec 2015 11:36:33 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Content-Length: 0
< Content-Type: text/html< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact



Example: POST Stop VM API



curl -k -v -u "admin:admin" -H "Accept:application/vnd.yang.data+xml" -H "Content-Type:application/vnd.yang.data+xml" -X 
POST [https://209.165.201.1/api/operations/vmAction|http://209.165.201.1/api/operations/vmAction] \--data 
'<vmAction><actionType>STOP</actionType><vmName><vm-instance name></vmName></vmAction>'
\* About to connect() to 209.165.201.1 port 80 (#0)
\*Trying 209.165.201.1...
\* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
\* Server auth using Basic with user 'admin'
> POST /api/operations/vmAction HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0
> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 129
>
\* upload completely sent off: 129 out of 129 bytes
< HTTP/1.1 204 No Content
< Server:
< Date: Fri, 11 Dec 2015 11:34:36 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
<
\* Connection #0 to host 209.165.201.1 left intact



Example: POST Restart VM API


curl -k -v -u "admin:admin" -H "Accept:application/vnd.yang.data+xml" -H "Content-Type:application/vnd.yang.data+xml" -X 
POST https://209.165.201.1/api/operations/vmAction --data '<vmAction><actionType>REBOOT</actionType><vmName>
 <vm-instance name></vmName></vmAction>'           
* About to connect() to 209.165.201.1 port 80 (#0)
* Trying 209.165.201.1...
* Connected to 209.165.201.1 (209.165.201.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> POST /api/operations/vmAction HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.29.0> Host: 209.165.201.1
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 131
>
* upload completely sent off: 131 out of 131 bytes
< HTTP/1.1 204 No Content
< Server:
< Date: Fri, 11 Dec 2015 11:30:28 GMT
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Content-Length: 0
< Content-Type: text/html
< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact



Example: POST Enable VM Monitoring API


curl -k -v -u "admin:password" -H "Accept:application/vnd.yang.data+xml" -H "Content-Type:application/vnd.yang.data+xml" -X POST https://209.165.201.1/api/operations/vmAction --data '<vmAction><actionType>ENABLE_MONITOR</actionType><vmName><vm-instance name></vmName></vmAction>'

* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / DHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=nfvis
* start date: Apr 18 18:54:43 2018 GMT
* expire date: Apr 15 18:54:43 2028 GMT
* issuer: CN=nfvis
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* Server auth using Basic with user 'admin'
> POST /api/operations/vmAction HTTP/1.1
> Host: 209.165.201.1
> Authorization: Basic YWRtaW46Q2lzY28xMjMj
> User-Agent: curl/7.54.0
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 133
>
* upload completely sent off: 133 out of 133 bytes
< HTTP/1.1 204 No Content
< Server: nginx
< Date: Wed, 25 Apr 2018 21:57:32 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact

Example: POST Disable VM Monitoring API


curl -k -v -u "admin:password" -H "Accept:application/vnd.yang.data+xml" -H "Content-Type:application/vnd.yang.data+xml" -X POST https://209.165.201.1/api/operations/vmAction --data '<vmAction><actionType>DISABLE_MONITOR</actionType><vmName><vm-instance name></vmName></vmAction>'

* Connected to 209.165.201.1 (209.165.201.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / DHE-RSA-AES256-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: CN=nfvis
* start date: Apr 18 18:54:43 2018 GMT
* expire date: Apr 15 18:54:43 2028 GMT
* issuer: CN=nfvis
* SSL certificate verify result: self signed certificate (18), continuing anyway.
* Server auth using Basic with user 'admin'
> POST /api/operations/vmAction HTTP/1.1
> Host: 209.165.201.1
> Authorization: Basic YWRtaW46Q2lzY28xMjMj
> User-Agent: curl/7.54.0
> Accept:application/vnd.yang.data+xml
> Content-Type:application/vnd.yang.data+xml
> Content-Length: 133
>
* upload completely sent off: 133 out of 133 bytes
< HTTP/1.1 204 No Content
< Server: nginx
< Date: Wed, 25 Apr 2018 21:57:32 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< Cache-Control: private, no-cache, must-revalidate, proxy-revalidate
< Pragma: no-cache
<
* Connection #0 to host 209.165.201.1 left intact

VM Network APIs

Table 9. VM Network APIs

Action

Method

Payload Required

APIs

To delete an existing subnet

DELETE

No

/api/config/vm_lifecycle/networks/network/int-mgmt-net/subnet/int-mgmt-net-subnet

To create a new subnet

POST

Yes

/api/config/vm_lifecycle/networks/network/int-mgmt-net

Example for VM Networks Payload

This section provides an example of networks payload.


<subnet>
        <name>int-mgmt-net-subnet</name>
        <dhcp>false</dhcp>
        <address>105.20.0.0</address>
        <netmask>255.255.255.0</netmask>
        <gateway>105.20.0.1</gateway>
</subnet>

Table 10. Description for VM Networks Payload

Property

Type

Description

Mandatory/Default Value

name

String Management subnet name Yes - Should be set to int-mgmt-net-subnet

address

String Subnet address for this network Yes

netmask

String

Netmask for the network

No

gateway

String

The gateway IP

No

Network File System APIs

Table 11. Network File System APIs

Action

Method

Payload Required

APIs

To mount NFS

POST

Yes

/api/config/system

To unmount NFS

DELETE

No

/api/config/system/storage

To register images on NFS

POST

Yes

/api/config/vm_lifecycle/images

To unregister images on NFS

DELETE

No

/api/config/vm_lifecycle/images/image

To deploy VM on NFS using an image

POST

Yes

/api/config/vm_lifecycle/tenants/tenant/admin/deployments

Example for Network File System Payload

This section provides an example of NFS payload.


<image>
<name> myas10</name>
<src>file:///data/mount/nfs_storage/repository/asav961.tar.gz</src>
<properties>
<property>
<name>placement</name>
<value>nfs_storage</value>
</property>
</properties>
</image>


{"deployment":
    {"name":"15065483181",
     "vm_group":
        {"name":"myasav1",
         "image":"asav961",
         "flavor":"ASAv5",
         "bootup_time":"-1",
         "recovery_wait_time":"0",
         "placement":{"type":"zone_host",
         "host":"nfs_storage"},
         "recovery_policy":{"action_on_recovery":"REBOOT_ONLY"},
         "interfaces":{"interface":[{"nicid":0,"network":"lan-net","model":"virtio"}]},
         "scaling":{"min_active":"1","max_active":"1"}}}}

Added in NFVIS 3.12.x release:



<image>
        <name>ubuntu</name>
        <src>file:///data/intdatastore/uploads/ubuntu_raw.tar.gz</src>
        <properties>
           <property>
                <name>placement</name>
                <value>iscsi:test</value>
           </property>
        </properties>
    </image>




<tenant>
                        <name>admin</name>
                        <deployments>
                                <deployment>
                                        <name>ubuntu</name>
                                        <vm_group>
                                                <name>ubgrp</name>
                                                <image>ubiscsi</image>
                                                <flavor>ubuntu-small-flav</flavor>
                                                <bootup_time>-1</bootup_time>
                                                <placement>
                                                    <type>zone_host</type>
                                                    <host>iscsi:test</host>
                                                </placement>
                                                <recovery_wait_time>0</recovery_wait_time>
                                                <interfaces>
                                                        <interface>
                                                                <nicid>0</nicid>
                                                                <network>int-mgmt-net</network>
                                                        </interface>
                                               </interfaces>
                                        </vm_group>
                                </deployment>
                        </deployments>
                </tenant>


VNC Console Start API

Table 12. VNC Console Start API

Action

Method

Payload Required

API

To start a VNC console

POST

No

/api/operations/vncconsole/start

VM Multi Serial Port APIs

Table 13. VM Multi Serial Port API

Action

Method

Payload Required

API

To deploy attaching serial port to VNF

POST

Yes

/api/config/vm_lifecycle/tenants/tenant/admin/deployments

Example for VM Multi Serial Port API


{

    "deployment": {

        "name": "15065483181",

        "vm_group": {

            "name": "myasav1",

            "image": "asav961",

            "flavor": "ASAv5",

            "bootup_time": "-1",

            "recovery_wait_time": "0",

            "interfaces": {

                "interface": [{

                    "nicid": 0,

                    "network": "lan-net",

                    "model": "virtio"

                }]

            },

           "serial_ports": {

                "serial_port": [{

                    "serial": 0,

                    "serial_type": "telnet",

                    "service_port": 7000

                }]

            }

        }

Table 14. Description for VM Multi Serial Port Payload

Property

Type

Description

Mandatory/Default Value

serial

String Serial port number Yes

serial_type

String Serial type, telnet or console Yes

service_port

String

Service port number

Yes