Skip to content

Commit 8ed64a8

Browse files
committed
Revert "Convert IPv6 addresses to lowercase in apply-patch (sonic-net#2299)"
This reverts commit 28b6ba5.
1 parent 10f31ea commit 8ed64a8

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

config/main.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,20 +1362,6 @@ def apply_patch(ctx, patch_file_path, format, dry_run, ignore_non_yang_tables, i
13621362
patch_as_json = json.loads(text)
13631363
patch = jsonpatch.JsonPatch(patch_as_json)
13641364

1365-
# convert IPv6 addresses to lowercase
1366-
for patch_line in patch:
1367-
if 'remove' == patch_line['op']:
1368-
match = re.search(r"(?P<prefix>/INTERFACE/\w+\|)(?P<ipv6_address>([a-fA-F0-9]{0,4}[:~]|::){1,7}[a-fA-F0-9]{0,4})"
1369-
"(?P<suffix>.*)", str.format(patch_line['path']))
1370-
if match:
1371-
prefix = match.group('prefix')
1372-
ipv6_address_str = match.group('ipv6_address')
1373-
suffix = match.group('suffix')
1374-
ipv6_address_str = ipv6_address_str.lower()
1375-
click.secho("converted ipv6 address to lowercase {} with prefix {} in value: {}"
1376-
.format(ipv6_address_str, prefix, patch_line['path']))
1377-
patch_line['path'] = prefix + ipv6_address_str + suffix
1378-
13791365
config_format = ConfigFormat[format.upper()]
13801366
GenericUpdater().apply_patch(patch, config_format, verbose, dry_run, ignore_non_yang_tables, ignore_path)
13811367

tests/ip_config_input/patch_ipv6.test

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

tests/ip_config_test.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import json
2-
import jsonpatch
31
import os
42
import traceback
53
from unittest import mock
@@ -14,9 +12,6 @@
1412
from utilities_common.db import Db
1513
import utilities_common.bgp_util as bgp_util
1614

17-
test_path = os.path.dirname(os.path.abspath(__file__))
18-
ip_config_input_path = os.path.join(test_path, "ip_config_input")
19-
2015
ERROR_MSG = "Error: IP address is not valid"
2116

2217
INVALID_VRF_MSG ="""\
@@ -243,21 +238,6 @@ def test_add_del_interface_shortened_ipv6_with_leading_zeros(self):
243238
assert result.exit_code != 0
244239
assert ('Ethernet68', '3000::1/64') not in db.cfgdb.get_table('INTERFACE')
245240

246-
def test_remove_interface_case_sensitive_mock_ipv6_w_apply_patch(self):
247-
runner = CliRunner()
248-
any_patch_as_json = [{"op": "remove", "path": "/INTERFACE/Ethernet12|FC00::1~1126"}]
249-
any_patch = jsonpatch.JsonPatch(any_patch_as_json)
250-
any_patch_as_text = json.dumps(any_patch_as_json)
251-
ipv6_patch_file = os.path.join(ip_config_input_path, 'patch_ipv6.test')
252-
253-
# config apply-patch patch
254-
mock_generic_updater = mock.Mock()
255-
with mock.patch('config.main.GenericUpdater', return_value=mock_generic_updater):
256-
with mock.patch('builtins.open', mock.mock_open(read_data=any_patch_as_text)):
257-
result = runner.invoke(config.config.commands["apply-patch"], [ipv6_patch_file], catch_exceptions=False)
258-
print(result.exit_code, result.output)
259-
assert "converted ipv6 address to lowercase fc00::1~1126 with prefix /INTERFACE/Ethernet12| in value: /INTERFACE/Ethernet12|FC00::1~1126" in result.output
260-
261241
def test_intf_vrf_bind_unbind(self):
262242
runner = CliRunner()
263243
db = Db()

0 commit comments

Comments
 (0)