mirror of
https://github.com/napalm-automation-community/napalm-vyos.git
synced 2026-09-23 04:31:16 +00:00
Replace _get_value with dict.get usage
This commit is contained in:
@@ -327,17 +327,12 @@ class VyOSDriver(NetworkDriver):
|
|||||||
ifaces_detail = config["interfaces"][iface_type]
|
ifaces_detail = config["interfaces"][iface_type]
|
||||||
|
|
||||||
for iface_name in ifaces_detail:
|
for iface_name in ifaces_detail:
|
||||||
description = self._get_value("description", ifaces_detail[iface_name])
|
details = ifaces_detail[iface_name]
|
||||||
if description is None:
|
description = details.get("description", "")
|
||||||
description = ""
|
speed = details.get("speed", "0")
|
||||||
speed = self._get_value("speed", ifaces_detail[iface_name])
|
|
||||||
if speed is None:
|
|
||||||
speed = 0
|
|
||||||
if speed == "auto":
|
if speed == "auto":
|
||||||
speed = 0
|
speed = 0
|
||||||
hw_id = self._get_value("hw-id", ifaces_detail[iface_name])
|
hw_id = details.get("hw-id", "00:00:00:00:00:00")
|
||||||
if hw_id is None:
|
|
||||||
hw_id = "00:00:00:00:00:00"
|
|
||||||
|
|
||||||
is_up = (iface_state[iface_name]["Link"] == "u")
|
is_up = (iface_state[iface_name]["Link"] == "u")
|
||||||
is_enabled = (iface_state[iface_name]["State"] == "u")
|
is_enabled = (iface_state[iface_name]["State"] == "u")
|
||||||
@@ -355,13 +350,6 @@ class VyOSDriver(NetworkDriver):
|
|||||||
|
|
||||||
return iface_dict
|
return iface_dict
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _get_value(key, target_dict):
|
|
||||||
if key in target_dict:
|
|
||||||
return target_dict[key]
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_arp_table(self, vrf=""):
|
def get_arp_table(self, vrf=""):
|
||||||
# 'age' is not implemented yet
|
# 'age' is not implemented yet
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user