Exemple #1
0
def create_data_interface(vserver_name: str, ip_address: str,
                          ip_netmask) -> None:
    """Creates an SVM-scoped IP Interface"""

    data = {
        'name': 'Data1',
        'ip': {
            'address': ip_address,
            'netmask': ip_netmask
        },
        'enabled': True,
        'scope': 'svm',
        'svm': {
            'name': vserver_name
        },
        #'home_port': {
        #    'name': 'e0d',
        #    'node': 'cluster1-01'
        #}
        'location': {
            'auto_revert': True,
            'broadcast_domain': {
                'name': 'Default'
            },
        }
    }

    ip_interface = IpInterface(**data)

    try:
        ip_interface.post()
        print("Ip Interface %s created successfully" % ip_interface.ip.address)
    except NetAppRestError as err:
        print("Error: IP Interface was not created: %s" % err)
    return
def create_mgmt_interface(vserver_name: str, interface_name: str,
                          node_name: str, ip_address: str,
                          ip_netmask: str) -> None:
    """Creates an SVM-scoped IP Interface"""

    data = {
        'name': interface_name,
        'ip': {
            'address': ip_address,
            'netmask': ip_netmask
        },
        'enabled': True,
        'scope': 'svm',
        'svm': {
            'name': vserver_name
        },
        'port': {
            'name': 'e0c',
            'node': node_name
        },
        'location': {
            'auto_revert': True,
            'broadcast_domain': {
                'name': 'Default'
            },
        }
    }

    ip_interface = IpInterface(**data)

    try:
        ip_interface.post()
        print("Management Ip Interface %s created successfully" %
              ip_interface.ip.address)
    except NetAppRestError as err:
        print("Error: Management IP Interface was not created: %s" % err)
    return