Ejemplo n.º 1
0
def list_interface():
    """ List Interface"""
    print("\n List of Interface:- \n")
    try:
        for interface in IpInterface.get_collection():
            print("Interface Name:- %s; Inteface UUID:- %s " %
                  (interface.name, interface.uuid))
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
Ejemplo n.º 2
0
def show_interface() -> None:
    """ List Interface"""
    print("\n List of Interface:- \n")
    try:
        for interface in IpInterface.get_collection():
            print("Interface Name:- %s; Inteface UUID:- %s " %
                  (interface.name, interface.uuid))
    except NetAppRestError as error:
        print("Error:- " % error.http_err_response.http_response.text)
        print("Exception caught :" + str(error))
Ejemplo n.º 3
0
    async def get_interfaces(self, message):
        """
        A skills function to get all interfaces on the cluster. The parser looks for the message argument.

        Arguments:
            message {str} -- get interfaces state on cluster
        """
        interfaces = []
        for interface in IpInterface.get_collection():
            interface.get()
            interfaces.append([interface.name, interface.state])
        await message.respond('All done! Response: {}'.format(interfaces))
### Step 3 - Get & print details
# SVMs
print("--> Printing SVM details")
print("{:<20}{:<15}{:<10}{:<30}".format("Name", "IP Space", "State",
                                        "Comment"))
for svm in Svm.get_collection():
    svm.get()
    print("{:<20}{:<15}{:<10}{:<30}".format(svm.name, svm.ipspace.name,
                                            svm.state, svm.comment))
print("")

# Interfaces
print("--> Printing network interface details")
print("{:<20}{:<25}{:<20}{:<15}".format("SVM", "Name", "IP", "Current Port"))
for lif in IpInterface.get_collection(**{"scope": "svm"}):
    lif.get()
    print("{:<20}{:<25}{:<20}{:15}".format(
        lif.svm.name, lif.name, lif.ip.address + "/" + lif.ip.netmask,
        lif.location.node.name + ":" + lif.location.port.name))
print("")

# DNS
print("--> Printing DNS details")
print("{:<20}{:<20}{:<20}".format("SVM", "Domains", "Servers"))
for dns in Dns.get_collection():
    dns.get()
    print("{:<20}{:<20}{:<20}".format(dns.svm.name, str(dns.domains),
                                      str(dns.servers)))
print("")