Support looking up named route table in routing rule

The user may need to define the named route table in the routing rule
besides the table id, add support for that.

The commit fixes
https://github.com/linux-system-roles/network/issues/506.

Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2022-09-22 13:38:44 -04:00 committed by Fernando Fernández Mancera
parent f5a01f94bf
commit cfbd14cd8a
4 changed files with 81 additions and 2 deletions

View file

@ -2336,7 +2336,10 @@ class ArgValidator_ListConnections(ArgValidatorList):
VALIDATE_ONE_MODE_INITSCRIPTS = "initscripts"
def validate_route_tables(self, connection, idx):
for r in connection["ip"]["route"]:
rule_route_combined_list = (
connection["ip"]["route"] + connection["ip"]["routing_rule"]
)
for r in rule_route_combined_list:
if isinstance(r["table"], Util.STRING_TYPE):
mapping = IPRouteUtils.get_route_tables_mapping()
if r["table"] in mapping: