fog-openstack 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/.travis.yml +6 -2
  4. data/README.md +4 -0
  5. data/Rakefile +10 -2
  6. data/fog-openstack.gemspec +2 -3
  7. data/gemfiles/Gemfile-1.9 +1 -1
  8. data/lib/fog/openstack.rb +14 -6
  9. data/lib/fog/openstack/baremetal.rb +1 -1
  10. data/lib/fog/openstack/common.rb +0 -2
  11. data/lib/fog/openstack/compute.rb +78 -75
  12. data/lib/fog/openstack/core.rb +2 -1
  13. data/lib/fog/openstack/docs/compute.md +1 -1
  14. data/lib/fog/openstack/docs/network.md +283 -0
  15. data/lib/fog/openstack/docs/nfv.md +144 -0
  16. data/lib/fog/openstack/examples/compute/block_device_mapping_v2.rb +4 -4
  17. data/lib/fog/openstack/examples/network/network_add_port.rb +21 -0
  18. data/lib/fog/openstack/examples/network/network_rbac.rb +69 -0
  19. data/lib/fog/openstack/identity.rb +14 -22
  20. data/lib/fog/openstack/identity_v2.rb +1 -1
  21. data/lib/fog/openstack/image_v1.rb +13 -28
  22. data/lib/fog/openstack/image_v2.rb +15 -17
  23. data/lib/fog/openstack/introspection.rb +1 -1
  24. data/lib/fog/openstack/metering.rb +1 -1
  25. data/lib/fog/openstack/models/collection.rb +4 -1
  26. data/lib/fog/openstack/models/compute/availability_zone.rb +5 -0
  27. data/lib/fog/openstack/models/compute/flavor.rb +21 -9
  28. data/lib/fog/openstack/models/compute/server.rb +64 -77
  29. data/lib/fog/openstack/models/compute/snapshot.rb +6 -6
  30. data/lib/fog/openstack/models/compute/volume_attachment.rb +15 -0
  31. data/lib/fog/openstack/models/compute/volume_attachments.rb +20 -0
  32. data/lib/fog/openstack/models/identity_v3/projects.rb +1 -1
  33. data/lib/fog/openstack/models/identity_v3/users.rb +2 -2
  34. data/lib/fog/openstack/models/image_v2/image.rb +41 -22
  35. data/lib/fog/openstack/models/network/floating_ip.rb +1 -0
  36. data/lib/fog/openstack/models/network/rbac_policies.rb +33 -0
  37. data/lib/fog/openstack/models/network/rbac_policy.rb +35 -0
  38. data/lib/fog/openstack/models/nfv/vnf.rb +58 -0
  39. data/lib/fog/openstack/models/nfv/vnfd.rb +53 -0
  40. data/lib/fog/openstack/models/nfv/vnfds.rb +28 -0
  41. data/lib/fog/openstack/models/nfv/vnfs.rb +28 -0
  42. data/lib/fog/openstack/models/volume/snapshot.rb +38 -0
  43. data/lib/fog/openstack/models/volume/snapshots.rb +26 -0
  44. data/lib/fog/openstack/models/volume/volume.rb +32 -2
  45. data/lib/fog/openstack/models/volume/volume_type.rb +3 -4
  46. data/lib/fog/openstack/models/volume_v1/snapshot.rb +43 -0
  47. data/lib/fog/openstack/models/volume_v1/snapshots.rb +16 -0
  48. data/lib/fog/openstack/models/volume_v1/volume.rb +12 -2
  49. data/lib/fog/openstack/models/volume_v2/snapshot.rb +43 -0
  50. data/lib/fog/openstack/models/volume_v2/snapshots.rb +16 -0
  51. data/lib/fog/openstack/models/volume_v2/volume.rb +12 -3
  52. data/lib/fog/openstack/network.rb +53 -46
  53. data/lib/fog/openstack/nfv.rb +158 -0
  54. data/lib/fog/openstack/orchestration.rb +1 -1
  55. data/lib/fog/openstack/planning.rb +1 -1
  56. data/lib/fog/openstack/requests/compute/create_server.rb +1 -1
  57. data/lib/fog/openstack/requests/compute/{create_volume_snapshot.rb → create_snapshot.rb} +16 -16
  58. data/lib/fog/openstack/requests/compute/delete_flavor_metadata.rb +30 -0
  59. data/lib/fog/openstack/requests/compute/evacuate_server.rb +8 -7
  60. data/lib/fog/openstack/requests/compute/get_key_pair.rb +49 -0
  61. data/lib/fog/openstack/requests/compute/list_availability_zones.rb +23 -0
  62. data/lib/fog/openstack/requests/compute/list_volume_attachments.rb +31 -0
  63. data/lib/fog/openstack/requests/compute/update_flavor_metadata.rb +33 -0
  64. data/lib/fog/openstack/requests/network/create_rbac_policy.rb +42 -0
  65. data/lib/fog/openstack/requests/network/delete_rbac_policy.rb +28 -0
  66. data/lib/fog/openstack/requests/network/get_rbac_policy.rb +28 -0
  67. data/lib/fog/openstack/requests/network/list_rbac_policies.rb +25 -0
  68. data/lib/fog/openstack/requests/network/update_port.rb +8 -7
  69. data/lib/fog/openstack/requests/network/update_rbac_policy.rb +41 -0
  70. data/lib/fog/openstack/requests/nfv/create_vnf.rb +37 -0
  71. data/lib/fog/openstack/requests/nfv/create_vnfd.rb +35 -0
  72. data/lib/fog/openstack/requests/nfv/delete_vnf.rb +23 -0
  73. data/lib/fog/openstack/requests/nfv/delete_vnfd.rb +23 -0
  74. data/lib/fog/openstack/requests/nfv/get_vnf.rb +24 -0
  75. data/lib/fog/openstack/requests/nfv/get_vnfd.rb +24 -0
  76. data/lib/fog/openstack/requests/nfv/list_vnfds.rb +25 -0
  77. data/lib/fog/openstack/requests/nfv/list_vnfs.rb +25 -0
  78. data/lib/fog/openstack/requests/nfv/update_vnf.rb +35 -0
  79. data/lib/fog/openstack/requests/volume/action.rb +16 -0
  80. data/lib/fog/openstack/requests/volume/create_snapshot.rb +18 -0
  81. data/lib/fog/openstack/requests/volume/delete_metadata.rb +15 -0
  82. data/lib/fog/openstack/requests/volume/delete_snapshot.rb +5 -5
  83. data/lib/fog/openstack/requests/volume/delete_snapshot_metadata.rb +15 -0
  84. data/lib/fog/openstack/requests/volume/replace_metadata.rb +20 -0
  85. data/lib/fog/openstack/requests/volume/update_metadata.rb +20 -0
  86. data/lib/fog/openstack/requests/volume/update_snapshot.rb +37 -0
  87. data/lib/fog/openstack/requests/volume/update_snapshot_metadata.rb +20 -0
  88. data/lib/fog/openstack/requests/volume/update_volume.rb +25 -0
  89. data/lib/fog/openstack/requests/volume_v1/action.rb +2 -0
  90. data/lib/fog/openstack/requests/volume_v1/create_snapshot.rb +45 -0
  91. data/lib/fog/openstack/requests/volume_v1/delete_metadata.rb +2 -0
  92. data/lib/fog/openstack/requests/volume_v1/delete_snapshot_metadata.rb +2 -0
  93. data/lib/fog/openstack/requests/volume_v1/replace_metadata.rb +2 -0
  94. data/lib/fog/openstack/requests/volume_v1/update_metadata.rb +2 -0
  95. data/lib/fog/openstack/requests/volume_v1/update_snapshot.rb +2 -0
  96. data/lib/fog/openstack/requests/volume_v1/update_snapshot_metadata.rb +2 -0
  97. data/lib/fog/openstack/requests/volume_v1/update_volume.rb +2 -0
  98. data/lib/fog/openstack/requests/volume_v2/action.rb +2 -0
  99. data/lib/fog/openstack/requests/volume_v2/create_snapshot.rb +45 -0
  100. data/lib/fog/openstack/requests/volume_v2/delete_metadata.rb +2 -0
  101. data/lib/fog/openstack/requests/volume_v2/delete_snapshot_metadata.rb +2 -0
  102. data/lib/fog/openstack/requests/volume_v2/replace_metadata.rb +2 -0
  103. data/lib/fog/openstack/requests/volume_v2/update_metadata.rb +2 -0
  104. data/lib/fog/openstack/requests/volume_v2/update_snapshot.rb +2 -0
  105. data/lib/fog/openstack/requests/volume_v2/update_snapshot_metadata.rb +2 -0
  106. data/lib/fog/openstack/requests/volume_v2/update_volume.rb +2 -0
  107. data/lib/fog/openstack/storage.rb +1 -1
  108. data/lib/fog/openstack/version.rb +1 -1
  109. data/lib/fog/openstack/volume.rb +1 -1
  110. data/lib/fog/openstack/volume_v1.rb +29 -21
  111. data/lib/fog/openstack/volume_v2.rb +29 -21
  112. data/supported.md +54 -0
  113. data/tests/openstack/models/identity/ec2_credential_tests.rb +1 -1
  114. data/tests/openstack/models/identity/ec2_credentials_tests.rb +1 -1
  115. data/tests/openstack/models/identity/role_tests.rb +8 -3
  116. data/tests/openstack/models/identity/roles_tests.rb +5 -4
  117. data/tests/openstack/models/identity/tenant_tests.rb +7 -4
  118. data/tests/openstack/models/identity/tenants_tests.rb +10 -5
  119. data/tests/openstack/models/identity/user_tests.rb +4 -3
  120. data/tests/openstack/models/identity/users_tests.rb +10 -6
  121. data/tests/openstack/models/nfv/vnf_tests.rb +35 -0
  122. data/tests/openstack/models/nfv/vnfd_tests.rb +23 -0
  123. data/tests/openstack/models/nfv/vnfds_tests.rb +31 -0
  124. data/tests/openstack/models/nfv/vnfs_tests.rb +38 -0
  125. data/tests/openstack/requests/identity/ec2_credentials_tests.rb +6 -9
  126. data/tests/openstack/requests/identity/helper.rb +12 -4
  127. data/tests/openstack/requests/identity/role_tests.rb +13 -10
  128. data/tests/openstack/requests/identity/tenant_tests.rb +10 -9
  129. data/tests/openstack/requests/identity/user_tests.rb +11 -6
  130. data/tests/openstack/requests/image/image_tests.rb +1 -0
  131. data/tests/openstack/requests/nfv/vnf_tests.rb +70 -0
  132. data/tests/openstack/requests/nfv/vnfd_tests.rb +44 -0
  133. metadata +81 -31
  134. data/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +0 -26
  135. data/lib/fog/openstack/requests/volume_v1/create_volume_snapshot.rb +0 -44
  136. data/lib/fog/openstack/requests/volume_v2/create_volume_snapshot.rb +0 -43
  137. data/tests/openstack/authenticate_tests.rb +0 -200
  138. data/tests/openstack/identity_version_tests.rb +0 -25
  139. data/tests/openstack/storage_tests.rb +0 -18
  140. data/tests/openstack/version_tests.rb +0 -55
  141. data/tests/openstack/volume_tests.rb +0 -18
@@ -79,7 +79,7 @@ To see a list of requests supported by the service:
79
79
 
80
80
  This returns:
81
81
 
82
- :list_servers, :list_servers_detail, :create_server, :get_server_details, :update_server, :delete_server, :server_actions, :server_action, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :pause_server, :unpause_server, :suspend_server, :resume_server, :rescue_server, :change_server_password, :add_fixed_ip, :remove_fixed_ip, :server_diagnostics, :boot_from_snapshot, :reset_server_state, :get_console_output, :get_vnc_console, :live_migrate_server, :migrate_server, :list_images, :list_images_detail, :create_image, :get_image_details, :delete_image, :list_flavors, :list_flavors_detail, :get_flavor_details, :create_flavor, :delete_flavor, :add_flavor_access, :remove_flavor_access, :list_tenants_with_flavor_access, :list_metadata, :get_metadata, :set_metadata, :update_metadata, :delete_metadata, :delete_meta, :update_meta, :list_addresses, :list_address_pools, :list_all_addresses, :list_private_addresses, :list_public_addresses, :get_address, :allocate_address, :associate_address, :release_address, :disassociate_address, :list_security_groups, :get_security_group, :create_security_group, :create_security_group_rule, :delete_security_group, :delete_security_group_rule, :get_security_group_rule, :list_key_pairs, :create_key_pair, :delete_key_pair, :list_tenants, :set_tenant, :get_limits, :list_volumes, :create_volume, :get_volume_details, :delete_volume, :attach_volume, :detach_volume, :get_server_volumes, :create_volume_snapshot, :list_snapshots, :get_snapshot_details, :delete_snapshot, :list_usages, :get_usage, :get_quota, :get_quota_defaults, :update_quota, :list_hosts, :get_host_details
82
+ :list_servers, :list_servers_detail, :create_server, :get_server_details, :update_server, :delete_server, :server_actions, :server_action, :reboot_server, :rebuild_server, :resize_server, :confirm_resize_server, :revert_resize_server, :pause_server, :unpause_server, :suspend_server, :resume_server, :rescue_server, :change_server_password, :add_fixed_ip, :remove_fixed_ip, :server_diagnostics, :boot_from_snapshot, :reset_server_state, :get_console_output, :get_vnc_console, :live_migrate_server, :migrate_server, :list_images, :list_images_detail, :create_image, :get_image_details, :delete_image, :list_flavors, :list_flavors_detail, :get_flavor_details, :create_flavor, :delete_flavor, :add_flavor_access, :remove_flavor_access, :list_tenants_with_flavor_access, :list_metadata, :get_metadata, :set_metadata, :update_metadata, :delete_metadata, :delete_meta, :update_meta, :list_addresses, :list_address_pools, :list_all_addresses, :list_private_addresses, :list_public_addresses, :get_address, :allocate_address, :associate_address, :release_address, :disassociate_address, :list_security_groups, :get_security_group, :create_security_group, :create_security_group_rule, :delete_security_group, :delete_security_group_rule, :get_security_group_rule, :list_key_pairs, :create_key_pair, :delete_key_pair, :list_tenants, :set_tenant, :get_limits, :list_volumes, :create_volume, :get_volume_details, :delete_volume, :attach_volume, :detach_volume, :get_server_volumes, :create_snapshot, :list_snapshots, :get_snapshot_details, :delete_snapshot, :list_usages, :get_usage, :get_quota, :get_quota_defaults, :update_quota, :list_hosts, :get_host_details
83
83
 
84
84
 
85
85
  #### Example Request
@@ -0,0 +1,283 @@
1
+ # Network (Neutron)
2
+
3
+ This document explains how to get started using OpenStack Network (Neutron) with Fog. It assumes you have read the [Getting Started with Fog and OpenStack](getting_started.md) document.
4
+
5
+ ## Starting irb console
6
+
7
+ Start by executing the following command:
8
+ ```
9
+ irb
10
+ ```
11
+ Once `irb` has launched you need to require the Fog library by executing:
12
+ ```
13
+ require 'fog/openstack'
14
+ ```
15
+ ## Create Service
16
+
17
+ Next, create a connection to the Network Service:
18
+ ```
19
+ service = Fog::Network::OpenStack.new(
20
+ :openstack_auth_url => 'http://KEYSTONE_HOST:KEYSTONE_PORT/v3/auth/tokens', # OpenStack Keystone v3 endpoint
21
+ :openstack_username => OPEN_STACK_USER, # Your OpenStack Username
22
+ :openstack_domain_name => OPEN_STACK_DOMAIN, # Your OpenStack Domain name
23
+ :openstack_project_name => OPEN_STACK_PROJECT, # Your OpenStack Project name
24
+ :openstack_api_key => OPEN_STACK_PASSWORD, # Your OpenStack Password
25
+ :connection_options => {} # Optional
26
+ )
27
+ ```
28
+
29
+ ### Optional Connection Parameters
30
+
31
+ Fog supports passing additional connection parameters to its underlying HTTP library (Excon) using the `:connection_options` parameter.
32
+
33
+ <table>
34
+ <tr>
35
+ <th>Key</th>
36
+ <th>Description</th>
37
+ </tr>
38
+ <tr>
39
+ <td>:connect_timeout</td>
40
+ <td>Connection timeout (default: 60 seconds)</td>
41
+ </tr>
42
+ <tr>
43
+ <td>:read_timeout</td>
44
+ <td>Read timeout for connection (default: 60 seconds)</td> </tr>
45
+ <tr>
46
+ <td>:write_timeout</td>
47
+ <td>Write timeout for connection (default: 60 seconds)</td>
48
+ </tr>
49
+ <tr>
50
+ <td>:proxy</td>
51
+ <td>Proxy for HTTP and HTTPS connections</td>
52
+ </tr>
53
+ <tr>
54
+ <td>:ssl_ca_path</td>
55
+ <td>Path to SSL certificate authorities</td>
56
+ </tr>
57
+ <tr>
58
+ <td>:ssl_ca_file</td>
59
+ <td>SSL certificate authority file</td>
60
+ </tr>
61
+ <tr>
62
+ <td>:ssl_verify_peer</td>
63
+ <td>SSL verify peer (default: true)</td>
64
+ </tr>
65
+ </table>
66
+
67
+
68
+ ## Fog Abstractions
69
+
70
+ Fog provides both a **model** and **request** abstraction. The request abstraction provides the most efficient interface and the model abstraction wraps the request abstraction to provide a convenient `ActiveModel` like interface.
71
+
72
+ ### Request Layer
73
+
74
+ The request abstraction maps directly to the [OpenStack Network API](http://developer.openstack.org/api-ref-networking-v2.html). It provides the most efficient interface to the OpenStack Network service.
75
+
76
+ To see a list of requests supported by the service:
77
+ ```
78
+ service.requests
79
+ ```
80
+
81
+ This returns:
82
+ ```
83
+ :list_networks, :create_network, :delete_network, :get_network, :update_network,
84
+ :list_ports, :create_port, :delete_port, :get_port, :update_port,
85
+ :list_subnets, :create_subnet, :delete_subnet, :get_subnet, :update_subnet,
86
+ :list_floating_ips, :create_floating_ip, :delete_floating_ip, :get_floating_ip, :associate_floating_ip, :disassociate_floating_ip,
87
+ :list_routers, :create_router, :delete_router, :get_router, :update_router, :add_router_interface, :remove_router_interface,
88
+ :list_lb_pools, :create_lb_pool, :delete_lb_pool, :get_lb_pool, :get_lb_pool_stats, :update_lb_pool,
89
+ :list_lb_members, :create_lb_member, :delete_lb_member, :get_lb_member, :update_lb_member,
90
+ :list_lb_health_monitors, :create_lb_health_monitor, :delete_lb_health_monitor, :get_lb_health_monitor, :update_lb_health_monitor, :associate_lb_health_monitor, :disassociate_lb_health_monitor,
91
+ :list_lb_vips, :create_lb_vip, :delete_lb_vip, :get_lb_vip, :update_lb_vip,
92
+ :list_vpn_services, :create_vpn_service, :delete_vpn_service, :get_vpn_service, :update_vpn_service,
93
+ :list_ike_policies, :create_ike_policy, :delete_ike_policy, :get_ike_policy, :update_ike_policy,
94
+ :list_ipsec_policies, :create_ipsec_policy, :delete_ipsec_policy, :get_ipsec_policy, :update_ipsec_policy,
95
+ :list_ipsec_site_connections, :create_ipsec_site_connection, :delete_ipsec_site_connection, :get_ipsec_site_connection, :update_ipsec_site_connection,
96
+ :list_rbac_policies, :create_rbac_policy, :delete_rbac_policy, :get_rbac_policy, :update_rbac_policy,
97
+ :create_security_group, :delete_security_group, :get_security_group, :list_security_groups,
98
+ :create_security_group_rule, :delete_security_group_rule, :get_security_group_rule, :list_security_group_rules,
99
+ :set_tenant, :get_quotas, :get_quota, :update_quota, :delete_quota
100
+ ```
101
+
102
+ #### Example Request
103
+
104
+ To request a list of networks:
105
+ ```
106
+ response = service.list_networks
107
+ ```
108
+ This returns in the following `Excon::Response`:
109
+ ```
110
+ #<Excon::Response:0x007fd20d34e0e0
111
+ @data={
112
+ :body=>{"networks"=>[
113
+ {"id"=>"f9c54735-a230-443e-9379-b87f741cc1b1", "name"=>"Public", "subnets"=>["db50da7f-1248-43d2-aa30-1c10da0d380d"], "shared"=>true, "status"=>"ACTIVE", "tenant_id"=>"a51fd915", "provider_network_type"=>"vlan", "router:external"=>false, "admin_state_up"=>true},
114
+ {"id"=>"e624a36d-762b-481f-9b50-4154ceb78bbb", "name"=>"network_1", "subnets"=>["2e4ec6a4-0150-47f5-8523-e899ac03026e"], "shared"=>false, "status"=>"ACTIVE", "admin_state_up"=>true, "tenant_id"=>"f8b26a6032bc47718a7702233ac708b9"}]},
115
+ :status=>200,
116
+ :headers=>{}},
117
+ @body={"networks"=>[
118
+ {"id"=>"f9c54735-a230-443e-9379-b87f741cc1b1", "name"=>"Public", "subnets"=>["db50da7f-1248-43d2-aa30-1c10da0d380d"], "shared"=>true, "status"=>"ACTIVE", "tenant_id"=>"a51fd915", "provider_network_type"=>"vlan", "router:external"=>false, "admin_state_up"=>true},
119
+ {"id"=>"e624a36d-762b-481f-9b50-4154ceb78bbb", "name"=>"network_1", "subnets"=>["2e4ec6a4-0150-47f5-8523-e899ac03026e"], "shared"=>false, "status"=>"ACTIVE", "admin_state_up"=>true, "tenant_id"=>"f8b26a6032bc47718a7702233ac708b9"}]},
120
+ @headers={},
121
+ @status=200,
122
+ @remote_ip=nil,
123
+ @local_port=nil,
124
+ @local_address=nil
125
+ >
126
+ ```
127
+ To view the status of the response:
128
+ ```
129
+ response.status
130
+ ```
131
+ **Note**: Fog is aware of valid HTTP response statuses for each request type. If an unexpected HTTP response status occurs, Fog will raise an exception.
132
+
133
+ To view response body:
134
+ ```
135
+ response.body
136
+ ```
137
+ This will return:
138
+ ```
139
+ {"networks"=>[
140
+ {"id"=>"f9c54735-a230-443e-9379-b87f741cc1b1", "name"=>"Public", "subnets"=>["db50da7f-1248-43d2-aa30-1c10da0d380d"], "shared"=>true, "status"=>"ACTIVE", "tenant_id"=>"a51fd915", "provider_network_type"=>"vlan", "router:external"=>false, "admin_state_up"=>true},
141
+ {"id"=>"e624a36d-762b-481f-9b50-4154ceb78bbb", "name"=>"network_1", "subnets"=>["2e4ec6a4-0150-47f5-8523-e899ac03026e"], "shared"=>false, "status"=>"ACTIVE", "admin_state_up"=>true, "tenant_id"=>"f8b26a6032bc47718a7702233ac708b9"}]
142
+ }
143
+ ```
144
+ To learn more about Network request methods refer to [rdoc](http://www.rubydoc.info/gems/fog-openstack/Fog/Network/OpenStack/Real). To learn more about Excon refer to [Excon GitHub repo](https://github.com/geemus/excon).
145
+
146
+ ### Model Layer
147
+
148
+ Fog models behave in a manner similar to `ActiveModel`. Models will generally respond to `create`, `save`, `persisted?`, `destroy`, `reload` and `attributes` methods. Additionally, fog will automatically create attribute accessors.
149
+
150
+ Here is a summary of common model methods:
151
+
152
+ <table>
153
+ <tr>
154
+ <th>Method</th>
155
+ <th>Description</th>
156
+ </tr>
157
+ <tr>
158
+ <td>create</td>
159
+ <td>
160
+ Accepts hash of attributes and creates object.<br>
161
+ Note: creation is a non-blocking call and you will be required to wait for a valid state before using resulting object.
162
+ </td>
163
+ </tr>
164
+ <tr>
165
+ <td>save</td>
166
+ <td>Saves object.<br>
167
+ Note: not all objects support updating object.</td>
168
+ </tr>
169
+ <tr>
170
+ <td>persisted?</td>
171
+ <td>Returns true if the object has been persisted.</td>
172
+ </tr>
173
+ <tr>
174
+ <td>destroy</td>
175
+ <td>
176
+ Destroys object.<br>
177
+ Note: this is a non-blocking call and object deletion might not be instantaneous.
178
+ </td>
179
+ <tr>
180
+ <td>reload</td>
181
+ <td>Updates object with latest state from service.</td>
182
+ <tr>
183
+ <td>ready?</td>
184
+ <td>Returns true if object is in a ready state and able to perform actions. This method will raise an exception if object is in an error state.</td>
185
+ </tr>
186
+ <tr>
187
+ <td>attributes</td>
188
+ <td>Returns a hash containing the list of model attributes and values.</td>
189
+ </tr>
190
+ <td>identity</td>
191
+ <td>
192
+ Returns the identity of the object.<br>
193
+ Note: This might not always be equal to object.id.
194
+ </td>
195
+ </tr>
196
+ <tr>
197
+ <td>wait_for</td>
198
+ <td>This method periodically reloads model and then yields to specified block until block returns true or a timeout occurs.</td>
199
+ </tr>
200
+ </table>
201
+
202
+ To see a list of collections supported by the service:
203
+ ```
204
+ service.collections
205
+ ```
206
+ This returns:
207
+ ```
208
+ :networks, :ports, :subnets, :floating_ips, :routers,
209
+ :lb_pools, :lb_members, :lb_health_monitors, :lb_vips,
210
+ :vpn_services, :ike_policies, :ipsec_policies, :ipsec_site_connections,
211
+ :rbac_policies, :security_groups, :security_group_rules
212
+ ```
213
+
214
+ #### Example Request
215
+
216
+ To request a collection of networks:
217
+ ```
218
+ networks = service.networks
219
+ ```
220
+ This returns in the following `Fog::OpenStack::Model`:
221
+ ```
222
+ <Fog::Network::OpenStack::Networks
223
+ filters={}
224
+ [<Fog::Network::OpenStack::Network
225
+ id="f9c54735-a230-443e-9379-b87f741cc1b1",
226
+ name="Public",
227
+ subnets= <Fog::Network::OpenStack::Subnets
228
+ filters={}
229
+ [<Fog::Network::OpenStack::Subnet ... >]
230
+ >,
231
+ shared=true,
232
+ status="ACTIVE",
233
+ admin_state_up=true,
234
+ tenant_id="a51fd915",
235
+ provider_network_type="vlan",
236
+ provider_physical_network=nil,
237
+ provider_segmentation_id=nil,
238
+ router_external=false
239
+ >,
240
+ <Fog::Network::OpenStack::Network
241
+ id="e624a36d-762b-481f-9b50-4154ceb78bbb",
242
+ name="network_1",
243
+ subnets= <Fog::Network::OpenStack::Subnets
244
+ filters={}
245
+ []
246
+ >,
247
+ shared=false,
248
+ status="ACTIVE",
249
+ admin_state_up=true,
250
+ tenant_id="f8b26a6032bc47718a7702233ac708b9",
251
+ provider_network_type=nil,
252
+ provider_physical_network=nil,
253
+ provider_segmentation_id=nil,
254
+ router_external=nil
255
+ >
256
+ ]
257
+ >
258
+ ```
259
+
260
+ To access the name of the first network:
261
+ ```
262
+ networks.first.name
263
+ ```
264
+ This will return:
265
+ ```
266
+ "Public"
267
+ ```
268
+ ## Examples
269
+
270
+ Example code using Network can be found [here](https://github.com/fog/fog-openstack/tree/master/lib/fog/openstack/examples/network).
271
+
272
+ ## Additional Resources
273
+
274
+ * [fog.io](http://fog.io/)
275
+ * [fog-openstack rdoc](http://rubydoc.info/gems/fog-openstack)
276
+ * [fog-openstack Github repo](https://github.com/fog/fog-openstack)
277
+ * [fog-openstack Github Issues](https://github.com/fog/fog-openstack/issues)
278
+ * [Excon Github repo](https://github.com/geemus/excon)
279
+ * [OpenStack Network API](http://developer.openstack.org/api-ref-networking-v2.html)
280
+
281
+ ## Support and Feedback
282
+
283
+ Your feedback is appreciated! If you have specific issues with the **fog-openstack** SDK, you should file an [issue via Github](https://github.com/fog/fog-openstack/issues).
@@ -0,0 +1,144 @@
1
+ # NFV
2
+
3
+ This document explains how to get started using NFV with
4
+ fog-openstack.
5
+
6
+ Please also refer to the
7
+ [Getting Started with Fog and the OpenStack](getting_started.md) document.
8
+
9
+ Tacker is an OpenStack service for NFV Orchestration with a general purpose
10
+ VNF Manager to deploy and operate Virtual Network Functions (VNFs) and Network
11
+ Services on an NFV Platform. It is based on ETSI MANO Architectural Framework.
12
+
13
+ # OpenStack setup
14
+
15
+ ## The catalog
16
+ For the fog-openstack's introspection service to work, the corresponding
17
+ service must be defined in the OpenStack catalog.
18
+
19
+ ```bash
20
+ openstack catalog show servicevm
21
+ +-----------+-----------------------------------------+
22
+ | Field | Value |
23
+ +-----------+-----------------------------------------+
24
+ | endpoints | regionOne |
25
+ | | publicURL: http://172.16.0.21:8888/ |
26
+ | | internalURL: http://172.16.0.21:8888/ |
27
+ | | adminURL: http://172.16.0.21:8888/ |
28
+ | | |
29
+ | name | tacker |
30
+ | type | servicevm |
31
+ +-----------+-----------------------------------------+
32
+ ```
33
+
34
+ Depending on the OpenStack release, the NFV service might be installed
35
+ but not defined yet in the catalog. In such case, you must add the service and
36
+ corresponding endpoints to create the catalog entry:
37
+
38
+ ```bash
39
+ source ./stackrc
40
+ openstack service create --name tacker --description "Tacker Project" servicevm
41
+ openstack endpoint create --region regionOne tacker --publicurl http://example.com:8888 --internalurl http://example.com:8888 --adminurl http://example.com:8888
42
+ ```
43
+
44
+ # Work flow
45
+ A usual work-flow might consist of:
46
+ * Create vnfd
47
+ * Deploy vnf using vnfd
48
+ * Retrieve vnf and vnfd data
49
+
50
+ For more details please refer to
51
+ http://docs.openstack.org/developer/tacker/
52
+
53
+ Using 'irb', we start with authentication:
54
+
55
+ ```ruby
56
+ @user = "admin"
57
+ @project = "admin"
58
+ @password = "secret"
59
+ @base_url = "http://keystone.example.com:5000/v3/auth/tokens"
60
+
61
+ require 'rubygems'
62
+ require 'fog/openstack'
63
+
64
+ @connection_params = {
65
+ :openstack_auth_url => @base_url,
66
+ :openstack_username => @user,
67
+ :openstack_api_key => @password,
68
+ :openstack_project_name => @project,
69
+ :openstack_domain_id => "default"
70
+ }
71
+ ```
72
+
73
+ ## Vnfd management
74
+
75
+ ### Create vnfd
76
+
77
+ ```ruby
78
+ 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"},
79
+ :service_types => [{:service_type => "vnfd"}],
80
+ :mgmt_driver => "noop",
81
+ :infra_driver => "heat"}
82
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
83
+ vnfd = Fog::NFV[:openstack].vnfds.create(:vnfd => vnfd_data, :auth => auth)
84
+ ```
85
+
86
+ ### List vnfds
87
+
88
+ ```ruby
89
+ vnfds = Fog::NFV[:openstack].vnfds
90
+ ```
91
+
92
+ ### Get vnfd
93
+
94
+ ```ruby
95
+ vnfd = Fog::NFV[:openstack].vnfds.last
96
+ vnfd = Fog::NFV[:openstack].vnfds.get(vnfd.id)
97
+ ```
98
+
99
+ ### Destroy vnfd
100
+
101
+ ```ruby
102
+ vnfd = Fog::NFV[:openstack].vnfds.last
103
+ vnfd.destroy
104
+ ```
105
+
106
+ ## Vnf management
107
+
108
+ ### Create vnf using vnfd
109
+
110
+ ```ruby
111
+ vnfd = Fog::NFV[:openstack].vnfds.last
112
+ vnf_data = {:vnfd_id => vnfd.id, :name => 'Test'}
113
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
114
+ vnf = Fog::NFV[:openstack].vnfs.create(:vnf => vnf_data, :auth => auth)
115
+ ```
116
+
117
+ ### List vnfs
118
+
119
+ ```ruby
120
+ vnfs = Fog::NFV[:openstack].vnfs
121
+ ```
122
+
123
+ ### Get vnf
124
+
125
+ ```ruby
126
+ vnf = Fog::NFV[:openstack].vnfs.last
127
+ vnf = Fog::NFV[:openstack].vnfs.get(vnf.id)
128
+ ```
129
+
130
+ ### Update vnf
131
+
132
+ ```ruby
133
+ vnf = Fog::NFV[:openstack].vnfs.last
134
+ vnf_data = {"attributes": {"config": "vdus:\n vdu1:<sample_vdu_config> \n\n"}}
135
+ auth = {"tenantName" => "admin", "passwordCredentials" => {"username" => "admin","password" => "password"}}
136
+ vnf = vnf.update(:vnf => vnf_data, :auth => auth)
137
+ ```
138
+
139
+ ### Destroy vnf
140
+
141
+ ```ruby
142
+ vnf = Fog::NFV[:openstack].vnfs.last
143
+ vnf.destroy
144
+ ```
@@ -11,17 +11,17 @@ compute_client ||= ::Fog::Compute::OpenStack.new(
11
11
  :openstack_api_key => password,
12
12
  :openstack_username => username,
13
13
  :openstack_auth_url => auth_url,
14
- :openstack_tenant => tenant,
14
+ :openstack_tenant => tenant
15
15
  )
16
16
 
17
- vm = compute_client.servers.create(
17
+ _vm = compute_client.servers.create(
18
18
  :name => name,
19
19
  :flavor_ref => flavor,
20
20
  :block_device_mapping_v2 => [
21
21
  {
22
- :boot_index => 0
22
+ :boot_index => 0,
23
23
  :device_name => "vda",
24
- :source_type => "volume", # Or "snapshot"
24
+ :source_type => "volume", # Or "snapshot"
25
25
  :destination_type => "volume",
26
26
  :delete_on_termination => false,
27
27
  :uuid => cinder_uddi,