mirror of
https://github.com/Telecominfraproject/ols-nos.git
synced 2025-11-02 11:07:46 +00:00
[dhcp_server] add show dhcp server info (#17468)
* add show dhcp server info
This commit is contained in:
@@ -7,9 +7,7 @@
|
||||
"lease_time": "3600",
|
||||
"mode": "PORT",
|
||||
"netmask": "255.255.255.0",
|
||||
"customized_options": [
|
||||
"option60"
|
||||
],
|
||||
"customized_options": "option60",
|
||||
"state": "enabled"
|
||||
},
|
||||
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS|option60": {
|
||||
|
||||
@@ -110,3 +110,42 @@ range3 100.1.1.10 100.1.1.10 1
|
||||
assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
|
||||
assert result.stdout == expected_stdout
|
||||
|
||||
def test_show_dhcp_server_ipv4_info_without_intf(self, mock_db):
|
||||
expected_stdout = """\
|
||||
Interface Mode Gateway Netmask Lease Time(s) State
|
||||
----------- ------ --------- ------------- --------------- -------
|
||||
Vlan100 PORT 100.1.1.1 255.255.255.0 3600 enabled
|
||||
"""
|
||||
runner = CliRunner()
|
||||
db = clicommon.Db()
|
||||
db.db = mock_db
|
||||
result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["info"], [], obj=db)
|
||||
assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
|
||||
assert result.stdout == expected_stdout
|
||||
|
||||
def test_show_dhcp_server_ipv4_info_with_intf(self, mock_db):
|
||||
expected_stdout = """\
|
||||
Interface Mode Gateway Netmask Lease Time(s) State
|
||||
----------- ------ --------- ------------- --------------- -------
|
||||
Vlan100 PORT 100.1.1.1 255.255.255.0 3600 enabled
|
||||
"""
|
||||
runner = CliRunner()
|
||||
db = clicommon.Db()
|
||||
db.db = mock_db
|
||||
result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["info"], ["Vlan100"], obj=db)
|
||||
assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
|
||||
assert result.stdout == expected_stdout
|
||||
|
||||
def test_show_dhcp_server_ipv4_info_with_customized_options(self, mock_db):
|
||||
expected_stdout = """\
|
||||
Interface Mode Gateway Netmask Lease Time(s) State Customized Options
|
||||
----------- ------ --------- ------------- --------------- ------- --------------------
|
||||
Vlan100 PORT 100.1.1.1 255.255.255.0 3600 enabled option60
|
||||
"""
|
||||
runner = CliRunner()
|
||||
db = clicommon.Db()
|
||||
db.db = mock_db
|
||||
result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["info"], ["Vlan100", "--with_customized_options"], obj=db)
|
||||
assert result.exit_code == 0, "exit code: {}, Exception: {}, Traceback: {}".format(result.exit_code, result.exception, result.exc_info)
|
||||
assert result.stdout == expected_stdout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user