From f0dc867d54d9b740ac2b2e81389e519212e35845 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 13 Dec 2023 19:15:25 +0000 Subject: [PATCH 1/9] add show dhcp_server port --- .../cli-plugin-tests/mock_config_db.json | 6 ++++ .../cli-plugin-tests/test_show_dhcp_server.py | 30 +++++++++++++++++++ .../cli/show/plugins/show_dhcp_server.py | 19 ++++++++++++ 3 files changed, 55 insertions(+) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json b/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json index fcc088e8c001..712bcdc999e2 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json +++ b/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json @@ -44,5 +44,11 @@ }, "DHCP_SERVER_IPV4_IP|eth0": { "ip": "240.127.1.2" + }, + "DHCP_SERVER_IPV4_PORT|Vlan100|Ethernet4": { + "ips": "100.1.1.10,10.1.1.11" + }, + "DHCP_SERVER_IPV4_PORT|Vlan100|Ethernet7": { + "ranges": "range1,range2" } } diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index 348e7f0edcd4..463c63637799 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -175,3 +175,33 @@ def test_show_dhcp_server_ipv4_option_with_name(self, mock_db): result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["option"], ["option60"], 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_port_without_intf(self, mock_db): + expected_stdout = """\ +Interface MAC Address IP Lease Start Lease End +------------------- ----------------- ----------- ------------------- ------------------- +Vlan1000|Ethernet10 10:70:fd:b6:13:00 192.168.0.1 2023-03-01 03:16:21 2023-03-01 03:31:21 +Vlan1000|Ethernet11 10:70:fd:b6:13:01 192.168.0.2 2023-03-01 03:16:21 2023-03-01 03:31:21 +Vlan1001| 10:70:fd:b6:13:02 192.168.0.3 2023-03-01 03:16:21 2023-03-01 03:31:21 +""" + runner = CliRunner() + db = clicommon.Db() + db.db = mock_db + result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], [], 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_port_with_intf(self, mock_db): + expected_stdout = """\ +Interface MAC Address IP Lease Start Lease End +------------------- ----------------- ----------- ------------------- ------------------- +Vlan1000|Ethernet10 10:70:fd:b6:13:00 192.168.0.1 2023-03-01 03:16:21 2023-03-01 03:31:21 +Vlan1000|Ethernet11 10:70:fd:b6:13:01 192.168.0.2 2023-03-01 03:16:21 2023-03-01 03:31:21 +Vlan1001| 10:70:fd:b6:13:02 192.168.0.3 2023-03-01 03:16:21 2023-03-01 03:31:21 +""" + runner = CliRunner() + db = clicommon.Db() + db.db = mock_db + result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], ["Ethernet7"], 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 diff --git a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py index 7f68bf055299..259b8eb98753 100644 --- a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py @@ -116,5 +116,24 @@ def option(db, option_name): click.echo(tabulate(table, headers=headers)) +@ipv4.command() +@click.argument('interface', required=False) +@clicommon.pass_db +def port(db, interface): + if not interface: + interface = "*" + headers = ["Interface", "Bind"] + table = [] + dbconn = db.db + for key in dbconn.keys("CONFIG_DB", "DHCP_SERVER_IPV4_PORT|*|" + interface): + intf = key.lstrip("DHCP_SERVER_IPV4_PORT|") + entry = dbconn.get_all("CONFIG_DB", key) + if "ranges" in entry: + table.append([intf, entry["ranges"]]) + if "ips" in entry: + table.append([intf, entry["ips"]]) + click.echo(tabulate(table, headers=headers)) + + def register(cli): cli.add_command(dhcp_server) From fe1a97202a33b458f827cc2d19efe36354902320 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 13 Dec 2023 19:31:06 +0000 Subject: [PATCH 2/9] fix bug --- dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py index 259b8eb98753..727f97ded34f 100644 --- a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py @@ -126,7 +126,7 @@ def port(db, interface): table = [] dbconn = db.db for key in dbconn.keys("CONFIG_DB", "DHCP_SERVER_IPV4_PORT|*|" + interface): - intf = key.lstrip("DHCP_SERVER_IPV4_PORT|") + intf = key[len("DHCP_SERVER_IPV4_PORT|"):] entry = dbconn.get_all("CONFIG_DB", key) if "ranges" in entry: table.append([intf, entry["ranges"]]) From 98fbf6ebf81b81e2492768e7388b805bce7ff6ac Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 13 Dec 2023 19:39:58 +0000 Subject: [PATCH 3/9] fix bug --- .../cli-plugin-tests/test_show_dhcp_server.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index 463c63637799..a9402dbd550c 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -178,11 +178,10 @@ def test_show_dhcp_server_ipv4_option_with_name(self, mock_db): def test_show_dhcp_server_ipv4_port_without_intf(self, mock_db): expected_stdout = """\ -Interface MAC Address IP Lease Start Lease End -------------------- ----------------- ----------- ------------------- ------------------- -Vlan1000|Ethernet10 10:70:fd:b6:13:00 192.168.0.1 2023-03-01 03:16:21 2023-03-01 03:31:21 -Vlan1000|Ethernet11 10:70:fd:b6:13:01 192.168.0.2 2023-03-01 03:16:21 2023-03-01 03:31:21 -Vlan1001| 10:70:fd:b6:13:02 192.168.0.3 2023-03-01 03:16:21 2023-03-01 03:31:21 +Interface Bind +----------------- -------------------- +Vlan100|Ethernet4 100.1.1.10,10.1.1.11 +Vlan100|Ethernet7 range1,range2 """ runner = CliRunner() db = clicommon.Db() @@ -193,11 +192,9 @@ def test_show_dhcp_server_ipv4_port_without_intf(self, mock_db): def test_show_dhcp_server_ipv4_port_with_intf(self, mock_db): expected_stdout = """\ -Interface MAC Address IP Lease Start Lease End -------------------- ----------------- ----------- ------------------- ------------------- -Vlan1000|Ethernet10 10:70:fd:b6:13:00 192.168.0.1 2023-03-01 03:16:21 2023-03-01 03:31:21 -Vlan1000|Ethernet11 10:70:fd:b6:13:01 192.168.0.2 2023-03-01 03:16:21 2023-03-01 03:31:21 -Vlan1001| 10:70:fd:b6:13:02 192.168.0.3 2023-03-01 03:16:21 2023-03-01 03:31:21 +Interface Bind +----------------- ------------- +Vlan100|Ethernet7 range1,range2 """ runner = CliRunner() db = clicommon.Db() From 699ac906e28ca0acdd8945c648bc38ba150801fa Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 20 Dec 2023 16:06:43 +0000 Subject: [PATCH 4/9] allow vlan and port input --- .../cli-plugin-tests/mock_config_db.json | 6 +++ .../cli-plugin-tests/test_show_dhcp_server.py | 41 ++++++++++++++++++- .../cli/show/plugins/show_dhcp_server.py | 29 ++++++++++--- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json b/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json index 712bcdc999e2..6183453aff80 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json +++ b/dockers/docker-dhcp-server/cli-plugin-tests/mock_config_db.json @@ -50,5 +50,11 @@ }, "DHCP_SERVER_IPV4_PORT|Vlan100|Ethernet7": { "ranges": "range1,range2" + }, + "DHCP_SERVER_IPV4_PORT|Vlan200|Ethernet8": { + "ranges": "range3,range4" + }, + "DHCP_SERVER_IPV4_PORT|Ethernet9": { + "ranges": "range5,range6" } } diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index a9402dbd550c..aaa6dae31479 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -190,7 +190,7 @@ def test_show_dhcp_server_ipv4_port_without_intf(self, mock_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_port_with_intf(self, mock_db): + def test_show_dhcp_server_ipv4_port_with_port(self, mock_db): expected_stdout = """\ Interface Bind ----------------- ------------- @@ -202,3 +202,42 @@ def test_show_dhcp_server_ipv4_port_with_intf(self, mock_db): result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], ["Ethernet7"], 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_port_with_vlan(self, mock_db): + expected_stdout = """\ +Interface Bind +----------------- ------------- +Vlan100|Ethernet7 range1,range2 +""" + runner = CliRunner() + db = clicommon.Db() + db.db = mock_db + result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], ["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_port_with_port_and_vlan(self, mock_db): + expected_stdout = """\ +Interface Bind +----------------- ------------- +Vlan100|Ethernet7 range1,range2 +""" + runner = CliRunner() + db = clicommon.Db() + db.db = mock_db + result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], ["Vlan200|Ethernet8"], 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_port_with_single_port(self, mock_db): + expected_stdout = """\ +Interface Bind +----------------- ------------- +Vlan100|Ethernet7 range1,range2 +""" + runner = CliRunner() + db = clicommon.Db() + db.db = mock_db + result = runner.invoke(show_dhcp_server.dhcp_server.commands["ipv4"].commands["port"], ["Ethernet9"], 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 diff --git a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py index 727f97ded34f..e71a61f292f7 100644 --- a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py @@ -5,6 +5,11 @@ import ipaddress from datetime import datetime + import fnmatch + import re + + regex = fnmatch.translate(pattern) + regex = re.compile(regex) def ts_to_str(ts): @@ -79,6 +84,17 @@ def range(db, range_name): click.echo(tabulate(table, headers=headers)) +def dhcp_interface_is_match(input_, key): + regex = fnmatch.translate(input_) + regex = re.compile(regex) + if regex.match(key): + return True + for item in key.split("|"): + if regex.match(item): + return True + return False + + @ipv4.command() @click.argument('dhcp_interface', required=False) @click.option('--with_customized_options', default=False, is_flag=True) @@ -125,13 +141,14 @@ def port(db, interface): headers = ["Interface", "Bind"] table = [] dbconn = db.db - for key in dbconn.keys("CONFIG_DB", "DHCP_SERVER_IPV4_PORT|*|" + interface): + for key in dbconn.keys("CONFIG_DB", "DHCP_SERVER_IPV4_PORT|*"): intf = key[len("DHCP_SERVER_IPV4_PORT|"):] - entry = dbconn.get_all("CONFIG_DB", key) - if "ranges" in entry: - table.append([intf, entry["ranges"]]) - if "ips" in entry: - table.append([intf, entry["ips"]]) + if dhcp_interface_is_match(interface, intf): + entry = dbconn.get_all("CONFIG_DB", key) + if "ranges" in entry: + table.append([intf, entry["ranges"]]) + if "ips" in entry: + table.append([intf, entry["ips"]]) click.echo(tabulate(table, headers=headers)) From 79a9b0c0a1216720da2aaf479780dc6eedc84736 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 20 Dec 2023 16:15:50 +0000 Subject: [PATCH 5/9] fi xbug --- .../cli/show/plugins/show_dhcp_server.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py index e71a61f292f7..42821c5d2365 100644 --- a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py @@ -5,11 +5,8 @@ import ipaddress from datetime import datetime - import fnmatch - import re - - regex = fnmatch.translate(pattern) - regex = re.compile(regex) +import fnmatch +import re def ts_to_str(ts): From c01feed06bcce0d0c2586968d3ff52a877f5f6f0 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 20 Dec 2023 16:27:33 +0000 Subject: [PATCH 6/9] fix bug --- .../cli-plugin-tests/test_show_dhcp_server.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index aaa6dae31479..dacc550c2955 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -182,6 +182,8 @@ def test_show_dhcp_server_ipv4_port_without_intf(self, mock_db): ----------------- -------------------- Vlan100|Ethernet4 100.1.1.10,10.1.1.11 Vlan100|Ethernet7 range1,range2 +Vlan200|Ethernet8 range3,range4 +Ethernet9 range5,range6 """ runner = CliRunner() db = clicommon.Db() @@ -206,7 +208,8 @@ def test_show_dhcp_server_ipv4_port_with_port(self, mock_db): def test_show_dhcp_server_ipv4_port_with_vlan(self, mock_db): expected_stdout = """\ Interface Bind ------------------ ------------- +----------------- -------------------- +Vlan100|Ethernet4 100.1.1.10,10.1.1.11 Vlan100|Ethernet7 range1,range2 """ runner = CliRunner() @@ -231,9 +234,9 @@ def test_show_dhcp_server_ipv4_port_with_port_and_vlan(self, mock_db): def test_show_dhcp_server_ipv4_port_with_single_port(self, mock_db): expected_stdout = """\ -Interface Bind ------------------ ------------- -Vlan100|Ethernet7 range1,range2 +Interface Bind +----------- ------------- +Ethernet9 range5,range6 """ runner = CliRunner() db = clicommon.Db() From 6cf4107331724bc6bce1fb83172d9cb9d024e218 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Wed, 20 Dec 2023 16:35:52 +0000 Subject: [PATCH 7/9] fix bug --- .../cli-plugin-tests/test_show_dhcp_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index dacc550c2955..f1f6fa137fa5 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -223,7 +223,7 @@ def test_show_dhcp_server_ipv4_port_with_port_and_vlan(self, mock_db): expected_stdout = """\ Interface Bind ----------------- ------------- -Vlan100|Ethernet7 range1,range2 +Vlan200|Ethernet8 range3,range4 """ runner = CliRunner() db = clicommon.Db() From a7e5421224e9a2468ea5101248c6690ffc0bd390 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Fri, 5 Jan 2024 14:05:30 +0000 Subject: [PATCH 8/9] replace comma with newline --- .../docker-dhcp-server/cli/show/plugins/show_dhcp_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py index 42821c5d2365..5afba07bd55f 100644 --- a/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli/show/plugins/show_dhcp_server.py @@ -143,9 +143,9 @@ def port(db, interface): if dhcp_interface_is_match(interface, intf): entry = dbconn.get_all("CONFIG_DB", key) if "ranges" in entry: - table.append([intf, entry["ranges"]]) + table.append([intf, entry["ranges"].replace(",", "\n")]) if "ips" in entry: - table.append([intf, entry["ips"]]) + table.append([intf, entry["ips"].replace(",", "\n")]) click.echo(tabulate(table, headers=headers)) From f6427fef1d5c16dd4bad43d36cc961daff2b6031 Mon Sep 17 00:00:00 2001 From: Xichen Lin Date: Fri, 5 Jan 2024 14:15:24 +0000 Subject: [PATCH 9/9] fix ut --- .../cli-plugin-tests/test_show_dhcp_server.py | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py index f1f6fa137fa5..9fffce6c23a3 100644 --- a/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py +++ b/dockers/docker-dhcp-server/cli-plugin-tests/test_show_dhcp_server.py @@ -179,11 +179,15 @@ def test_show_dhcp_server_ipv4_option_with_name(self, mock_db): def test_show_dhcp_server_ipv4_port_without_intf(self, mock_db): expected_stdout = """\ Interface Bind ------------------ -------------------- -Vlan100|Ethernet4 100.1.1.10,10.1.1.11 -Vlan100|Ethernet7 range1,range2 -Vlan200|Ethernet8 range3,range4 -Ethernet9 range5,range6 +----------------- ---------- +Vlan100|Ethernet4 100.1.1.10 + 10.1.1.11 +Vlan100|Ethernet7 range1 + range2 +Vlan200|Ethernet8 range3 + range4 +Ethernet9 range5 + range6 """ runner = CliRunner() db = clicommon.Db() @@ -195,8 +199,9 @@ def test_show_dhcp_server_ipv4_port_without_intf(self, mock_db): def test_show_dhcp_server_ipv4_port_with_port(self, mock_db): expected_stdout = """\ Interface Bind ------------------ ------------- -Vlan100|Ethernet7 range1,range2 +----------------- ------ +Vlan100|Ethernet7 range1 + range2 """ runner = CliRunner() db = clicommon.Db() @@ -208,9 +213,11 @@ def test_show_dhcp_server_ipv4_port_with_port(self, mock_db): def test_show_dhcp_server_ipv4_port_with_vlan(self, mock_db): expected_stdout = """\ Interface Bind ------------------ -------------------- -Vlan100|Ethernet4 100.1.1.10,10.1.1.11 -Vlan100|Ethernet7 range1,range2 +----------------- ---------- +Vlan100|Ethernet4 100.1.1.10 + 10.1.1.11 +Vlan100|Ethernet7 range1 + range2 """ runner = CliRunner() db = clicommon.Db() @@ -222,8 +229,9 @@ def test_show_dhcp_server_ipv4_port_with_vlan(self, mock_db): def test_show_dhcp_server_ipv4_port_with_port_and_vlan(self, mock_db): expected_stdout = """\ Interface Bind ------------------ ------------- -Vlan200|Ethernet8 range3,range4 +----------------- ------ +Vlan200|Ethernet8 range3 + range4 """ runner = CliRunner() db = clicommon.Db() @@ -235,8 +243,9 @@ def test_show_dhcp_server_ipv4_port_with_port_and_vlan(self, mock_db): def test_show_dhcp_server_ipv4_port_with_single_port(self, mock_db): expected_stdout = """\ Interface Bind ------------ ------------- -Ethernet9 range5,range6 +----------- ------ +Ethernet9 range5 + range6 """ runner = CliRunner() db = clicommon.Db()