File: nfv.md

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (144 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# NFV

This document explains how to get started using NFV with
fog-openstack.

Please also refer to the
[Getting Started with Fog and the OpenStack](getting_started.md) document.

Tacker is an OpenStack service for NFV Orchestration with a general purpose
VNF Manager to deploy and operate Virtual Network Functions (VNFs) and Network
Services on an NFV Platform. It is based on ETSI MANO Architectural Framework.

# OpenStack setup

## The catalog
For the fog-openstack's introspection service to work, the corresponding
service must be defined in the OpenStack catalog.

```bash
openstack catalog show servicevm
+-----------+-----------------------------------------+
| Field     | Value                                   |
+-----------+-----------------------------------------+
| endpoints | regionOne                               |
|           |   publicURL: http://172.16.0.21:8888/   |
|           |   internalURL: http://172.16.0.21:8888/ |
|           |   adminURL: http://172.16.0.21:8888/    |
|           |                                         |
| name      | tacker                                  |
| type      | servicevm                               |
+-----------+-----------------------------------------+
```

Depending on the OpenStack release, the NFV service might be installed
but not defined yet in the catalog. In such case, you must add the service and
corresponding endpoints to create the catalog entry:

```bash
source ./stackrc
openstack service create --name tacker --description "Tacker Project" servicevm
openstack endpoint create --region regionOne tacker --publicurl http://example.com:8888 --internalurl http://example.com:8888 --adminurl http://example.com:8888
```

# Work flow
A usual work-flow might consist of:
* Create vnfd
* Deploy vnf using vnfd
* Retrieve vnf and vnfd data

For more details please refer to
http://docs.openstack.org/developer/tacker/

Using 'irb', we start with authentication:

```ruby
@user     = "admin"
@project  = "admin"
@password = "secret"
@base_url = "http://keystone.example.com:5000/v3/auth/tokens"

require 'rubygems'
require 'fog/openstack'

@connection_params = {
  :openstack_auth_url     => @base_url,
  :openstack_username     => @user,
  :openstack_api_key      => @password,
  :openstack_project_name => @project,
  :openstack_domain_id    => "default"
}
```

## Vnfd management

### Create vnfd

```ruby
vnfd_data = {:attributes    => {:vnfd => "template_name: sample-vnfd\ndescription: demo-example\n\nservice_properties:\n  Id: sample-vnfd\n  vendor: tacker\n  version: 1\n\nvdus:\n  vdu1:\n    id: vdu1\n    vm_image: cirros\n    instance_type: m1.tiny\n\n    network_interfaces:\n      management:\n        network: net_mgmt\n        management: true\n      pkt_in:\n        network: net0\n      pkt_out:\n        network: net1\n\n    placement_policy:\n      availability_zone: nova\n\n    auto-scaling: noop\n\n    config:\n      param0: key0\n      param1: key1\n"},
             :service_types => [{:service_type => "vnfd"}],
             :mgmt_driver   => "noop",
             :infra_driver  => "heat"}
auth      = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
vnfd      = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
```

### List vnfds

```ruby
vnfds = Fog::NFV[:openstack].vnfds
```

### Get vnfd

```ruby
vnfd = Fog::NFV[:openstack].vnfds.last
vnfd = Fog::NFV[:openstack].vnfds.get(vnfd.id)
```

### Destroy vnfd

```ruby
vnfd = Fog::NFV[:openstack].vnfds.last
vnfd.destroy
```

## Vnf management

### Create vnf using vnfd

```ruby
vnfd     = Fog::NFV[:openstack].vnfds.last
vnf_data = {:vnfd_id => vnfd.id, :name => 'Test'}
auth     = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
vnf      = Fog::NFV[:openstack].vnfs.create(:vnf => vnf_data, :auth => auth)
```

### List vnfs

```ruby
vnfs = Fog::NFV[:openstack].vnfs
```

### Get vnf

```ruby
vnf = Fog::NFV[:openstack].vnfs.last
vnf = Fog::NFV[:openstack].vnfs.get(vnf.id)
```

### Update vnf

```ruby
vnf      = Fog::NFV[:openstack].vnfs.last
vnf_data = {"attributes": {"config": "vdus:\n  vdu1:<sample_vdu_config> \n\n"}}
auth     = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
vnf      = vnf.update(:vnf => vnf_data, :auth => auth)
```

### Destroy vnf

```ruby
vnf = Fog::NFV[:openstack].vnfs.last
vnf.destroy
```