Skip to content

Commit

Permalink
Merge pull request #8 from dell/release_1.6.0
Browse files Browse the repository at this point in the history
release 1.6.0 for PyPowerStore python library
  • Loading branch information
shenda1 authored Mar 18, 2022
2 parents 58be390 + 4d2e4cd commit 3983982
Show file tree
Hide file tree
Showing 38 changed files with 1,691 additions and 31 deletions.
7 changes: 5 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# PyPowerStore Change Log

## Version 1.6.0 - released on 25/03/22
- Added configuration operations includes SMTP configuration, email notification, NTP servers, DNS servers, remote support and remote support contacts and getting high level facts about all these entities.

## Version 1.5.0 - released on 16/12/21
- Added configuration operations includes certificates and security configuration.
- Added protection operations includes remote systems.
- Added configuration operations includes certificates and security configuration and getting high level facts about all these entities.
- Added protection operations includes remote systems and getting high level facts about remote systems.

## Version 1.4.0 - released on 25/09/21
- Added configuration operations includes managing clusters, networks, local users and getting high level facts about all these entities.
Expand Down
26 changes: 26 additions & 0 deletions ProgrammersGuideExamples/dns_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" DNS operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)

# Getting DNS list
dns_list = CONN.config_mgmt.get_dns_list()
print(dns_list)

# Getting DNS instance details
dns_details = CONN.config_mgmt.get_dns_details(dns_id=dns_list[0]['id'])
print(dns_details)

# Modifying the DNS addresses
modify_dict = { "addresses": ["XX.XX.XX.XX","XX.XX.XX.YY"] }

resp_modify = CONN.config_mgmt.modify_dns_details(dns_id=dns_list[0]['id'], modify_parameters=modify_dict)
print(resp_modify)
45 changes: 45 additions & 0 deletions ProgrammersGuideExamples/email_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" Email operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<IP>",
verify=False,
application_type="<Application>",
timeout=180.0)

# Getting destination email addresses
email_list = CONN.config_mgmt.get_destination_emails()
print(email_list)

# Getting destination email instance details
email_details = CONN.config_mgmt.get_destination_email_details(email_id=email_list[0]['id'])
print(email_details)

# Getting destination email instance details using address
email_details = CONN.config_mgmt.get_destination_email_by_address(email_address=email_details['email_address'])
print(email_details)

# Adding a destination email address
create_dict = { "email_address": "abc_xyz@dell.com", "notify_critical": True }

resp_create = CONN.config_mgmt.create_destination_email(create_params=create_dict)
print(resp_create)

# Modifying the destination email details
modify_dict = { "notify_major": True }

resp_modify = CONN.config_mgmt.modify_destination_email_details(email_id=resp_create['id'], modify_parameters=modify_dict)
print(resp_modify)

# Sending test mail to a destination email instance
resp_test = CONN.config_mgmt.test_destination_email(email_id=resp_create['id'])
print(resp_test)

# Delete a destination email instance
resp_delete = CONN.config_mgmt.delete_destination_email(email_id=resp_create['id'])
print(resp_delete)
26 changes: 26 additions & 0 deletions ProgrammersGuideExamples/ntp_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" NTP operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)

# Getting NTP list
ntp_list = CONN.config_mgmt.get_ntp_list()
print(ntp_list)

# Getting NTP instance details
ntp_details = CONN.config_mgmt.get_ntp_details(ntp_id=ntp_list[0]['id'])
print(ntp_details)

# Modifying the NTP addresses
modify_dict = {"addresses": ["XX.XX.XX.XX","XX.XX.XX.YY"]}

resp_modify = CONN.config_mgmt.modify_ntp_details(ntp_id=ntp_list[0]['id'], modify_parameters=modify_dict)
print(resp_modify)
31 changes: 31 additions & 0 deletions ProgrammersGuideExamples/remote_support_contact_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" Remote Support Contact operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)

# Getting Remote Support Contact configurations
remote_support_contact_list = CONN.config_mgmt.get_remote_support_contact_list()
print(remote_support_contact_list)

# Getting Remote Support Contact instance details
remote_support_contact_details = CONN.config_mgmt.get_remote_support_contact_details(remote_support_contact_id=remote_support_contact_list[0]['id'])
print(remote_support_contact_details)

# Modifying the Remote Support Contact details
modify_dict = {
"first_name": "abc",
"last_name": "xyz",
"email": "abc_xyz@dell.com",
"phone": "111-222-333-444"
}

resp_modify = CONN.config_mgmt.modify_remote_support_contact_details(remote_support_contact_id=remote_support_contact_list[0]['id'], modify_parameters=modify_dict)
print(resp_modify)
45 changes: 45 additions & 0 deletions ProgrammersGuideExamples/remote_support_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" Remote Support operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<Password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)

# Getting Remote Support configurations
remote_support_list = CONN.config_mgmt.get_remote_support_list()
print(remote_support_list)

# Getting Remote Support configuration instance details
remote_support_details = CONN.config_mgmt.get_remote_support_details(remote_support_id=remote_support_list[0]['id'])
print(remote_support_details)

# Modifying the Remote Support configuration details
modify_dict = {
"type": "SRS_Integrated_Tier2",
"proxy_address": "10.10.10.10",
"proxy_port": 3128,
"proxy_username": "user",
"proxy_password": "pass123"
}

resp_modify = CONN.config_mgmt.modify_remote_support_details(remote_support_id=remote_support_list[0]['id'], modify_parameters=modify_dict)
print(resp_modify)

verify_dict = {
"type": "SRS_Gateway_Tier3",
"address": "10.10.10.10",
"port": 9443
}

resp_verify = CONN.config_mgmt.verify_remote_support_config(remote_support_id=remote_support_list[0]['id'], verify_parameters=verify_dict)
print(resp_verify)

# Sending test mail for Remote Support
resp_test = CONN.config_mgmt.test_remote_support_config(remote_support_id=remote_support_list[0]['id'])
print(resp_test)
32 changes: 32 additions & 0 deletions ProgrammersGuideExamples/smtp_config_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright: (c) 2022, Dell EMC

""" SMTP Config operations"""

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)

# Getting SMTP configurations
smtp_config_list = CONN.config_mgmt.get_smtp_configs()
print(smtp_config_list)

# Getting SMTP configuration instance details
smtp_config_details = CONN.config_mgmt.get_smtp_config_details(smtp_id=smtp_config_list[0]['id'])
print(smtp_config_details)

# Modifying the SMTP configuration details
modify_dict = { "address": "sample.smtp.com", "port": 25,"source_email": "def@dell.com" }

resp_modify = CONN.config_mgmt.modify_smtp_config_details(smtp_id=smtp_config_list[0]['id'], modify_parameters=modify_dict)
print(resp_modify)

# Sending test mail through an SMTP configuration
test_dict = { "email_address": "xyz@dell.com" }

resp_test = CONN.config_mgmt.test_smtp_config(smtp_id=smtp_config_list[0]['id'], test_parameters=test_dict)
print(resp_test)
4 changes: 2 additions & 2 deletions PyPowerStore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"""__init__.py."""

__title__ = 'PyPowerStore'
__version__ = '1.5.0.0'
__version__ = '1.6.0.0'
__author__ = 'Dell EMC or its subsidiaries'
__copyright__ = 'Copyright 2021 Dell EMC'
__copyright__ = 'Copyright 2019 Dell EMC'
5 changes: 4 additions & 1 deletion PyPowerStore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Codes
VALID_CODES = [200, 201, 202, 204, 206, 207]

ENGVIS_LIST = ["remote_support"]

class Client():
"""Client class for PowerStore"""
Expand Down Expand Up @@ -80,6 +80,9 @@ def fetch_response(self, http_method, url, payload=None, querystring=None,
auth_headers = {}
auth_headers = self.get_auth_token(split_host[2], headers)

if split_host[5] in ENGVIS_LIST:
headers['DELL-VISIBILITY'] = 'internal'

if auth_headers:
headers.update(auth_headers)

Expand Down
Loading

0 comments on commit 3983982

Please sign in to comment.