Skip to content

Commit 17e77fe

Browse files
authored
Revert "Run yang validation in unit test (#3025)" (#3055)
This reverts commit e01fc89.
1 parent 96dd555 commit 17e77fe

11 files changed

+20
-96
lines changed

scripts/db_migrator.py

-28
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@
66
import sys
77
import traceback
88
import re
9-
import sonic_yang
10-
import syslog
119

1210
from sonic_py_common import device_info, logger
1311
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector, SonicDBConfig
1412
from minigraph import parse_xml
1513

1614
INIT_CFG_FILE = '/etc/sonic/init_cfg.json'
1715
MINIGRAPH_FILE = '/etc/sonic/minigraph.xml'
18-
YANG_MODELS_DIR = "/usr/local/yang-models"
1916

2017
# mock the redis for unit test purposes #
2118
try:
@@ -1164,31 +1161,6 @@ def migrate(self):
11641161
version = next_version
11651162
# Perform common migration ops
11661163
self.common_migration_ops()
1167-
config = self.configDB.get_config()
1168-
# Fix table key in tuple
1169-
for table_name, table in config.items():
1170-
new_table = {}
1171-
hit = False
1172-
for table_key, table_val in table.items():
1173-
if isinstance(table_key, tuple):
1174-
new_key = "|".join(table_key)
1175-
new_table[new_key] = table_val
1176-
hit = True
1177-
else:
1178-
new_table[table_key] = table_val
1179-
if hit:
1180-
config[table_name] = new_table
1181-
# Run yang validation
1182-
yang_parser = sonic_yang.SonicYang(YANG_MODELS_DIR)
1183-
yang_parser.loadYangModel()
1184-
try:
1185-
yang_parser.loadData(configdbJson=config)
1186-
yang_parser.validate_data_tree()
1187-
except sonic_yang.SonicYangException as e:
1188-
syslog.syslog(syslog.LOG_CRIT, "Yang validation failed: " + str(e))
1189-
if os.environ["UTILITIES_UNIT_TESTING"] == "2":
1190-
raise
1191-
11921164

11931165
def main():
11941166
try:

tests/db_migrator_input/config_db/cross_branch_upgrade_to_4_0_3_expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
"VERSION": "version_4_0_3"
44
},
55
"FLEX_COUNTER_TABLE|ACL": {
6-
"FLEX_COUNTER_STATUS": "enable",
6+
"FLEX_COUNTER_STATUS": "true",
77
"FLEX_COUNTER_DELAY_STATUS": "true",
88
"POLL_INTERVAL": "10000"
99
},
1010
"FLEX_COUNTER_TABLE|QUEUE": {
11-
"FLEX_COUNTER_STATUS": "enable",
11+
"FLEX_COUNTER_STATUS": "true",
1212
"FLEX_COUNTER_DELAY_STATUS": "true",
1313
"POLL_INTERVAL": "10000"
1414
},
1515
"FLEX_COUNTER_TABLE|PG_WATERMARK": {
16-
"FLEX_COUNTER_STATUS": "disable",
16+
"FLEX_COUNTER_STATUS": "false",
1717
"FLEX_COUNTER_DELAY_STATUS": "true"
1818
}
1919
}

tests/db_migrator_input/config_db/cross_branch_upgrade_to_4_0_3_input.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"VERSION": "version_1_0_1"
44
},
55
"FLEX_COUNTER_TABLE|ACL": {
6-
"FLEX_COUNTER_STATUS": "enable",
6+
"FLEX_COUNTER_STATUS": "true",
77
"FLEX_COUNTER_DELAY_STATUS": "true",
88
"POLL_INTERVAL": "10000"
99
},
1010
"FLEX_COUNTER_TABLE|QUEUE": {
11-
"FLEX_COUNTER_STATUS": "enable",
11+
"FLEX_COUNTER_STATUS": "true",
1212
"FLEX_COUNTER_DELAY_STATUS": "false",
1313
"POLL_INTERVAL": "10000"
1414
},
1515
"FLEX_COUNTER_TABLE|PG_WATERMARK": {
16-
"FLEX_COUNTER_STATUS": "disable"
16+
"FLEX_COUNTER_STATUS": "false"
1717
}
1818
}

tests/db_migrator_input/config_db/portchannel-expected.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
{
22
"PORTCHANNEL|PortChannel0": {
33
"admin_status": "up",
4+
"members@": "Ethernet0,Ethernet4",
45
"min_links": "2",
56
"mtu": "9100",
67
"lacp_key": "auto"
78
},
89
"PORTCHANNEL|PortChannel1": {
910
"admin_status": "up",
11+
"members@": "Ethernet8,Ethernet12",
1012
"min_links": "2",
1113
"mtu": "9100",
1214
"lacp_key": "auto"
1315
},
1416
"PORTCHANNEL|PortChannel0123": {
1517
"admin_status": "up",
18+
"members@": "Ethernet16",
1619
"min_links": "1",
1720
"mtu": "9100",
1821
"lacp_key": "auto"
1922
},
2023
"PORTCHANNEL|PortChannel0011": {
2124
"admin_status": "up",
25+
"members@": "Ethernet20,Ethernet24",
2226
"min_links": "2",
2327
"mtu": "9100",
2428
"lacp_key": "auto"

tests/db_migrator_input/config_db/portchannel-input.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
{
22
"PORTCHANNEL|PortChannel0": {
33
"admin_status": "up",
4+
"members@": "Ethernet0,Ethernet4",
45
"min_links": "2",
56
"mtu": "9100"
67
},
78
"PORTCHANNEL|PortChannel1": {
89
"admin_status": "up",
10+
"members@": "Ethernet8,Ethernet12",
911
"min_links": "2",
1012
"mtu": "9100"
1113
},
1214
"PORTCHANNEL|PortChannel0123": {
1315
"admin_status": "up",
16+
"members@": "Ethernet16",
1417
"min_links": "1",
1518
"mtu": "9100"
1619
},
1720
"PORTCHANNEL|PortChannel0011": {
1821
"admin_status": "up",
22+
"members@": "Ethernet20,Ethernet24",
1923
"min_links": "2",
2024
"mtu": "9100"
2125
},

tests/db_migrator_input/config_db/qos_map_table_expected.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@
2929
"pfc_to_queue_map": "AZURE",
3030
"tc_to_pg_map": "AZURE",
3131
"tc_to_queue_map": "AZURE"
32-
},
33-
"TC_TO_QUEUE_MAP|AZURE": {"0": "0"},
34-
"TC_TO_PRIORITY_GROUP_MAP|AZURE": {"0": "0"},
35-
"MAP_PFC_PRIORITY_TO_QUEUE|AZURE": {"0": "0"},
36-
"DSCP_TO_TC_MAP|AZURE": {"0": "0"},
37-
"PORT|Ethernet0": {"lanes": "0", "speed": "1000"},
38-
"PORT|Ethernet92": {"lanes": "92", "speed": "1000"},
39-
"PORT|Ethernet96": {"lanes": "96", "speed": "1000"},
40-
"PORT|Ethernet100": {"lanes": "100", "speed": "1000"}
32+
}
4133
}
4234

tests/db_migrator_input/config_db/qos_map_table_input.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,5 @@
2727
"pfc_to_queue_map": "AZURE",
2828
"tc_to_pg_map": "AZURE",
2929
"tc_to_queue_map": "AZURE"
30-
},
31-
"TC_TO_QUEUE_MAP|AZURE": {"0": "0"},
32-
"TC_TO_PRIORITY_GROUP_MAP|AZURE": {"0": "0"},
33-
"MAP_PFC_PRIORITY_TO_QUEUE|AZURE": {"0": "0"},
34-
"DSCP_TO_TC_MAP|AZURE": {"0": "0"},
35-
"PORT|Ethernet0": {"lanes": "0", "speed": "1000"},
36-
"PORT|Ethernet92": {"lanes": "92", "speed": "1000"},
37-
"PORT|Ethernet96": {"lanes": "96", "speed": "1000"},
38-
"PORT|Ethernet100": {"lanes": "100", "speed": "1000"}
30+
}
3931
}

tests/db_migrator_input/config_db/reclaiming-buffer-dynamic-double-pools-expected.json

+1-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"profile": "NULL"
1313
},
1414
"BUFFER_PG|Ethernet8|3-4": {
15-
"profile": "customized_ingress_lossless_profile"
15+
"profile": "customized_lossless_profile"
1616
},
1717
"BUFFER_PG|Ethernet12|0": {
1818
"profile": "ingress_lossy_profile"
@@ -103,11 +103,6 @@
103103
"BUFFER_PORT_INGRESS_PROFILE_LIST|Ethernet24": {
104104
"profile_list": "ingress_lossless_profile,ingress_lossy_profile"
105105
},
106-
"BUFFER_PROFILE|customized_egress_lossless_profile": {
107-
"dynamic_th": "7",
108-
"pool": "egress_lossless_pool",
109-
"size": "0"
110-
},
111106
"BUFFER_PROFILE|egress_lossless_profile": {
112107
"dynamic_th": "7",
113108
"pool": "egress_lossless_pool",
@@ -118,11 +113,6 @@
118113
"pool": "egress_lossy_pool",
119114
"size": "9216"
120115
},
121-
"BUFFER_PROFILE|customized_ingress_lossless_profile": {
122-
"dynamic_th": "7",
123-
"pool": "ingress_lossless_pool",
124-
"size": "0"
125-
},
126116
"BUFFER_PROFILE|ingress_lossless_profile": {
127117
"dynamic_th": "7",
128118
"pool": "ingress_lossless_pool",

tests/db_migrator_input/config_db/reclaiming-buffer-dynamic-double-pools-input.json

+1-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"profile": "NULL"
44
},
55
"BUFFER_PG|Ethernet8|3-4": {
6-
"profile": "customized_ingress_lossless_profile"
6+
"profile": "customized_lossless_profile"
77
},
88
"BUFFER_PG|Ethernet12|0": {
99
"profile": "ingress_lossy_profile"
@@ -55,11 +55,6 @@
5555
"BUFFER_PORT_INGRESS_PROFILE_LIST|Ethernet24": {
5656
"profile_list": "ingress_lossless_profile,ingress_lossy_profile"
5757
},
58-
"BUFFER_PROFILE|customized_egress_lossless_profile": {
59-
"dynamic_th": "7",
60-
"pool": "egress_lossless_pool",
61-
"size": "0"
62-
},
6358
"BUFFER_PROFILE|egress_lossless_profile": {
6459
"dynamic_th": "7",
6560
"pool": "egress_lossless_pool",
@@ -70,11 +65,6 @@
7065
"pool": "egress_lossy_pool",
7166
"size": "9216"
7267
},
73-
"BUFFER_PROFILE|customized_ingress_lossless_profile": {
74-
"dynamic_th": "7",
75-
"pool": "ingress_lossless_pool",
76-
"size": "0"
77-
},
7868
"BUFFER_PROFILE|ingress_lossless_profile": {
7969
"dynamic_th": "7",
8070
"pool": "ingress_lossless_pool",

tests/db_migrator_input/config_db/reclaiming-buffer-dynamic-single-pool-expected.json

+1-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"profile": "NULL"
1313
},
1414
"BUFFER_PG|Ethernet8|3-4": {
15-
"profile": "customized_ingress_lossless_profile"
15+
"profile": "customized_lossless_profile"
1616
},
1717
"BUFFER_PG|Ethernet12|0": {
1818
"profile": "ingress_lossy_profile"
@@ -99,11 +99,6 @@
9999
"BUFFER_PORT_INGRESS_PROFILE_LIST|Ethernet24": {
100100
"profile_list": "ingress_lossless_profile"
101101
},
102-
"BUFFER_PROFILE|customized_egress_lossless_profile": {
103-
"dynamic_th": "7",
104-
"pool": "egress_lossless_pool",
105-
"size": "0"
106-
},
107102
"BUFFER_PROFILE|egress_lossless_profile": {
108103
"dynamic_th": "7",
109104
"pool": "egress_lossless_pool",
@@ -114,11 +109,6 @@
114109
"pool": "egress_lossy_pool",
115110
"size": "9216"
116111
},
117-
"BUFFER_PROFILE|customized_ingress_lossless_profile": {
118-
"dynamic_th": "7",
119-
"pool": "ingress_lossless_pool",
120-
"size": "0"
121-
},
122112
"BUFFER_PROFILE|ingress_lossless_profile": {
123113
"dynamic_th": "7",
124114
"pool": "ingress_lossless_pool",

tests/db_migrator_input/config_db/reclaiming-buffer-dynamic-single-pool-input.json

+1-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"profile": "NULL"
44
},
55
"BUFFER_PG|Ethernet8|3-4": {
6-
"profile": "customized_ingress_lossless_profile"
6+
"profile": "customized_lossless_profile"
77
},
88
"BUFFER_PG|Ethernet12|0": {
99
"profile": "ingress_lossy_profile"
@@ -51,11 +51,6 @@
5151
"BUFFER_PORT_INGRESS_PROFILE_LIST|Ethernet24": {
5252
"profile_list": "ingress_lossless_profile"
5353
},
54-
"BUFFER_PROFILE|customized_egress_lossless_profile": {
55-
"dynamic_th": "7",
56-
"pool": "egress_lossless_pool",
57-
"size": "0"
58-
},
5954
"BUFFER_PROFILE|egress_lossless_profile": {
6055
"dynamic_th": "7",
6156
"pool": "egress_lossless_pool",
@@ -66,11 +61,6 @@
6661
"pool": "egress_lossy_pool",
6762
"size": "9216"
6863
},
69-
"BUFFER_PROFILE|customized_ingress_lossless_profile": {
70-
"dynamic_th": "7",
71-
"pool": "ingress_lossless_pool",
72-
"size": "0"
73-
},
7464
"BUFFER_PROFILE|ingress_lossless_profile": {
7565
"dynamic_th": "7",
7666
"pool": "ingress_lossless_pool",

0 commit comments

Comments
 (0)