Skip to content

Commit

Permalink
Merge 3aa6713 into f19e9b0
Browse files Browse the repository at this point in the history
  • Loading branch information
chebroluharika committed Sep 8, 2020
2 parents f19e9b0 + 3aa6713 commit 50f89db
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 113 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 5.4.0(unreleased)
#### Notes
Extends support of the SDK to OneView REST API version 1800 (OneView v5.30).
Extends support of the SDK to OneView REST API version 2000 (OneView v5.40).

#### Breaking Changes
Enhancement made in this version breaks the previous version of the SDK.
Expand All @@ -15,6 +15,17 @@ Extends support of the SDK to OneView REST API version 1800 (OneView v5.30).

#### Major changes
Refactored base class to take default API version as per provided Oneview appliance.
Removed provision of "type" field as those are optional from API1600

#### Features supported with the current release
- Enclosures
- Enclosure Groups
- Ethernet network
- FC network
- FCOE network
- Logical Enclosures
- Network set
- Uplink set

#### Bug fixes & Enhancements
- [#81](https://github.com/HewlettPackard/oneview-python/issues/81) EthernetNetworks Update does not work.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ The API list is as follows:
- HPE OneView 5.00 API version: `1200`
- HPE OneView 5.20 API version: `1600`
- HPE OneView 5.30 API version: `1800`
- HPE OneView 5.40 API version: `2000`

### HPE Synergy Image Streamer

Expand Down
144 changes: 72 additions & 72 deletions endpoints-support.md

Large diffs are not rendered by default.

37 changes: 22 additions & 15 deletions examples/enclosures.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

enclosure_name = "Enc"

# Specify variant of your appliance before running this example
api_variant = "C7000"

# Declare a CA signed certificate file path.
certificate_file = ""

Expand Down Expand Up @@ -97,16 +100,18 @@
print(e.msg)

# Set the calibrated max power of an unmanaged or unsupported enclosure
print("Set the calibrated max power of an unmanaged or unsupported enclosure")
# update_environmental_configuration is available only in C7000
if api_variant == 'C7000':
print("Set the calibrated max power of an unmanaged or unsupported enclosure")

try:
configuration = {
"calibratedMaxPower": 2500
}
enclosure_updated_encConf = enclosure.update_environmental_configuration(configuration)
print(" Done.")
except HPEOneViewException as e:
print(e.msg)
try:
configuration = {
"calibratedMaxPower": 2500
}
enclosure_updated_encConf = enclosure.update_environmental_configuration(configuration)
print(" Done.")
except HPEOneViewException as e:
print(e.msg)

# Refresh the enclosure
print("Refreshing the enclosure")
Expand All @@ -118,12 +123,14 @@
print(e.msg)

# Buid the SSO URL parameters
print("Build the SSO (Single Sign-On) URL parameters for the enclosure")
try:
sso_url_parameters = enclosure.get_sso('Active')
pprint(sso_url_parameters)
except HPEOneViewException as e:
print(e.msg)
# get_sso is available only in C7000
if api_variant == 'C7000':
print("Build the SSO (Single Sign-On) URL parameters for the enclosure")
try:
sso_url_parameters = enclosure.get_sso('Active')
pprint(sso_url_parameters)
except HPEOneViewException as e:
print(e.msg)

# Get Statistics specifying parameters
print("Get the enclosure statistics")
Expand Down
10 changes: 6 additions & 4 deletions examples/ethernet_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@

# Get URIs of associated profiles
print("\nGet associated profiles uri(s)")
associated_profiles = ethernet_network.get_associated_profiles()
pprint(associated_profiles)
if ethernet_network:
associated_profiles = ethernet_network.get_associated_profiles()
pprint(associated_profiles)

# Get URIs of uplink port group
print("\nGet uplink port group uri(s)")
uplink_group_uris = ethernet_network.get_associated_uplink_groups()
pprint(uplink_group_uris)
if ethernet_network:
uplink_group_uris = ethernet_network.get_associated_uplink_groups()
pprint(uplink_group_uris)

# Get the associated uplink set resources
print("\nGet associated uplink sets")
Expand Down
9 changes: 5 additions & 4 deletions examples/fcoe_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from pprint import pprint
from hpeOneView.oneview_client import OneViewClient
from config_loader import try_load_from_file
from copy import deepcopy

# To run this example fill the ip and the credentials below or use a configuration file
config = {
Expand Down Expand Up @@ -81,12 +82,12 @@
print("\nCreated fcoe-network '%s' successfully.\n uri = '%s'" % (fcoe_network.data['name'], fcoe_network.data['uri']))

# Update autoLoginRedistribution from recently created network
resource = fcoe_network.data.copy()
resource = deepcopy(fcoe_network.data)
resource['status'] = 'Warning'
resource['name'] = "{}-Renamed".format(options["name"])
fcoe_network.update(resource)
print("\nUpdated fcoe-network '%s' successfully.\n uri = '%s'" % (fcoe_network.data['name'], fcoe_network.data['uri']))
print(" with attribute {'status': %s}" % fcoe_network.data['status'])
fcoe_network_updated = fcoe_network.update(resource)
print("\nUpdated fcoe-network '%s' successfully.\n uri = '%s'" % (fcoe_network_updated.data['name'], fcoe_network_updated.data['uri']))
print(" with attribute {'status': %s}" % fcoe_network_updated.data['status'])

# Get by Uri
print("\nGet a fcoe-network by uri")
Expand Down
4 changes: 2 additions & 2 deletions examples/logical_enclosures.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
# This method is only available on HPE Synergy.
logical_enclosure = logical_enclosures.create(options)
print("Created logical enclosure'%s' successfully.\n uri = '%s'" % (
logical_enclosure['name'],
logical_enclosure['uri'])
logical_enclosure.data['name'],
logical_enclosure.data['uri'])
)

# Update the logical enclosure name
Expand Down
13 changes: 8 additions & 5 deletions examples/network_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,17 @@

# Get network set without Ethernet networks
print("Get network-set without Ethernet:")
net_set_without_ethernet = network_set.get_without_ethernet()
pprint(net_set_without_ethernet)
if network_set:
net_set_without_ethernet = network_set.get_without_ethernet()
pprint(net_set_without_ethernet)
else:
print("No network set '%s' found.\n" % (network_set.data['name']))

# Update name of recently created network set
network_set_update = {'name': 'OneViewSDK Test Network Set Re-named'}
network_set = network_set.update(network_set_update)
print("Updated network set '%s' successfully.\n" %
(network_set.data['name']))
if network_set:
network_set = network_set.update(network_set_update)
print("Updated network set '%s' successfully.\n" % (network_set.data['name']))

# Adds network set to scope defined only for V300 and V500
if scope_name and 300 <= oneview_client.api_version <= 500:
Expand Down
23 changes: 13 additions & 10 deletions examples/uplink_sets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] 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 Down Expand Up @@ -95,30 +95,33 @@

# Update an uplink set
print("\nUpdate an uplink set")
uplink_set.data['name'] = 'Renamed Uplink Set Demo'
uplink_set.update(uplink_set.data)
print("Updated uplink set name to '{name}' successfully.\n uri = '{uri}'".format(**uplink_set.data))
if uplink_set:
uplink_set.data['name'] = 'Renamed Uplink Set Demo'
uplink_set.update(uplink_set.data)
print("Updated uplink set name to '{name}' successfully.\n uri = '{uri}'".format(**uplink_set.data))

# Add an ethernet network to the uplink set
# To run this example you must define an ethernet network uri or ID below
if ethernet_network_name:
if ethernet_network_name and uplink_set:
print("\nAdd an ethernet network to the uplink set")
uplink_added_ethernet = uplink_set.add_ethernet_networks(ethernet_network_name)
print("The uplink set with name = '{name}' have now the networkUris:\n {networkUris}".format(**uplink_added_ethernet))

# Remove an ethernet network from the uplink set
# To run this example you must define an ethernet network uri or ID below
if ethernet_network_name:
if ethernet_network_name and uplink_set:
print("\nRemove an ethernet network of the uplink set")
uplink_removed_ethernet = uplink_set.remove_ethernet_networks(ethernet_network_name)
print("The uplink set with name = '{name}' have now the networkUris:\n {networkUris}".format(**uplink_removed_ethernet))

# Get the associated ethernet networks of an uplink set
print("\nGet the associated ethernet networks of the uplink set")
networks = uplink_set.get_ethernet_networks()
pprint(networks)
if uplink_set:
networks = uplink_set.get_ethernet_networks()
pprint(networks)

# Delete the recently created uplink set
print("\nDelete the uplink set")
uplink_set.delete()
print("Successfully deleted the uplink set")
if uplink_set:
uplink_set.delete()
print("Successfully deleted the uplink set")

0 comments on commit 50f89db

Please sign in to comment.