Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # ---------------------------------------------------------------------
- # InfiNet.WANFlexX.get_lldp_neighbors
- # ---------------------------------------------------------------------
- # Copyright (C) 2007-2017 The NOC Project
- # See LICENSE for details
- # ---------------------------------------------------------------------
- # Python modules
- import re
- # NOC modules
- from noc.core.script.base import BaseScript
- from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors
- from noc.lib.validators import is_int, is_ipv4, is_ipv6, is_mac
- from noc.sa.interfaces.base import MACAddressParameter, IPv4Parameter
- class Script(BaseScript):
- name = "InfiNet.WANFlexX.get_lldp_neighbors"
- interface = IGetLLDPNeighbors
- rx_chassis_id = re.compile(
- r"ChassisID: \|\s*(?P<id>\S+)", re.MULTILINE | re.IGNORECASE)
- def execute(self):
- v = self.cli("lldp report")
- match = self.rx_chassis_id.search(v)
- if match:
- lldp = match.group("id")
- return lldp
- else:
- raise self.UnexpectedResultError()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement