次の内容(ホスト)を持つ(postgres)SQLテーブルがあります。
ip_address | mac_address | hostname | device | physical_port
----------------+----------------+----------+--------+---------------
111.111.111.111 | aaaa.aaaa.aaaa | hosta | swh-a | Gi1/1
111.111.111.112 | bbbb.bbbb.bbbb | hostb | swh-b | Gi2/1
111.111.111.113 | cccc.cccc.cccc | hostc | swh-c | Gi3/1
テーブル間のポイントツーポイント リンクを含む別のテーブル (ピア) がありdevices
ます。
device | physical_port | peer_device | peer_physical_port
-------+---------------+-------------+----------------------+
swh-a | Gi1/20 | swh-b | Gi2/1
swh-b | Gi2/1 | swh-a | Gi1/20
swh-b | Gi2/1 | swh-c | Gi3/1
swh-c | Gi3/1 | swh-b | Gi2/1
基本的に、Peers テーブルに含まれる Hosts テーブルからエントリを除外して、次のようにします。
ip_address | mac_address | hostname | device | physical_port
----------------+----------------+----------+--------+---------------
111.111.111.111 | aaaa.aaaa.aaaa | hosta | swh-a | Gi1/1
(その場合、 Peers テーブル内に存在します) device=swh-b physical_port=Gi2/1
。device=swh-c physical_port=Gi3/1