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

Handle default VLAN create and delete #929

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

santoshdoke
Copy link

What I did
Handle default VLAN creation/deletion in SWSS orch agent.

Why I did it
The default VLAN is created in SAI/driver during switch initialization. When user tries to create the default VLAN, OrchAgent detects error from SyncD and terminates. Reason is the VLAN already exists. To avoid that, handling the case of default VLAN creation/deletion and skipped the driver call.

How I verified it

  1. Create/Delete VLAN 1
  2. Add/Remove physical ports from VLAN 1
  3. Tagged/Untagged membership for VLAN 1
  4. Add/Remove PortChannel from VLAN 1
  5. Save/Reload VLAN 1 configuration
  6. Ensure that VLAN membership is updated as per config (in driver/SDK)
  7. L2 MAC learning/flushing on VLAN 1
  8. L3 interface configuration on VLAN 1 (ipv4)
  9. ARP learning on VLAN 1 interface
  10. CPU Tx/Rx with VLAN tag 1

Details if related

@msftclas
Copy link

msftclas commented Jun 12, 2019

CLA assistant check
All CLA requirements met.

@lguohan lguohan requested a review from stcheng June 22, 2019 00:13
@@ -110,7 +110,8 @@ class PortsOrch : public Orch, public Subject
Port m_cpuPort;
// TODO: Add Bridge/Vlan class
sai_object_id_t m_default1QBridge;
sai_object_id_t m_defaultVlan;
sai_object_id_t m_defaultVlan_ObjId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting the PR. The logic looks valid to me. Could you modify the type of the current m_defaultVlan to type Port? Then you could use m_vlan_info to store both the oid and the id of the VLAN. This would prevent having more private variables.

@chenkelly
Copy link

retest this please

@stcheng
Copy link
Contributor

stcheng commented Jul 22, 2019

@santoshdoke @chenkelly could you check my comments on the pull request?

Copy link
Contributor

@stcheng stcheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a unit test case for this change as well.

}

m_defaultVlan.m_vlan_info.vlan_id = attr.value.u16;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you put the default VLAN into the m_portList? Then we don't need to handle special case in the function addVlan.

@@ -2578,7 +2592,17 @@ bool PortsOrch::addVlan(string vlan_alias)
sai_attribute_t attr;
attr.id = SAI_VLAN_ATTR_VLAN_ID;
attr.value.u16 = vlan_id;
sai_status_t status = sai_vlan_api->create_vlan(&vlan_oid, gSwitchId, 1, &attr);
sai_status_t status = SAI_STATUS_SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the default VLAN is in the m_portList, there's no need to modify this function.

sai_status_t status = sai_vlan_api->remove_vlan(vlan.m_vlan_info.vlan_oid);
if (status != SAI_STATUS_SUCCESS)
/* Do not delete default VLAN from driver, but clear internal state */
if (vlan.m_vlan_info.vlan_id != m_defaultVlan.m_vlan_info.vlan_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this check into the function doVlanTask() before removeVlan() function so that the this function's purpose is not touched. Add add a warning if the to-be-removed VLAN is the default VLAN, since it is not supposed to be removed.

@lguohan
Copy link
Contributor

lguohan commented Jul 31, 2019

retest this please

@lguohan
Copy link
Contributor

lguohan commented Jul 31, 2019

can you add vs test to verify the app db to asic db translate is protected for vlan 1 case?

@prsunny prsunny self-requested a review as a code owner September 2, 2022 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants