Coder Social home page Coder Social logo

fbpush's Introduction

fbpush

fbpush is a CLI tool to push config files to Juniper network devices.

Requirements

fbpush requires or works with

  • Mac OS X or Linux
  • Python 2.6.* or 2.7.*

Installation

  • Clone the project from the github repository

    • git clone https://github.com/facebook/fbpush.git
  • Go to the Project Directory install using setup.py

    • sudo python setup.py install
  • The sample config files are stored in /var/lib/fbpush/config .

    • devices.json contains the network device details
    • configuration.json contians the config variables
    • The default directory can be changed by passing --config-dir='/path/to/directory'
  • The devices.json contains a list of device details dictonary. The attributes currently supported out of box are:

    • "name" : name of the device
    • "vendor" : name of the device vendor
    • "location" : location of the device
    • "ip" : ip of the device
  • Adding new attributes to the above list is easy, just change the OPTION_ATTRS in configuration.json and add the same to devices.json.

  • The configuration.json contains a list of configuration variables for the fbpush tool.

fbpush is now ready to use.

How to use fbpush

  • Prepare the config files
    • A sample config file could look like (if you are lazy one can be found in home directory too with name sample.conf)-
      /* $Id:$ name: <device_name>; vendors: juniper */
      /* Generated by <user> at Thu May  7 00:27:28 2015, apply with fbpush or "load replace terminal" */
      groups {
          <user>-TEST {
              }
      }
      
    • Replace the <device_name> and the <user> in the above and the sample.conf is ready to test.
  • Dry Run is currently compulsory (unless the --clowntown flag is set).
    • $ fbpush -n sample.conf
  • After dry run is succesful user should review the diff files. If the diff file looks correct conduct the actual push using
    • $ fbpush sample.conf

Full documentation

The following options are provided by the command line parser of fbpush. -

Options:

-h, --help                                                          Display the Help Message   
--names=NAMES                                                       Filter the devices based on name,    
--vendors=VENDORS                                                   Filter based on vendors,     
--locations=LOCATIONS                                               Filter based on locations, 

--name_regex=NAME_REGEX                                             Regex filter based on names,   
--vendor_regex=VENDOR_REGEX                                         Regex filter based on vendors,
--location_regex=LOCATION_REGEX                                     Regex filter based on locations,   

--exclude_name_regex=EXCLUDE_NAME_REGEX                             Exclude regex filter based on names,   
--exclude_vendor_regex=EXCLUDE_VENDOR_REGEX                         Exclude regex filter based on vendors, 
--exclude_location_regex=EXCLUDE_ROLE_REGEX                         Exclude regex filter based on locations, 

--config-dir=/path/to/config/dir                                    Use it if the config files reside in some other directory than default directory,
-u USERNAME, --user=USERNAME                                        Username to be used to login to the network device (Optional Unix Username by default)  
-p PASSWORD, --pass=PASSWORD                                        Password for the above User
-c CONFIRMED_IN, --confirmed_in=CONFIRMED_IN    
-r ROLLBACK_IN, --rollback_in=ROLLBACK_IN  
-a, --atomic                                                        All or nothing  
-f, --force                                                         Force the config files into network device without dry run.
--gen_md5                                                           Generate the md5 hash for the config run
-n, --dry_run                                                       Giver dry run to the config file without really changing anything
-m, --multiple_diffs  
-x, --xml  
-d DIFF_DIR, --diff_dir=DIFF_DIR  
--stdin  
--color  
--clowntown  
--xml_debug  
--full_comments                                                     Dont't filter out the comments from the config files
--no_commit_full  

NOTE : All the regex based filters are pythonic regex.

Running Tests

  • The tests can be run via setup.py using:
    • sudo python setup.py test

License

fbpush is BSD-licensed. We also provide an additional patent grant.

fbpush's People

Contributors

orthographic-pedant avatar penguinraider avatar starskywongfb 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

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

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.