Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 42: StatViewAssistant fails with regex matching multiple views;… #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions ixnetwork_restpy/assistants/statistics/statviewassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,25 @@ def _take_csv_snapshot(self):
@property
def _is_view_ready(self):
start = time.time()
# Find the right view(s)
while self._View is None:
view = self._Statistics.View.find(Caption='^%s$' % self._ViewName)
if (len(view)) == 1:
if (len(view)) >= 1:
self._View = view
break
if time.time() - start > self._Timeout:
raise NotFoundError('After %s seconds the %s view does not exist.' % (self._Timeout, self._ViewName))
time.sleep(2)
# Wait until the/a view has data or time runs out
# For multiple matching views, return successfully if any has data
while True:
if self._View.Data.IsReady is True:
break
if len(self._View) == 1:
if self._View.Data.IsReady is True:
return
else:
for v in self._View:
if v.Data.IsReady is True:
return
if time.time() - start > self._Timeout:
raise NotFoundError('After %s seconds the %s view has no data available.' % (self._Timeout, self._View.Caption))
time.sleep(2)
Expand Down
4 changes: 2 additions & 2 deletions ixnetwork_restpy/testplatform/sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def GetFileList(self, remote_directory=None):
"""
href = '%s/ixnetwork/files' % self.href
if remote_directory is not None:
href = '%s?absolute=remote_directory'
href = '%s?absolute=remote_directory' % (href, remote_directory)
return self._connection._read(href)

def DownloadFile(self, remote_filename, local_filename = None):
Expand Down Expand Up @@ -357,4 +357,4 @@ def UploadFile(self, local_filename, remote_filename=None):
if self._parent.Platform == 'linux' and remote_filename is not None:
remote_filename = remote_filename.replace('\\', '/')
return self._connection._put_file('%s/ixnetwork' % self.href,
local_filename=local_filename, remote_filename=remote_filename)
local_filename=local_filename, remote_filename=remote_filename)