diff --git a/snappi_ixnetwork/snappi_api.py b/snappi_ixnetwork/snappi_api.py index 237ae59fc..7341b8c1b 100644 --- a/snappi_ixnetwork/snappi_api.py +++ b/snappi_ixnetwork/snappi_api.py @@ -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") diff --git a/snappi_ixnetwork/vport.py b/snappi_ixnetwork/vport.py index 34c52b9a5..74e27cb81 100644 --- a/snappi_ixnetwork/vport.py +++ b/snappi_ixnetwork/vport.py @@ -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 @@ -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", ""), diff --git a/tests/uhd/test_uhd_mock.py b/tests/uhd/test_uhd_mock.py index b4008e0c9..3e3a204b0 100644 --- a/tests/uhd/test_uhd_mock.py +++ b/tests/uhd/test_uhd_mock.py @@ -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)