Пример #1
0
    def get_ap_location(self,
                        conn,
                        ap_id: str,
                        offset=0,
                        limit=100,
                        units="FEET"):
        """Get location of an access point within a floorplan

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param ap_id: Provide ap_id returned by `get_floor_aps()` within class:`FloorPlan`
        :type ap_id: str
        :param offset: Pagination start index., defaults to 0
        :type offset: int, optional
        :param limit: Pagination size. Default 100 Max 100, defaults to 100
        :type limit: int, optional
        :param units: METERS or FEET, defaults to "FEET"
        :type units: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.FLOOR_PLAN["GET_AP_LOC"], ap_id)
        params = {"offset": offset, "limit": limit, "units": units}
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #2
0
    def update_user(self, conn, username: str, description: str, name: dict,
                    phone: str, address: dict, applications: dict):
        """Update user account details specified by user id. Providing info on account setting app
        is mandatory in this API along with other subscribed apps.Scope must be given only for NMS
        app. For non-nms apps such as account setting refer the parameters in the example json
        payload.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param username: User's email id is specified as the user id
        :type username: str
        :param description: description of user
        :type description: str
        :param name: 'firstname' and 'lastname' of the user.
        :type name: dict
        :param phone: Phone number. Format: +country_code-local_number
        :type phone: str
        :param address: Address of the user. Dict containing 'street', 'city', 'state', 'country'
            and 'zipcode'.
        :type address: dict
        :param applications: Define applications that needs access. \n
            * keyword name: Name of the application. Example: 'nms', 'account_setting', etc. \n
            * keyword info:  A list of dictionaries. Each element containing 'role', 'tenant_role',
                and 'scope'. Where 'scope' contains 'groups' key with list of groups. \n
        :type applications: dict
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.USERS["UPDATE"], username)
        data = self._build_user(username, description, name, phone, address,
                                applications)
        resp = conn.command(apiMethod="PATCH", apiPath=path, apiData=data)
        return resp
Пример #3
0
    def update_ap_settings(self, conn, serial_number: str,
                           ap_settings_data: dict):
        """Update Existing AP Settings

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param serial_number: Serial number of an AP. Example: CNBRHMV3HG
        :type serial_number: str
        :param ap_settings_data: Data to update ap settings. \n
            * keyword hostname: Name string to set to the AP \n
            * keyword ip_address: IP Address string to set to AP. Should be set to "0.0.0.0" if AP get IP from DHCP. \n
            * keyword zonename: Zonename string to set to AP \n
            * keyword achannel: achannel string to set to AP \n
            * keyword atxpower: atxpower string to set to AP \n
            * keyword gchannel: gchannel string to set to AP \n
            * keyword gtxpower: gtxpower string to set to AP \n
            * keyword dot11a_radio_disable: dot11a_radio_disable string to set to AP \n
            * keyword dot11g_radio_disable: dot11g_radio_disable string to set to AP \n
            * keyword usb_port_disable: usb_port_disable string to set to AP \n
        :type ap_settings_data: dict
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.AP_SETTINGS["UPDATE"], serial_number)
        data = ap_settings_data
        resp = conn.command(apiMethod="POST", apiPath=path, apiData=data)
        return resp
Пример #4
0
    def update_user_role(self,
                         conn,
                         app_name,
                         rolename,
                         applications,
                         permission="modify"):
        """Update a role specified by role name

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param app_name: app name
        :type app_name: str
        :param rolename: User role name
        :type rolename: str
        :param applications: List of dict. Each element containing the following structure. \n
            * keyword appname: Name of the application. Example: 'nms', 'account_setting', etc. \n
            * keyword modules:  A list of dictionaries. Each element containing 'module_name'
                and 'permission' for the modules. \n
            * keyword permission: permission for the app \n
        :type applications: dict
        :param permission: [description], defaults to "modify"
        :type permission: str, optional
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.ROLES["GET"], app_name, "roles", rolename)
        data = {
            "rolename": rolename,
            "permission": permission,
            "applications": applications
        }
        resp = conn.command(apiMethod="PATCH", apiPath=path, apiData=data)
        return resp
Пример #5
0
    def get_device_templates_from_hash(self,
                                       conn,
                                       template_hash,
                                       offset=0,
                                       limit=20,
                                       exclude_hash=False,
                                       device_type="IAP"):
        """List of devices with its group name and template information is populated

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param template_hash: Template_hash of the template for which list of devices needs to be populated.
        :type template_hash: str
        :param offset: Pagination offset, defaults to 0
        :type offset: int, optional
        :param limit: Pagination limit with Max 20, defaults to 20
        :type limit: int, optional
        :param exclude_hash: Fetch devices template details not matching with provided hash, defaults to False
        :type exclude_hash: bool, optional
        :param device_type: Device type (i.e. IAP/ArubaSwitch/MobilityController/CX), defaults to "IAP"
        :type device_type: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.DEVICES["GET"], template_hash, "template")
        params = {
            "offset": offset,
            "limit": limit,
            "exclude_hash": exclude_hash,
            "device_type": device_type
        }
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #6
0
    def get_rogueap_location(self,
                             conn,
                             macaddr: str,
                             offset=0,
                             limit=100,
                             units="FEET"):
        """Get location of rogue a access point based on its Mac Address

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param macaddr: Provide Mac Address of an Access Point
        :type macaddr: str
        :param offset: Pagination start index., defaults to 0
        :type offset: int, optional
        :param limit: Pagination size. Default 100 Max 100, defaults to 100
        :type limit: int, optional
        :param units: METERS or FEET, defaults to "FEET"
        :type units: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.ROGUE_LOCATION["GET_AP_LOC"], macaddr)
        params = {"offset": offset, "limit": limit, "units": units}
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #7
0
    def get_floor_clients(self,
                          conn,
                          floor_id: str,
                          offset=0,
                          limit=100,
                          units="FEET"):
        """Get location of clients within a floormap in Aruba Central visualRF.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param floor_id: Provide floor_id returned by `get_building_floors()` function in
            class:`FloorPlan`
        :type floor_id: str
        :param offset: Pagination start index., defaults to 0
        :type offset: int, optional
        :param limit: Pagination size. Default 100 Max 100, defaults to 100
        :type limit: int, optional
        :param units: METERS or FEET, defaults to "FEET"
        :type units: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.CLIENT_LOCATION["GET_FLOOR_CLIENTS"], floor_id,
                       "client_location")
        params = {"offset": offset, "limit": limit, "units": units}
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #8
0
    def get_client_location(self,
                            conn,
                            macaddr: str,
                            offset=0,
                            limit=100,
                            units="FEET"):
        """Get location of a client. This function provides output only when visualRF is
        configured in Aruba Central.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param macaddr: Provide a macaddr of a client. For example "ac:bb:cc:dd:ec:10"
        :type macaddr: str
        :param offset: Pagination start index., defaults to 0
        :type offset: int, optional
        :param limit: Pagination size. Default 100 Max 100, defaults to 100
        :type limit: int, optional
        :param units: METERS or FEET, defaults to "FEET"
        :type units: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.CLIENT_LOCATION["GET_CLIENT_LOC"], macaddr)
        params = {"offset": offset, "limit": limit, "units": units}
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #9
0
    def get_floor_info(self,
                       conn,
                       floor_id: str,
                       offset=0,
                       limit=100,
                       units="FEET"):
        """Get floor information

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param floor_id: Provide floor id. Can be obtained from `get_building_floors()` within
            class:`FloorPlan`
        :type floor_id: str
        :param offset: Pagination start index., defaults to 0
        :type offset: int, optional
        :param limit: Pagination size. Default 100 Max 100, defaults to 100
        :type limit: int, optional
        :param units: METERS or FEET, defaults to "FEET"
        :type units: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.FLOOR_PLAN["GET_FLOOR_INFO"], floor_id)
        params = {"offset": offset, "limit": limit, "units": units}
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #10
0
    def update_template(self,
                        conn,
                        group_name,
                        template_name,
                        template_filename,
                        device_type="",
                        version="",
                        model=""):
        """[summary]

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of the group in which the template file exists.
        :type group_name: str
        :param template_name: Name of the template to be modified
        :type template_name: str
        :param template_filename: Name of the template file in local machine to be sent to central using API
        :type template_filename: str
        :param device_type: Aruba device type of the template , defaults to ""
        :type device_type: str, optional
        :param version: Firmware version property of template., defaults to ""
        :type version: str, optional
        :param model: Device model property of template. For 'ArubaSwitch' device_type, part number (J number) can be
            used, defaults to ""
        :type model: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        # Open template file in binary mode
        files = {}
        fp = None
        try:
            fp = open(template_filename, "rb")
            files = {"template": fp}
        except Exception as err:
            logger.error("Unable to open the template file! " + str(err))
            return None

        path = urlJoin(urls.TEMPLATES["CREATE"], group_name, "templates")
        params = {"name": template_name}
        if device_type:
            params["device_type"] = device_type
        if version:
            params["version"] = version
        if model:
            params["model"] = model

        resp = conn.command(apiMethod="PATCH",
                            apiPath=path,
                            apiParams=params,
                            files=files)

        # Close the file
        if fp:
            fp.close()

        return resp
Пример #11
0
    def create_template(self,
                        conn,
                        group_name,
                        template_name,
                        template_filename,
                        device_type="IAP",
                        version="ALL",
                        model="ALL"):
        """Upload a new template file

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of the group in which the template file will be created.
        :type group_name: str
        :param template_name: Name for the template to be created
        :type template_name: str
        :param template_filename: Name of the template file in local machine to be sent to central using API
        :type template_filename: str
        :param device_type: Type of the Aruba device, defaults to "IAP"
        :type device_type: str, optional
        :param version: Firmware version property of template., defaults to "ALL"
        :type version: str, optional
        :param model: Model property of template. For 'ArubaSwitch' device_type, part number (J number) can be
            used, defaults to "ALL"
        :type model: str, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        # Open template file in binary mode
        files = {}
        fp = None
        try:
            fp = open(template_filename, "rb")
            files = {"template": fp}
        except Exception as err:
            logger.error("Unable to open the template file! " + str(err))
            return None

        # Make the API request
        path = urlJoin(urls.TEMPLATES["CREATE"], group_name, "templates")
        params = {
            "name": template_name,
            "device_type": device_type,
            "version": version,
            "model": model
        }
        resp = conn.command(apiMethod="POST",
                            apiPath=path,
                            apiParams=params,
                            files=files)

        # Close the file
        if fp:
            fp.close()

        return resp
Пример #12
0
    def get_devices_group(self, conn, device_serial):
        """Get group name for a device

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Serial number of Aruba device
        :type device_serial: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.DEVICES["GET"], device_serial, "group")
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #13
0
    def delete_group(self, conn, group_name):
        """Delete an existin group

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of the group to be deleted.
        :type group_name: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.GROUPS["DELETE"], group_name)
        resp = conn.command(apiMethod="DELETE", apiPath=path)
        return resp
Пример #14
0
    def get_firmware_swarm(self, conn, swarm_id):
        """Get firmware details for specific swarm.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param swarm_id: Swarm ID for which the firmware detail to be queried
        :type swarm_id: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.FIRMWARE["GET_SWARM"], swarm_id)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #15
0
    def get_ap_settings(self, conn, serial_number: str):
        """Get existing AP settings

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param serial_number: Serial number of an AP. Example: CNBRHMV3HG
        :type serial_number: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.AP_SETTINGS["GET"], serial_number)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #16
0
    def get_traillogs_detail(self, conn, id):
        """Get details of an audit log

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param id: ID of audit event
        :type id: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.TRAIL_LOG["GET"], id)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #17
0
    def get_device_details(self, conn, device_serial):
        """Provides details of a device when serial number is passed as input.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Device Serial Number
        :type device_serial: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.TOPOLOGY["GET_DEVICES"], device_serial)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #18
0
    def delete_template_variables(self, conn, device_serial):
        """Delete all existing template variables for a device

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Serial number of a device
        :type device_serial: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.VARIABLES["DELETE"], device_serial,
                       "template_variables")
        resp = conn.command(apiMethod="DELETE", apiPath=path)
        return resp
Пример #19
0
    def get_devices_configuration(self, conn, device_serial):
        """Get last known device configuration for a device.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Serial number of Aruba device.
        :type device_serial: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.DEVICES["GET"], device_serial, "configuration")
        headers = {"Accept": "multipart/form-data"}
        resp = conn.command(apiMethod="GET", apiPath=path, headers=headers)
        return resp
Пример #20
0
    def delete_site(self, conn, site_id):
        """Delete an existing site

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param site_id: ID assigned by Aruba Central when the site is created. Can be obtained
            from find_site_id function.
        :type site_id: int
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.SITES["DELETE"], str(site_id))
        resp = conn.command(apiMethod="DELETE", apiPath=path)
        return resp
Пример #21
0
    def get_topology(self, conn, site_id):
        """Get topology details of a site. The input is the id corresponding to a label or a site.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param site_id: Site ID
        :type site_id: int
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.TOPOLOGY["GET_TOPO_SITE"], str(site_id))
        print(path)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #22
0
    def ap_lldp_neighbors(self, conn, device_serial):
        """Get neighbor details reported by AP via LLDP.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Device serial number.
        :type device_serial: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.TOPOLOGY["GET_AP_LLDP"], device_serial)

        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #23
0
    def get_template(self,
                     conn,
                     group_name,
                     device_type="",
                     template_name="",
                     version="",
                     model="",
                     q="",
                     offset=0,
                     limit=20):
        """Get all templates in group. Query can be filtered by name, device_type, version, model or version number.
        Response is sorted by template name.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of the group for which the templates will be being queried.
        :type group_name: str
        :param device_type: Filter on device_type, defaults to ""
        :type device_type: str, optional
        :param template_name: Filter on template name, defaults to ""
        :type template_name: str, optional
        :param version: Filter on version property of template, defaults to ""
        :type version: str, optional
        :param model: Filter on model property of template. For 'ArubaSwitch' device_type, part number
            (J number) can be used., defaults to ""
        :type model: str, optional
        :param q: Search for template OR version OR model, q will be ignored if any of filter parameters are
            provided, defaults to ""
        :type q: str, optional
        :param offset: Pagination offset, defaults to 0
        :type offset: int, optional
        :param limit: Pagination limit with Max 20, defaults to 20
        :type limit: int, optional
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.TEMPLATES["GET"], group_name, "templates")
        params = {"limit": limit, "offset": offset}
        if device_type:
            params["device_type"] = device_type
        if template_name:
            params["template"] = template_name
        if version:
            params["version"] = version
        if model:
            params["model"] = model
        if q:
            params["q"] = q
        resp = conn.command(apiMethod="GET", apiPath=path, apiParams=params)
        return resp
Пример #24
0
    def get_user_role(self, conn, app_name, rolename):
        """Get Role details

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param app_name: app name
        :type app_name: str
        :param rolename: User role name
        :type rolename: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.ROLES["GET"], app_name, "roles", rolename)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #25
0
    def get_switch_variablized_templates(self, conn, device_serial):
        """Get template and variabled for Aruba device (switch)

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param device_serial: Serial number of Aruba device.
        :type device_serial: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.DEVICES["GET"], device_serial,
                       "variablised_template")
        headers = {"Accept": "multipart/form-data"}
        resp = conn.command(apiMethod="GET", apiPath=path, headers=headers)
        return resp
Пример #26
0
    def get_license_status(self, conn, service_name: str):
        """Get services and corresponding license token availability status. If True, license tokens are more than device
        count else less than device count.(Note - Autolicense is in paused state when license tokens are
        less than device count)

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param service_name: Specific service name(dm/pa/..). Call services/config API to get the list of valid service names.
        :type service_name: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.AUTO_LICENSE["GET_SVC_LIC_TOK"], service_name, "status")
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #27
0
    def delete_user(self, conn, username, system_user=True):
        """Delete user account details specified by user id

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param username: User's email id is specified as the user id
        :type username: str
        :param system_user: false if federated user, defaults to True
        :type system_user: bool, optional
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.USERS["DELETE"], username)
        params = {"system_user": system_user}
        resp = conn.command(apiMethod="DELETE", apiPath=path, apiParams=params)
        return resp
Пример #28
0
    def get_edge_details(self, conn, source_serial, dest_serial):
        """Get details of an edge grouped by lagname. The serials of nodes/devices on both
        sides of the edge should passed as input.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param source_serial: Device serial number.
        :type source_serial: str
        :param dest_serial: Device serial number.
        :type dest_serial: str
        :return: HTTP Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`
        :rtype: dict
        """
        path = urlJoin(urls.TOPOLOGY["GET_EDGES"], source_serial, dest_serial)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #29
0
    def get_template_text(self, conn, group_name, template_name):
        """Get CLI template in text format.

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of an existing group
        :type group_name: str
        :param template_name: Name of an existing template within mentioned group
        :type template_name: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.TEMPLATES["GET"], group_name, "templates",
                       template_name)
        resp = conn.command(apiMethod="GET", apiPath=path)
        return resp
Пример #30
0
    def delete_template(self, conn, group_name, template_name):
        """Delete an existing template

        :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an API call.
        :type conn: class:`pycentral.ArubaCentralBase`
        :param group_name: Name of the group in which the template file exists.
        :type group_name: str
        :param template_name: Name of the template to be deleted.
        :type template_name: str
        :return: Response as provided by 'command' function in class:`pycentral.ArubaCentralBase`.
        :rtype: dict
        """
        path = urlJoin(urls.TEMPLATES["GET"], group_name, "templates",
                       template_name)
        resp = conn.command(apiMethod="DELETE", apiPath=path)
        return resp