Skip to content

Commit 476942f

Browse files
committed
"version 1.1.11"
1 parent c8ecc77 commit 476942f

File tree

69 files changed

+1317
-373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1317
-373
lines changed

RELEASENOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Release Notes
2+
### November 2023
3+
* 1.1.11
4+
* support ixnetwork version 9.30.2309.46 (9.30 Update-3)
5+
* New Feature in Stat View Assistant Utility to `filter` Statistics
6+
* please refer to sample script filter_stats_using_stat_view_assistant.py
7+
* Bug fixes in Stat View Assistant Utility
8+
* fixed fetching of the correct traffic item node after drill down
9+
* fixed drill down statics for views apart from Traffic Item Statistics
210
### July 2023
311
* 1.1.10
412
* support ixnetwork version 9.30.2306.60 (9.30 Update-2)

ixnetwork_restpy/assistants/statistics/statviewassistant.py

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
from ixnetwork_restpy.assistants.statistics.row import Row
44
from ixnetwork_restpy.errors import *
5+
from ixnetwork_restpy.assistants.batch.batchupdate import BatchUpdate
56
from ixnetwork_restpy.files import Files
67
import re
78
import os
@@ -42,12 +43,14 @@ def __init__(
4243
LocalCsvStorage=None,
4344
PrintFormat=OBJECT,
4445
PrintColumns=[],
46+
FilterType=None,
4547
):
4648
"""
4749
Args
4850
----
4951
- IxNetwork (obj (ixnetwork_restpy.testplatform.sessions.ixnetwork.Ixnetwork)): An Ixnetwork object
50-
- ViewName (str): The name of a statistics view, supports regex
52+
- ViewName (str): The name of a statistics view, supports regex.
53+
If used for filtering the parameter needs to be a string.
5154
- Timeout (int): The timeout in seconds to wait for the ViewName to be available and/or ready
5255
- LocalCsvStorage (str): The local path where downloaded csv statistic files will be stored.
5356
The path must exist and will not be created.
@@ -56,10 +59,16 @@ def __init__(
5659
If PrintFormat is TABLE each row will be output as a single line
5760
- PrintColumns (list(str)): A list of statistic column names that will be printed out
5861
If the list is None all columns will be printed out
62+
- FilterType (str) The type of filter the needs to be imposed on the view
5963
"""
6064
self._snapshot = None
6165
self._IxNetwork = IxNetwork
6266
self._ViewName = ViewName
67+
self._filter_view = None
68+
if FilterType is not None:
69+
# redirect to custom filter stats creation
70+
self._create_view_for_filter(FilterType)
71+
return
6372
self._root_directory = self._IxNetwork._connection._read(
6473
"%s/files" % self._IxNetwork.href
6574
)["absolute"]
@@ -187,6 +196,10 @@ def ColumnHeaders(self):
187196
"""Returns a list of all the column headers in the view."""
188197
return self._View.Page.ColumnCaptions
189198

199+
@property
200+
def FilterView(self):
201+
return self._filter_view
202+
190203
def AddRowFilter(self, ColumnName, Comparator, FilterValue):
191204
"""Add a filter that reduces the Row resultset
192205
@@ -288,6 +301,7 @@ def DrillDownOptions(self, TargetIndex=0):
288301
"""
289302
drill_down = self._View.DrillDown.find()
290303
drill_down.TargetRowIndex = TargetIndex
304+
drill_down.refresh()
291305
return drill_down.AvailableDrillDownOptions
292306

293307
def TargetRowFilters(self, TargetIndex=0):
@@ -301,15 +315,19 @@ def TargetRowFilters(self, TargetIndex=0):
301315
"""
302316
drill_down = self._View.DrillDown.find()
303317
drill_down.TargetRowIndex = TargetIndex
318+
drill_down.refresh()
304319
return drill_down.AvailableTargetRowFilters.find()
305320

306-
def Drilldown(self, TargetRowIndex, DrillDownOption, TargetRowFilter):
321+
def Drilldown(
322+
self, TargetRowIndex, DrillDownOption, TargetRowFilter, DrillDownView=None
323+
):
307324
"""Drilldown on an existing view to get a new StatViewAssistant
308325
309326
Args:
310327
TargetRowIndex (int): the 0 based index of the row that you are interested in drilling down into
311328
DrillDownOption (str): drill down options are dynamic and are based on tracking options selected during traffic item creation
312329
TargetRowFilter (str): drill down filters are dynamic and are based on tracking options selected during traffic item creation
330+
DrillDownView (str): The resultant drill down for which you want the stat view assistant info. Default is None.
313331
314332
Returns:
315333
obj(ixnetwork_restpy.assistants.statistics.statviewassistant.StatViewAssistant)
@@ -319,7 +337,12 @@ def Drilldown(self, TargetRowIndex, DrillDownOption, TargetRowFilter):
319337
drill_down.TargetDrillDownOption = DrillDownOption
320338
drill_down.TargetRowFilter = TargetRowFilter
321339
drill_down.DoDrillDown()
322-
return StatViewAssistant(self._IxNetwork, "User Defined Statistics")
340+
self._View = None
341+
self._is_view_ready
342+
if self._ViewName == "Traffic Item Statistics":
343+
return StatViewAssistant(self._IxNetwork, "User Defined Statistics")
344+
elif DrillDownView is not None:
345+
return StatViewAssistant(self._IxNetwork, DrillDownView)
323346

324347
def __str__(self):
325348
"""Return a string with all the rows in the current view"""
@@ -348,3 +371,29 @@ def __str__(self):
348371
for row in self.Rows:
349372
statistics += row.__str__()
350373
return statistics.rstrip()
374+
375+
def _create_view_for_filter(self, filter_type):
376+
# create custom view
377+
self._filter_view = self._IxNetwork.Statistics.View.add(
378+
Caption=self._ViewName, Type=filter_type, Visible=True
379+
)
380+
self._IxNetwork.debug(
381+
"custom view for filter created successfully: " + self._filter_view.href
382+
)
383+
384+
def GetFilteredStats(self):
385+
"""
386+
Get filtered statistics
387+
Returns:
388+
obj(ixnetwork_restpy.assistants.statistics.statviewassistant.StatViewAssistant)
389+
"""
390+
if self._filter_view is None:
391+
raise Exception(
392+
"No filter view, This method is only valid if FilterType was provided"
393+
)
394+
self._IxNetwork.debug("Enabling all the statistics for the filter view")
395+
with BatchUpdate(self._IxNetwork):
396+
for statistic in self._filter_view.Statistic.find():
397+
statistic.Enabled = True
398+
self._filter_view.Enabled = True
399+
return StatViewAssistant(self._IxNetwork, self._ViewName)

ixnetwork_restpy/pytest_tests/.pytest_cache/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

ixnetwork_restpy/pytest_tests/.pytest_cache/CACHEDIR.TAG

Lines changed: 0 additions & 4 deletions
This file was deleted.

ixnetwork_restpy/pytest_tests/.pytest_cache/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

ixnetwork_restpy/pytest_tests/.pytest_cache/v/cache/lastfailed

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)