def main(): """ Check if BGP/OSPF neighbors for an Arista device are ESTABLISHED/FULL. Anything else is CRITICAL """ # print("STARTING TIME " + str(datetime.datetime.now()) + "\n") args = parse_args() my_password = getpass("Password for user allowed to connect to eAPI: ") check_arista = Arista() connection = pyeapi.connect( transport="https", host=args.ip, username=args.username, password=my_password, port=args.port, ) node = Node(connection) if args.protocol == "bgp": check_arista.bgp_status(node, args.hostname) elif args.protocol == "ospf": check_arista.ospf_status(node, args.hostname, 0) else: print("CRITICAL - Command not supported or wrong")
def eapi_conn(request): connection = pyeapi.connect( transport="https", host="0.0.0.0", username="******", password="******", port=9002, ) node = Node(connection) return node
def setUp(self): self.node = Node(None) self.node._running_config = self.config self.mock_config = Mock(name='node.config') self.node.config = self.mock_config self.mock_enable = Mock(name='node.enable') self.node.enable = self.mock_enable self.assertIsNotNone(self.instance) self.instance.node = self.node