Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit d6b7179

Browse files
committed
Merge branch 'master' into upgrade/800/server_profile
2 parents f223971 + f5d0641 commit d6b7179

19 files changed

+759
-1445
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ Resource data will be available with the resource object. This enhancement helps
3333
- Interconnect type
3434
- Internal link set
3535
- Logical enclosure
36+
- Logical interconnect
37+
- Logical interconnect group
38+
- Logical switch group
3639
- Managed SAN
3740
- SAS interconnect
3841
- SAS interconnect type
3942
- SAS logical interconnect
43+
- SAS logical interconnect group
4044
- Server hardware
4145
- Server hardware type
4246
- Server profile

endpoints-support.md

Lines changed: 48 additions & 47 deletions
Large diffs are not rendered by default.

examples/logical_interconnect_groups.py

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
###
3-
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
3+
# (C) Copyright (2012-2019) Hewlett Packard Enterprise Development LP
44
#
55
# Permission is hereby granted, free of charge, to any person obtaining a copy
66
# of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,6 @@
2525
from pprint import pprint
2626

2727
from config_loader import try_load_from_file
28-
from hpOneView.exceptions import HPOneViewException
2928
from hpOneView.oneview_client import OneViewClient
3029

3130
config = {
@@ -38,16 +37,21 @@
3837

3938
# Try load config from a file (if there is a config file)
4039
config = try_load_from_file(config)
41-
4240
oneview_client = OneViewClient(config)
41+
logical_interconnect_groups = oneview_client.logical_interconnect_groups
42+
interconnect_types = oneview_client.interconnect_types
4343

4444
# Define the scope name to add the logical interconnect group to it
4545
scope_name = ""
4646

47-
# Get the interconnect type named 'HP VC FlexFabric 10Gb/24-Port Module' and using the uri in the values for the fields
47+
interconnect_type_name = "Synergy 10Gb Interconnect Link Module"
48+
# Get the interconnect type by name and using the uri in the values for the fields
4849
# "permittedInterconnectTypeUri" and create a Logical Interconnect Group.
4950
# Note: If this type does not exist, select another name
50-
interconnect_type = oneview_client.interconnect_types.get_by('name', 'HP VC FlexFabric 10Gb/24-Port Module')[0]['uri']
51+
interconnect_type = oneview_client.interconnect_types.get_by_name(interconnect_type_name)
52+
if interconnect_type:
53+
pprint(interconnect_type.data)
54+
interconnect_type_url = interconnect_type.data["uri"]
5155

5256
options = {
5357
"category": None,
@@ -76,7 +80,7 @@
7680
}
7781
]
7882
},
79-
"permittedInterconnectTypeUri": interconnect_type
83+
"permittedInterconnectTypeUri": interconnect_type_url
8084
},
8185
{
8286
"logicalDownlinkUri": None,
@@ -193,83 +197,75 @@
193197
}
194198
}
195199

196-
# Create a logical interconnect group
197-
print("Create a logical interconnect group")
198-
created_lig = oneview_client.logical_interconnect_groups.create(options)
199-
pprint(created_lig)
200+
# Get all, with defaults
201+
print("Get all Logical Interconnect Groups")
202+
ligs = logical_interconnect_groups.get_all()
203+
pprint(ligs)
204+
205+
# Get by uri
206+
print("Get a Logical Interconnect Group by uri")
207+
lig_byuri = logical_interconnect_groups.get_by_uri(ligs[0]["uri"])
208+
pprint(lig_byuri.data)
200209

201210
# Get the first 10 records, sorting by name descending, filtering by name
202211
print("Get the first Logical Interconnect Groups, sorting by name descending, filtering by name")
203-
ligs = oneview_client.logical_interconnect_groups.get_all(
212+
ligs = logical_interconnect_groups.get_all(
204213
0, 10, sort='name:descending', filter="\"'name'='OneView Test Logical Interconnect Group'\"")
205214
pprint(ligs)
206215

207216
# Get Logical Interconnect Group by property
208-
lig = oneview_client.logical_interconnect_groups.get_by('name', 'OneView Test Logical Interconnect Group')[0]
217+
lig = logical_interconnect_groups.get_by('name', 'SYN-LIG')[0]
209218
print("Found lig by name: '%s'.\n uri = '%s'" % (lig['name'], lig['uri']))
210219

220+
# Get Logical Interconnect Group by scope_uris
221+
if oneview_client.api_version >= 600:
222+
lig_by_scope_uris = logical_interconnect_groups.get_all(scope_uris="\"'/rest/scopes/3bb0c754-fd38-45af-be8a-4d4419de06e9'\"")
223+
if len(lig_by_scope_uris) > 0:
224+
print("Found %d Logical Interconnect Groups" % (len(lig_by_scope_uris)))
225+
i = 0
226+
while i < len(lig_by_scope_uris):
227+
print("Found Logical Interconnect Group by scope_uris: '%s'.\n uri = '%s'" % (lig_by_scope_uris[i]['name'], lig_by_scope_uris[i]['uri']))
228+
i += 1
229+
pprint(lig_by_scope_uris)
230+
else:
231+
print("No Logical Interconnect Group found.")
232+
233+
# Get logical interconnect group by name
234+
lig = logical_interconnect_groups.get_by_name(options["name"])
235+
if not lig:
236+
# Create a logical interconnect group
237+
print("Create a logical interconnect group")
238+
lig = logical_interconnect_groups.create(options)
239+
pprint(lig.data)
240+
211241
# Update a logical interconnect group
212242
print("Update a logical interconnect group")
213-
lig_to_update = created_lig.copy()
243+
lig_to_update = lig.data.copy()
214244
lig_to_update["name"] = "Renamed Logical Interconnect Group"
215-
updated_lig = oneview_client.logical_interconnect_groups.update(lig_to_update)
216-
pprint(updated_lig)
217-
218-
# Get all, with defaults
219-
print("Get all Logical Interconnect Groups")
220-
ligs = oneview_client.logical_interconnect_groups.get_all()
221-
pprint(ligs)
222-
223-
# Get by Id
224-
try:
225-
print("Get a Logical Interconnect Group by id")
226-
lig_byid = oneview_client.logical_interconnect_groups.get('f0a0a113-ec97-41b4-83ce-d7c92b900e7c')
227-
pprint(lig_byid)
228-
except HPOneViewException as e:
229-
print(e.msg)
230-
231-
# Get by uri
232-
try:
233-
print("Get a Logical Interconnect Group by uri")
234-
lig_byuri = oneview_client.logical_interconnect_groups.get(created_lig["uri"])
235-
pprint(lig_byuri)
236-
except HPOneViewException as e:
237-
print(e.msg)
245+
lig.update(lig_to_update)
246+
pprint(lig.data)
238247

239248
# Performs a patch operation
240-
scope = oneview_client.scopes.get_by_name(scope_name)
241-
if scope:
242-
print("\nPatches the logical interconnect group adding one scope to it")
243-
updated_lig = oneview_client.logical_interconnect_groups.patch(updated_lig['uri'],
244-
'replace',
245-
'/scopeUris',
246-
[scope['uri']])
247-
pprint(updated_lig)
249+
if oneview_client.api_version <= 500:
250+
scope = oneview_client.scopes.get_by_name(scope_name)
251+
if scope:
252+
print("\nPatches the logical interconnect group adding one scope to it")
253+
updated_lig = lig.patch('replace',
254+
'/scopeUris',
255+
[scope['uri']])
256+
pprint(updated_lig.data)
248257

249258
# Get default settings
250259
print("Get the default interconnect settings for a logical interconnect group")
251-
lig_default_settings = oneview_client.logical_interconnect_groups.get_default_settings()
260+
lig_default_settings = lig.get_default_settings()
252261
pprint(lig_default_settings)
253262

254263
# Get settings
255264
print("Gets the interconnect settings for a logical interconnect group")
256-
lig_settings = oneview_client.logical_interconnect_groups.get_settings(created_lig["uri"])
265+
lig_settings = lig.get_settings()
257266
pprint(lig_settings)
258267

259-
# Get Logical Interconnect Group by scope_uris
260-
if oneview_client.api_version >= 600:
261-
lig_by_scope_uris = oneview_client.logical_interconnect_groups.get_all(scope_uris="\"'/rest/scopes/3bb0c754-fd38-45af-be8a-4d4419de06e9'\"")
262-
if len(lig_by_scope_uris) > 0:
263-
print("Found %d Logical Interconnect Groups" % (len(lig_by_scope_uris)))
264-
i = 0
265-
while i < len(lig_by_scope_uris):
266-
print("Found Logical Interconnect Group by scope_uris: '%s'.\n uri = '%s'" % (lig_by_scope_uris[i]['name'], lig_by_scope_uris[i]['uri']))
267-
i += 1
268-
pprint(lig_by_scope_uris)
269-
else:
270-
print("No Logical Interconnect Group found.")
271-
272268
# Delete a logical interconnect group
273269
print("Delete the created logical interconnect group")
274-
oneview_client.logical_interconnect_groups.delete(updated_lig)
270+
lig.delete()
275271
print("Successfully deleted logical interconnect group")

0 commit comments

Comments
 (0)