bb48ee92ab
Why I did it Currently the config cli of dhcpv4 is may cause confusion and config of dhcpv6 is missing. How I did it Add dhcp_relay config cli and test cases. config dhcp_relay ipv4 helper (add | del) <vlan_id> <helper_ip_list> config dhcp_relay ipv6 destination (add | del) <vlan_id> <destination_ip_list> Updated docs for it in sonic-utilities: https://github.com/sonic-net/sonic-utilities/pull/2598/files How to verify it Build docker-dhcp-relay.gz with and without INCLUDE_DHCP_RELAY, and check target/docker-dhcp-relay.gz.log
33 lines
716 B
Python
33 lines
716 B
Python
import pytest
|
|
import mock_tables # lgtm [py/unused-import]
|
|
from unittest import mock
|
|
|
|
@pytest.fixture()
|
|
def mock_cfgdb():
|
|
cfgdb = mock.Mock()
|
|
CONFIG = {
|
|
'VLAN': {
|
|
'Vlan1000': {
|
|
'dhcp_servers': ['192.0.0.1']
|
|
}
|
|
},
|
|
'DHCP_RELAY': {
|
|
'Vlan1000': {
|
|
'dhcpv6_servers': ['fc02:2000::1']
|
|
}
|
|
}
|
|
}
|
|
|
|
def get_entry(table, key):
|
|
return CONFIG[table][key]
|
|
|
|
def set_entry(table, key, data):
|
|
CONFIG[table].setdefault(key, {})
|
|
CONFIG[table][key] = data
|
|
|
|
cfgdb.get_entry = mock.Mock(side_effect=get_entry)
|
|
cfgdb.set_entry = mock.Mock(side_effect=set_entry)
|
|
|
|
yield cfgdb
|
|
|