Skip to content

Commit

Permalink
[dash] fix ENI admin state update (#3081)
Browse files Browse the repository at this point in the history
* [dash] fix ENI admin state update
  • Loading branch information
Yakiv-Huryk authored Apr 10, 2024
1 parent 56ba6de commit 774973d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions orchagent/dash/dashorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ bool DashOrch::setEniAdminState(const string& eni, const EniEntry& entry)
{
SWSS_LOG_ENTER();

bool eni_enable = entry.metadata.admin_state() == dash::eni::State::STATE_ENABLED;

sai_attribute_t eni_attr;
eni_attr.id = SAI_ENI_ATTR_ADMIN_STATE;
eni_attr.value.booldata = entry.metadata.admin_state();
eni_attr.value.booldata = eni_enable;

sai_status_t status = sai_dash_eni_api->set_eni_attribute(eni_entries_[eni].eni_id,
&eni_attr);
Expand All @@ -293,7 +295,7 @@ bool DashOrch::setEniAdminState(const string& eni, const EniEntry& entry)
}
}
eni_entries_[eni].metadata.set_admin_state(entry.metadata.admin_state());
SWSS_LOG_NOTICE("Set ENI %s admin state to %s", eni.c_str(), entry.metadata.admin_state() ? "UP" : "DOWN");
SWSS_LOG_NOTICE("Set ENI %s admin state to %s", eni.c_str(), eni_enable ? "UP" : "DOWN");

return true;
}
Expand Down
11 changes: 11 additions & 0 deletions tests/test_dash_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ def test_eni(self, dvs):
for fv in fvs.items():
if fv[0] == "SAI_ENI_ETHER_ADDRESS_MAP_ENTRY_ATTR_ENI_ID":
assert fv[1] == str(self.eni_oid)

# test admin state update
pb.admin_state = State.STATE_DISABLED
dashobj.create_eni(self.mac_string, {"pb": pb.SerializeToString()})
time.sleep(3)
enis = dashobj.asic_eni_table.get_keys()
assert len(enis) == 1
assert enis[0] == self.eni_oid
eni_attrs = dashobj.asic_eni_table[self.eni_oid]
assert eni_attrs["SAI_ENI_ATTR_ADMIN_STATE"] == "false"

return dashobj

def test_vnet_map(self, dvs):
Expand Down

0 comments on commit 774973d

Please sign in to comment.