From bfb5bcb7764ad865a9689a8489e1563ad2e8fea2 Mon Sep 17 00:00:00 2001 From: gifrerenom <lluis.gifre@cttc.es> Date: Wed, 11 Dec 2024 13:46:33 +0000 Subject: [PATCH] Service component - gNMI OpenConfig Service Handler: - Corrected link composition in StaticRouteGenerator --- .../l3nm_gnmi_openconfig/StaticRouteGenerator.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/service/service/service_handlers/l3nm_gnmi_openconfig/StaticRouteGenerator.py b/src/service/service/service_handlers/l3nm_gnmi_openconfig/StaticRouteGenerator.py index b315c7f4d..cdc58049d 100644 --- a/src/service/service/service_handlers/l3nm_gnmi_openconfig/StaticRouteGenerator.py +++ b/src/service/service/service_handlers/l3nm_gnmi_openconfig/StaticRouteGenerator.py @@ -72,6 +72,15 @@ class StaticRouteGenerator: added_connection_hops.add(connection_hop) connection_hop_list = filtered_connection_hop_list + # In some cases connection_hop_list first and last items might be internal endpoints of + # devices instead of link endpoints. Filter those endpoints not reaching a new device. + if len(connection_hop_list) > 2 and connection_hop_list[0][0] == connection_hop_list[1][0]: + # same device on first 2 endpoints + connection_hop_list = connection_hop_list[1:] + if len(connection_hop_list) > 2 and connection_hop_list[-1][0] == connection_hop_list[-2][0]: + # same device on last 2 endpoints + connection_hop_list = connection_hop_list[:-1] + num_connection_hops = len(connection_hop_list) if num_connection_hops % 2 != 0: raise Exception('Number of connection hops must be even') if num_connection_hops < 4: raise Exception('Number of connection hops must be >= 4') -- GitLab