Skip to content

Commit

Permalink
Formatted using black
Browse files Browse the repository at this point in the history
  • Loading branch information
ABHISHEK-SINHA10 committed Jan 15, 2025
1 parent 699338e commit 2ee5ffd
Show file tree
Hide file tree
Showing 194 changed files with 4,774 additions and 4,084 deletions.
20 changes: 12 additions & 8 deletions ProgrammersGuideExamples/appliance_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

from PyPowerStore import powerstore_conn

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

# Get appliances list
Expand All @@ -19,10 +21,12 @@

# Get appliance details
appliance_details = CONN.config_mgmt.get_appliance_details(
appliance_id=appliances_list[0]['id'])
appliance_id=appliances_list[0]["id"]
)
print(appliance_details)

# Get appliance by name
appliance_details_by_name = CONN.config_mgmt.get_appliance_by_name(
appliance_name=appliances_list[0]['name'])
appliance_name=appliances_list[0]["name"]
)
print(appliance_details_by_name)
31 changes: 15 additions & 16 deletions ProgrammersGuideExamples/certificate_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@

from PyPowerStore import powerstore_conn

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

certificate_list = CONN.config_mgmt.get_certificates()
print(certificate_list)

certificate_details = CONN.config_mgmt.get_certificate_details(
certificate_list[0]['id'])
certificate_list[0]["id"]
)
print(certificate_details)

create_dict = {
Expand All @@ -27,22 +30,18 @@
"certificate": "<certificate string>",
"private_key": "",
"passphrase": "<passphrase>",
"is_current": True
"is_current": True,
}
resp = CONN.config_mgmt.create_certificate(create_cert_dict=create_dict)
print(resp)

reset_dict = {
"service": "VASA_HTTP"
}
reset_dict = {"service": "VASA_HTTP"}
resp = CONN.config_mgmt.reset_certificates(reset_cert_dict=reset_dict)
print(resp)

modify_dict = {
"certificate": "<passphrase>",
"is_current": True
}
modify_dict = {"certificate": "<passphrase>", "is_current": True}

resp = CONN.config_mgmt.modify_certificate(
certificate_id=resp['id'], modify_cert_dict=modify_dict)
certificate_id=resp["id"], modify_cert_dict=modify_dict
)
print(resp)
20 changes: 12 additions & 8 deletions ProgrammersGuideExamples/chap_config_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

from PyPowerStore import powerstore_conn

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

# Get chap config list
Expand All @@ -19,10 +21,12 @@

# Get chap config details
chap_config_details = CONN.config_mgmt.get_chap_config_details(
chap_config_id=chap_configs_list[0]['id'])
chap_config_id=chap_configs_list[0]["id"]
)
print(chap_config_details)

# Modify chap config
updated_chap_config_details = CONN.config_mgmt.modify_chap_config(
chap_config_id=chap_configs_list[0]['id'], mode='Disabled')
chap_config_id=chap_configs_list[0]["id"], mode="Disabled"
)
print(updated_chap_config_details)
46 changes: 28 additions & 18 deletions ProgrammersGuideExamples/cluster_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
""" Cluster 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)
CONN = powerstore_conn.PowerStoreConn(
username="<username>",
password="<password>",
server_ip="<IP>",
verify=False,
application_type="<Application>",
timeout=180.0,
)

print(CONN)

Expand All @@ -18,17 +20,17 @@
print(clusters_list)

# Get cluster id by cluster_name
cluster = CONN.config_mgmt.get_cluster_by_name(name=clusters_list[0]['name'])
print(cluster[0]['id'])
cluster = CONN.config_mgmt.get_cluster_by_name(name=clusters_list[0]["name"])
print(cluster[0]["id"])

# Get cluster details by cluster_id
cluster_details = CONN.config_mgmt.get_cluster_details(
cluster_id=cluster[0]['id'])
cluster_details = CONN.config_mgmt.get_cluster_details(cluster_id=cluster[0]["id"])
print(cluster_details)

# Modify MTU and name of the cluster
updated_cluster_details = CONN.config_mgmt.modify_cluster(
cluster_id=cluster[0]['id'], physical_mtu=1500, name="AB-C1234")
cluster_id=cluster[0]["id"], physical_mtu=1500, name="AB-C1234"
)
print(updated_cluster_details)

# Validate create cluster
Expand All @@ -40,19 +42,27 @@
{
"type": "Management",
"prefix_length": 24,
"addresses": ["4x.3x.2x.1x", "1xx.2xx.3xx.4xx"]
"addresses": ["4x.3x.2x.1x", "1xx.2xx.3xx.4xx"],
}
]
is_http_redirect_enabled = True
validate_resp = CONN.config_mgmt.cluster_create_validate(
cluster=cluster, appliances=appliances, dns_servers=dns_servers,
ntp_servers=ntp_servers, networks=networks,
is_http_redirect_enabled=is_http_redirect_enabled)
cluster=cluster,
appliances=appliances,
dns_servers=dns_servers,
ntp_servers=ntp_servers,
networks=networks,
is_http_redirect_enabled=is_http_redirect_enabled,
)
print(validate_resp)

# Create Cluster
Create_resp = CONN.config_mgmt.cluster_create(
cluster=cluster, appliances=appliances, dns_servers=dns_servers,
ntp_servers=ntp_servers, networks=networks,
is_http_redirect_enabled=is_http_redirect_enabled)
cluster=cluster,
appliances=appliances,
dns_servers=dns_servers,
ntp_servers=ntp_servers,
networks=networks,
is_http_redirect_enabled=is_http_redirect_enabled,
)
print(Create_resp)
14 changes: 8 additions & 6 deletions ProgrammersGuideExamples/discovered_appliances_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

from PyPowerStore import powerstore_conn

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

# Get Discovered appliances list
Expand Down
17 changes: 10 additions & 7 deletions ProgrammersGuideExamples/dns_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<server_ip>",
verify=False,
timeout=180.0)
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'])
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)
dns_id=dns_list[0]["id"], modify_parameters=modify_dict
)
print(resp_modify)
31 changes: 17 additions & 14 deletions ProgrammersGuideExamples/email_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,49 @@

from PyPowerStore import powerstore_conn

CONN = powerstore_conn.PowerStoreConn(username="<username>",
password="<password>",
server_ip="<IP>",
verify=False,
application_type="<Application>",
timeout=180.0)
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'])
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'])
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)
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)
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'])
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'])
resp_delete = CONN.config_mgmt.delete_destination_email(email_id=resp_create["id"])
print(resp_delete)
40 changes: 17 additions & 23 deletions ProgrammersGuideExamples/file_dns_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,28 @@
""" File DNS 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)
CONN = powerstore_conn.PowerStoreConn(
username="<username>",
password="<password>",
server_ip="<IP>",
verify=False,
application_type="<Application>",
timeout=180.0,
)
print(CONN)

MODIFY_PARAMS = {
"domain": "stringa",
"add_ip_addresses": [
"10.10.10.11"
],
"remove_ip_addresses": [
"10.10.10.10"
],
"transport": "TCP"
"add_ip_addresses": ["10.10.10.11"],
"remove_ip_addresses": ["10.10.10.10"],
"transport": "TCP",
}

CREATE_PARAMS = {
"nas_server_id": "6581683c-61a3-76ab-f107-62b767ad9845",
"domain": "string",
"ip_addresses": [
"10.10.10.10"
],
"transport": "UDP"
"ip_addresses": ["10.10.10.10"],
"transport": "UDP",
}

# create file DNS
Expand All @@ -41,19 +37,17 @@
print(FILE_DNSES)

# get file DNS details by ID
FILE_DNS = CONN.file_dns.get_file_dns_details(FILE_DNS['id'])
FILE_DNS = CONN.file_dns.get_file_dns_details(FILE_DNS["id"])
print(FILE_DNS)

# get file DNS details by NAS server
FILE_DNS = CONN.file_dns.get_file_dns_by_nas_server_id(
CREATE_PARAMS['nas_server_id'])
FILE_DNS = CONN.file_dns.get_file_dns_by_nas_server_id(CREATE_PARAMS["nas_server_id"])
print(FILE_DNS)

# modify file DNS
MODIFY_FILE_DNS = CONN.file_dns.modify_file_dns(FILE_DNS[0]['id'],
MODIFY_PARAMS)
MODIFY_FILE_DNS = CONN.file_dns.modify_file_dns(FILE_DNS[0]["id"], MODIFY_PARAMS)
print(MODIFY_FILE_DNS)

# delete file DNS
DELETE_FILE_DNS = CONN.file_dns.delete_file_dns(FILE_DNS[0]['id'])
DELETE_FILE_DNS = CONN.file_dns.delete_file_dns(FILE_DNS[0]["id"])
print(DELETE_FILE_DNS)
Loading

0 comments on commit 2ee5ffd

Please sign in to comment.