コード例 #1
0
def create_interface():
    """Create Interface"""
    int_name = input("Enter the name of the Interface:- ")
    print()
    show_svm()
    print()
    svm_name = input(
        "Enter the name of the SVM on which the interface should be created :- "
    )
    svm_uuid = input(
        "Enter the UUID of the SVM on which the interface should be created :- "
    )
    print()
    show_node()
    print()
    node_name = input(
        "Enter the name of the home node on which the interface should be created :- "
    )
    node_uuid = input(
        "Enter the uuid of the home node on which the interface should be created :- "
    )
    ip_add = input("Enter the IP address:- ")
    netmask = input("Enter the NetMask:- ")

    interfaceobj = {
        "enabled": True,
        "ip": {
            "address": ip_add,
            "netmask": netmask
        },
        "name": int_name,
        "scope": "svm",
        "svm": {
            "name": svm_name,
            "uuid": svm_uuid
        },
        "location": {
            "home_node": {
                "name": node_name,
                "uuid": node_uuid
            }
        }
    }
    try:
        ipint = IpInterface.from_dict(interfaceobj)
        if ipint.post(poll=True):
            print("Interface created successfully.")
    except NetAppRestError as error:
        print("Exception caught :" + str(error))
コード例 #2
0
                                   username=global_vars["PRI_CLU_USER"],
                                   password=global_vars["PRI_CLU_PASS"],
                                   verify=False)

### Step 3 - Create operation
lif = IpInterface.from_dict({
    "name": global_vars["PRI_SVM"] + "_cifs_01",
    "svm": {
        "name": global_vars["PRI_SVM"]
    },
    "ip": {
        "address": global_vars["PRI_SVM_CIFS_IP"],
        "netmask": global_vars["PRI_SVM_CIFS_NETMASK"]
    },
    "location": {
        "home_port": {
            "name": global_vars["PRI_DATA_PORT"],
            "node": {
                "name": global_vars["PRI_NODE"]
            }
        }
    },
    "service_policy": {
        "name": "default-data-files"
    }
})

print("--> Starting interface create operation")
try:
    lif.post()
    print("--> CIFS interface \"{}\" created successfully".format(lif.name))
コード例 #3
0
                                   username=global_vars["PRI_CLU_USER"],
                                   password=global_vars["PRI_CLU_PASS"],
                                   verify=False)

### Step 3 - Create operation
lif = IpInterface.from_dict({
    "name": global_vars["PRI_SVM"],
    "svm": {
        "name": global_vars["PRI_SVM"]
    },
    "ip": {
        "address": global_vars["PRI_SVM_IP"],
        "netmask": global_vars["PRI_SVM_NETMASK"]
    },
    "location": {
        "home_port": {
            "name": global_vars["PRI_MGMT_PORT"],
            "node": {
                "name": global_vars["PRI_NODE"]
            }
        }
    },
    "service_policy": {
        "name": "default-management"
    }
})

print("--> Starting management interface create operation")
try:
    lif.post()
    print("--> Interface \"{}\" created successfully".format(lif.name))