Skip to content

Commit

Permalink
Merge pull request #471 from HewlettPackard/API2000_enclosure_resources
Browse files Browse the repository at this point in the history
Added API2000 support for enclosure resources
  • Loading branch information
VenkateshRavula authored Sep 16, 2020
2 parents 8478edc + 4956144 commit fe7de59
Show file tree
Hide file tree
Showing 19 changed files with 296 additions and 101 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Oneview Features supported
- oneview_connection_template
- oneview_enclosure
- oneview_enclosure_group
- oneview_ethernet_network
- oneview_fc_network
- oneview_fcoe_network
Expand All @@ -19,6 +21,8 @@
- oneview_network_set
- oneview_scope
- oneview_server_certificate
- oneview_server_hardware
- oneview_server_hardware_type
- oneview_server_profile
- oneview_server_profile_template
- oneview_storage_pool
Expand Down
90 changes: 45 additions & 45 deletions endpoints-support.md

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions examples/demo/infrastructure_provisioning_with_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD'],
api_version: 1800
api_version: 2000
}

my_server_hardware_type = 'SY 480 Gen9 2'
my_server_hardware = 'SYN03_Frame1, bay 3'
my_enclosure_group = 'EG'
my_spt = 'SPT-102'
my_fc_network_data = [
{
FC01: {
Expand Down Expand Up @@ -62,7 +64,7 @@
]

# To create server profile template
oneview_server_profile_template 'SPT-102' do
oneview_server_profile_template my_spt do
client my_client
enclosure_group my_enclosure_group
server_hardware_type my_server_hardware_type
Expand All @@ -81,13 +83,12 @@
client my_client
enclosure_group my_enclosure_group
server_hardware_type my_server_hardware_type
server_profile_template 'SPT-102'
server_hardware 'SYN03_Frame1, bay 3'
server_profile_template my_spt
server_hardware my_server_hardware
end

# Power on the server

oneview_server_hardware 'SYN03_Frame1, bay 3' do
oneview_server_hardware my_server_hardware do
client my_client
power_state 'on'
action :set_power_state
Expand Down
35 changes: 22 additions & 13 deletions examples/enclosure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD'],
api_version: 1800
api_version: 2000,
api_variant: 'Synergy'
}

oneview_enclosure 'Encl1' do
enc_name = '0000A66102'

oneview_enclosure enc_name do
data(
hostname: '172.18.1.11',
username: 'dcs',
Expand All @@ -32,12 +35,13 @@
enclosure_group 'Eg1'
client my_client
action :add
only_if { client[:api_variant] == 'C7000' }
end

#Generate certificate Signing Request
oneview_enclosure 'e10' do
oneview_enclosure enc_name do
client my_client
bay_number 1
bay_number 1 # bay number is required only for C7000
csr_file_path 'file_path_of_csr_file'
csr_data(
type: 'CertificateDtoV2',
Expand All @@ -53,17 +57,17 @@
end

#Import a signed server certtificate into 'Encl1'
oneview_enclosure 'e10' do
oneview_enclosure enc_name do
client my_client
bay_number 1
bay_number 1 # bay number is required only for C7000
csr_file_path 'file_path_of_csr_file'
csr_type 'CertificateDataV2'
action :import_certificate
end

# Rename enclosure
# Warning: Operation persists in hardware
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
operation 'replace'
path '/name'
Expand All @@ -76,42 +80,47 @@
client my_client
operation 'replace'
path '/name'
value 'Encl1'
value enc_name
action :patch
end

# Refreshes the enclosure
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
action :refresh
end

# Supported for API 300 till 500
# Adds 'Encl1' to 'Scope1' and 'Scope2'
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
scopes ['Scope1', 'Scope2']
action :add_to_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Supported for API 300 till 500
# Removes 'Encl1' from 'Scope1'
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
scopes ['Scope1']
action :remove_from_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Supported for API 300 till 500
# Replaces 'Scope1' and 'Scope2' for 'Encl1'
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
scopes ['Scope1', 'Scope2']
action :replace_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Remove operation will work only for C7000
# Removes it from the appliance
oneview_enclosure 'Encl1' do
oneview_enclosure enc_name do
client my_client
action :remove
only_if { client[:api_variant] == 'C7000' }
end
8 changes: 5 additions & 3 deletions examples/enclosure_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD'],
api_version: 1800
api_version: 2000,
api_variant: 'Synergy'
}

interconnect_bay_mapping = [
{ interconnectBay: 1, logicalInterconnectGroupUri: '/rest/logical-interconnect-groups/a6ac18fa-c0a6-4937-96ea-3d0da4fe7e21' },
{ interconnectBay: 4, logicalInterconnectGroupUri: '/rest/logical-interconnect-groups/a6ac18fa-c0a6-4937-96ea-3d0da4fe7e21' }
{ interconnectBay: 3, logicalInterconnectGroupUri: '/rest/logical-interconnect-groups/a6ac18fa-c0a6-4937-96ea-3d0da4fe7e21' },
{ interconnectBay: 6, logicalInterconnectGroupUri: '/rest/logical-interconnect-groups/a6ac18fa-c0a6-4937-96ea-3d0da4fe7e21' }
]

oneview_enclosure_group 'Eg2' do
Expand All @@ -39,6 +40,7 @@
api_variant 'C7000'
script '#TEST COMMAND'
action :set_script
only_if { client[:api_variant] == 'C7000' }
end

oneview_enclosure_group 'Eg2' do
Expand Down
8 changes: 4 additions & 4 deletions examples/ethernet_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :add_to_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Only for V300 and V500
Expand All @@ -76,7 +76,7 @@
client my_client
scopes ['Scope1']
action :remove_from_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Only for V300 and V500
Expand All @@ -85,7 +85,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :replace_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Only for V300 and V500
Expand All @@ -95,7 +95,7 @@
operation 'replace'
path '/scopeUris'
value []
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
action :patch
end

Expand Down
8 changes: 4 additions & 4 deletions examples/fc_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :add_to_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Removes 'Fc1' from 'Scope1'
Expand All @@ -74,7 +74,7 @@
client my_client
scopes ['Scope1']
action :remove_from_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces 'Scope1' and 'Scope2' for 'Fc1'
Expand All @@ -83,7 +83,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :replace_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces all scopes to empty list of scopes
Expand All @@ -94,7 +94,7 @@
path '/scopeUris'
value []
action :patch
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Reset the connection template for a fc network
Expand Down
8 changes: 4 additions & 4 deletions examples/fcoe_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :add_to_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Removes 'FCoE1' from 'Scope1'
Expand All @@ -65,7 +65,7 @@
client my_client
scopes ['Scope1']
action :remove_from_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Replaces scopes to 'Scope1' and 'Scope2'
Expand All @@ -74,7 +74,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :replace_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Replaces all scopes to empty list of scopes
Expand All @@ -85,7 +85,7 @@
path '/scopeUris'
value []
action :patch
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Reset the connection template for 'FCoE1'
Expand Down
8 changes: 4 additions & 4 deletions examples/network_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :add_to_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Removes 'ChefNetworkSet_1' from 'Scope1'
Expand All @@ -75,7 +75,7 @@
client my_client
scopes ['Scope1']
action :remove_from_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces 'Scope1' and 'Scope2' for 'ChefNetworkSet_1'
Expand All @@ -84,7 +84,7 @@
client my_client
scopes ['Scope1', 'Scope2']
action :replace_scopes
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces all scopes to empty list of scopes
Expand All @@ -95,7 +95,7 @@
path '/scopeUris'
value []
action :patch
only_if { client[:api_version] == 300 && client[:api_version] == 500 }
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Reset the connection template for a network
Expand Down
Loading

0 comments on commit fe7de59

Please sign in to comment.