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

Commit 112a4b7

Browse files
committed
Updated documentation in example file and test file
1 parent ed209f2 commit 112a4b7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

examples/storage_volume_templates.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@
2727
from config_loader import try_load_from_file
2828

2929
config = {
30-
"ip": "16.124.133.232",
30+
"ip": "172.16.102.59",
3131
"credentials": {
3232
"userName": "administrator",
33-
"password": "ecosystem"
34-
},
35-
"api_version": 500
33+
"password": ""
34+
}
3635
}
3736

3837
# Try load config from a file (if there is a config file)
3938
config = try_load_from_file(config)
4039

4140
oneview_client = OneViewClient(config)
4241

42+
networks = "/rest/fcoe-networks/7f0f74a0-4957-47ac-81c1-f573aa6d83de"
43+
scope_uris = "/rest/scopes/63d1ca81-95b3-41f1-a1ee-f9e1bc2d635f"
44+
4345
# Request body for create operation
4446
# Supported from API version >= 500
4547
options = {
@@ -117,7 +119,7 @@
117119
"Full",
118120
"Thin Deduplication"
119121
],
120-
"meta": {
122+
"meta": {
121123
"locked": "true",
122124
"createOnly": "true"
123125
},
@@ -219,11 +221,10 @@
219221
print(" Found '{name}' at uri: {uri}".format(**volume_template_byname))
220222

221223
# Gets the storage templates that are connected on the specified networks
224+
# scoper_uris and private_allowed_only parameters supported only with API version > 600
222225
print("Get torage templates that are connected on the specified networks")
223-
storage_templates=oneview_client.storage_volume_templates.get_reachable_volume_templates(
224-
networks="/rest/fcoe-networks/7f0f74a0-4957-47ac-81c1-f573aa6d83de,",
225-
scope_uris="/rest/scopes/63d1ca81-95b3-41f1-a1ee-f9e1bc2d635f",
226-
private_allowed_only=False)
226+
storage_templates = oneview_client.storage_volume_templates.get_reachable_volume_templates(
227+
networks=networks, scope_uris=scope_uris, private_allowed_only=False)
227228
print(storage_templates)
228229

229230
# Retrieves all storage systems that is applicable to the storage volume template.

tests/unit/resources/storage/test_storage_volume_templates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def test_get_connectable_volume_templates_called_once(self, mock_get):
102102

103103
@mock.patch.object(ResourceClient, 'get')
104104
def test_get_reachable_volume_templates_called_once(self, mock_get):
105-
uri = '/rest/storage-volume-templates/reachable-volume-templates?networks=\'/rest/fake\'&start=0&count=-1&privateAllowedOnly=False'
106-
self._storage_volume_templates.get_reachable_volume_templates(networks=['/rest/fake'])
105+
uri = '/rest/storage-volume-templates/reachable-volume-templates?networks=/rest/fake&privateAllowedOnly=False&start=0&count=-1'
106+
self._storage_volume_templates.get_reachable_volume_templates(networks='/rest/fake')
107107
mock_get.assert_called_once_with(uri)
108108

109109
@mock.patch.object(ResourceClient, 'get')

0 commit comments

Comments
 (0)