sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
722 stars 1.38k forks source link

Sflow Agent ID reconfiguration is not working upon deleting the agentID #13108

Open vidhya-rajan opened 1 year ago

vidhya-rajan commented 1 year ago

Description

config sflow agent-id add Upon configuring a valid agent ID, the sample packet contains the IP address corresponding to the interface. Once the agentID is removed using config sflow agent-id del, agentID should fallback to the default IP (multicast IP )

Issue observed is the older agentID still persists in the sample packet and the previous agentID is not unconfigured.

Steps to reproduce the issue:

  1. Load 202205 community SONiC release build
  2. Enable sflow feature by using 'config feature state sflow enabled '
  3. Ensure sflow docker is instantiated successfully before executing sflow rleated config commands.
  4. Enable sflow globally by using 'config sflow enable'
  5. Configure a valid agenID using the command config sflow agent-id add
  6. Remove the configured agent-id using config sflow agent-id del

Describe the results you received:

Sample packet contains the previously configured agentID though the agentID id deleted

03:03:55.524563 IP 6.1.1.2.55682 > 6.1.1.1.6343: sFlowv5, IPv4 agent 3.3.3.1, agent-id 100000, length 1288 03:03:55.526175 IP 6.1.1.2.55682 > 6.1.1.1.6343: sFlowv5, IPv4 agent 3.3.3.1, agent-id 100000, length 448

Describe the results you expected:

The sample packet should contain the multicast IP as agentID since the previously configured agentID is deleted.

03:04:01.535556 IP 6.1.1.2.56719 > 6.1.1.1.6343: sFlowv5, IPv4 agent 240.127.1.1, agent-id 100000, length 868

Root cause

Two reasons for the failure

  1. Application DB persists the previously configured agentID even after reconfiguration.
  2. Hsflow daemon sends event notifications for every configuration change. The agentID event notification is sent only for addition of agentID and not removal

Proposed Solution

  1. Application DB has to remove the agenID upon deletion.
  2. Hsflow daemon has to send agentID config notifications for removal.
vidhya-rajan commented 1 year ago

0003-host_sflow_sonic.patch @dgsudharsan @venkatmahalingam @liat-grozovik @hari-selvam Please find the attached patch with fix in hsflow . Kindly let us know if we could add this patch in sonic sflow

vadymhlushko-mlnx commented 1 year ago

0003-host_sflow_sonic.patch @dgsudharsan @venkatmahalingam @liat-grozovik @hari-selvam Please find the attached patch with fix in hsflow . Kindly let us know if we could add this patch in sonic sflow

LGTM!

dgsudharsan commented 1 year ago

@vidhya-rajan The change looks good to me. Please raise an issue or fix in hsflowd and once its approved there we can raise patch fix in SONiC. Regarding application DB, the field is not used there. hsflowd obtains this filed from config_db. You can remove it in appl db if required.

vidhya-rajan commented 1 year ago

@vidhya-rajan The change looks good to me. Please raise an issue or fix in hsflowd and once its approved there we can raise patch fix in SONiC. Regarding application DB, the field is not used there. hsflowd obtains this filed from config_db. You can remove it in appl db if required.

Thanks @dgsudharsan . Will raise a PR for the fix.

vidhya-rajan commented 1 year ago

host-sflow have added commits recently to address dynamic config change along with the above mentioned issue

https://github.com/sflow/host-sflow/commit/7cb2b83ef34ed970a7b6028e8b3d4b44ddef8452 This requires upgrade of host-sflow in community SONIC