Skip to content

Commit bdc5720

Browse files
authored
Revert "Fix for Switch Port Modes and VLAN CLI Enhancement (#3108)" (#3246)
Reverts sonic-net/sonic-utilities#3108
1 parent e35452b commit bdc5720

File tree

17 files changed

+141
-1888
lines changed

17 files changed

+141
-1888
lines changed

config/main.py

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
from .config_mgmt import ConfigMgmtDPB, ConfigMgmt
5858
from . import mclag
5959
from . import syslog
60-
from . import switchport
6160
from . import dns
6261

6362
# mock masic APIs for unit test
@@ -106,7 +105,6 @@
106105
PORT_SPEED = "speed"
107106
PORT_TPID = "tpid"
108107
DEFAULT_TPID = "0x8100"
109-
PORT_MODE= "switchport_mode"
110108

111109
DOM_CONFIG_SUPPORTED_SUBPORTS = ['0', '1']
112110

@@ -1215,9 +1213,6 @@ def config(ctx):
12151213
# DNS module
12161214
config.add_command(dns.dns)
12171215

1218-
# Switchport module
1219-
config.add_command(switchport.switchport)
1220-
12211216
@config.command()
12221217
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
12231218
expose_value=False, prompt='Existing files will be overwritten, continue?')
@@ -4591,40 +4586,19 @@ def add(ctx, interface_name, ip_addr, gw):
45914586
if interface_name is None:
45924587
ctx.fail("'interface_name' is None!")
45934588

4589+
# Add a validation to check this interface is not a member in vlan before
4590+
# changing it to a router port
4591+
vlan_member_table = config_db.get_table('VLAN_MEMBER')
4592+
if (interface_is_in_vlan(vlan_member_table, interface_name)):
4593+
click.echo("Interface {} is a member of vlan\nAborting!".format(interface_name))
4594+
return
4595+
45944596
portchannel_member_table = config_db.get_table('PORTCHANNEL_MEMBER')
45954597

45964598
if interface_is_in_portchannel(portchannel_member_table, interface_name):
45974599
ctx.fail("{} is configured as a member of portchannel."
45984600
.format(interface_name))
4599-
4600-
4601-
# Add a validation to check this interface is in routed mode before
4602-
# assigning an IP address to it
4603-
4604-
sub_intf = False
46054601

4606-
if clicommon.is_valid_port(config_db, interface_name):
4607-
is_port = True
4608-
elif clicommon.is_valid_portchannel(config_db, interface_name):
4609-
is_port = False
4610-
else:
4611-
sub_intf = True
4612-
4613-
if not sub_intf:
4614-
interface_mode = "routed"
4615-
if is_port:
4616-
interface_data = config_db.get_entry('PORT',interface_name)
4617-
elif not is_port:
4618-
interface_data = config_db.get_entry('PORTCHANNEL',interface_name)
4619-
4620-
if "mode" in interface_data:
4621-
interface_mode = interface_data["mode"]
4622-
4623-
if interface_mode != "routed":
4624-
ctx.fail("Interface {} is not in routed mode!".format(interface_name))
4625-
return
4626-
4627-
46284602
try:
46294603
ip_address = ipaddress.ip_interface(ip_addr)
46304604
except ValueError as err:

config/switchport.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)