Skip to content

Commit c8ecc77

Browse files
committed
"version 1.1.10"
1 parent a191299 commit c8ecc77

279 files changed

Lines changed: 18634 additions & 498 deletions

File tree

Some content is hidden

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

RELEASENOTES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
# Release Notes
2+
### July 2023
3+
* 1.1.10
4+
* support ixnetwork version 9.30.2306.60 (9.30 Update-2)
5+
* Bug Fixes and features
6+
* Support to ignore strong password policy
7+
* New attribute in SessionAssistant name `IgnoreStrongPasswordPolicy`, by default `True`
8+
* fix missing files of pcep learned info
9+
* fix issue related to overlays
10+
* fix issue regarding improper cache clearance for poll urls
11+
* minor improvements to port map assistant
12+
213
### April 2023
314
* 1.1.9
415
* support ixnetwork version 9.30.2304.57 (9.30 Update-1)

ixnetwork_restpy/assistants/ports/portmapassistant.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,34 @@ def _add_hosts(self, HostReadyTimeout):
154154
if ";" in map["location"]:
155155
chassis_address = map["location"].split(";")[0]
156156
ip_addresses.append(chassis_address)
157-
ip_addresses = set(ip_addresses)
157+
ip_addresses = list(set(ip_addresses))
158158
if len(ip_addresses) > 0:
159-
self._IxNetwork.info(
160-
"Adding test port hosts [%s]..." % ", ".join(ip_addresses)
161-
)
159+
ip_str = ", ".join(ip_addresses)
160+
self._IxNetwork.info("Adding test port hosts [%s]..." % ip_str)
161+
162+
# check if chassis is already added
163+
res = self._select_chassis("")
164+
ips_not_ready = []
165+
if "chassis" in res:
166+
for chassis_info in res["chassis"]:
167+
ip = chassis_info["hostname"]
168+
if ip in ip_addresses:
169+
if chassis_info["state"] != "ready":
170+
ips_not_ready.append(ip)
171+
ip_addresses.remove(ip)
172+
173+
if len(ip_addresses) == 0:
174+
self._IxNetwork.info("[%s] is already added." % ip_str)
175+
162176
url = self._IxNetwork.href + "/availableHardware/chassis"
163177
for ip_address in ip_addresses:
164178
payload = {"hostname": ip_address}
165179
self._IxNetwork._connection._create(url, payload)
180+
181+
ip_addresses = ip_addresses + ips_not_ready
182+
if len(ip_addresses) == 0:
183+
return
184+
166185
start_time = time.time()
167186
while True:
168187
select = self._select_chassis("^(%s)$" % "|".join(ip_addresses))

ixnetwork_restpy/assistants/sessions/sessionassistant.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def __init__(
4141
SessionName=None,
4242
ApplicationType=APP_TYPE_IXNETWORK,
4343
ClearConfig=False,
44+
UrlPrefix=None,
45+
IgnoreStrongPasswordPolicy=True,
4446
):
4547
"""Create a session or connect to an existing session.
4648
Provides access to the TestPlatform, Sessions, Ixnetwork, PortMapAssistant and StatViewAssistant classes.
@@ -68,6 +70,8 @@ def __init__(
6870
- SessionName (str): The name of the session to connect to.
6971
- ApplicationType (str(APP_TYPE_IXNETWORK|APP_TYPE_QUICKTEST)): The type of IxNetwork middleware test session to create
7072
- ClearConfig (bool): Clear the current configuration
73+
- UrlPrefix (str): Some appliances (like novus-mini) needs url prefix in their rest url nomenclature
74+
- IgnoreStrongPasswordPolicy (bool): By default True, it rejects authentication with server if password is weak.
7175
7276
Raises
7377
------
@@ -83,11 +87,12 @@ def __init__(
8387
ignore_env_proxy=IgnoreEnvProxy,
8488
verify_cert=VerifyCertificates,
8589
trace=LogLevel,
90+
url_prefix=UrlPrefix,
8691
)
8792
if ApiKey is not None:
8893
testplatform.ApiKey = ApiKey
8994
elif UserName is not None and Password is not None:
90-
testplatform.Authenticate(UserName, Password)
95+
testplatform.Authenticate(UserName, Password, IgnoreStrongPasswordPolicy)
9196
session = None
9297
if SessionId is not None:
9398
session = testplatform.Sessions.find(Id=SessionId)

ixnetwork_restpy/connection.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Connection(object):
6262
TRACE_ALL = "all"
6363
PLATFORMS = {
6464
"Jetty": "linux",
65-
"nginx/1.17.8": "linux",
65+
"nginx": "linux",
6666
"SelfHost": "windows",
6767
"Kestrel": "windows",
6868
"Microsoft-HTTPAPI/2.0": "connection_manager",
@@ -78,6 +78,7 @@ def __init__(
7878
verify_cert=False,
7979
trace="none",
8080
script_watch=True,
81+
url_prefix=None,
8182
):
8283
"""Set the connection parameters to a rest server
8384
@@ -89,6 +90,7 @@ def __init__(
8990
ignore_env_proxy (bool):
9091
verify_cert (bool):
9192
script_watch (bool):
93+
url_prefix (str): the prefix that needs to added in the rest url
9294
"""
9395
self.trace = trace
9496
if len(logging.getLogger(__name__).handlers) == 0:
@@ -135,6 +137,7 @@ def __init__(
135137
if ignore_env_proxy is True:
136138
os.environ["no_proxy"] = "*"
137139
self._hostname = hostname
140+
self._url_prefix = url_prefix
138141
if ":" in self._hostname and "[" not in self._hostname:
139142
self._hostname = "[%s]" % self._hostname
140143
self._rest_port = rest_port
@@ -162,11 +165,19 @@ def _determine_test_tool_platform(self, platform):
162165
for rest_port in rest_ports:
163166
for scheme in ["http", "https"]:
164167
try:
165-
url = "%s://%s:%s/api/v1/auth/session" % (
166-
scheme,
167-
self._hostname,
168-
rest_port,
169-
)
168+
if self._url_prefix is not None:
169+
url = "%s://%s:%s/%s/api/v1/auth/session" % (
170+
scheme,
171+
self._hostname,
172+
rest_port,
173+
self._url_prefix,
174+
)
175+
else:
176+
url = "%s://%s:%s/api/v1/auth/session" % (
177+
scheme,
178+
self._hostname,
179+
rest_port,
180+
)
170181
payload = json.dumps({"username": "", "password": ""})
171182
headers = self._headers
172183
headers["content-type"] = "application/json"
@@ -328,6 +339,8 @@ def _normalize_url(self, url):
328339
if ":" in hostname and "[" not in hostname:
329340
hostname = "[%s]" % hostname
330341
connection = "%s://%s:%s" % (self._scheme, hostname, self._rest_port)
342+
if self._url_prefix is not None:
343+
connection += "/" + self._url_prefix
331344
if url.startswith(self._scheme) == False:
332345
url = "%s/%s" % (connection, url.strip("/"))
333346
path_start = url.find("://") + 3
@@ -553,7 +566,13 @@ def _send_recv(self, method, url, payload=None):
553566
self._async_operation.poll_headers = headers.copy()
554567
self._async_operation.async_response = response
555568
if self._async_operation.request is None:
556-
return self._poll()
569+
try:
570+
return self._poll()
571+
finally:
572+
self._async_operation.request = None
573+
self._async_operation.async_response = None
574+
self._async_operation.poll_url = None
575+
self._async_operation.poll_headers = None
557576

558577
while response.status_code == 409:
559578
time.sleep(6)

ixnetwork_restpy/multivalue.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def _custom_select(self):
749749
self._set_properties(self._connection._execute(url, payload)[0], clear=True)
750750
return self
751751

752-
def Overlay(self, index, value):
752+
def Overlay(self, index, value, count=1):
753753
"""Add an overlay at a specific device index in a pattern.
754754
755755
This is meant to overwrite an existing pattern with a few non-contiguous, random values.
@@ -760,20 +760,9 @@ def Overlay(self, index, value):
760760
----
761761
- index (int): 1 based device index
762762
- value (str): the overlay value
763+
- count (int): the number of indices to update with the overlay value starting from index attribute, default: 1
763764
"""
764765
if self._parent._mode[0] == "config":
765-
# if self.parent._properties.get('OverlayIndex', None) is not None:
766-
# self._overlay_index = self.parent._properties.get('OverlayIndex')
767-
# multivalue_dict = dict()
768-
# self._overlay_index += 1
769-
# pattern = 'overlay[' + str(self._overlay_index) + ']'
770-
# multivalue_dict['xpath'] = self._get_multivalue_xpath(self._href, pattern)
771-
# multivalue_dict['count'] = '1'
772-
# multivalue_dict['index'] = index
773-
# multivalue_dict['indexStep'] = '1'
774-
# multivalue_dict['value'] = value
775-
# self._xpathObj._config.append(multivalue_dict)
776-
# self.parent._properties['OverlayIndex'] = self._overlay_index
777766
attribute_present = False
778767
for multivaute_attr in self.parent._properties["multiValue"]:
779768
if self._href in multivaute_attr:
@@ -793,7 +782,7 @@ def Overlay(self, index, value):
793782
)
794783
else:
795784
href = "%s/overlay" % (self._href)
796-
payload = {"count": 1, "index": index, "indexStep": 1, "value": value}
785+
payload = {"count": count, "index": index, "indexStep": 1, "value": value}
797786
self._connection._create(href, payload)
798787

799788
def ClearOverlays(self):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Created by pytest automatically.
2+
*
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Signature: 8a477f597d28d172789f06886806bc55
2+
# This file is a cache directory tag created by pytest.
3+
# For information about cache directory tags, see:
4+
# https://bford.info/cachedir/spec.html
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# pytest cache directory #
2+
3+
This directory contains data from the pytest's cache plugin,
4+
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5+
6+
**Do not** commit this to version control.
7+
8+
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"tests/batch/batch_add/test_batch_add_classic.py::test_batch_add_with_dependent_attr[10.39.51.146:443:linux]": true,
3+
"tests/batch/batch_add/test_batch_add_classic.py::test_batch_add_with_classic_config[10.39.51.146:443:linux]": true,
4+
"tests/batch/batch_add/test_batch_add_traffic.py::test_batch_add_with_traffic[10.39.51.146:443:linux]": true,
5+
"tests/batch/batch_add/test_batch_add_traffic.py::test_batch_add_with_multicast_traffic[10.39.51.146:443:linux]": true,
6+
"tests/batch/batch_add/test_batch_add_traffic.py::test_batch_add_with_traffic_having_href_objects[10.39.51.146:443:linux]": true,
7+
"tests/batch/batch_add/test_batch_add_with_load_config.py::test_batch_add_with_multiple_nodes[10.39.51.146:443:linux]": true,
8+
"tests/batch/batch_add/test_batch_add_with_load_config.py::test_precedence_with_batch_add[10.39.51.146:443:linux]": true,
9+
"tests/session_tests/test_qt_or_ixnrest.py::test_add_ixnrest_session[10.39.51.146:443:linux]": true,
10+
"tests/session_tests/test_sessions.py::test_can_create_sessions[10.39.51.146:443:linux]": true,
11+
"tests/session_tests/test_sessions.py::test_can_set_session_name[10.39.51.146:443:linux]": true,
12+
"tests/session_tests/test_sessions.py::test_can_retrieve_sessions_by_id[10.39.51.146:443:linux]": true,
13+
"tests/session_tests/test_sessions.py::test_should_return_no_session_when_wrong_session_id_provided[10.39.51.146:443:linux]": true,
14+
"tests/session_tests/test_sessions.py::test_can_login_to_server_by_api_key[10.39.51.146:443:linux]": true,
15+
"tests/session_tests/test_sessions.py::test_should_fail_on_wrong_auth_creds[10.39.51.146:443:linux]": true
16+
}

0 commit comments

Comments
 (0)