Skip to content

Commit

Permalink
[DPB] Remove the optimization logic for delete/add ports. (sonic-net#…
Browse files Browse the repository at this point in the history
…2463)

* Fix port breakout issue

* Address comments

* fix LGTM alerts
  • Loading branch information
aravindmani-1 authored and mssonicbld committed Jan 4, 2024
1 parent 8765fce commit f5f9a85
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4048,28 +4048,12 @@ def breakout(ctx, interface_name, mode, verbose, force_remove_dependencies, load
click.secho("[ERROR] port_dict is None!", fg='red')
raise click.Abort()

""" Special Case: Dont delete those ports where the current mode and speed of the parent port
remains unchanged to limit the traffic impact """

click.secho("\nAfter running Logic to limit the impact", fg="cyan", underline=True)
matched_items = [intf for intf in del_intf_dict if intf in add_intf_dict and del_intf_dict[intf] == add_intf_dict[intf]]

# Remove the interface which remains unchanged from both del_intf_dict and add_intf_dict
for item in matched_items:
del_intf_dict.pop(item)
add_intf_dict.pop(item)

# validate all del_ports before calling breakOutPort
for intf in del_intf_dict.keys():
if not interface_name_is_valid(config_db, intf):
click.secho("[ERROR] Interface name {} is invalid".format(intf))
raise click.Abort()

click.secho("\nFinal list of ports to be deleted : \n {} \nFinal list of ports to be added : \n {}".format(json.dumps(del_intf_dict, indent=4), json.dumps(add_intf_dict, indent=4), fg='green', blink=True))
if not add_intf_dict:
click.secho("[ERROR] add_intf_dict is None or empty! No interfaces are there to be added", fg='red')
raise click.Abort()

port_dict = {}
for intf in add_intf_dict:
if intf in add_ports:
Expand Down

0 comments on commit f5f9a85

Please sign in to comment.