Skip to content

Commit

Permalink
"version 1.0.60"
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbalogh committed Dec 8, 2020
1 parent 23eeb24 commit 58d99e9
Show file tree
Hide file tree
Showing 38 changed files with 4,526 additions and 170 deletions.
7 changes: 7 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

### Dec 2020
* 1.0.60
* support uhd 9.10.2011.61
* bug fix: print version number once
* bug fix: support __getitem__ slice
* bug fix: issue #37 Session.GetFileList fails when passed a remote_directory

### Oct 2020
* 1.0.59
* bug fix: SessionAssistant ApiKey not passed
Expand Down
23 changes: 16 additions & 7 deletions ixnetwork_restpy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,22 @@ def __next__(self):
return self[self._index]

def __getitem__(self, index):
if index >= len(self._object_properties):
raise IndexError
elif index < 0 and len(self._object_properties) + index in range(len(self._object_properties)):
index = len(self._object_properties) + index
item = self.__class__(self._parent)
item._object_properties.append(self._object_properties[index])
return item
if isinstance(index, slice) is True:
start, stop, step = index.indices(len(self))
item = self.__class__(self._parent)
for i in range(start, stop, step):
item._object_properties.append(self._object_properties[i])
return item
elif isinstance(index, int) is True:
if index >= len(self._object_properties):
raise IndexError
elif index < 0 and len(self._object_properties) + index in range(len(self._object_properties)):
index = len(self._object_properties) + index
item = self.__class__(self._parent)
item._object_properties.append(self._object_properties[index])
return item
else:
raise NotImplemented('support for index of %s is not implemented' % index)

@property
def index(self):
Expand Down
332 changes: 206 additions & 126 deletions ixnetwork_restpy/pytest_tests/.pytest_cache/v/cache/nodeids

Large diffs are not rendered by default.

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions ixnetwork_restpy/testplatform/sessions/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Sessions(Base):

def __init__(self, parent):
super(Sessions, self).__init__(parent)
self._build_numbers = []

@property
def Ixnetwork(self):
Expand All @@ -49,15 +50,17 @@ def Ixnetwork(self):
ixnetwork = Ixnetwork(self)
response = ixnetwork._connection._read('%s/ixnetwork/globals' % self.href)
build_number = response['buildNumber']
user_name = response['username']
from distutils.version import LooseVersion
if len(build_number) == 0:
self.warn('Using DEBUG version of IxNetwork api server')
elif LooseVersion(build_number) < LooseVersion('8.52'):
raise ValueError('IxNetwork api server version %s is not supported. The minimum version supported is 8.52' % build_number)
else:
self.info('Using IxNetwork api server version %s' % (build_number))
self.info('User info %s' % (user_name))
if build_number not in self._build_numbers:
user_name = response['username']
from distutils.version import LooseVersion
if len(build_number) == 0:
self.warn('Using DEBUG version of IxNetwork api server')
elif LooseVersion(build_number) < LooseVersion('8.52'):
raise ValueError('IxNetwork api server version %s is not supported. The minimum version supported is 8.52' % build_number)
else:
self.info('Using IxNetwork api server version %s' % (build_number))
self.info('User info %s' % (user_name))
self._build_numbers.append(build_number)
ixnetwork._set_properties(ixnetwork._connection._read('%s/%s' % (self.href, Ixnetwork._SDM_NAME)))
return ixnetwork

Expand Down Expand Up @@ -322,7 +325,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=%s' % (href, remote_directory)
return self._connection._read(href)

def DownloadFile(self, remote_filename, local_filename = None):
Expand Down
23 changes: 16 additions & 7 deletions uhd_restpy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,22 @@ def __next__(self):
return self[self._index]

def __getitem__(self, index):
if index >= len(self._object_properties):
raise IndexError
elif index < 0 and len(self._object_properties) + index in range(len(self._object_properties)):
index = len(self._object_properties) + index
item = self.__class__(self._parent)
item._object_properties.append(self._object_properties[index])
return item
if isinstance(index, slice) is True:
start, stop, step = index.indices(len(self))
item = self.__class__(self._parent)
for i in range(start, stop, step):
item._object_properties.append(self._object_properties[i])
return item
elif isinstance(index, int) is True:
if index >= len(self._object_properties):
raise IndexError
elif index < 0 and len(self._object_properties) + index in range(len(self._object_properties)):
index = len(self._object_properties) + index
item = self.__class__(self._parent)
item._object_properties.append(self._object_properties[index])
return item
else:
raise NotImplemented('support for index of %s is not implemented' % index)

@property
def index(self):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from uhd_restpy.base import Base
from uhd_restpy.files import Files


class Lac(Base):
"""L2TP Access Concentrator global and per-port settings
The Lac class encapsulates a required lac resource which will be retrieved from the server every time the property is accessed.
"""

__slots__ = ()
_SDM_NAME = 'lac'
_SDM_ATT_MAP = {
'Count': 'count',
'DescriptiveName': 'descriptiveName',
'EnableAggregatedCSUN': 'enableAggregatedCSUN',
'Name': 'name',
'RowNames': 'rowNames',
}

def __init__(self, parent):
super(Lac, self).__init__(parent)

@property
def Count(self):
"""
Returns
-------
- number: Number of elements inside associated multiplier-scaled container object, e.g. number of devices inside a Device Group.
"""
return self._get_attribute(self._SDM_ATT_MAP['Count'])

@property
def DescriptiveName(self):
"""
Returns
-------
- str: Longer, more descriptive name for element. It's not guaranteed to be unique like -name-, but may offer more context.
"""
return self._get_attribute(self._SDM_ATT_MAP['DescriptiveName'])

@property
def EnableAggregatedCSUN(self):
"""
Returns
-------
- obj(uhd_restpy.multivalue.Multivalue): Enables Aggregated CSUN
"""
from uhd_restpy.multivalue import Multivalue
return Multivalue(self, self._get_attribute(self._SDM_ATT_MAP['EnableAggregatedCSUN']))

@property
def Name(self):
"""
Returns
-------
- str: Name of NGPF element, guaranteed to be unique in Scenario
"""
return self._get_attribute(self._SDM_ATT_MAP['Name'])
@Name.setter
def Name(self, value):
self._set_attribute(self._SDM_ATT_MAP['Name'], value)

@property
def RowNames(self):
"""
Returns
-------
- list(str): Name of rows
"""
return self._get_attribute(self._SDM_ATT_MAP['RowNames'])

def update(self, Name=None):
"""Updates lac resource on the server.
This method has some named parameters with a type: obj (Multivalue).
The Multivalue class has documentation that details the possible values for those named parameters.
Args
----
- Name (str): Name of NGPF element, guaranteed to be unique in Scenario
Raises
------
- ServerError: The server has encountered an uncategorized error condition
"""
return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))

def get_device_ids(self, PortNames=None, EnableAggregatedCSUN=None):
"""Base class infrastructure that gets a list of lac device ids encapsulated by this object.
Use the optional regex parameters in the method to refine the list of device ids encapsulated by this object.
Args
----
- PortNames (str): optional regex of port names
- EnableAggregatedCSUN (str): optional regex of enableAggregatedCSUN
Returns
-------
- list(int): A list of device ids that meets the regex criteria provided in the method parameters
Raises
------
- ServerError: The server has encountered an uncategorized error condition
"""
return self._get_ngpf_device_ids(locals())
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from uhd_restpy.base import Base
from uhd_restpy.files import Files


class Lacp(Base):
"""Lacp Port Specific Data
The Lacp class encapsulates a required lacp resource which will be retrieved from the server every time the property is accessed.
"""

__slots__ = ()
_SDM_NAME = 'lacp'
_SDM_ATT_MAP = {
'Count': 'count',
'DescriptiveName': 'descriptiveName',
'Name': 'name',
'RowNames': 'rowNames',
}

def __init__(self, parent):
super(Lacp, self).__init__(parent)

@property
def Count(self):
"""
Returns
-------
- number: Number of elements inside associated multiplier-scaled container object, e.g. number of devices inside a Device Group.
"""
return self._get_attribute(self._SDM_ATT_MAP['Count'])

@property
def DescriptiveName(self):
"""
Returns
-------
- str: Longer, more descriptive name for element. It's not guaranteed to be unique like -name-, but may offer more context.
"""
return self._get_attribute(self._SDM_ATT_MAP['DescriptiveName'])

@property
def Name(self):
"""
Returns
-------
- str: Name of NGPF element, guaranteed to be unique in Scenario
"""
return self._get_attribute(self._SDM_ATT_MAP['Name'])
@Name.setter
def Name(self, value):
self._set_attribute(self._SDM_ATT_MAP['Name'], value)

@property
def RowNames(self):
"""
Returns
-------
- list(str): Name of rows
"""
return self._get_attribute(self._SDM_ATT_MAP['RowNames'])

def update(self, Name=None):
"""Updates lacp resource on the server.
Args
----
- Name (str): Name of NGPF element, guaranteed to be unique in Scenario
Raises
------
- ServerError: The server has encountered an uncategorized error condition
"""
return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))
Empty file.
Loading

0 comments on commit 58d99e9

Please sign in to comment.