Esempio n. 1
0
def load_cvp_data():
    clnt = CvpClient()
    clnt.connect([cvp_ip], cvp_user, cvp_password)
    api = CvpApi(clnt)
    leaf_inventory = api.get_devices_in_container('LEAF')
    leaf_fqdn_list = list()
    for element in leaf_inventory:
        hostname = re.split('\.', element['fqdn'])[0]
        leaf_fqdn_list.append(hostname)
    return leaf_fqdn_list
Esempio n. 2
0
                addContainer = clntapi.add_container(container[:-5],
                                                     parentname, parentkey)
                getcontainerbyname = clntapi.get_container_by_name(
                    container[:-5])
                getcontainerbyname_old = clntapi.get_container_by_name(
                    container)
                getconfigletsbycontainerid = clntapi.get_configlets_by_container_id(
                    getcontainerbyname_old["key"])["configletList"]
                applyconfigletstocontainer = clntapi.apply_configlets_to_container(
                    app_name, getcontainerbyname, getconfigletsbycontainerid)
                parentname = container[:-5]

if suffixremove == "n":
    for paths in paths_to_leaves:
        for container in paths:
            get_devices_in_container = clntapi.get_devices_in_container(
                container)
            get_container_by_name = clntapi.get_container_by_name(container +
                                                                  "_temp")
            for device in get_devices_in_container:
                move_device_to_container = clntapi.move_device_to_container(
                    app_name, device, get_container_by_name)
if suffixremove == "y":
    for paths in paths_to_leaves:
        for container in paths:
            get_devices_in_container = clntapi.get_devices_in_container(
                container)
            get_container_by_name = clntapi.get_container_by_name(
                container[:-5])
            for device in get_devices_in_container:
                move_device_to_container = clntapi.move_device_to_container(
                    app_name, device, get_container_by_name)