diff --git a/Berksfile b/Berksfile index d6c2cd5b..f3c1582a 100644 --- a/Berksfile +++ b/Berksfile @@ -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' diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a848dd6..e430867a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - oneview_hypervisor_manager - oneview_interconnect - oneview_logical_enclosure +- oneview_logical_interconnect - oneview_logical_interconnect_group - oneview_network_set - oneview_scope diff --git a/endpoints-support.md b/endpoints-support.md index 267ae866..c8603828 100644 --- a/endpoints-support.md +++ b/endpoints-support.md @@ -100,36 +100,37 @@ |/rest/logical-enclosures/{id}/support-dumps | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | |/rest/logical-enclosures/{id}/updateFromGroup | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | **Logical Interconnects** | -|/rest/logical-interconnects | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/locations/interconnects | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | -|/rest/logical-interconnects/locations/interconnects | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | -|/rest/logical-interconnects/{id} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/compliance | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/ethernetSettings | GET | :heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/ethernetSettings | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/igmpSettings | GET | :heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/igmpSettings | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/firmware | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/firmware | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/forwarding-information-base | GET | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/forwarding-information-base | POST | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/forwarding-information-base/{dumpFileName}.{suffix} | GET | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/internalNetworks | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/internalVlans | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/qos-aggregated-configuration | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/qos-aggregated-configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/settings | PUT | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | -|/rest/logical-interconnects/{id}/snmp-configuration | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/snmp-configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/support-dumps | POST | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | -|/rest/logical-interconnects/{id}/unassignedUplinkPortsForPortMonitor | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/port-monitor | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/port-monitor | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/telemetry-configurations/{tcId} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/{id}/telemetry-configurations/{tcId} | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | -|/rest/logical-interconnects/compliance | PUT | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: | -|/rest/logical-interconnects/{id} | PATCH | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnects | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/locations/interconnects | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnects/locations/interconnects | DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnects/{id} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/compliance | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/ethernetSettings | GET | :heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/ethernetSettings | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/igmpSettings | GET | :heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/igmpSettings | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/firmware | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/firmware | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/forwarding-information-base | GET | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/forwarding-information-base | POST | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/forwarding-information-base/{dumpFileName}.{suffix} | GET | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/internalNetworks | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/internalVlans | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/qos-aggregated-configuration | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/qos-aggregated-configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/settings | PUT | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnects/{id}/snmp-configuration | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/snmp-configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/support-dumps | POST | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | +|/rest/logical-interconnects/{id}/unassignedUplinkPortsForPortMonitor | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/configuration | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/port-monitor | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/port-monitor | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/telemetry-configurations/{tcId} | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/{id}/telemetry-configurations/{tcId} | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +|/rest/logical-interconnects/compliance | PUT | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: | :heavy_multiplication_x: |:heavy_multiplication_x: |:heavy_multiplication_x: | +|/rest/logical-interconnects/{id} | PATCH | :white_check_mark: | :white_check_mark: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | +|/rest/logical-interconnects/bulk-inconsistency-validation | POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: |:heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | | **Logical Interconnect Groups** | |/rest/logical-interconnect-groups | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | |/rest/logical-interconnect-groups | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: |:white_check_mark: | diff --git a/examples/logical_interconnect.rb b/examples/logical_interconnect.rb index 74e714f0..2a297b91 100644 --- a/examples/logical_interconnect.rb +++ b/examples/logical_interconnect.rb @@ -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. @@ -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 @@ -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 @@ -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: { @@ -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: { @@ -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, @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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: { @@ -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( @@ -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( @@ -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( @@ -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 diff --git a/libraries/matchers.rb b/libraries/matchers.rb index 0f23cfa1..ef0eb115 100644 --- a/libraries/matchers.rb +++ b/libraries/matchers.rb @@ -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, @@ -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], diff --git a/libraries/resource_providers/api2000/c7000/logical_interconnect_provider.rb b/libraries/resource_providers/api2000/c7000/logical_interconnect_provider.rb new file mode 100644 index 00000000..13653e28 --- /dev/null +++ b/libraries/resource_providers/api2000/c7000/logical_interconnect_provider.rb @@ -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 diff --git a/libraries/resource_providers/api2000/synergy/logical_interconnect_provider.rb b/libraries/resource_providers/api2000/synergy/logical_interconnect_provider.rb new file mode 100644 index 00000000..44d94dd1 --- /dev/null +++ b/libraries/resource_providers/api2000/synergy/logical_interconnect_provider.rb @@ -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 diff --git a/resources/logical_interconnect.rb b/resources/logical_interconnect.rb index abad5807..900b1ac9 100644 --- a/resources/logical_interconnect.rb +++ b/resources/logical_interconnect.rb @@ -19,6 +19,7 @@ property :firmware_data, Hash, default: {} property :scopes, Array property :port_monitor, Hash, default: {} +property :logicalInterconnectUris, Array, default: [] default_action :none @@ -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 diff --git a/spec/fixtures/cookbooks/oneview_test_api2000_c7000/attributes/default.rb b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/attributes/default.rb new file mode 100644 index 00000000..709061d0 --- /dev/null +++ b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/attributes/default.rb @@ -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 } diff --git a/spec/fixtures/cookbooks/oneview_test_api2000_c7000/metadata.rb b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/metadata.rb new file mode 100644 index 00000000..6631d651 --- /dev/null +++ b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/metadata.rb @@ -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' diff --git a/spec/fixtures/cookbooks/oneview_test_api2000_c7000/recipes/logical_interconnect_validate_bulk_inconsistency.rb b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/recipes/logical_interconnect_validate_bulk_inconsistency.rb new file mode 100644 index 00000000..a91137a4 --- /dev/null +++ b/spec/fixtures/cookbooks/oneview_test_api2000_c7000/recipes/logical_interconnect_validate_bulk_inconsistency.rb @@ -0,0 +1,22 @@ +# Cookbook Name:: oneview_test_api2000_c7000 +# Recipe:: logical_interconnect_validate_bulk_inconsistency +# +# (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. +# + +oneview_logical_interconnect 'LogicalInterconnect-validate_bulk_inconsistency' do + client node['oneview_test']['client'] + data( + 'logicalInterconnectUris' => ['/rest/fake'] + ) + action :validate_bulk_inconsistency +end diff --git a/spec/unit/resources/logical_interconnect/validate_bulk_inconsistency_spec.rb b/spec/unit/resources/logical_interconnect/validate_bulk_inconsistency_spec.rb new file mode 100644 index 00000000..9a7faf7d --- /dev/null +++ b/spec/unit/resources/logical_interconnect/validate_bulk_inconsistency_spec.rb @@ -0,0 +1,11 @@ +require_relative './../../../spec_helper' + +describe 'oneview_test_api2000_c7000::logical_interconnect_validate_bulk_inconsistency' do + let(:resource_name) { 'logical_interconnect' } + include_context 'chef context' + + it 'fails if the resource is not found' do + expect_any_instance_of(OneviewSDK::API2000::C7000::LogicalInterconnect).to receive(:retrieve!).and_return(false) + expect { real_chef_run }.to raise_error(RuntimeError, /not found/) + end +end diff --git a/spec/unit/resources/matchers_spec.rb b/spec/unit/resources/matchers_spec.rb index f5aeaf84..808c8961 100644 --- a/spec/unit/resources/matchers_spec.rb +++ b/spec/unit/resources/matchers_spec.rb @@ -130,6 +130,7 @@ expect(chef_run).to_not update_oneview_logical_interconnect_igmp_settings('') expect(chef_run).to_not update_oneview_logical_interconnect_firmware('') expect(chef_run).to_not update_oneview_logical_interconnect_internal_networks('') + expect(chef_run).to_not validate_oneview_logical_interconnect_bulk_inconsistency('') expect(chef_run).to_not update_oneview_logical_interconnect_port_monitor('') expect(chef_run).to_not update_oneview_logical_interconnect_qos_configuration('') expect(chef_run).to_not update_oneview_logical_interconnect_settings('')