[minigraph]: Do not fail for minigraphs which do not have neighbors listed in <Devices> section (#2522)

Signed-off-by: Nadiya.Stetskovych <nstetskovych@barefootnetworks.com>
This commit is contained in:
Nadiia Stetskovych 2019-02-05 08:43:08 +02:00 committed by lguohan
parent 1cc6afc9a9
commit bb5a171ffc

View File

@ -40,7 +40,7 @@ def
{%- set cable_len = [] %}
{%- for local_port in DEVICE_NEIGHBOR %}
{%- if local_port == port_name %}
{%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- if DEVICE_NEIGHBOR_METADATA is defined and DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] %}
{%- set neighbor_role = neighbor.type %}
{%- set roles1 = switch_role + '_' + neighbor_role %}