Code Monkey home page Code Monkey logo

fcr's People

Contributors

amyreese avatar connernilsen avatar coxley avatar facebook-github-bot avatar florazzz avatar fried avatar itaytamary avatar jermenkoo avatar praihan avatar thatch avatar vitaut avatar yns88 avatar zertosh avatar zpao avatar zsol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fcr's Issues

Ambiguous ERROR messages

This may be a question and not necessary an issue.

I see this error message in the server output:

future: <Task finished coro=<SSHConnection._run_task() done, defined at /Users/bthornto/github/FCR2/venv/lib/python3.6/site-packages/asyncssh/connection.py:366> exception=CancelledError()>
concurrent.futures._base.CancelledError

It doesn't seem to correlate directly to a device failure so I'm not sure what to think of it.

Any clue what it may indicate?

Idea: Provide some common default vendors

The most time consuming part of adopting a new command-runner is defining the interaction between different vendors. This seems quite flexible with FCR except other than test-case examples, there's nothing provided there.

While similar products (trigger or netmiko) may be lacking comparatively in features like client-neutral API, scalability, and configuration, have bundled vendor drivers. I like FCR but feel it will simply be an underused framework until there are community distributed vendor configs to avoid Network Engineers at each company repeating the same wonky regex work. :)

First run

First of all thank you for FCR, it looks great.

A couple comments just testing it out:

I need to change device_info.py, def get_ip from

            if self.check_ip(ip):
                return ip.addr

to

            if self.check_ip(ip):
                return ip

otherwise I would get an error:

    message='run failed: AttributeError("\'str\' object has no attribute \'addr\'",)')

Additionally, the json example has a few errors, I was able to get this working:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#

from fbnet.command_runner.service import FcrServiceBase
from fbnet.command_runner.command_server import CommandServer
from fbnet.command_runner.device_db import BaseDeviceDB
from fbnet.command_runner.device_vendor import DeviceVendors
from fbnet.command_runner.device_info import DeviceInfo, DeviceIP

from fbnet.command_runner.device_db import BaseDeviceDB
from fbnet.command_runner.options import Option

# You will likely get this data from your backend systems.
# But for illustration we will assume this is available in JSON
# format
import json
json_devdata = '''
[
  {"host": "device.company.net", "chassis": "N7000", "ip": ["10.250.255.15"], "role": "switch", "vendor": "cisco_nxos"}
]
'''

class DeviceDB(BaseDeviceDB):

    async def _fetch_device_data(self, name_filter=None, hostname=None):
        '''
        Fetch data from your backend database.

        This sample implementation assumes you have the data in a json format
        '''
        devinfos = json.loads(json_devdata)

        return {self._make_dev(devinfo) for devinfo in devinfos }

    def _make_dev(self, devinfo):
        return DeviceInfo(
            self.service,
            hostname=devinfo['host'],
            username='default',     # typically a user with a bare minimum RO priviledges
            password='passwd',
            pref_ips=devinfo['ip'], # a list of IP addresses in order of preferences
            ip=devinfo['ip'][0],    # the default fallback IP (after exhausting the pref_ips
            vendor_data=self.service.vendors.get(devinfo['vendor']),
            # vendor_data=self.app.vendors.get(devinfo['vendor']),
            role=devinfo['role'],
            ch_model=devinfo['chassis'])

class Vendors(DeviceVendors):
    pass


class FCRService(FcrServiceBase):

    def __init__(self):

        super().__init__("FCR")

        self.vendors = Vendors(self)
        self.device_db = DeviceDB(self)
        self.service = CommandServer(self)


def main():

    service = FCRService()
    service.start()


if __name__ == "__main__":
    main()

thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.