Commit bfb5bcb7 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component - gNMI OpenConfig Service Handler:

- Corrected link composition in StaticRouteGenerator
parent 76292e00
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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')