[FRR] fix pfx_filter to fix bgpd.conf.j2 rendering when no vlan interfaces (#2994)
This commit is contained in:
parent
f5f7fb38b8
commit
383fc0fa4b
@ -6,9 +6,9 @@ minigraph file, config DB, json file(s), yaml files(s), command line input,
|
|||||||
and write the data into DB, print as json, or render a jinja2 config template.
|
and write the data into DB, print as json, or render a jinja2 config template.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
Render template with minigraph:
|
Render template with minigraph:
|
||||||
sonic-cfggen -m -t /usr/share/template/bgpd.conf.j2
|
sonic-cfggen -m -t /usr/share/template/bgpd.conf.j2
|
||||||
Dump config DB content into json file:
|
Dump config DB content into json file:
|
||||||
sonic-cfggen -d --print-data > db_dump.json
|
sonic-cfggen -d --print-data > db_dump.json
|
||||||
Load content of json file into config DB:
|
Load content of json file into config DB:
|
||||||
sonic-cfggen -j db_dump.json --write-to-db
|
sonic-cfggen -j db_dump.json --write-to-db
|
||||||
@ -93,6 +93,10 @@ def pfx_filter(value):
|
|||||||
For eg - VLAN_INTERFACE|Vlan1000 vs VLAN_INTERFACE|Vlan1000|192.168.0.1/21
|
For eg - VLAN_INTERFACE|Vlan1000 vs VLAN_INTERFACE|Vlan1000|192.168.0.1/21
|
||||||
"""
|
"""
|
||||||
table = OrderedDict()
|
table = OrderedDict()
|
||||||
|
|
||||||
|
if not value:
|
||||||
|
return table
|
||||||
|
|
||||||
for key,val in value.items():
|
for key,val in value.items():
|
||||||
if not isinstance(key, tuple):
|
if not isinstance(key, tuple):
|
||||||
continue
|
continue
|
||||||
@ -104,7 +108,7 @@ class FormatConverter:
|
|||||||
We will move to DB schema and remove this class when the config templates are modified.
|
We will move to DB schema and remove this class when the config templates are modified.
|
||||||
|
|
||||||
TODO(taoyl): Current version of config db only supports BGP admin states.
|
TODO(taoyl): Current version of config db only supports BGP admin states.
|
||||||
All other configuration are still loaded from minigraph. Plan to remove
|
All other configuration are still loaded from minigraph. Plan to remove
|
||||||
minigraph and move everything into config db in a later commit.
|
minigraph and move everything into config db in a later commit.
|
||||||
"""
|
"""
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -214,7 +218,7 @@ def main():
|
|||||||
|
|
||||||
for yaml_file in args.yaml:
|
for yaml_file in args.yaml:
|
||||||
with open(yaml_file, 'r') as stream:
|
with open(yaml_file, 'r') as stream:
|
||||||
additional_data = yaml.load(stream)
|
additional_data = yaml.load(stream)
|
||||||
deep_update(data, FormatConverter.to_deserialized(additional_data))
|
deep_update(data, FormatConverter.to_deserialized(additional_data))
|
||||||
|
|
||||||
for json_file in args.json:
|
for json_file in args.json:
|
||||||
@ -223,7 +227,7 @@ def main():
|
|||||||
|
|
||||||
if args.additional_data != None:
|
if args.additional_data != None:
|
||||||
deep_update(data, json.loads(args.additional_data))
|
deep_update(data, json.loads(args.additional_data))
|
||||||
|
|
||||||
if args.from_db:
|
if args.from_db:
|
||||||
configdb = ConfigDBConnector(**db_kwargs)
|
configdb = ConfigDBConnector(**db_kwargs)
|
||||||
configdb.connect()
|
configdb.connect()
|
||||||
|
Loading…
Reference in New Issue
Block a user