コード例 #1
0
ファイル: NetworkHost.py プロジェクト: superadm1n/dnac_api
    def num_of_hosts(self, **kwargs):
        """Returns number of hosts. Sends get request to ``/host/count``

         :param kwargs: See Keyword Arguments below for available keyword arguments.
        :Keyword Arguments:
            * *limit* (``str``)
            * *hostName* (``str``)
            * *hostMac* (``str``)
            * *hostType* (``str``)
            * *connectedInterfaceName* (``str``)
            * *hostIp* (``str``)
            * *connectedNetworkDeviceIpAddress* (``str``)
            * *connectedNetworkDeviceName* (``str``)
            * *hostDeviceType* (``str``)
            * *subType* (``str``)
        :return:
        """
        allowed_kwargs = [
            'hostName', 'hostMac', 'hostType', 'connectedInterfaceName',
            'hostIp', 'connectedNetworkDeviceIpAddress',
            'connectedNetworkDeviceName', 'hostDeviceType', 'subType'
        ]
        url = '/host/count'
        params = handle_kwargs({}, allowed_kwargs=allowed_kwargs, **kwargs)
        return self.get_handler(url, params=params)
コード例 #2
0
ファイル: NetworkHost.py プロジェクト: superadm1n/dnac_api
 def hosts_by_filter(self, **kwargs):
     '''
     :param kwargs: See Keyword Arguments below for available keyword arguments.
     :Keyword Arguments:
         * *limit* (``str``)
         * *offset* (``str``)
         * *sortBy* (``str``)
         * *order* (``str``)
         * *hostName* (``str``)
         * *hostMac* (``str``)
         * *hostType* (``str``)
         * *connectedInterfaceName* (``str``)
         * *hostIp* (``str``)
         * *connectedNetworkDeviceIpAddress* (``str``)
         * *connectedNetworkDeviceName* (``str``)
         * *hostDeviceType* (``str``)
         * *subType* (``str``)	Available values: 'UNKNOWN' or 'IP_PHONE' or 'TELEPRESENCE' or 'VIDEO_SURVEILLANCE_IP_CAMERA' or 'VIDEO_ENDPOINT'. Only exact match filtering supported on this field
     '''
     allowed_kwargs = [
         'limit', 'offset', 'sortBy', 'order', 'hostName', 'hostMac',
         'hostType', 'connectedInterfaceName', 'hostIp',
         'connectedNetworkDeviceIpAddress', 'connectedNetworkDeviceName',
         'hostDeviceType', 'subType'
     ]
     params = handle_kwargs({}, allowed_kwargs=allowed_kwargs, **kwargs)
     return self.get_handler(url='/host', params=params)
コード例 #3
0
    def snmpv2_write(self, **kwargs):
        """This method is used to get global SNMPv2 Write credentials. This method gets to
        the api route ``/global-credential``

        :param kwargs: See Keyword Arguments below for available keyword arguments.
        :Keyword Arguments:
            * *sortBy* (``str``) -- define sorting on the data returned
            * *order* (``str``) -- Define order on data returned
        :return: Global SNMPv2 Write Credentials
        """
        url_params = {'credentialSubType': 'SNMPV2_WRITE_COMMUNITY'}
        url_params = handle_kwargs(url_params, self.allowed_kwargs, **kwargs)
        response = self.get_handler(self.url, params=url_params)
        return response
コード例 #4
0
    def netconf(self, **kwargs):
        """This method is used to get global Netconf credentials. This method gets to
        the api route ``/global-credential``

        :param kwargs: See Keyword Arguments below for available keyword arguments.
        :Keyword Arguments:
            * *sortBy* (``str``) -- define sorting on the data returned
            * *order* (``str``) -- Define order on data returned
        :return: Global Netconf Credentials
        """
        url_params = {'credentialSubType': 'NETCONF'}
        url_params = handle_kwargs(url_params, self.allowed_kwargs, **kwargs)
        response = self.get_handler(self.url, params=url_params)
        return response
コード例 #5
0
    def discovery_jobs_by_id(self, discovery_id, **kwargs):
        """Returns discovery jobs by specified ID.

        :param discovery_id:
        :param kwargs: See Keyword Arguments below
        :Keyword Arguments:
            * *offset* (``str``)
            * *limit* (``str``)
            * *ipAddress* (``str``)
        :return:
        """
        allowed_kwargs = ['offset', 'limit', 'ipAddress']
        url = '/discovery/{}/job'.format(discovery_id)
        url_params = handle_kwargs(params={}, allowed_kwargs=allowed_kwargs, **kwargs)
        return self.get_handler(url, params=url_params if url_params else None)
コード例 #6
0
    def discovery_jobs_for_ip(self, ip, **kwargs):
        """Return discovery jobs associated with an IP address

        :param ip: IP address to get discovery jobs for.
        :param kwargs: See Keyword Arguments below
        :Keyword Arguments:
            * *offset* (``str``)
            * *limit* (``str``)
            * *name* (``str``)
        :return: Discovery Jobs
        """
        allowed_kwargs = ['offset', 'limit', 'name']
        url = '/discovery/job'
        url_params = {'ipAddress': ip}
        # append additional paramenters
        url_params = handle_kwargs(url_params, allowed_kwargs=allowed_kwargs, **kwargs)

        response = self.get_handler(url, params=url_params)
        return response
コード例 #7
0
    def number_of_modules_in_device(self, device_id, **kwargs):
        """Returns the number of modules in a device. Sends get request to ``/network-device/module/count``

        :param device_id: Device ID of network device
        :param kwargs: See Keyword Arguments below
        :Keyword Arguments:
            * *deviceId* (``str``)
            * *nameList* (``str``)
            * *vendorEquipmentTypeList* (``str``)
            * *partNumberList* (``str``)
            * *operationalStateCodeList* (``str``)

        :return:
        """
        allowed_kwargs = [
            'deviceId', 'nameList', 'vendorEquipmentTypeList',
            'partNumberList', 'operationalStateCodeList'
        ]
        url = '/network-device/module/count'
        params = {'deviceId': device_id}
        params = handle_kwargs(params, allowed_kwargs=allowed_kwargs, **kwargs)
        return self.get_handler(url, params=params)
コード例 #8
0
    def network_devices_from_discovery_by_filters(self, discovery_id, **kwargs):
        """

        :param discovery_id:
        :param kwargs: See Keyword Arguments below
        :Keyword Arguments:
            * *offset* (``str``)
            * *limit* (``str``)
            * *ipAddress* (``str``)
            * *taskId* (``str``)
            * *sortyBy* (``str``)
            * *sortOrder* (``str``)
            * *ipAddress* (``str``)
            * *pingStatus* (``str``)
            * *snmpStatus* (``str``)
            * *cliStatus* (``str``)
            * *netconfStatus* (``str``)
            * *httpStatus* (``str``)
        :return:
        """
        allowed_kwargs = ['taskId', 'sortyBy', 'sortOrder', 'ipAddress', 'pingStatus', 'snmpStatus', 'cliStatus', 'netconfStatus', 'httpStatus']
        url = '/discovery/{}/summary'.format(discovery_id)
        url_params = handle_kwargs(params={}, allowed_kwargs=allowed_kwargs, **kwargs)
        return self.get_handler(url, params=url_params if url_params else None)