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

FlowControlUHD #551

Merged
merged 3 commits into from
Aug 5, 2022
Merged
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
5 changes: 3 additions & 2 deletions snappi_ixnetwork/snappi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,9 +690,10 @@ def _validate_instance(self, config):
if port.location is None:
continue
if ";" in port.location:
(_, card, port_info) = port.location.split(";")
port_info = "{}.{}".format(card, port_info)
# Ex: 10.36.70.66;localuhd;1 or 10.36.70.66;localuhd;17.1
(_, _, port_info) = port.location.split(";")
elif "/" in port.location:
# Ex: localuhd/1
(_, port_info) = port.location.split("/")
else:
raise SnappiIxnException(400, "port location is not valid")
Expand Down
17 changes: 14 additions & 3 deletions snappi_ixnetwork/vport.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def __init__(self, ixnetworkapi):
self._interval = 1
self._timeout = 10

@property
def isUhd(self):
return "UHD" in self._api._ixnetwork.Globals.ProductVersion

def config(self):
"""Transform config.ports into Ixnetwork.Vport
1) delete any vport that is not part of the config
Expand Down Expand Up @@ -626,9 +630,16 @@ def _set_fcoe(self, vport, layer1, imports):
vport["xpath"],
vport["type"].replace("Fcoe", ""),
)
imports.append(
{"xpath": l1_xpath, "flowControlDirectedAddress": directed_address}
)
if self.isUhd:
imports.append(
{"xpath": l1_xpath, "enabledFlowControl": True}
)
else:
imports.append(
{"xpath": l1_xpath,
"flowControlDirectedAddress": directed_address,
"enabledFlowControl": True}
)
xpath = "%s/l1Config/%s/fcoe" % (
vport["xpath"],
vport["type"].replace("Fcoe", ""),
Expand Down
2 changes: 1 addition & 1 deletion tests/uhd/test_uhd_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_uhd_port_locations():
api._traffic.State = "Stopped"
config = snappi.Api().config()
api._config = config
port = config.ports.port(location="a;b;c", name="p1").port(
port = config.ports.port(location="a;localuhd;b.c", name="p1").port(
location="localuhd/a", name="p2"
)
api._validate_instance(config)
Expand Down