Skip to content

Commit 873f8c3

Browse files
authored
Merge branch 'master' into dev/mghoneim/groupings
2 parents 21b748e + 1723206 commit 873f8c3

8 files changed

Lines changed: 3181 additions & 44 deletions

File tree

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ stages:
2020
- job:
2121
displayName: "Python3"
2222
variables:
23-
DIFF_COVER_CHECK_THRESHOLD: 0
23+
DIFF_COVER_CHECK_THRESHOLD: 50
2424
DIFF_COVER_ENABLE: 'true'
2525
pool:
2626
vmImage: ubuntu-20.04

config/vlan.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ def add_vlan(db, vid):
2424
ctx.fail("Invalid VLAN ID {} (1-4094)".format(vid))
2525

2626
vlan = 'Vlan{}'.format(vid)
27+
28+
if vid == 1:
29+
ctx.fail("{} is default VLAN".format(vlan))
30+
2731
if clicommon.check_if_vlanid_exist(db.cfgdb, vlan):
2832
ctx.fail("{} already exists".format(vlan))
2933

generic_config_updater/gu_common.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ def create_path(self, tokens):
273273
return JsonPointer.from_parts(tokens).path
274274

275275
def has_path(self, doc, path):
276-
return JsonPointer(path).get(doc, default=None) is not None
276+
return self.get_from_path(doc, path) is not None
277+
278+
def get_from_path(self, doc, path):
279+
return JsonPointer(path).get(doc, default=None)
280+
281+
def is_config_different(self, path, current, target):
282+
return self.get_from_path(current, path) != self.get_from_path(target, path)
277283

278284
def get_xpath_tokens(self, xpath):
279285
"""
@@ -558,7 +564,8 @@ def _get_xpath_tokens_from_leaf(self, model, token_index, path_tokens, config):
558564
if uses_leaf_model:
559565
return [token]
560566

561-
raise ValueError("Token not found")
567+
raise ValueError(f"Path token not found.\n model: {model}\n token_index: {token_index}\n " + \
568+
f"path_tokens: {path_tokens}\n config: {config}")
562569

563570
def _extractKey(self, tableKey, keys):
564571
keyList = keys.split()
@@ -729,7 +736,8 @@ def _get_path_tokens_from_leaf(self, model, token_index, xpath_tokens, config):
729736
if uses_leaf_model:
730737
return [token]
731738

732-
raise Exception("no leaf")
739+
raise ValueError(f"Xpath token not found.\n model: {model}\n token_index: {token_index}\n " + \
740+
f"xpath_tokens: {xpath_tokens}\n config: {config}")
733741

734742
def _extract_key_dict(self, list_token):
735743
# Example: VLAN_MEMBER_LIST[name='Vlan1000'][port='Ethernet8']

generic_config_updater/patch_sorter.py

Lines changed: 355 additions & 39 deletions
Large diffs are not rendered by default.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"PORT": {
3+
"Ethernet4": {
4+
"admin_status": "up",
5+
"alias": "fortyGigE0/4",
6+
"description": "Servers0:eth0",
7+
"index": "1",
8+
"lanes": "29,30,31,32",
9+
"mtu": "9100",
10+
"pfc_asym": "off",
11+
"speed": "40000"
12+
},
13+
"Ethernet8": {
14+
"admin_status": "up",
15+
"alias": "fortyGigE0/8",
16+
"description": "Servers1:eth0",
17+
"index": "2",
18+
"lanes": "33,34,35,36",
19+
"pfc_asym": "off",
20+
"speed": "40000"
21+
},
22+
"Ethernet12": {
23+
"admin_status": "down",
24+
"alias": "fortyGigE0/12",
25+
"description": "Servers2:eth0",
26+
"index": "3",
27+
"lanes": "37,38,39,40",
28+
"mtu": "9100",
29+
"pfc_asym": "off",
30+
"speed": "40000"
31+
},
32+
"Ethernet16": {
33+
"alias": "fortyGigE0/16",
34+
"description": "Servers3:eth0",
35+
"index": "4",
36+
"lanes": "41,42,43,44",
37+
"pfc_asym": "off",
38+
"speed": "40000"
39+
}
40+
},
41+
"BUFFER_PG": {
42+
"Ethernet4|0": {
43+
"profile": "ingress_lossy_profile"
44+
},
45+
"Ethernet12|0": {
46+
"profile": "ingress_lossy_profile"
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)