Skip to content

Commit

Permalink
run all offline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shmir committed Oct 11, 2022
1 parent 0c93667 commit 1e51c1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
8 changes: 5 additions & 3 deletions ixexplorer/ixe_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def reserve(self, force: bool = False) -> None:
else:
try:
self.api.call_rc(f"ixPortTakeOwnership {self.uri}")
except Exception as _:
except Exception:
raise TgnError(f"Failed to take ownership for port {self} current owner is {self.owner}")

def release(self, force: bool = False) -> None:
Expand All @@ -201,7 +201,7 @@ def release(self, force: bool = False) -> None:
else:
try:
self.api.call_rc(f"ixPortClearOwnership {self.uri}")
except Exception as _:
except Exception:
raise TgnError(f"Failed to clear ownership for port {self} current owner is {self.owner}")

def write(self) -> None:
Expand Down Expand Up @@ -236,6 +236,8 @@ def load_config(self, config_file: Path) -> None:
Configuration file type is extracted from the file suffix - prt or str.
:TODO: Investigate why port import can only import files that were exported with port export, not from File -> export.
:param config_file: full path to the configuration file.
IxTclServer must have access to the file location. either:
The config file is on shared folder.
Expand Down Expand Up @@ -639,7 +641,7 @@ class IxeSplitPacketGroup(IxePortObj, metaclass=ixe_obj_meta):
]

def __init__(self, parent):
super(self.__class__, self).__init__(parent)
super().__init__(parent)
self.ix_set_default()


Expand Down
28 changes: 11 additions & 17 deletions tests/test_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ def test_load_config(ixia: IxeApp, locations: List[str]) -> None:

def test_build_config(ixia: IxeApp, locations: List[str]) -> None:
"""Build configuration from factory default and test different configuration objects."""
print(test_build_config.__doc__)

ixia.session.reserve_ports(locations, force=True)
ixia.session.add_ports(*locations)
ixia.session.reserve_ports(force=True)

ixia.session.ports[locations[0]].add_stream()
ixia.session.ports[locations[0]].streams[1].da = "22:22:22:22:22:11"
Expand Down Expand Up @@ -103,9 +102,8 @@ def test_build_config(ixia: IxeApp, locations: List[str]) -> None:

def test_write_after_write(ixia: IxeApp, locations: List[str]) -> None:
"""Test port configuration write to HW."""
print(test_write_after_write.__doc__)

ixia.session.reserve_ports(locations, force=True)
ixia.session.add_ports(*locations)
ixia.session.reserve_ports(force=True)

IxeObject.set_auto_set(False)

Expand Down Expand Up @@ -153,10 +151,9 @@ def test_write_after_write(ixia: IxeApp, locations: List[str]) -> None:
assert port2_stream1.ip.destIpAddr == "1.1.1.2"


def test_discover(ixia: IxeApp, locations: List[str]) -> None:
# noqa: T201
def test_discover(ixia: IxeApp) -> None:
"""Test chassis discovery."""
print(test_discover.__doc__)

chassis = list(ixia.chassis_chain.values())[0]
assert chassis.obj_name() == chassis.ipAddress
ixia.discover()
Expand All @@ -165,18 +162,16 @@ def test_discover(ixia: IxeApp, locations: List[str]) -> None:
print(list(list(chassis.cards.values())[0].ports.values())[0].supported_speeds())


# noqa: T201
def test_stream_stats_configuration(ixia: IxeApp, locations: List[str]) -> None:
"""Test stream statistics configuration (without running actual traffic)."""
print(test_stream_stats_configuration.__doc__)

ixia.session.reserve_ports(locations, force=True)
ixia.session.add_ports(*locations)
ixia.session.reserve_ports(force=True)

#: :type port: ixexplorer.ixe_port.IxePort
port = ixia.session.ports[locations[0]]
if not int(port.isValidFeature("portFeatureRxDataIntegrity")):
pytest.skip("Port not supporting RxDataIntegrity")

#: :type stream: ixexplorer.ixe_stream.IxeStream
stream = port.add_stream()
stream.framesize = 200

Expand Down Expand Up @@ -221,9 +216,8 @@ def test_stream_stats_configuration(ixia: IxeApp, locations: List[str]) -> None:

def test_wrf(ixia: IxeApp, locations: List[str]) -> None:
"""Test weighted random frame size configuration."""
print(test_wrf.__doc__)

ixia.session.reserve_ports(locations, force=True)
ixia.session.add_ports(*locations)
ixia.session.reserve_ports(force=True)

port = ixia.session.ports[locations[0]]
port.add_stream()
Expand Down

0 comments on commit 1e51c1d

Please sign in to comment.