Netflow:部分代码

   1 import requests
   2 
   3 
   4 class NetFlow(object):
   5     def __init__(self, domain: str, api_key: str):
   6         """
   7         :param domain: https://netflow.lenovo.com or http://ServerIP:port
   8         :param api_key: ''
   9         """
  10         if not domain.startswith(('https://', 'http://')):
  11             raise ValueError('Parameter "domain" error, e.g: https://example.com or http://x.x.x.x:8080')
  12         self.domain = domain
  13         self.api_key = api_key
  14         self.conversation = self.Conversation(self)
  15         self.inventory_device = self.InventoryDevice(self)
  16         self.inventory_interface = self.InventoryInterface(self)
  17         self.inventory_groups = self.InventoryGroups(self)
  18         self.inventory_application = self.InventoryApplication(self)
  19         self.inventory_qos = self.InventoryQos(self)
  20         self.inventory_wlc = self.InventoryWirelessController(self)
  21         self.reports = self.Reports(self)
  22 
  23     def get_result(self, relative_path: str, params: dict):
  24         result = {'success': True}
  25         try:
  26             params.update(apiKey=self.api_key)
  27             url = os.path.join(self.domain, relative_path).replace('\\', '/')
  28             data = requests.get(url, params=params, verify=False).json() or {}
  29             if isinstance(data, dict):
  30                 result.update(**data)
  31             else:
  32                 result.update(data=data)
  33         except Exception as e:
  34             result.update(success=False, error=str(e))
  35         return result
  36 
  37     class Conversation(object):
  38         def __init__(self, parent):
  39             self._parent = parent
  40 
  41         def conversation_details(self, **params):
  42             """
  43             http://netflowapi.helpdocsonline.com/conversation-details
  44             :param params:
  45                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
  46                 DeviceID            IPGroup / Interface Group ID
  47                 tablegridviewtype    Chart/Grid
  48                 Type                source/Destination/application
  49                 Data                IN/OUT
  50                 Entity                Source ip/ Destination IP/Application Name
  51                 ResolveDNS            true
  52                 BussView            true/false
  53                 IPGroup                true/false
  54                 BussView            true(Always true for Interface group)
  55             Sample API
  56             http://localhost:8080/api/json/nfadevice/conDetailData?apiKey=xxxx&TimeFrame=hourly&DeviceID=2500002&Type=Source&Data=IN&Entity=100.0.0.1&ResolveDNS=false&groupBy=&BussView=true&pageCount=1&rows=50
  57             :return:
  58             """
  59             relative_path = 'api/json/nfadevice/conDetailData'
  60             return self._parent.get_result(relative_path=relative_path, params=params)
  61 
  62     class InventoryDevice(object):
  63         def __init__(self, parent):
  64             self._parent = parent
  65 
  66         def get_device_list(self):
  67             """
  68             http://netflowapi.helpdocsonline.com/get-device-list
  69             Get Device List with basic information
  70             Sample API
  71             http://localhost:8080/api/json/nfadevice/getIndexRouterData?apiKey=xxxx
  72             :return:
  73             """
  74             relative_path = 'api/json/nfadevice/getIndexRouterData'
  75             return self._parent.get_result(relative_path=relative_path, params={})
  76 
  77         def get_router_id(self):
  78             """
  79             http://netflowapi.helpdocsonline.com/get-router-id
  80             Get Router List with ID and IP
  81             Sample API
  82             http://localhost:8080/api/json/nfadevice/listDevices?apiKey=xxxx&_=1482326391051
  83             :return:
  84             """
  85             relative_path = 'api/json/nfadevice/listDevices'
  86             return self._parent.get_result(relative_path=relative_path, params={})
  87 
  88         def get_interface_list(self, **params):
  89             """
  90             http://netflowapi.helpdocsonline.com/get-interface-list
  91             Get Interface List with basic information
  92             :param params:
  93                 TimeFrame    hourly/6hour/today/Daily/Weekly/Monthly
  94                 DeviceID    -1(All Device)/ specific Device ID
  95             Sample API
  96             http://localhost:8080/api/json/nfadevice/getIndexInterfaceData?apiKey=xxxx&TimeFrame=hourly&DeviceID=50003
  97             :return:
  98             """
  99             relative_path = 'api/json/nfadevice/getIndexInterfaceData'
 100             return self._parent.get_result(relative_path=relative_path, params=params)
 101 
 102         def get_device_traffic(self, **params):
 103             """
 104             http://netflowapi.helpdocsonline.com/get-device-traffic
 105             Device traffic with different IN/OUT
 106             :param params:
 107                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 108                 RouterIP    IP of the device
 109                 ReportType    devTraffic/inGraph/outGraph
 110             Sample API
 111             http://localhost:8080/api/json/v2/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=outGraph
 112             :return:
 113             """
 114             relative_path = 'api/json/v2/nfadevice/getDeviceReport'
 115             return self._parent.get_result(relative_path=relative_path, params=params)
 116 
 117         def get_interface_traffic(self, **params):
 118             """
 119             http://netflowapi.helpdocsonline.com/get-interfacetraffic
 120             Get all the interface traffic of the particular device
 121             :param params:
 122                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 123                 RouterIP            IP of the device
 124                 tablegridviewtype    Chart/Grid
 125                 Type                speed/volume/percentage
 126                 entity                IN/OUT
 127             Sample API
 128             http://localhost:8080/api/json/nfadevice/getIntfMultiSeriesData?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&tablegridviewtype=Chart&Type=volume&entity=IN&expand=false&_=1482326391080
 129             :return:
 130             """
 131             relative_path = 'api/json/nfadevice/getIntfMultiSeriesData'
 132             return self._parent.get_result(relative_path=relative_path, params=params)
 133 
 134         def get_application_data(self, **params):
 135             """
 136             http://netflowapi.helpdocsonline.com/get-application-data
 137             Application list with traffic data
 138             :param params:
 139                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 140                 RouterIP    IP of the device
 141                 ReportType    topApp/topProt
 142             Sample API
 143             http://localhost:8080/api/json/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=topApp
 144             :return:
 145             """
 146             relative_path = 'api/json/nfadevice/getDeviceReport'
 147             return self._parent.get_result(relative_path=relative_path, params=params)
 148 
 149         def get_source_data(self, **params):
 150             """
 151             http://netflowapi.helpdocsonline.com/get-source-data
 152             Source IP List with traffic volume data
 153             :param params:
 154                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 155                 RouterIP    IP of the device
 156                 ReportType    source
 157                 ResolveDNS    true/false
 158             Sample API
 159             http://localhost:8080/api/json/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=source&ResolveDNS=false
 160             :return:
 161             """
 162             relative_path = 'api/json/nfadevice/getDeviceReport'
 163             return self._parent.get_result(relative_path=relative_path, params=params)
 164 
 165         def get_destination_data(self, **params):
 166             """
 167             http://netflowapi.helpdocsonline.com/get-destination-data
 168             Destination IP List with traffic volume data.
 169             :param params:
 170                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 171                 RouterIP    IP of the device
 172                 ReportType    Destination
 173                 ResolveDNS    true/false
 174             Sample API
 175             http://localhost:8080/api/json/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=destination&ResolveDNS=false
 176             :return:
 177             """
 178             relative_path = 'api/json/nfadevice/getDeviceReport'
 179             return self._parent.get_result(relative_path=relative_path, params=params)
 180 
 181         def get_qos_data(self, **params):
 182             """
 183             http://netflowapi.helpdocsonline.com/get-qos-data
 184             QoS List with traffic volume data
 185             :param params:
 186                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 187                 RouterIP    IP of the device
 188                 ReportType    dscp
 189             Sample API
 190             http://localhost:8080/api/json/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=dscp
 191             :return:
 192             """
 193             relative_path = 'api/json/nfadevice/getDeviceReport'
 194             return self._parent.get_result(relative_path=relative_path, params=params)
 195 
 196         def get_device_conversation_data(self, **params):
 197             """
 198             http://netflowapi.helpdocsonline.com/get-device-conversation-data
 199             Conversation with traffic volume data
 200             :param params:
 201                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 202                 RouterIP    IP of the device
 203                 ReportType    conversation
 204             Sample API
 205             http://localhost:8080/api/json/nfadevice/getDeviceReport?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&ReportType=Conversation
 206             :return:
 207             """
 208             relative_path = 'api/json/nfadevice/getDeviceReport'
 209             return self._parent.get_result(relative_path=relative_path, params=params)
 210 
 211         def get_as_view_data(self, **params):
 212             """
 213             http://netflowapi.helpdocsonline.com/get-as-view-data
 214             Get AS View Data
 215             :param params:
 216                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 217                 RouterIP    IP of the device
 218                 count        Integer
 219             Sample API
 220             http://localhost:8080/api/json/nfadevice/getASView?apiKey=xxxx&RouterIP=1.1.7.10&TimeFrame=hourly&count=10
 221             :return:
 222             """
 223             relative_path = 'api/json/nfadevice/getASView'
 224             return self._parent.get_result(relative_path=relative_path, params=params)
 225 
 226         def get_bill_pan_list(self, **params):
 227             """
 228             http://netflowapi.helpdocsonline.com/get-bill-plan-list
 229             Get Bill Plan list
 230             :param params:
 231                 planID    1
 232             :return:
 233             """
 234             relative_path = 'api/json/nfabilling/listBillPlan'
 235             return self._parent.get_result(relative_path=relative_path, params=params)
 236 
 237     class InventoryInterface(object):
 238         def __init__(self, parent):
 239             self._parent = parent
 240 
 241         def list_all_interfaces(self, **params):
 242             """
 243             http://netflowapi.helpdocsonline.com/list-all-interfaces
 244             Get All Interface list with basic information
 245             :param params:
 246                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 247                 DeviceID    -1(All Device) / Specific ID
 248             Sample API
 249             http://localhost:8080/api/json/nfadevice/getIndexInterfaceData?apiKey=xxxx&TimeFrame=hourly&DeviceID=-1
 250             :return:
 251             """
 252             relative_path = 'api/json/nfadevice/getIndexInterfaceData'
 253             return self._parent.get_result(relative_path=relative_path, params=params)
 254 
 255         def get_interface_summary(self, **params):
 256             """
 257             http://netflowapi.helpdocsonline.com/get-interfaces-summary
 258             Get interface details like IN/OUT speed , interface type
 259             :param params:
 260                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 261                 DeviceID    Interface ID
 262             Sample API
 263             http://localhost:8080/api/json/nfadevice/getSummaryData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly
 264             :return:
 265             """
 266             relative_path = 'api/json/nfadevice/getSummaryData'
 267             return self._parent.get_result(relative_path=relative_path, params=params)
 268 
 269         def interface_traffic(self, **params):
 270             """
 271             http://netflowapi.helpdocsonline.com/interface-traffic
 272             Get Interface Traffic Data
 273             :param params:
 274                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 275                 DeviceID            Interface ID
 276                 tablegridviewtype     Chart/Grid
 277                 Type                 speed/volume/packets/percentage
 278                 granularity            1/5/15
 279             Sample API
 280             http://localhost:8080/api/json/v2/nfadevice/getTrafficData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly&tablegridviewtype=Chart&Type=speed&granularity=1
 281             :return:
 282             """
 283             relative_path = 'api/json/v2/nfadevice/getTrafficData'
 284             return self._parent.get_result(relative_path=relative_path, params=params)
 285 
 286         def interface_application_data(self, **params):
 287             """
 288             http://netflowapi.helpdocsonline.com/interface-application-data
 289             Get application list for particular interface traffic
 290             :param params:
 291                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 292                 DeviceID            Interface ID
 293                 tablegridviewtype     Chart/Grid
 294                 Type                Application
 295                 Data                IN/OUT
 296                 pageCount             Number
 297                 rows                number(Rows per page)
 298                 chartType            line
 299             Sample API
 300             http://localhost:8080/api/json/v2/nfadevice/getAppData?apiKey=xxxx&DeviceID=5000002&rows=10&chartType=line&TimeFrame=hourly&Type=Application&pageCount=1&tablegridviewtype=Chart&Data=IN
 301             :return:
 302             """
 303             relative_path = 'api/json/v2/nfadevice/getAppData'
 304             return self._parent.get_result(relative_path=relative_path, params=params)
 305 
 306         def interface_source_data(self, **params):
 307             """
 308             http://netflowapi.helpdocsonline.com/interface-source-data
 309             Get Source list for particular interface traffic
 310             :param params:
 311                 TimeFrame             hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 312                 DeviceID            Interface ID
 313                 tablegridviewtype    Chart/Grid
 314                 Type                Application
 315                 Data                IN/OUT
 316                 pageCount            Number
 317                 rows                number(Rows per page)
 318                 chartType            line
 319                 isNetwork            true/false
 320                 isLocation            true/false
 321             Sample API
 322             http://localhost:8080/api/json/nfadevice/getSourceData?apiKey=xxxx&DeviceID=5000002&rows=10&TimeFrame=hourly&pageCount=1&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false&Data=IN
 323             :return:
 324             """
 325             relative_path = 'api/json/nfadevice/getSourceData'
 326             return self._parent.get_result(relative_path=relative_path, params=params)
 327 
 328         def interface_destination_data(self, **params):
 329             """
 330             http://netflowapi.helpdocsonline.com/interface-destination-data
 331             Get Destination IP list for particular interface traffic
 332             :param params:
 333                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 334                 DeviceID            Interface ID
 335                 tablegridviewtype    Chart/Grid
 336                 Type                Application
 337                 Data                IN/OUT
 338                 pageCount            Number
 339                 rows                number(Rows per page)
 340                 chartType            line
 341                 isNetwork            true/false
 342                 isLocation            true/false
 343             Sample API
 344             http://localhost:8080/api/json/nfadevice/getDstData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly&rows=10&pageCount=1&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false&Data=IN
 345             :return:
 346             """
 347             relative_path = 'api/json/nfadevice/getDstData'
 348             return self._parent.get_result(relative_path=relative_path, params=params)
 349 
 350         def interface_qos_data(self, **params):
 351             """
 352             http://netflowapi.helpdocsonline.com/interface-qos-data
 353             Get Qos Data i.e. Dscp/Tos list for particular interface
 354             :param params:
 355                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 356                 DeviceID            Interface ID
 357                 tablegridviewtype    Chart/Grid
 358                 Type                DSCP/TOS/Grp
 359                 Data                IN/OUT
 360                 pageCount            Number
 361                 rows                number (Rows per page)
 362             Sample API
 363             http://localhost:8080/api/json/v2/nfadevice/getDSCPTosData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly&rows=10&pageCount=1&tablegridviewtype=Chart&Type=DSCP&Data=IN
 364             :return:
 365             """
 366             relative_path = 'api/json/v2/nfadevice/getDSCPTosData'
 367             return self._parent.get_result(relative_path=relative_path, params=params)
 368 
 369         def interface_conversation_data(self, **params):
 370             """
 371             http://netflowapi.helpdocsonline.com/interface-conversation-data
 372             Get conversation details for particular interface
 373             :param params:
 374                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 375                 DeviceID            Interface ID
 376                 tablegridviewtype    Chart/Grid
 377                 Data                IN/OUT
 378                 pageCount            Number
 379                 rows                number(Rows per page)
 380                 isNetwork            true/false
 381             Sample API
 382             http://localhost:8080/api/json/nfadevice/getConvData?apiKey=xxxx&DeviceID=5000002&pageCount=1&rows=10&TimeFrame=hourly&GroupBy=&isNetwork=false&ResolveDNS=false&Data=IN
 383             :return:
 384             """
 385             relative_path = 'api/json/nfadevice/getConvData'
 386             return self._parent.get_result(relative_path=relative_path, params=params)
 387 
 388         def interface_top_sites_data(self, **params):
 389             """
 390             http://netflowapi.helpdocsonline.com/interface-top-sites-data
 391             Interface Top Sites Data
 392             :param params:
 393                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 394                 DeviceID    Interface ID
 395                 Data        IN/OUT
 396             Sample API
 397             http://localhost:8080/api/json/nfadevice/getTopSites?apiKey=xxxx&DeviceID=5000002&TimeFrame=today&Data=IN
 398             :return:
 399             """
 400             relative_path = 'api/json/nfadevice/getTopSites'
 401             return self._parent.get_result(relative_path=relative_path, params=params)
 402 
 403         def nbar2_application_data(self, **params):
 404             """
 405             http://netflowapi.helpdocsonline.com/nbar2-application-data
 406             Get NBAR 2 application list for particular interface traffic
 407             :param params:
 408                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 409                 DeviceID            Interface ID
 410                 tablegridviewtype    Chart/Grid
 411                 Type                speed/volume/packets/percentage
 412                 Data                IN/OUT
 413                 pageCount            Number
 414                 rows                number(Rows per page)
 415                 chartType            line
 416             Sample API
 417             http://localhost:8080/api/json/v2/nfadevice/getNbar2AppData?apiKey=xxxx&DeviceID=5000002&GraphData=true&TimeFrame=hourly&Type=volume&tablegridviewtype=Chart&Data=IN
 418             :return:
 419             """
 420             relative_path = 'api/json/v2/nfadevice/getNbar2AppData'
 421             return self._parent.get_result(relative_path=relative_path, params=params)
 422 
 423         def http_host_data(self, **params):
 424             """
 425             http://netflowapi.helpdocsonline.com/http-host-data
 426             Get HTTP host list for particular interface
 427             :param params:
 428                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 429                 DeviceID            Interface ID
 430                 tablegridviewtype    Chart/Grid
 431                 Type                speed/volume/packets/percentage
 432                 Data                IN/OUT
 433             Sample API
 434             http://localhost:8080/api/json/v2/nfadevice/getAVCURLStatsData?apiKey=xxxx&DeviceID=5000002&Type=volume&TimeFrame=hourly&GraphData=true&tablegridviewtype=Chart&Data=IN
 435             :return:
 436             """
 437             relative_path = 'api/json/v2/nfadevice/getAVCURLStatsData'
 438             return self._parent.get_result(relative_path=relative_path, params=params)
 439 
 440         def qos_stats_data(self, **params):
 441             """
 442             http://netflowapi.helpdocsonline.com/qos-stats-data
 443             Get Qos Stats Data
 444             :param params:
 445                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 446                 DeviceID            Interface ID
 447                 tablegridviewtype    Chart/Grid
 448                 Type                volume
 449                 Data                IN/OUT
 450                 showQoSDrop            false/true
 451             Sample API
 452             http://localhost:8080/api/json/v2/nfadevice/getAVCQosStatsData?apiKey=xxxx&DeviceID=5000004&TimeFrame=hourly&GraphData=true&Type=volume&showQoSDrop=false&Data=IN
 453             :return:
 454             """
 455             relative_path = 'api/json/v2/nfadevice/getAVCQosStatsData'
 456             return self._parent.get_result(relative_path=relative_path, params=params)
 457 
 458         def art_data(self, **params):
 459             """
 460             http://netflowapi.helpdocsonline.com/art-data
 461             Get ART data for particular interface
 462             :param params:
 463                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 464                 DeviceID            Interface ID
 465                 tablegridviewtype    Chart/Grid
 466                 Type                Volume
 467                 Data                IN/OUT
 468                 GraphType            server/client
 469                 TopNGraphData        true
 470             Sample API
 471             http://localhost:8080/api/json/v2/nfadevice/getARTReportData?apiKey=xxxx&DeviceID=5000004&Type=volume&TimeFrame=hourly&GraphData=true&tablegridviewtype=Chart&TopNGraphData=true&GraphType=server&Data=IN
 472             :return:
 473             """
 474             relative_path = 'api/json/v2/nfadevice/getARTReportData'
 475             return self._parent.get_result(relative_path=relative_path, params=params)
 476 
 477     class InventoryGroups(object):
 478         def __init__(self, parent):
 479             self._parent = parent
 480 
 481         def list_all_interface_groups(self, **params):
 482             """
 483             http://netflowapi.helpdocsonline.com/list-all-interface-groups
 484             Get all Interface group list with basic information
 485             :param params:
 486                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 487             Sample API
 488             http://localhost:8080/api/json/nfadevice/getIndexIntfGroupData?apiKey=xxxx&TimeFrame=hourly
 489             :return:
 490             """
 491             relative_path = 'api/json/nfadevice/getIndexIntfGroupData'
 492             return self._parent.get_result(relative_path=relative_path, params=params)
 493 
 494         def interface_group_traffic(self, **params):
 495             """
 496             http://netflowapi.helpdocsonline.com/interface-group-traffic
 497             Get interface Group Traffic data
 498             :param params:
 499                 DeviceID            Interface group ID
 500                 tablegridviewtype    Chart/Grid
 501                 Type                speed/volume/packets/percentage
 502                 granularity            1/5/15
 503                 BussView            true(Always true for Interface group
 504             Sample API
 505             http://localhost:8080/api/json/v2/nfadevice/getTrafficData?apiKey=xxxx&DeviceID=2500002&TimeFrame=hourly&BussView=true&enableBussHour=true&BussStartTime=0000&BussEndTime=0000&tablegridviewtype=Chart&Type=speed&granularity=1
 506             :return:
 507             """
 508             relative_path = 'api/json/v2/nfadevice/getTrafficData'
 509             return self._parent.get_result(relative_path=relative_path, params=params)
 510 
 511         def interface_group_application_data(self, **params):
 512             """
 513             http://netflowapi.helpdocsonline.com/interface-group-application-data
 514             Get Application list for particular interface group traffic
 515             :param params:
 516                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 517                 DeviceID            Interface group ID
 518                 tablegridviewtype    Chart/Grid
 519                 Type                Application
 520                 Data                IN/OUT
 521                 pageCount            Number
 522                 rows                number(Rows per page)
 523                 chartType            line
 524                 BussView            true (Always true for Interface group)
 525             Sample API
 526             http://localhost:8080/api/json/v2/nfadevice/getAppData?apiKey=xxxx&DeviceID=2500002&rows=10&chartType=line&Type=Application&TimeFrame=hourly&BussView=true&pageCount=1&tablegridviewtype=Chart&Data=IN
 527             :return:
 528             """
 529             relative_path = 'api/json/v2/nfadevice/getAppData'
 530             return self._parent.get_result(relative_path=relative_path, params=params)
 531 
 532         def interface_group_source_data(self, **params):
 533             """
 534             http://netflowapi.helpdocsonline.com/interface-group-source-data
 535             Get Source list for particular interface Group traffic
 536             :param params:
 537                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 538                 DeviceID            Interface group ID
 539                 tablegridviewtype    Chart/Grid
 540                 Type                Application
 541                 Data                IN/OUT
 542                 pageCount            Number
 543                 rows                number(Rows per page)
 544                 chartType            line
 545                 isNetwork             true/ false
 546                 isLocation            true/false
 547                 BussView            true(Always true for Interface group)
 548             Sample API
 549             http://localhost:8080/api/json/nfadevice/getSourceData?apiKey=xxxx&DeviceID=5000002&rows=10&BussView=true&TimeFrame=hourly&pageCount=1&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false&Data=IN
 550             :return:
 551             """
 552             relative_path = 'api/json/nfadevice/getSourceData'
 553             return self._parent.get_result(relative_path=relative_path, params=params)
 554 
 555         def interface_group_destination_data(self, **params):
 556             """
 557             http://netflowapi.helpdocsonline.com/interface-group-destination-data
 558             :param params:
 559                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 560                 DeviceID            Interface groupID
 561                 tablegridviewtype    Chart/Grid
 562                 Type                 Application
 563                 Data                 IN/OUT
 564                 pageCount            Number
 565                 rows                number(Rows per page)
 566                 chartType            line
 567                 isNetwork            true/ false
 568                 isLocation            true/false
 569                 BussView            true(Always true for Interface group)
 570             Sample API
 571             http://localhost:8080/api/json/nfadevice/getDstData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly&rows=10&BussView=true&pageCount=1&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false&Data=IN
 572             :return:
 573             """
 574             relative_path = 'api/json/nfadevice/getDstData'
 575             return self._parent.get_result(relative_path=relative_path, params=params)
 576 
 577         def interface_group_qos_data(self, **params):
 578             """
 579             http://netflowapi.helpdocsonline.com/interface-group-qos-data
 580             :param params:
 581                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 582                 DeviceID            Interface groupID
 583                 tablegridviewtype    Chart/Grid
 584                 Type                 DSCP/TOS/Grp
 585                 Data                 IN/OUT
 586                 pageCount            Number
 587                 rows                number(Rows per page)
 588                 BussView            true(Always true for Interface group)
 589             :return:
 590             Sample API
 591             http://localhost:8080/api/json/v2/nfadevice/getDSCPTosData?apiKey=xxxx&DeviceID=5000002&TimeFrame=hourly&rows=10&BussView=true&pageCount=1&tablegridviewtype=Chart&Type=DSCP&Data=IN
 592             """
 593             relative_path = 'api/json/v2/nfadevice/getDSCPTosData'
 594             return self._parent.get_result(relative_path=relative_path, params=params)
 595 
 596         def interface_group_conversation_data(self, **params):
 597             """
 598             http://netflowapi.helpdocsonline.com/interface-groupconversation-data
 599             Get Conversation details for particular interface Group
 600             :param params:
 601                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 602                 DeviceID            Interface groupID
 603                 tablegridviewtype    Chart/Grid
 604                 Data                IN/OUT
 605                 pageCount            Number
 606                 rows                number(Rows per page)
 607                 isNetwork            true/false
 608                 BussView            true(Always true for Interface group)
 609             Sample API
 610             http://localhost:8080/api/json/nfadevice/getConvData?apiKey=xxxx&DeviceID=5000002&pageCount=1&BussView=true&rows=10&TimeFrame=hourly&GroupBy=&isNetwork=false&ResolveDNS=false&Data=IN
 611             :return:
 612             """
 613             relative_path = 'api/json/nfadevice/getConvData'
 614             return self._parent.get_result(relative_path=relative_path, params=params)
 615 
 616         def nbar2_application_data(self, **params):
 617             """
 618             http://netflowapi.helpdocsonline.com/nbar2-applicationdata
 619             Get NBAR2 App list for particular interface group traffic
 620             :param params:
 621                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 622                 DeviceID            Interface groupID
 623                 tablegridviewtype    Chart/Grid
 624                 Type                speed/volume/packets/percentage
 625                 Data                IN/OUT
 626                 pageCount            Number
 627                 rows                number(Rows per page)
 628                 chartType            line
 629                 BussView            true(Always true for Interface group)
 630             Sample API
 631             http://localhost:8080/api/json/v2/nfadevice/getNbar2AppData?apiKey=xxxx&DeviceID=5000002&GraphData=true&TimeFrame=hourly&Type=volume&tablegridviewtype=Chart&Data=IN&BussView=true
 632             :return:
 633             """
 634             relative_path = 'api/json/v2/nfadevice/getNbar2AppData'
 635             return self._parent.get_result(relative_path=relative_path, params=params)
 636 
 637         def http_host_data(self, **params):
 638             """
 639             http://netflowapi.helpdocsonline.com/http-host-data-2
 640             :param params:
 641                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 642                 DeviceID            Interface groupID
 643                 tablegridviewtype    Chart/Grid
 644                 Type                speed/volume/packets/percentage
 645                 Data                IN/OUT
 646                 BussView            true(Always true for Interface group)
 647             Sample API
 648             http://localhost:8080/api/json/v2/nfadevice/getAVCURLStatsData?apiKey=xxxx&DeviceID=5000002&Type=volume&TimeFrame=hourly&GraphData=true&tablegridviewtype=Chart&Data=IN&BussView=true
 649             :return:
 650             """
 651             relative_path = 'api/json/v2/nfadevice/getAVCURLStatsData'
 652             return self._parent.get_result(relative_path=relative_path, params=params)
 653 
 654         def qos_stats_data(self, **params):
 655             """
 656             http://netflowapi.helpdocsonline.com/qos-stats-data-2
 657             Get HTTP Host list for particular interface group
 658             :param params:
 659                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 660                 DeviceID            Interface groupID
 661                 tablegridviewtype    Chart/Grid
 662                 Type                volume
 663                 Data                IN/OUT
 664                 showQoSDrop            false/true
 665                 BussView            true(Always true for Interface group)
 666             Sample API
 667             http://localhost:8080/api/json/v2/nfadevice/getAVCQosStatsData?apiKey=xxxx&DeviceID=5000004&TimeFrame=hourly&GraphData=true&Type=volume&showQoSDrop=false&Data=IN&BussView=true
 668             :return:
 669             """
 670             relative_path = 'api/json/v2/nfadevice/getAVCQosStatsData'
 671             return self._parent.get_result(relative_path=relative_path, params=params)
 672 
 673         def art_data(self, **params):
 674             """
 675             http://netflowapi.helpdocsonline.com/art-data-2
 676             :param params:
 677                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 678                 DeviceID            Interface groupID
 679                 tablegridviewtype    Chart/Grid
 680                 Type                volume
 681                 Data                IN/OUT
 682                 GraphType            server/client
 683                 TopNGraphData        true
 684                 BussView            true(Always true for Interface group)
 685             Sample API
 686             http://localhost:8080/api/json/v2/nfadevice/getARTReportData?apiKey=xxxx&DeviceID=5000004&Type=volume&TimeFrame=hourly&GraphData=true&tablegridviewtype=Chart&TopNGraphData=true&GraphType=server&Data=IN&BussView=true
 687             :return:
 688             """
 689             relative_path = 'api/json/v2/nfadevice/getARTReportData'
 690             return self._parent.get_result(relative_path=relative_path, params=params)
 691 
 692         def get_ipgroup_list(self, **params):
 693             """
 694             http://netflowapi.helpdocsonline.com/get-ipgroup-list
 695             Get IPgroup List with basic information
 696             :param params:
 697                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 698             Sample API
 699             http://localhost:8080/api/json/v2/nfadevice/getIndexIPGroupData?apiKey=xxxx&TimeFrame=hourly
 700             :return:
 701             """
 702             relative_path = 'api/json/v2/nfadevice/getIndexIPGroupData'
 703             return self._parent.get_result(relative_path=relative_path, params=params)
 704 
 705         def ipgroup_traffic(self, **params):
 706             """
 707             http://netflowapi.helpdocsonline.com/ipgroup-traffic
 708             Get IP group Traffic with different options like speed/ volume.
 709             :param params:
 710                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 711                 DeviceID            IPGroup ID
 712                 tablegridviewtype    Chart/Grid
 713                 Type                speed/volume/packets/percentage
 714                 Granularity            1/5/15
 715                 IPGroup                true(Always true for ipgroups)
 716             Sample API
 717             http://localhost:8080/api/json/v2/nfadevice/getTrafficData?apiKey=xxxx&DeviceID=2500001&TimeFrame=hourly&IPGroup=true&tablegridviewtype=Chart&granularity=1&Type=speed
 718             :return:
 719             """
 720             relative_path = 'api/json/v2/nfadevice/getTrafficData'
 721             return self._parent.get_result(relative_path=relative_path, params=params)
 722 
 723         def ipgroup_application_data(self, **params):
 724             """
 725             http://netflowapi.helpdocsonline.com/ipgroup-application-data
 726             Get application list for particular IPGroup traffic.
 727             :param params:
 728                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 729                 DeviceID            IPGroup ID
 730                 tablegridviewtype    Chart/Grid
 731                 Type                Application
 732                 Data                IN/OUT
 733                 pageCount            Number
 734                 rows                number(Rows per page)
 735                 chartType            line
 736                 IPGroup                true (Always true for IPgroups)
 737             Sample API
 738             http://localhost:8080/api/json/v2/nfadevice/getAppData?apiKey=xxxx&DeviceID=2500001&Type=Application&chartType=line&TimeFrame=hourly&IPGroup=true&rows=10&pageCount=1&tablegridviewtype=Chart&Data=IN
 739             :return:
 740             """
 741             relative_path = 'api/json/v2/nfadevice/getAppData'
 742             return self._parent.get_result(relative_path=relative_path, params=params)
 743 
 744         def ipgroup_source_data(self, **params):
 745             """
 746             http://netflowapi.helpdocsonline.com/ipgroup-source-data
 747             Get Source list for particular IPGroup traffic
 748             :param params:
 749                 DeviceID            IPGroup ID
 750                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 751                 tablegridviewtype    Chart/Grid
 752                 Type                Application
 753                 Data                IN/OUT
 754                 pageCount            Number
 755                 rows                number(Rows per page)
 756                 chartType            line
 757                 isNetwork            true/false
 758                 isLocation            true/false
 759                 IPGroup                true
 760             Sample API
 761             http://localhost:8080/api/json/nfadevice/getSourceData?apiKey=xxxx&DeviceID=2500001&pageCount=1&Data=IN&TimeFrame=hourly&Count=10&IPGroup=true&rows=10&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false
 762             :return:
 763             """
 764             relative_path = 'api/json/nfadevice/getSourceData'
 765             return self._parent.get_result(relative_path=relative_path, params=params)
 766 
 767         def ipgroup_destination_data(self, **params):
 768             """
 769             http://netflowapi.helpdocsonline.com/ipgroup-destination-data
 770             Get Destination IP list for particular IPGroup traffic
 771             :param params:
 772                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 773                 DeviceID            IPGroup ID
 774                 tablegridviewtype    Chart/Grid
 775                 Type                Application
 776                 Data                IN/OUT
 777                 pageCount            Number
 778                 rows                number (Rows per page)
 779                 chartType            line
 780                 isNetwork            true/false
 781                 isLocation            true/false
 782                 IPGroup                true
 783                 Sample API
 784                 http://localhost:8080/api/json/nfadevice/getDstData?apiKey=xxxx&DeviceID=2500001&pageCount=1&rows=10&IPGroup=true&TimeFrame=hourly&Data=IN&tablegridviewtype=Chart&isNetwork=false&isLocation=false&ResolveDNS=false
 785 
 786              :return:
 787             """
 788             relative_path = 'api/json/nfadevice/getSourceData'
 789             return self._parent.get_result(relative_path=relative_path, params=params)
 790 
 791         def ipgroup_qos_data(self, **params):
 792             """
 793             http://netflowapi.helpdocsonline.com/ipgroup-qos-data
 794             Get Dscp/Tos list for particular IPGroup
 795             :param params:
 796                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 797                 DeviceID            IPGroup ID
 798                 tablegridviewtype    Chart/Grid
 799                 Type                DSCP/TOS/Grp
 800                 Data                IN/OUT
 801                 pageCount            Number
 802                 rows                number(Rows per page)
 803                 IPGroup                true
 804             Sample API
 805             http://localhost:8080/api/json/v2/nfadevice/getDSCPTosData?apiKey=xxxx&DeviceID=2500001&TimeFrame=hourly&IPGroup=true&rows=10&pageCount=1&tablegridviewtype=Chart&Type=DSCP&Data=IN
 806             :return:
 807             """
 808             relative_path = 'api/json/v2/nfadevice/getDSCPTosData'
 809             return self._parent.get_result(relative_path=relative_path, params=params)
 810 
 811         def ipgroup_conversation_data(self, **params):
 812             """
 813             http://netflowapi.helpdocsonline.com/ipgroup-conversation-data
 814             Get Conversation details for particular IPGroup
 815             :param params:
 816                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 817                 DeviceID            IPGroup ID
 818                 tablegridviewtype    Chart/Grid
 819                 Data                IN/OUT
 820                 pageCount            Number
 821                 rows                number(Rows per page)
 822                 isNetwork            true/false
 823                 IPGroup                true
 824             Sample API
 825             http://localhost:8080/api/json/nfadevice/getConvData?apiKey=xxxx&DeviceID=2500001&IPGroup=true&pageCount=1&rows=10&TimeFrame=hourly&GroupBy=&isNetwork=false&ResolveDNS=false&Data=IN
 826             :return:
 827             """
 828             relative_path = 'api/json/nfadevice/getConvData'
 829             return self._parent.get_result(relative_path=relative_path, params=params)
 830 
 831         def add_an_ipgroup(self, **params):
 832             """
 833             http://netflowapi.helpdocsonline.com/add-an-ip-group
 834             :param params:
 835                 speed       1000000
 836                 GroupName   test1234
 837                 Desc        aravind test
 838             Sample API
 839             http://localhost:8080/client/api/json/nfaipgroup/addIPGroup?apiKey=00512c6ff9201f26a1111cf56fa02668&GroupName=test1234&Desc=aravind%20test%20&speed=1000000&DevList=5000001,5000003,5000004&IPData=1.1.1.1,255.255.255.0&status=include&IPType=ipnetwork
 840             :return:
 841             """
 842             relative_path = 'api/json/nfaipgroup/addIPGroup'
 843             return self._parent.get_result(relative_path=relative_path, params=params)
 844 
 845     class InventoryApplication(object):
 846         def __init__(self, parent):
 847             self._parent = parent
 848 
 849         def list_apps(self, **params):
 850             """
 851             http://netflowapi.helpdocsonline.com/list-apps
 852             Get List all the application with traffic details
 853             :param params:
 854                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 855                 islayer7    true/false
 856             Sample API
 857             http://localhost:8080/api/json/v2/nfaapps/listApps?apiKey=xxxx&TimeFrame=hourly&islayer7=false
 858             :return:
 859             """
 860             relative_path = 'api/json/v2/nfaapps/listApps'
 861             return self._parent.get_result(relative_path=relative_path, params=params)
 862 
 863         def application_traffic(self, **params):
 864             """
 865             http://netflowapi.helpdocsonline.com/application-traffic
 866             Get Application Traffic for the application
 867             :param params:
 868                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 869                 islayer7    true/false
 870                 appid        appname (ftp,facebook)
 871                 Type        speed/volume/percentage/packets
 872                 Data        IN/OUT
 873             Sample API
 874             http://localhost:8080/api/json/v2/nfaapps/getAppDataSet?apiKey=xxxx&appid=ftp&islayer7=false&TimeFrame=hourly&Type=speed&chartType=line&Data=IN
 875             :return:
 876             """
 877             relative_path = 'api/json/v2/nfaapps/getAppDataSet'
 878             return self._parent.get_result(relative_path=relative_path, params=params)
 879 
 880         def app_interface_list(self, **params):
 881             """
 882             http://netflowapi.helpdocsonline.com/app-interface-list
 883             Get interface list for the application
 884             :param params:
 885                 TimeFrame            hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 886                 islayer7            true/false
 887                 appid                appname (ftp,facebook)
 888                 Type                speed/volume/percentage/packets
 889                 Data                IN/OUT
 890                 tablegridviewtype    Chart/Grid
 891             Sample API
 892             http://localhost:8080/api/json/v2/nfaapps/getAppTrafficForInterface?apiKey=xxxx&appid=ftp&islayer7=false&TimeFrame=hourly&Type=speed&chartType=line&tablegridviewtype=Chart&Data=IN
 893             :return:
 894             """
 895             relative_path = 'api/json/v2/nfaapps/getAppTrafficForInterface'
 896             return self._parent.get_result(relative_path=relative_path, params=params)
 897 
 898     class InventoryQos(object):
 899         def __init__(self, parent):
 900             self._parent = parent
 901 
 902         def list_qos(self, **params):
 903             """
 904             http://netflowapi.helpdocsonline.com/list-qos
 905             Get List qos for the network
 906             :param params:
 907                 TimeFrame    hourly/6hour/Daily/today/yesterday/Weekly/Monthly
 908                 WidgetID    Number
 909                 count       100
 910                 Category    0
 911                 DeviceID    1
 912                 reqTo       true
 913             Sample API
 914             http://localhost:8080/api/json/nfadashBoard/getWidgetData?apiKey=xxxx&WidgetID=10097&TimeFrame=hourly&count=100&Category=0&DeviceID=1&reqTo=true
 915             :return:
 916             """
 917             relative_path = 'api/json/nfadashBoard/getWidgetData'
 918             return self._parent.get_result(relative_path=relative_path, params=params)
 919 
 920     class InventoryWirelessController(object):
 921         def __init__(self, parent):
 922             self._parent = parent
 923 
 924         def get_controller_list(self):
 925             """
 926             http://netflowapi.helpdocsonline.com/get-controller-list
 927             Get List all controllers with basic information
 928             Sample API
 929             http://localhost:8080/api/json/nfadevice/getWlcRouterData?apiKey=xxxx
 930             :return:
 931             """
 932             relative_path = 'api/json/nfadevice/getWlcRouterData'
 933             return self._parent.get_result(relative_path=relative_path, params={})
 934 
 935         def get_ssid_list(self, **params):
 936             """
 937             http://netflowapi.helpdocsonline.com/get-ssid-list
 938             Get List all SSID with IN & OUT Traffic info
 939             :param params:
 940                 TimeFrame    hourly/6hour/today/daily/Weekly/Monthly
 941                 Criteria    WIRELESS_SSID
 942             Sample API
 943             http://localhost:8080/api/json/nfadevice/listWLCIcons?apiKey=xxxx&TimeFrame=today&Criteria=WIRELESS_SSID
 944             :return:
 945             """
 946             relative_path = 'api/json/nfadevice/listWLCIcons'
 947             return self._parent.get_result(relative_path=relative_path, params=params)
 948 
 949         def get_clients_list(self, **params):
 950             """
 951             http://netflowapi.helpdocsonline.com/get-clients-list
 952             Get List all Clients with IN & OUT Traffic info
 953             :param params:
 954                 TimeFrame    hourly/6hour/today/daily/Weekly/Monthly
 955                 Criteria    CLIENTIP
 956             Sample API
 957             http://localhost:8080/api/json/nfadevice/listWLCIcons?apiKey=xxxx&TimeFrame=today&Criteria=CLIENTIP
 958             :return:
 959             """
 960             relative_path = 'api/json/nfadevice/listWLCIcons'
 961             return self._parent.get_result(relative_path=relative_path, params=params)
 962 
 963         def get_access_points_list(self, **params):
 964             """
 965             http://netflowapi.helpdocsonline.com/get-access-points-list
 966             Get List all Access points with IN & OUT Traffic info
 967             :param params:
 968                 TimeFrame    hourly/6hour/today/daily/Weekly/Monthly
 969                 Criteria    APMAC
 970             Sample API
 971             http://localhost:8080/api/json/nfadevice/listApMacIcons?apiKey=xxxx&TimeFrame=today&Criteria=APMAC
 972             :return:
 973             """
 974             relative_path = 'api/json/nfadevice/listApMacIcons'
 975             return self._parent.get_result(relative_path=relative_path, params=params)
 976 
 977         def get_controller_traffic(self, **params):
 978             """
 979             http://netflowapi.helpdocsonline.com/get-controller-traffic
 980             Get Controller traffic data
 981             :param params:
 982                 TimeFrame    hourly/6hour/today/daily/Weekly/Monthly
 983                 RouterID    Controller ID
 984                 pageCount    Number
 985                 rows        Number
 986                 ReportType    Graph/topIPHost/topSSID/topAP/topApp/topDSCP/topConv
 987             Sample API
 988             http://localhost:8080/api/json/v2/nfadevice/getWLCDeviceReport?apiKey=xxxx&RouterID=50004&type=OUT&TimeFrame=6Hour&pageCount=1&ReportType=graph&rows=11&expand=false&_=1482326391446
 989             :return:
 990             """
 991             relative_path = 'api/json/v2/nfadevice/getWLCDeviceReport'
 992             return self._parent.get_result(relative_path=relative_path, params=params)
 993 
 994         def get_ssid_data(self, **params):
 995             """
 996             http://netflowapi.helpdocsonline.com/get-ssid-data
 997             Get SSID based Applications, Access points, Qos
 998             :param params:
 999                 TimeFrame            hourly/6hour/today/daily/Weekly/Monthly
1000                 RouterID            Controller ID
1001                 pageCount            Number
1002                 rows                Number
1003                 ReportType            topIPHost/topAP/topApp/topDSCP
1004                 Tablegridviewtype     Grid/Chart
1005                 critival            SSID Name
1006                 critcol                WIRELESS_SSID
1007             Sample API
1008             http://localhost:8080/api/json/v2/nfadevice/getWLCSnapData?apiKey=cab4e1fb930ceb5a7a89572099240de2&critval=NFA12&ReportType=topAP&TimeFrame=hourly&critcol=WIRELESS_SSID&pageCount=1&rows=10&tablegridviewtype=Chart&type=IN
1009             :return:
1010             """
1011             relative_path = 'api/json/v2/nfadevice/getWLCSnapData'
1012             return self._parent.get_result(relative_path=relative_path, params=params)
1013 
1014         def get_clients_data(self, **params):
1015             """
1016             http://netflowapi.helpdocsonline.com/get-clients-data
1017             Getting Clients based Applications, Access points, Qos
1018             :param params:
1019                 TimeFrame            hourly/6hour/today/daily/Weekly/Monthly
1020                 RouterID            Controller ID
1021                 pageCount            Number
1022                 rows                Number
1023                 ReportType            topSSID/topAP/topAP/topApp/topDSCP
1024                 Tablegridviewtype     Grid/Chart
1025                 critival            Clients IP
1026                 critcol                CLIENTIP
1027             Sample API
1028             http://localhost:8080/api/json/v2/nfadevice/getWLCSnapData?apiKey=cab4e1fb930ceb5a7a89572099240de2&critval=1.1.1.6&rows=10&ReportType=topApp&TimeFrame=hourly&critcol=CLIENTIP&pageCount=1&tablegridviewtype=Chart&type=IN
1029             :return:
1030             """
1031             relative_path = 'api/json/v2/nfadevice/getWLCSnapData'
1032             return self._parent.get_result(relative_path=relative_path, params=params)
1033 
1034         def get_access_points_data(self, **params):
1035             """
1036             http://netflowapi.helpdocsonline.com/get-access-points-data
1037             Getting Clients based Applications, Access points, Qos
1038             :param params:
1039                 TimeFrame            hourly/6hour/today/daily/Weekly/Monthly
1040                 apMacID                Access point ID
1041                 pageCount            Number
1042                 rows                Number
1043                 ReportType            graph/topIPHost/topAP/topSSID/topConv/topApp/topDSCP
1044                 Tablegridviewtype     Grid/Chart
1045                 type                IN/OUT
1046             Sample API
1047             http://localhost:8080/api/json/v2/nfadevice/getWLCApmacReport?apiKey=cab4e1fb930ceb5a7a89572099240de2&apMacID=5000025&rows=11&type=IN&TimeFrame=hourly&ReportType=graph&pageCount=1&tablegridviewtype=Chart&granularity=1&graphoption=volume
1048             :return:
1049             """
1050             relative_path = 'api/json/v2/nfadevice/getWLCApmacReport'
1051             return self._parent.get_result(relative_path=relative_path, params=params)
1052 
1053     class Reports(object):
1054         def __init__(self, parent):
1055             self._parent = parent
1056 
1057         def consolidated_report(self, **params):
1058             """
1059             http://netflowapi.helpdocsonline.com/consolidated-report
1060             :param params:
1061                 DeviceID         InterfaceID/IPGroupID/Interface Group ID
1062                 Type             speed/volume/percentage
1063                 reportType         all
1064                 count             integer value
1065                 TimeFrame         hourly/today/yesterday/weekly/monthly/eight/custom
1066                 ResolveDNS         true/false
1067                 IPGroup         true/false
1068                 BussView         true if the source is interface group else false
1069                 granularity     1/5
1070             Sample API
1071             http://localhost:8080/api/json/v2/nfareports/consReport?&ResolveDNS=false&apiKey=d34fdda92933bfe523a5f3947cb82116&BussView=false&IPGroup=false&filterStTime=00&filterEdTime=00&Device
1072             :return:
1073             """
1074             relative_path = 'api/json/v2/nfareports/consReport'
1075             return self._parent.get_result(relative_path=relative_path, params=params)
1076 
1077         def conpasity_planning_report(self, **params):
1078             """
1079             http://netflowapi.helpdocsonline.com/capacity-planning-report
1080             Capacity Planning Report
1081             :param params:
1082                 DeviceID         Interfaceid/interface group id/ipgroup id
1083                 idIPGroup         true(when the resource type is IP group)
1084                 Type             speed/ volume / percentage/packets
1085                 Data             IN/OUT
1086                 filterStTime     Integer(0-24)
1087                 filterEdTime     Integer(0-24)
1088                 exweekend         true/false
1089                 TimeFrame         hourly/6Hour/Daily/today/yesterday/weekly/monthly/Quarterly/custom
1090                 granularity     1/5
1091             Sample API
1092             http://testpc:8080/api/json/v2/nfadevice/getCapacityPlanData?apiKey=407ef7c282fa0ace024d34f6cc8e7ba1&DeviceID=5000019&TimeFrame=today&Type=speed&filterStTime=00&filterEdTime=00&exweekend
1093             :return:
1094             """
1095             relative_path = 'api/json/v2/nfadevice/getCapacityPlanData'
1096             return self._parent.get_result(relative_path=relative_path, params=params)
1097 
1098         def ipgroup_consolidated_report(self, **params):
1099             """
1100             http://netflowapi.helpdocsonline.com/ipgroup-consolidated-report
1101             IP Group Consolidated Report
1102             :param params:
1103                 Type         speed/volume/percentage
1104                 TimeFrame     hourly/today/yesterday/weekly/monthly/eight/custom
1105             Sample API
1106             http://localhost:8080/api/json/nfareports/getIPGroupConsReport?&apiKey=407ef7c282fa0ace024d34f6cc8e7ba1&Typ=speed&TimeFrame=hourly
1107             :return:
1108             """
1109             relative_path = 'api/json/nfareports/getIPGroupConsReport'
1110             return self._parent.get_result(relative_path=relative_path, params=params)
1111 
1112         def wcl(self, **params):
1113             """
1114             http://netflowapi.helpdocsonline.com/wlc-consolidated-report
1115             WLC Consolidated Report
1116             :param params:
1117                 DeviceID         Access point ID
1118                 RouterID         Controller ID
1119                 Type             speed/volume/percentage
1120                 reportType         all/Traffic/application/apmac/host/iphost
1121                 count             integer value
1122                 TimeFrame         hourly/today/yesterday/weekly/monthly/eight/custom
1123                 granularity     1/5
1124                 filterStTime     1 to 24
1125                 filterEdTime     1 to 24
1126             Sample API
1127             http://localhost:8080/api/json/v2/nfareports/wlcconsReport?&ResolveDNS=false&apiKey=xxxxxx&RouterID=50001&filterStTime=00&filterEdTime=00&Device
1128             :return:
1129             """
1130             relative_path = 'api/json/v2/nfareports/wlcconsReport'
1131             return self._parent.get_result(relative_path=relative_path, params=params)
1132 
1133         def protocol_(self, **params):
1134             """
1135             http://netflowapi.helpdocsonline.com/protocol-distribution-report-2
1136             Protocol Distribution
1137             :param params:
1138                 DeviceID     Interfaceid/interface group id/ipgroup id
1139                 BussView     true(when the resource type is interface group)
1140                 IPGroup     true(when the resource type is IP group)
1141                 Type         speed/ volume / percentage
1142                 Data         IN/OUT
1143                 TimeFrame     15Minute/30Minute/hourly/6Hour/Daily/today/yesterday/weekly/monthly/Quarterly/custom
1144             Sample API
1145             http://testpc:8080/api/json/v2/nfadevice/getProtocolData?&apiKey=xxxxxxx&DeviceID=5000019&BussView=false&IPGroup=false&Type=speed&TimeFrame=6Hour&Data=IN
1146             :return:
1147             """
1148             relative_path = 'api/json/v2/nfadevice/getProtocolData'
1149             return self._parent.get_result(relative_path=relative_path, params=params)
1150 
1151 
1152 if __name__ == '__main__':
1153     nf = NetFlow(domain='https://example.com', api_key='key')
1154     result = nf.inventory_interface.list_all_interfaces()
1155     if not result.get('success'):
1156         print(result)
1157         exit()
1158     nf_data_list = result.get('data', [])
1159     for data in nf_data_list:
1160         print(data)

 

posted @ 2021-01-06 16:56  士为知己  阅读(130)  评论(0)    收藏  举报