Skip to content

Commit

Permalink
[GCU] Marking fields under BGP_PEER_RANGE, BGP_MONITORS as create-only (
Browse files Browse the repository at this point in the history
sonic-net#2092)

#### What I did
Fixes sonic-net#2029 sonic-net#2062

Changes to fields under BGP_PEER_RANGE, BGP_MONITORS using GCU are not reflected unless each key is deleted and added back. This means the fields are create-only.

#### How I did it
Marked the fields under BGP_PEER_RANGE, BGP_MONITORS as create-only

#### How to verify it
unit-test
  • Loading branch information
ghooo authored Mar 9, 2022
1 parent b00b870 commit 2c56e92
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions generic_config_updater/patch_sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,14 @@ def __init__(self, path_addressing):
["BGP_NEIGHBOR", "*", "local_addr"],
["BGP_NEIGHBOR", "*", "nhopself"],
["BGP_NEIGHBOR", "*", "rrclient"],
["BGP_PEER_RANGE", "*", "*"],
["BGP_MONITORS", "*", "holdtime"],
["BGP_MONITORS", "*", "keepalive"],
["BGP_MONITORS", "*", "name"],
["BGP_MONITORS", "*", "asn"],
["BGP_MONITORS", "*", "local_addr"],
["BGP_MONITORS", "*", "nhopself"],
["BGP_MONITORS", "*", "rrclient"],
],
path_addressing)

Expand Down
33 changes: 33 additions & 0 deletions tests/generic_config_updater/patch_sorter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,28 @@ def test_hard_coded_create_only_paths(self):
"nhopself": "0",
"rrclient": "0"
}
},
"BGP_PEER_RANGE": {
"BGPSLBPassive": {
"ip_range": [
"10.255.0.0/25"
],
"name": "BGPSLBPassive",
"peer_asn": "65543",
"src_address": "10.1.0.32"
}
},
"BGP_MONITORS": {
"5.6.7.8": {
"admin_status": "up",
"asn": "65000",
"holdtime": "180",
"keepalive": "60",
"local_addr": "10.0.0.11",
"name": "BGPMonitor",
"nhopself": "0",
"rrclient": "0"
}
}
}
expected = [
Expand All @@ -1025,6 +1047,17 @@ def test_hard_coded_create_only_paths(self):
"/BGP_NEIGHBOR/10.0.0.57/name",
"/BGP_NEIGHBOR/10.0.0.57/nhopself",
"/BGP_NEIGHBOR/10.0.0.57/rrclient",
"/BGP_PEER_RANGE/BGPSLBPassive/ip_range",
"/BGP_PEER_RANGE/BGPSLBPassive/name",
"/BGP_PEER_RANGE/BGPSLBPassive/peer_asn",
"/BGP_PEER_RANGE/BGPSLBPassive/src_address",
"/BGP_MONITORS/5.6.7.8/asn",
"/BGP_MONITORS/5.6.7.8/holdtime",
"/BGP_MONITORS/5.6.7.8/keepalive",
"/BGP_MONITORS/5.6.7.8/local_addr",
"/BGP_MONITORS/5.6.7.8/name",
"/BGP_MONITORS/5.6.7.8/nhopself",
"/BGP_MONITORS/5.6.7.8/rrclient",
]

actual = self.validator._get_create_only_paths(config)
Expand Down

0 comments on commit 2c56e92

Please sign in to comment.