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

Commit 79532ef

Browse files
authored
Merge pull request #400 from gzecchi/develop
Release v4.8.0 - Added the capability to handle OneView Appliance SNMP Settings
2 parents 418c500 + c862348 commit 79532ef

21 files changed

+1341
-12
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# 4.7.1
1+
# 4.8.0 (Unreleased)
2+
#### Notes
3+
Added the capability to handle OneView Appliance SNMP Settings
4+
Extends support of the SDK to OneView Rest API version 800 (OneView v4.1).
5+
6+
#### Features supported with current release:
7+
- Appliance Device Read Community
8+
- Appliance Device SNMP v1 Trap Destinations
9+
- Appliance Device SNMP v3 Trap Destinations
10+
- Appliance Device SNMP v3 Users
11+
212
#### Bug fixes
313
- [#364] (https://github.com/HewlettPackard/python-hpOneView/issues/364) Bug in index_resources.get_all()
414

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export ONEVIEWSDK_PROXY='<proxy_host>:<proxy_port>'
193193

194194
### Setting your OneView version
195195

196-
The OneView Python SDK supports the API endpoints for HPE OneView 2.0, 3.0, 3.10 and 4.0.
196+
The OneView Python SDK supports the API endpoints for HPE OneView 2.0, 3.0, 3.10, 4.0 and 4.10.
197197

198198
The current `default` HPE OneView version used by the Python SDK is `3.00`, API `300`.
199199

@@ -216,6 +216,7 @@ The API list is as follows:
216216
- HPE OneView 3.0 API version: `300`
217217
- HPE OneView 3.10 API version: `500`
218218
- HPE OneView 4.0 API version: `600`
219+
- HPE OneView 4.10 API version: `800`
219220

220221
### HPE Synergy Image Streamer
221222

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
# built documents.
7272
#
7373
# The short X.Y version.
74-
version = u'4.7.0'
74+
version = u'4.8.0'
7575
# The full version, including alpha/beta/rc tags.
76-
release = u'4.7.0'
76+
release = u'4.8.0'
7777

7878
# The language for content autogenerated by Sphinx. Refer to documentation
7979
# for a list of supported languages.

endpoints-support.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
## HPE OneView
2020

21-
| Endpoints | Verb | V200 | V300 | V500 |V600
22-
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: |
21+
| Endpoints | Verb | V200 | V300 | V500 | V600 | V800
22+
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: | :------------------: |
2323
| **Alerts** |
2424
|<sub>/rest/alerts </sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
2525
|<sub>/rest/alerts </sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
@@ -30,6 +30,30 @@
3030
| **Appliance Time and Locale Configuration** |
3131
|<sub>/rest/appliance/configuration/time-locale</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
3232
|<sub>/rest/appliance/configuration/time-locale</sub> |POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
33+
| **Appliance Device Read Community String** |
34+
|<sub>/rest/appliance/device-read-community-string</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
35+
|<sub>/rest/appliance/device-read-community-string</sub> |PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
36+
| **Appliance SNMPv1 Trap Destinations** |
37+
|<sub>/rest/appliance/trap-destinations</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
38+
|<sub>/rest/appliance/trap-destinations/validation</sub> |POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
39+
|<sub>/rest/appliance/trap-destinations/{id}</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
40+
|<sub>/rest/appliance/trap-destinations/{id}</sub> |POST | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
41+
|<sub>/rest/appliance/trap-destinations/{id}</sub> |PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
42+
|<sub>/rest/appliance/trap-destinations/{id}</sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
43+
| **Appliance SNMPv3 Trap Destinations** |
44+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations</sub> |GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
45+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations</sub> |POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
46+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/validation</sub> |POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
47+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}}</sub> |GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
48+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}</sub> |PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
49+
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}</sub> |DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
50+
| **Appliance SNMPv3 Users** |
51+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
52+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |POST | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
53+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
54+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}}</sub> |GET | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
55+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}</sub> |PUT | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
56+
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}</sub> |DELETE | :heavy_minus_sign: | :heavy_minus_sign: | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
3357
| **Backups** |
3458
|<sub>/rest/backups</sub> |GET | :white_check_mark: | :white_check_mark: |
3559
|<sub>/rest/backups</sub> |POST | :white_check_mark: | :white_check_mark: |
@@ -566,8 +590,8 @@
566590

567591
## HPE Synergy Image Streamer
568592

569-
| Endpoints | Verb | V300 | V500 |V600
570-
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: |
593+
| Endpoints | Verb | V300 | V500 | V600 | V800
594+
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :------------------: | :------------------: |
571595
| **Artifacts Bundle** |
572596
|<sub> /rest/artifact-bundles </sub> | GET | :white_check_mark: |
573597
|<sub> /rest/artifact-bundles </sub> | POST(create) | :white_check_mark: |
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# -*- coding: utf-8 -*-
2+
###
3+
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
###
23+
24+
from pprint import pprint
25+
from hpOneView.oneview_client import OneViewClient
26+
from config_loader import try_load_from_file
27+
28+
config = {
29+
"ip": "<oneview_ip>",
30+
"credentials": {
31+
"userName": "<username>",
32+
"password": "<password>"
33+
}
34+
}
35+
36+
options = {
37+
"communityString": "public"
38+
}
39+
40+
# Try load config from a file (if there is a config file)
41+
config = try_load_from_file(config)
42+
43+
oneview_client = OneViewClient(config)
44+
45+
# Lists the appliance device read community
46+
read_community = oneview_client.appliance_device_read_community.get()
47+
print("\n## Got appliance device read community successfully!")
48+
pprint(read_community)
49+
50+
# Backup original values
51+
bkp = {}
52+
bkp['communityString'] = read_community['communityString']
53+
54+
# Update Read Community
55+
# Set to use appliance device read community
56+
read_community['communityString'] = options['communityString']
57+
read_community = oneview_client.appliance_device_read_community.update(read_community)
58+
print("\n## Updated appliance device read community string successfully!")
59+
pprint(read_community)
60+
61+
# Revert the changes made
62+
read_community['communityString'] = bkp['communityString']
63+
read_community = oneview_client.appliance_device_read_community.update(read_community)
64+
print("\n## Reverted appliance device read community string successfully!")
65+
pprint(read_community)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# -*- coding: utf-8 -*-
2+
###
3+
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
###
23+
24+
from pprint import pprint
25+
from hpOneView.oneview_client import OneViewClient
26+
from config_loader import try_load_from_file
27+
28+
config = {
29+
"ip": "<oneview_ip>",
30+
"credentials": {
31+
"userName": "<username>",
32+
"password": "<password>"
33+
}
34+
}
35+
36+
options = {
37+
"destination": "1.1.1.1",
38+
"communityString": "testOne",
39+
"port": 162
40+
}
41+
42+
# Try load config from a file (if there is a config file)
43+
config = try_load_from_file(config)
44+
45+
oneview_client = OneViewClient(config)
46+
47+
# Add appliance device SNMP v1 Trap Destination
48+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.create(options)
49+
snmp_v1_trap_uri = snmp_v1_trap['uri']
50+
print("\n## Create appliance SNMP v1 trap destination successfully!")
51+
pprint(snmp_v1_trap)
52+
53+
# Add appliance device SNMP v1 Trap Destination with ID
54+
trap_id = 9
55+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.create(options, trap_id)
56+
print("\n## Create appliance SNMP v1 trap destination successfully!")
57+
pprint(snmp_v1_trap)
58+
59+
# Lists the appliance device SNMP v1 Trap Destination
60+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.get_all()
61+
print("\n## Got appliance SNMP v1 trap destination successfully!")
62+
pprint(snmp_v1_trap)
63+
64+
# Lists the appliance device SNMP v1 Trap Destination by destination (unique)
65+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.get_by('destination', '1.1.1.1')
66+
print("\n## Got appliance SNMP v1 trap by destination successfully!")
67+
pprint(snmp_v1_trap)
68+
69+
# Get by URI
70+
print("Find an SNMP v1 trap destination by URI")
71+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.get(snmp_v1_trap_uri)
72+
pprint(snmp_v1_trap)
73+
74+
# Change appliance device SNMP v1 Trap Destination - Only Community String and Port can be changed
75+
snmp_v1_trap['communityString'] = 'testTwo'
76+
snmp_v1_trap = oneview_client.appliance_device_snmp_v1_trap_destinations.update(snmp_v1_trap)
77+
print("\n## Update appliance SNMP v1 trap destination successfully!")
78+
pprint(snmp_v1_trap)
79+
80+
# Delete Created Entry
81+
del_result = oneview_client.appliance_device_snmp_v1_trap_destinations.delete(snmp_v1_trap)
82+
print("\n## Delete appliance SNMP v1 trap destination successfully!")
83+
pprint(del_result)
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# -*- coding: utf-8 -*-
2+
###
3+
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
###
23+
24+
from pprint import pprint
25+
from hpOneView.oneview_client import OneViewClient
26+
from config_loader import try_load_from_file
27+
28+
# Set api_version to 600, default is 300 and this API has been introduced since API 600.
29+
config = {
30+
"ip": "<oneview_ip>",
31+
"credentials": {
32+
"userName": "<username>",
33+
"password": "<password>"
34+
},
35+
"api_version": 600
36+
}
37+
38+
options = {
39+
"type": "Destination",
40+
"destinationAddress": "1.1.1.1",
41+
"userId": "a8cda396-584b-4b68-98a2-4ff9f4d3c01a",
42+
"port": 162
43+
}
44+
45+
# Try load config from a file (if there is a config file)
46+
config = try_load_from_file(config)
47+
48+
oneview_client = OneViewClient(config)
49+
50+
# Add appliance device SNMP v3 Trap Destination
51+
snmp_v3_trap = oneview_client.appliance_device_snmp_v3_trap_destinations.create(options)
52+
snmp_v3_trap_uri = snmp_v3_trap['uri']
53+
print("\n## Crate appliance SNMP v3 trap destination successfully!")
54+
pprint(snmp_v3_trap)
55+
56+
# Lists the appliance device read community
57+
snmp_v3_trap_list = oneview_client.appliance_device_snmp_v3_trap_destinations.get_all()
58+
print("\n## Got appliance SNMP v3 trap destination successfully!")
59+
pprint(snmp_v3_trap_list)
60+
61+
# Get first element of the List
62+
snmp_v3_trap = snmp_v3_trap_list.pop()
63+
64+
# Get by URI
65+
print("Find an SNMP v3 trap destination by URI")
66+
snmp_v3_trap = oneview_client.appliance_device_snmp_v3_trap_destinations.get(snmp_v3_trap_uri)
67+
pprint(snmp_v3_trap)
68+
69+
# Change appliance device SNMP v3 Trap Destination - Only Community String and Port can be changed
70+
snmp_v3_trap['destinationAddress'] = "1.1.9.9"
71+
snmp_v3_trap = oneview_client.appliance_device_snmp_v3_trap_destinations.update(snmp_v3_trap)
72+
print("\n## Update appliance SNMP v3 trap destination successfully!")
73+
pprint(snmp_v3_trap)
74+
75+
# Delete Created Entry
76+
del_result = oneview_client.appliance_device_snmp_v1_trap_destinations.delete(snmp_v3_trap)
77+
print("\n## Delete appliance SNMP v3 trap destination successfully!")
78+
pprint(del_result)

0 commit comments

Comments
 (0)