From c472086ee97ecc4f811261b02aa530211c8e3ff1 Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Thu, 19 Oct 2023 00:20:32 +0530 Subject: [PATCH 01/10] Add new cli to add a interface ip as secondary address --- config/main.py | 10 +++++++++- tests/ip_config_test.py | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config/main.py b/config/main.py index 1d2c33605f..3c2f46b45d 100644 --- a/config/main.py +++ b/config/main.py @@ -4487,9 +4487,10 @@ def ip(ctx): @ip.command() @click.argument('interface_name', metavar='', required=True) @click.argument("ip_addr", metavar="", required=True) +@click.argument('secondary', metavar='', required=False) @click.argument('gw', metavar='', required=False) @click.pass_context -def add(ctx, interface_name, ip_addr, gw): +def add(ctx, interface_name, ip_addr, secondary, gw): """Add an IP address towards the interface""" # Get the config_db connector config_db = ValidatedConfigDBConnector(ctx.obj['config_db']) @@ -4551,6 +4552,13 @@ def add(ctx, interface_name, ip_addr, gw): config_db.set_entry(table_name, interface_name, {"NULL": "NULL"}) config_db.set_entry(table_name, (interface_name, str(ip_address)), {"NULL": "NULL"}) + if secondary: + # Only update if it is instance of boolean, if not ignore as this is optional field + if isinstance(secondary, bool): + config_db.set_entry(table_name, (interface_name, str(ip_address)), {"secondary": "true"}) + else: + click.echo("Field secondary should be of type boolean") + # # 'del' subcommand # diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index 2f262a4a09..b754c4fc7c 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -66,6 +66,13 @@ def test_add_del_interface_valid_ipv4(self): assert result.exit_code == 0 assert ('Eth36.10', '32.11.10.1/24') in db.cfgdb.get_table('VLAN_SUB_INTERFACE') + # config int ip add Ethernet0.10 10.11.20.1/24 as secondary + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Ethernet0.10", "10.11.20.1/24", "True"], obj=obj) + print(result.exit_code, result.output) + assert result.exit_code == 0 + assert ('Ethernet0.10', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_SUB_INTERFACE') + assert db.cfgdb.get_table('VLAN_SUB_INTERFACE')[('Ethernet0.10', '10.11.20.1/24')]['secondary'] == "true" + # config int ip remove Ethernet64 10.10.10.1/24 result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["remove"], ["Ethernet64", "10.10.10.1/24"], obj=obj) print(result.exit_code, result.output) From 33d6da70a6768f1f98effef1ff07123c8d36b75f Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Sat, 21 Oct 2023 23:16:58 +0530 Subject: [PATCH 02/10] Correct tests and add the secondary as optional argument --- config/main.py | 10 ++++------ tests/ip_config_test.py | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/config/main.py b/config/main.py index 3c2f46b45d..bcd0fbc9a6 100644 --- a/config/main.py +++ b/config/main.py @@ -4487,10 +4487,10 @@ def ip(ctx): @ip.command() @click.argument('interface_name', metavar='', required=True) @click.argument("ip_addr", metavar="", required=True) -@click.argument('secondary', metavar='', required=False) @click.argument('gw', metavar='', required=False) +@click.option('--secondary', "-s", is_flag=True, default=False) @click.pass_context -def add(ctx, interface_name, ip_addr, secondary, gw): +def add(ctx, interface_name, ip_addr, gw, secondary): """Add an IP address towards the interface""" # Get the config_db connector config_db = ValidatedConfigDBConnector(ctx.obj['config_db']) @@ -4553,11 +4553,9 @@ def add(ctx, interface_name, ip_addr, secondary, gw): config_db.set_entry(table_name, (interface_name, str(ip_address)), {"NULL": "NULL"}) if secondary: - # Only update if it is instance of boolean, if not ignore as this is optional field - if isinstance(secondary, bool): + # We update the secondary flag only in case of VLAN Interface. + if table_name == "VLAN_INTERFACE": config_db.set_entry(table_name, (interface_name, str(ip_address)), {"secondary": "true"}) - else: - click.echo("Field secondary should be of type boolean") # # 'del' subcommand diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index b754c4fc7c..bfb10e57aa 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -66,13 +66,6 @@ def test_add_del_interface_valid_ipv4(self): assert result.exit_code == 0 assert ('Eth36.10', '32.11.10.1/24') in db.cfgdb.get_table('VLAN_SUB_INTERFACE') - # config int ip add Ethernet0.10 10.11.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Ethernet0.10", "10.11.20.1/24", "True"], obj=obj) - print(result.exit_code, result.output) - assert result.exit_code == 0 - assert ('Ethernet0.10', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_SUB_INTERFACE') - assert db.cfgdb.get_table('VLAN_SUB_INTERFACE')[('Ethernet0.10', '10.11.20.1/24')]['secondary'] == "true" - # config int ip remove Ethernet64 10.10.10.1/24 result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["remove"], ["Ethernet64", "10.10.10.1/24"], obj=obj) print(result.exit_code, result.output) @@ -91,6 +84,18 @@ def test_add_del_interface_valid_ipv4(self): assert result.exit_code != 0 assert ('Eth36.10', '32.11.10.1/24') not in db.cfgdb.get_table('VLAN_SUB_INTERFACE') + # config int ip add Ethernet0.10 10.21.20.1/24 as secondary + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan100", "10.11.20.1/24", "--secondary"], obj=obj) + assert result.exit_code == 0 + assert ('Vlan100', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') + assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan100', '10.11.20.1/24')]['secondary'] == "true" + + # config int ip add Ethernet0.10 10.21.20.1/24 as secondary + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan200", "10.21.20.1/24", "--secondary"], obj=obj) + assert result.exit_code == 0 + assert ('Vlan200', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') + assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan200', '10.21.20.1/24')]['secondary'] == "true" + def test_add_interface_invalid_ipv4(self): db = Db() runner = CliRunner() From f3283d7f166879ad7e2f6ef12a646f9614220178 Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Sat, 21 Oct 2023 23:19:10 +0530 Subject: [PATCH 03/10] Correct tests --- tests/ip_config_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index bfb10e57aa..e20111b65c 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -91,7 +91,7 @@ def test_add_del_interface_valid_ipv4(self): assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan100', '10.11.20.1/24')]['secondary'] == "true" # config int ip add Ethernet0.10 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan200", "10.21.20.1/24", "--secondary"], obj=obj) + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan200", "10.21.20.1/24", "-s"], obj=obj) assert result.exit_code == 0 assert ('Vlan200', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan200', '10.21.20.1/24')]['secondary'] == "true" From 7a0f31e451943082b6bc930f0b69ea7da786a766 Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Mon, 20 Nov 2023 17:37:25 +0530 Subject: [PATCH 04/10] Check if interface has primary added before adding a secondary --- config/main.py | 16 ++++++++++++++-- tests/ip_config_test.py | 22 ++++++++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/config/main.py b/config/main.py index bcd0fbc9a6..b623594168 100644 --- a/config/main.py +++ b/config/main.py @@ -4550,12 +4550,24 @@ def add(ctx, interface_name, ip_addr, gw, secondary): config_db.set_entry(table_name, interface_name, {"admin_status": "up"}) else: config_db.set_entry(table_name, interface_name, {"NULL": "NULL"}) - config_db.set_entry(table_name, (interface_name, str(ip_address)), {"NULL": "NULL"}) if secondary: # We update the secondary flag only in case of VLAN Interface. if table_name == "VLAN_INTERFACE": - config_db.set_entry(table_name, (interface_name, str(ip_address)), {"secondary": "true"}) + vlan_interface_table = config_db.get_table(table_name) + contains_primary = False + for key, value in vlan_interface_table.items(): + if not isinstance(key, tuple): + continue + name, prefix = key + if name == interface_name and "secondary" not in value: + contains_primary = True + if contains_primary == True: + config_db.set_entry(table_name, (interface_name, str(ip_address)), {"secondary": "true"}) + else: + ctx.fail("Primary for the interface {} is not set, so skipping adding the interface".format(interface_name)) + else: + config_db.set_entry(table_name, (interface_name, str(ip_address)), {"NULL": "NULL"}) # # 'del' subcommand diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index e20111b65c..300c0a995e 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -84,17 +84,23 @@ def test_add_del_interface_valid_ipv4(self): assert result.exit_code != 0 assert ('Eth36.10', '32.11.10.1/24') not in db.cfgdb.get_table('VLAN_SUB_INTERFACE') - # config int ip add Ethernet0.10 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan100", "10.11.20.1/24", "--secondary"], obj=obj) + # config int ip add vlan1000 10.21.20.1/24 as secondary + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan1000", "10.11.20.1/24", "--secondary"], obj=obj) assert result.exit_code == 0 - assert ('Vlan100', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') - assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan100', '10.11.20.1/24')]['secondary'] == "true" + assert ('Vlan1000', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') + assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan1000', '10.11.20.1/24')]['secondary'] == "true" - # config int ip add Ethernet0.10 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan200", "10.21.20.1/24", "-s"], obj=obj) + # config int ip add vlan2000 10.21.20.1/24 as secondary + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan2000", "10.21.20.1/24", "-s"], obj=obj) assert result.exit_code == 0 - assert ('Vlan200', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') - assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan200', '10.21.20.1/24')]['secondary'] == "true" + assert ('Vlan2000', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') + assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan2000', '10.21.20.1/24')]['secondary'] == "true" + + # config int ip add vlan500 10.21.20.1/24 as secondary - should fail as vlan500 is not added in table + ERR_MSG = "Error: Primary for the interface Vlan500 is not set, so skipping adding the interface" + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) + assert result.exit_code != 0 + assert ERR_MSG in result.output def test_add_interface_invalid_ipv4(self): db = Db() From c3d1e30dad676022e4ffbccbeab7ea85db52e16f Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Wed, 22 Nov 2023 12:00:24 +0530 Subject: [PATCH 05/10] Add a test case to check when --secondary is not passed the flag is not added to the interface --- tests/ip_config_test.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index 300c0a995e..15f5af3c93 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -96,6 +96,12 @@ def test_add_del_interface_valid_ipv4(self): assert ('Vlan2000', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan2000', '10.21.20.1/24')]['secondary'] == "true" + # config int ip add vlan4000 10.16.20.1/24 as primary and make sure secondary is not present in table + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan4000", "10.16.20.1/24"], obj=obj) + assert result.exit_code == 0 + assert ('Vlan4000', '10.16.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') + assert 'secondary' not in db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan4000', '10.16.20.1/24')] + # config int ip add vlan500 10.21.20.1/24 as secondary - should fail as vlan500 is not added in table ERR_MSG = "Error: Primary for the interface Vlan500 is not set, so skipping adding the interface" result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) From b1ae45d53e9c04134dfaddc181f937eb9172adeb Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Wed, 15 May 2024 23:02:02 +0530 Subject: [PATCH 06/10] Add creation of vlan500 so as to check adding secondary fails --- tests/ip_config_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index 9f0d73964b..af1e9ddda1 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -149,6 +149,8 @@ def test_add_del_interface_valid_ipv4(self): assert ('Vlan4000', '10.16.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert 'secondary' not in db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan4000', '10.16.20.1/24')] + # create vlan 500 + result = runner.invoke(config.config.commands["vlan"].commands["add"], ["500"], obj=db) # config int ip add vlan500 10.21.20.1/24 as secondary - should fail as vlan500 is not added in table ERR_MSG = "Error: Primary for the interface Vlan500 is not set, so skipping adding the interface" result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) From 090eaecb7a3d968607c9b9c07519f611cae427b6 Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Wed, 15 May 2024 23:13:52 +0530 Subject: [PATCH 07/10] Fix Static Analysis errors --- config/main.py | 5 +++-- tests/ip_config_test.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/main.py b/config/main.py index 5e19531a55..bd93dd019b 100644 --- a/config/main.py +++ b/config/main.py @@ -4733,10 +4733,11 @@ def add(ctx, interface_name, ip_addr, gw, secondary): name, prefix = key if name == interface_name and "secondary" not in value: contains_primary = True - if contains_primary == True: + if contains_primary: config_db.set_entry(table_name, (interface_name, str(ip_address)), {"secondary": "true"}) else: - ctx.fail("Primary for the interface {} is not set, so skipping adding the interface".format(interface_name)) + ctx.fail("Primary for the interface {} is not set, so skipping adding the interface" + .format(interface_name)) else: config_db.set_entry(table_name, (interface_name, str(ip_address)), {"NULL": "NULL"}) diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index af1e9ddda1..f83d3763b6 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -130,21 +130,23 @@ def test_add_del_interface_valid_ipv4(self): assert mock_run_command.call_count == 1 assert ('Eth36.10', '32.11.10.1/24') not in db.cfgdb.get_table('VLAN_SUB_INTERFACE') - # config int ip add vlan1000 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan1000", "10.11.20.1/24", "--secondary"], obj=obj) + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + ["Vlan1000", "10.11.20.1/24", "--secondary"], obj=obj) assert result.exit_code == 0 assert ('Vlan1000', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan1000', '10.11.20.1/24')]['secondary'] == "true" # config int ip add vlan2000 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan2000", "10.21.20.1/24", "-s"], obj=obj) + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + ["Vlan2000", "10.21.20.1/24", "-s"], obj=obj) assert result.exit_code == 0 assert ('Vlan2000', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan2000', '10.21.20.1/24')]['secondary'] == "true" # config int ip add vlan4000 10.16.20.1/24 as primary and make sure secondary is not present in table - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan4000", "10.16.20.1/24"], obj=obj) + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + ["Vlan4000", "10.16.20.1/24"], obj=obj) assert result.exit_code == 0 assert ('Vlan4000', '10.16.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert 'secondary' not in db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan4000', '10.16.20.1/24')] @@ -153,7 +155,8 @@ def test_add_del_interface_valid_ipv4(self): result = runner.invoke(config.config.commands["vlan"].commands["add"], ["500"], obj=db) # config int ip add vlan500 10.21.20.1/24 as secondary - should fail as vlan500 is not added in table ERR_MSG = "Error: Primary for the interface Vlan500 is not set, so skipping adding the interface" - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) assert result.exit_code != 0 assert ERR_MSG in result.output From a0d44c794d89e4835661b2323064df3ad4b221ab Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Wed, 15 May 2024 23:30:56 +0530 Subject: [PATCH 08/10] Remove Trailing white space --- tests/ip_config_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/ip_config_test.py b/tests/ip_config_test.py index f83d3763b6..9338d341e4 100644 --- a/tests/ip_config_test.py +++ b/tests/ip_config_test.py @@ -131,21 +131,21 @@ def test_add_del_interface_valid_ipv4(self): assert ('Eth36.10', '32.11.10.1/24') not in db.cfgdb.get_table('VLAN_SUB_INTERFACE') # config int ip add vlan1000 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan1000", "10.11.20.1/24", "--secondary"], obj=obj) assert result.exit_code == 0 assert ('Vlan1000', '10.11.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan1000', '10.11.20.1/24')]['secondary'] == "true" # config int ip add vlan2000 10.21.20.1/24 as secondary - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan2000", "10.21.20.1/24", "-s"], obj=obj) assert result.exit_code == 0 assert ('Vlan2000', '10.21.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') assert db.cfgdb.get_table('VLAN_INTERFACE')[('Vlan2000', '10.21.20.1/24')]['secondary'] == "true" # config int ip add vlan4000 10.16.20.1/24 as primary and make sure secondary is not present in table - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan4000", "10.16.20.1/24"], obj=obj) assert result.exit_code == 0 assert ('Vlan4000', '10.16.20.1/24') in db.cfgdb.get_table('VLAN_INTERFACE') @@ -155,7 +155,7 @@ def test_add_del_interface_valid_ipv4(self): result = runner.invoke(config.config.commands["vlan"].commands["add"], ["500"], obj=db) # config int ip add vlan500 10.21.20.1/24 as secondary - should fail as vlan500 is not added in table ERR_MSG = "Error: Primary for the interface Vlan500 is not set, so skipping adding the interface" - result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], + result = runner.invoke(config.config.commands["interface"].commands["ip"].commands["add"], ["Vlan500", "10.21.20.1/24", "--secondary"], obj=obj) assert result.exit_code != 0 assert ERR_MSG in result.output From de33cb5f0560c4321abd6db080ad433578a61eb5 Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Thu, 16 May 2024 00:04:56 +0530 Subject: [PATCH 09/10] Try fix Static Analysis issue --- config/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/main.py b/config/main.py index bd93dd019b..6b1954ff19 100644 --- a/config/main.py +++ b/config/main.py @@ -4630,13 +4630,13 @@ def validate_vlan_exists(db,text): # 'add' subcommand # -@ip.command() +@ip.command('add') @click.argument('interface_name', metavar='', required=True) @click.argument("ip_addr", metavar="", required=True) @click.argument('gw', metavar='', required=False) @click.option('--secondary', "-s", is_flag=True, default=False) @click.pass_context -def add(ctx, interface_name, ip_addr, gw, secondary): +def add_interface_ip(ctx, interface_name, ip_addr, gw, secondary): """Add an IP address towards the interface""" # Get the config_db connector config_db = ValidatedConfigDBConnector(ctx.obj['config_db']) From b8570c9681822e2c2f2ad4123824a666acdd3abf Mon Sep 17 00:00:00 2001 From: "shashanka.balakuntala" Date: Thu, 16 May 2024 00:06:55 +0530 Subject: [PATCH 10/10] Fix removed space --- config/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/main.py b/config/main.py index 6b1954ff19..41a9f48121 100644 --- a/config/main.py +++ b/config/main.py @@ -4630,6 +4630,7 @@ def validate_vlan_exists(db,text): # 'add' subcommand # + @ip.command('add') @click.argument('interface_name', metavar='', required=True) @click.argument("ip_addr", metavar="", required=True)