Skip to content

Commit

Permalink
Revert Fix for GCU_DHCP_Relay to resolve HEAD PR (sonic-net#10093)
Browse files Browse the repository at this point in the history
Description of PR
This PR is created to resolve issues in KVM test which are failing in advance utilities HEAD PR. KVM Elastic test are failing in generic_config_updater/test_dhcp_relay.py file due to missing mode attribute.

What is the motivation for this PR?
Modified GCU fixtures/duthost_utilities.py to make it compatible for HEAD PR . We have added "switchport mode command" in duthost_utilites to add mode trunk on Ethernet4 so that it will allow addition of vlan membership on ports. Removed added function and check "switchport mode explicitly"


co-authorized by: jianquanye@microsoft.com
  • Loading branch information
ridahanif96 authored Sep 22, 2023
1 parent 4dc6e68 commit eddc597
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/common/fixtures/duthost_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ def utils_create_test_vlans(duthost, cfg_facts, vlan_ports_list, vlan_intfs_dict
continue
cmds.append('config vlan add {}'.format(k))
cmds.append("config interface ip add Vlan{} {}".format(k, v['ip'].upper()))

# Delete untagged vlans from interfaces to avoid error message
# when adding untagged vlan to interface that already have one
if delete_untagged_vlan and '201911' not in duthost.os_version:
Expand All @@ -439,7 +438,6 @@ def utils_create_test_vlans(duthost, cfg_facts, vlan_ports_list, vlan_intfs_dict
for permit_vlanid in vlan_port['permit_vlanid']:
if vlan_intfs_dict[int(permit_vlanid)]['orig']:
continue

if (check_switchport_cmd(duthost, vlan_port['dev']) is True):
cmds.append('config switchport mode trunk {port}'.format(port=vlan_port['dev']))
cmds.append('config vlan member add {tagged} {id} {port}'.format(
Expand All @@ -454,9 +452,14 @@ def utils_create_test_vlans(duthost, cfg_facts, vlan_ports_list, vlan_intfs_dict
def check_switchport_cmd(duthost, tport):
cmds = 'config switchport mode trunk {port}'.format(port=tport)
logger.info("Commands: {}".format(cmds))
output = duthost.shell(cmds, module_ignore_errors=True)
if (output['rc'] == 0):
out = duthost.shell(cmds, module_ignore_errors=True)

if out['rc'] == 0:
cmds = 'config switchport mode routed {port}'.format(port=tport)
logger.info("Commands: {}".format(cmds))
out = duthost.shell(cmds, module_ignore_errors=True)
return True

return False


Expand Down

0 comments on commit eddc597

Please sign in to comment.