Skip to content

Commit 33e85d3

Browse files
authored
[dhcp_relay] Remove add field of vlanid to DHCP_RELAY table while add vlan (sonic-net#2678)
What I did Remove add field of vlanid to DHCP_RELAY table while add vlan which would cause conflict with yang model. How I did it Remove add field of vlanid to DHCP_RELAY table while add vlan How to verify it By unit tests Signed-off-by: Yaqiang Zhu <[email protected]>
1 parent 36824e4 commit 33e85d3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

config/vlan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def add_vlan(db, vid):
4747
set_dhcp_relay_table('VLAN', config_db, vlan, {'vlanid': str(vid)})
4848

4949
# set dhcpv6_relay table
50-
set_dhcp_relay_table('DHCP_RELAY', config_db, vlan, {'vlanid': str(vid)})
50+
set_dhcp_relay_table('DHCP_RELAY', config_db, vlan, None)
5151
# We need to restart dhcp_relay service after dhcpv6_relay config change
5252
dhcp_relay_util.handle_restart_dhcp_relay_service()
5353

tests/vlan_test.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"table": "DHCP_RELAY"
2020
}
2121
}
22-
DHCP_RELAY_TABLE_ENTRY = {
23-
"vlanid": "1001"
24-
}
2522

2623
show_vlan_brief_output="""\
2724
+-----------+-----------------+-----------------+----------------+-------------+
@@ -610,7 +607,8 @@ def test_config_add_del_vlan_dhcp_relay(self, ip_version, mock_restart_dhcp_rela
610607
print(result.output)
611608
assert result.exit_code == 0
612609

613-
assert db.cfgdb.get_entry(IP_VERSION_PARAMS_MAP[ip_version]["table"], "Vlan1001") == DHCP_RELAY_TABLE_ENTRY
610+
exp_output = {"vlanid": "1001"} if ip_version == "ipv4" else {}
611+
assert db.cfgdb.get_entry(IP_VERSION_PARAMS_MAP[ip_version]["table"], "Vlan1001") == exp_output
614612

615613
# del vlan 1001
616614
result = runner.invoke(config.config.commands["vlan"].commands["del"], ["1001"], obj=db)

0 commit comments

Comments
 (0)