def list_aggregate() -> None:
    """Lists the Aggregate"""
    print("\n List of Aggregates:- \n")
    try:
        for aggregatelist in Aggregate.get_collection():
            print(aggregatelist.name)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
def list_aggregate_pycl() -> None:
    """List the aggregates."""

    print("\n List of Aggregates:- \n")
    try:
        print(*(aggr.name for aggr in Aggregate.get_collection()), sep="\n")
    except NetAppRestError as err:
        print("Error: Aggregate list could not be retrieved: %s" % err)
Пример #3
0
def show_aggregate() -> None:
    """Lists the Aggregate"""
    print("\n List of Aggregates:- \n")
    try:
        for aggregatelist in Aggregate.get_collection():
            print(aggregatelist.name)
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))
def list_aggregate_pycl() -> None:
    """List the aggregates."""

    print("\n List of Aggregates:- \n")
    try:
        for aggregatelist in Aggregate.get_collection():
            aggregatelist.get()
            print(aggregatelist.name)
    except NetAppRestError as err:
        print("Error: Aggregate list was not created: %s" % err)
    return
def delete_aggregate() -> None:
    """ Delete aggregate"""
    print("----------Delete Aggregate-----------")
    print()
    show_aggregate()
    aggr_name = input("Enter the name of the Aggregate Name to be Deleted:- ")
    print()
    try:
        aggr = Aggregate.find(name=aggr_name)
        aggr.delete(poll=True)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
Пример #6
0
    async def get_aggregates(self, message):
        """
        A skills function to get all aggregates on the cluster. The parser looks for the message argument.

        Arguments:
            message {str} -- get aggregates on cluster
        """
        aggregates = []
        for aggr in Aggregate.get_collection():
            aggr.get(fields='name')
            aggregates.append(aggr.name)
        await message.respond('All done! Response: {}'.format(aggregates))
def patch_aggregate() -> None:
    """ Create aggregate"""
    print("----------Create Aggregate-----------")
    print()
    show_aggregate()
    aggr_name = input("Enter the name of the Aggregate Name to be Updated :- ")
    aggr_new_name = input(
        "Enter the new name of the aggregate to be updated :- ")
    try:
        aggr = Aggregate.find(name=aggr_name)
        aggr.name = aggr_new_name
        aggr.patch(poll=True)
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
Пример #8
0
def create_aggregate_pycl(aggr_name: str, node_name: str, disk_count: int) -> None:
    """Create an aggregate on the specified node"""

    aggregate = Aggregate.from_dict({
    'node': {'name':node_name},
    'name': aggr_name,
    'block_storage': {'primary': {'disk_count': disk_count}}
    })

    try:
        aggregate.post()
        print("Aggregate %s created successfully" % aggregate.name)
    except NetAppRestError as err:
        print("Error: Aggregate was not created: %s" % err)
    return
def create_aggregate() -> None:
    """ Create aggregate"""
    print("----------Create Aggregate-----------")
    print()
    show_node()
    node_name = input("Enter the name of the node name :- ")
    node_uuid = input("Enter the name of the node uuid :- ")
    print()
    show_disk()
    aggr_name = input("Enter the name of the Aggregate :- ")
    disk_count = input("Enter the Disk Count :- ")
    raid_size = input("Enter the RAID size :- ")
    raid_type = input("Enter the RAID type :- ")

    aggrobj = {
        "block_storage": {
            "mirror": {
                "enabled": "false"
            },
            "primary": {
                "checksum_style": "block",
                "disk_class": "performance",
                "disk_count": disk_count,
                "raid_size": raid_size,
                "raid_type": raid_type
            }
        },
        "name": aggr_name,
        "node": {
            "name": node_name,
            "uuid": node_uuid
        },
        "snaplock_type": "non_snaplock"
    }

    try:
        aggr = Aggregate.from_dict(aggrobj)
        if aggr.post(poll=True):
            print("Aggregate created successfully.")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
from netapp_ontap import config
from netapp_ontap import HostConnection
from netapp_ontap.resources import Cluster, Aggregate, Port, Volume, Autosupport, IpInterface, Disk, Chassis, Account, Svm

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

conn = HostConnection('192.168.1.200',
                      username='******',
                      password='******',
                      verify=False)

config.CONNECTION = conn
clus = Cluster()
clus.get()
print(clus)

aggr = Aggregate.find()
aggr.get()
print(aggr.name, aggr.node)

svm = Svm.find(name="study")
svm.get()
print(svm.to_dict())
Пример #11
0
def show_aggregate(api, apiuser, apipass):
    config.CONNECTION = HostConnection(api, apiuser, apipass, verify=False)
    print("\n List of Aggregates:- \n")
    for aggregatelist in Aggregate.get_collection(fields="uuid"):
        print(aggregatelist.name)
    return
Пример #12
0
# Nodes
print("--> Printing node details")
print("{:<20}{:<15}{:<15}{:<15}{:<10}".format("Name", "Node", "Size", "Used",
                                              "State"))
for node in Node.get_collection():
    node.get()
    print("{:<20}{:<15}{:<10}".format(node.name, node.serial_number,
                                      node.model))
print("")

# Aggregates
print("--> Printing aggregate details")
print("{:<20}{:<15}{:<15}{:<15}{:<10}".format("Name", "Node", "Size", "Used",
                                              "State"))
for aggr in Aggregate.get_collection():
    aggr.get()
    print("{:<20}{:<15}{:<15}{:<15}{:<10}".format(
        aggr.name, aggr.home_node.name, aggr.space.block_storage.size,
        aggr.space.block_storage.used, aggr.state))
print("")

# Ports
print("--> Printing port details")
print("{:<10}{:<15}{:<10}{:<10}{:<10}{:<15}".format("Name", "Node", "Speed",
                                                    "MTU", "State",
                                                    "BC Domain"))
for port in Port.get_collection():
    port.get()
    print("{:<10}{:<15}{:<10}{:<10}{:<10}{:<15}".format(
        port.name, port.node.name, port.speed, port.mtu, port.state,
Пример #13
0
#! /usr/bin/env python3.7
"""
	Sample Python Script
Author: Vish Hulikal
This will get detials about aggregates.
"""

from netapp_ontap import config
from netapp_ontap import HostConnection
from netapp_ontap.resources import Aggregate
import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
conn = HostConnection("192.168.0.111", username = "******", password = "******", verify = False)
config.CONNECTION = conn  
aggr = Aggregate()
aggr.get()
print (aggr)