Skip to content

Commit

Permalink
Merge pull request #473 from HewlettPackard/API2000_logicalinterconnect
Browse files Browse the repository at this point in the history
Added API2000 support to logical interconnects
  • Loading branch information
VenkateshRavula authored Sep 21, 2020
2 parents fe7de59 + 4dbaf9e commit a185557
Show file tree
Hide file tree
Showing 13 changed files with 214 additions and 66 deletions.
1 change: 1 addition & 0 deletions Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ group :test do
cookbook 'oneview_test_api800_c7000', path: './spec/fixtures/cookbooks/oneview_test_api800_c7000'
cookbook 'oneview_test_api1600_c7000', path: './spec/fixtures/cookbooks/oneview_test_api1600_c7000'
cookbook 'oneview_test_api1800_c7000', path: './spec/fixtures/cookbooks/oneview_test_api1800_c7000'
cookbook 'oneview_test_api2000_c7000', path: './spec/fixtures/cookbooks/oneview_test_api2000_c7000'
cookbook 'image_streamer_test_api300', path: './spec/fixtures/cookbooks/image_streamer_test_api300'
cookbook 'image_streamer_test_api500', path: './spec/fixtures/cookbooks/image_streamer_test_api500'
cookbook 'image_streamer_test_api600', path: './spec/fixtures/cookbooks/image_streamer_test_api600'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- oneview_hypervisor_manager
- oneview_interconnect
- oneview_logical_enclosure
- oneview_logical_interconnect
- oneview_logical_interconnect_group
- oneview_network_set
- oneview_scope
Expand Down
61 changes: 31 additions & 30 deletions endpoints-support.md

Large diffs are not rendered by default.

101 changes: 67 additions & 34 deletions examples/logical_interconnect.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,11 +17,20 @@
my_client = {
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD']
password: ENV['ONEVIEWSDK_PASSWORD'],
api_variant: 'Synergy',
api_version: 2000
}

# Variable declaration
li_name = 'LE-LIG'
network1 = 'Test-Network-1'
network2 = 'Test-Network-2'
scope1 = 'Scope1'
scope2 = 'Scope2'

# No action
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
end

Expand All @@ -32,6 +41,7 @@
enclosure 'Encl1'
bay_number 1
action :remove_interconnect
only_if { client[:api_version] == 200 }
end

# Add the interconnect in the enclosure 'Encl1' in bay 1 for management in HPE OneView
Expand All @@ -41,29 +51,48 @@
enclosure 'Encl1'
bay_number 1
action :add_interconnect
only_if { client[:api_version] == 200 }
end

# Get the inconsistency report for bulk update from group
oneview_logical_interconnect li_name do
client my_client
logicalInterconnectUris ['/rest/logical-interconnects/1d2be484-6d4c-46f4-8f6a-8a34080030a6']
action :validate_bulk_inconsistency
only_if { client[:api_version] >= 200 && client[:api_variant] == 'Synergy' }
end

# Set the EthernetNetwork1 and EthernetNetwork2 as internal networks for the logical interconnect
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
internal_networks ['EthernetNetwork1', 'EthernetNetwork2']
internal_networks [network1, network2]
action :update_internal_networks
end

# Increase the ethernet settings refresh and timeout intervals
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
ethernetSettings: {
igmpIdleTimeoutInterval: 230,
macRefreshInterval: 15
}
)
if client[:api_variant] == 'C7000'
data(
ethernetSettings: {
igmpIdleTimeoutInterval: 230,
macRefreshInterval: 30
}
)
end
if client[:api_variant] == 'Synergy'
data(
ethernetSettings: {
igmpIdleTimeoutInterval: 230,
stormControlPollingInterval: 20
}
)
end
action :update_ethernet_settings
end

# Update igmp settings refresh and timeout intervals
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
igmpSettings: {
Expand All @@ -74,7 +103,7 @@
end

# Activate the port monitor service
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
port_monitor(
analyzerPort: {
Expand All @@ -94,7 +123,7 @@
end

# Disable the port monitor service
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
port_monitor(
analyzerPort: nil,
Expand All @@ -106,7 +135,7 @@
end

# Activate the port monitor service with data
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup_1' do
oneview_logical_interconnect li_name do
client my_client
data(
portMonitor: {
Expand All @@ -128,7 +157,7 @@
end

# Disable the port monitor service with data
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup_1' do
oneview_logical_interconnect li_name do
client my_client
data(
portMonitor: {
Expand All @@ -142,7 +171,7 @@
end

# Activate the port monitor service with data and port_monitor property
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup_1' do
oneview_logical_interconnect li_name do
client my_client
data(
portMonitor: {
Expand All @@ -166,7 +195,7 @@
end

# Update quality of service configuration
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
qosConfiguration: {
Expand All @@ -180,7 +209,7 @@
end

# Update telemetry configuration
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
telemetryConfiguration: {
Expand All @@ -192,7 +221,7 @@
end

# Add one SNMP Trap configuration
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
snmpConfiguration: {
Expand All @@ -213,7 +242,7 @@
end

# Clean the SNMP Traps
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
data(
snmpConfiguration: {
Expand All @@ -224,7 +253,7 @@
end

# Stage one firmware bundle in the Logical Interconnect with sme flahsing options
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
Expand All @@ -238,7 +267,7 @@
end

# Update the staged firmware driver flahsing options
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
Expand All @@ -251,7 +280,7 @@

# Activate the staged firmware in the logical interconnect
# It starts the flashing process in each managed interconnect
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
firmware 'ROM Flash - SPP'
firmware_data(
Expand All @@ -261,48 +290,52 @@
end

# Start to reapply the configuration in each managed interconnect
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
action :reapply_configuration
end

# Compliance update
# Update the logical interconnect according to its associated logical interconnect group
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
action :update_from_group
end

# Example: Adds 'Encl1-LogicalInterconnectGroup1' to 'Scope1' and 'Scope2'
# Available only in Api300 and Api500
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
scopes ['Scope1', 'Scope2']
scopes [scope1, scope2]
action :add_to_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Removes 'Encl1-LogicalInterconnectGroup1' from 'Scope1'
# Available only in Api300 and Api500
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
scopes ['Scope1']
scopes [scope1]
action :remove_from_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces 'Scope1' and 'Scope2' for 'Encl1-LogicalInterconnectGroup1'
# Available only in Api300 and Api500
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
scopes ['Scope1', 'Scope2']
scopes [scope1, scope2]
action :replace_scopes
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end

# Example: Replaces all scopes to empty list of scopes
# Available only in Api300 and Api500
oneview_logical_interconnect 'Encl1-LogicalInterconnectGroup1' do
oneview_logical_interconnect li_name do
client my_client
operation 'replace'
path '/scopeUris'
value []
action :patch
only_if { client[:api_version] == 300 || client[:api_version] == 500 }
end
4 changes: 2 additions & 2 deletions libraries/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
scope_actions = %i[add_to_scopes remove_from_scopes replace_scopes patch]
# Lists all the possible action verbs
action_list = %w[create add delete remove set reset refresh update configure reconfigure edit none discover apply reapply activate
stage new patch replace change load download upload extract backup allocate collect repair import modify]
stage new patch replace change load download upload extract backup allocate collect repair import modify validate]

oneview_resources = {
oneview_resource: standard_actions,
Expand All @@ -40,7 +40,7 @@
oneview_logical_interconnect: %i[none add_interconnect remove_interconnect update_internal_networks update_settings
update_ethernet_settings update_igmp_settings update_port_monitor update_qos_configuration
update_telemetry_configuration update_snmp_configuration update_firmware stage_firmware
activate_firmware update_from_group reapply_configuration] + scope_actions,
validate_bulk_inconsistency activate_firmware update_from_group reapply_configuration] + scope_actions,
oneview_logical_switch_group: standard_actions + scope_actions,
oneview_logical_switch: standard_actions + scope_actions + %i[refresh],
oneview_managed_san: %i[refresh set_policy set_public_attributes],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

module OneviewCookbook
module API2000
module C7000
# LogicalInterconnect API2000 C7000 provider
class LogicalInterconnectProvider < API1800::C7000::LogicalInterconnectProvider
def validate_bulk_inconsistency
@item.retrieve! || raise("#{@resource_name} '#{@name}' not found!")
@item['logicalInterconnectUris'] = @new_resource.logicalInterconnectUris
@item.bulk_inconsistency_validate
Chef::Log.info("Report: #{@item['logicalInterconnectsReport']}")
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

module OneviewCookbook
module API2000
module Synergy
# LogicalInterconnect API2000 Synergy provider
class LogicalInterconnectProvider < API2000::C7000::LogicalInterconnectProvider
end
end
end
end
5 changes: 5 additions & 0 deletions resources/logical_interconnect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
property :firmware_data, Hash, default: {}
property :scopes, Array
property :port_monitor, Hash, default: {}
property :logicalInterconnectUris, Array, default: []

default_action :none

Expand Down Expand Up @@ -49,6 +50,10 @@
OneviewCookbook::Helper.do_resource_action(self, :LogicalInterconnect, :update_igmp_settings)
end

action :validate_bulk_inconsistency do
OneviewCookbook::Helper.do_resource_action(self, :LogicalInterconnect, :validate_bulk_inconsistency)
end

action :update_port_monitor do
OneviewCookbook::Helper.do_resource_action(self, :LogicalInterconnect, :update_port_monitor)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Cookbook Name:: oneview_test_api2000_c7000
# Attributes:: default
#
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#

default['oneview']['api_version'] = 2000
default['oneview']['api_variant'] = 'C7000'

default['oneview_test']['client'] = { url: 'https://oneview.example.com', user: 'Administrator', password: 'secret123', api_version: 2000 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name 'oneview_test_api2000_c7000'
maintainer 'none'
license 'All rights reserved'
description 'A test cookbook for the oneview cookbook API2000::C7000 module'
version '0.1.0'

depends 'oneview'
Loading

0 comments on commit a185557

Please sign in to comment.