{"id":33182764,"url":"https://github.com/ios-xr/Solenoid","last_synced_at":"2025-11-20T22:00:57.483Z","repository":{"id":97952867,"uuid":"68959140","full_name":"ios-xr/Solenoid","owner":"ios-xr","description":"App that injects routes directly into Cisco's IOS-XR RIB table.","archived":true,"fork":false,"pushed_at":"2020-04-21T17:59:54.000Z","size":731,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-06-24T10:32:48.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ios-xr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-09-22T20:21:00.000Z","updated_at":"2023-01-28T14:55:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5127325-e645-469c-b509-8102546c86a3","html_url":"https://github.com/ios-xr/Solenoid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ios-xr/Solenoid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ios-xr%2FSolenoid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ios-xr%2FSolenoid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ios-xr%2FSolenoid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ios-xr%2FSolenoid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ios-xr","download_url":"https://codeload.github.com/ios-xr/Solenoid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ios-xr%2FSolenoid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285519539,"owners_count":27185526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T04:00:30.750Z","updated_at":"2025-11-20T22:00:57.477Z","avatar_url":"https://github.com/ios-xr.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Examples"],"readme":"** This project is no longer being maintained, please use at your own discretion! **\n# Solenoid\n### Route Injection Agent\n\n##### Author: Lisa Roach \u0026 Karthik Kumaravel\n##### Contact: Please use the Issues page to ask questions or open bugs and feature requests. \n\n\n## Description:\n\nSolenoid takes a third-party BGP protocol and sends the BGP updates to Cisco's RIB table on the IOS-XR devices, allowing for increased flexibility over the BGP protocols used on the box.\n\nThe changes to the RIB are accomplished by using [gRPC](http://www.grpc.io/) calls to send JSON modeled by YANG. The YANG model currently in use is [Cisco-IOS-XR-ip-static-cfg] (https://github.com/YangModels/yang/blob/master/vendor/cisco/xr/600/Cisco-IOS-XR-ip-static-cfg.yang), see [Current Limitations](#current-limitations) for more information.\n\n[exaBGP] (https://github.com/Exa-Networks/exabgp) is used for reading BGP updates. exaBGP is a tool for monitoring BGP network announcements, withdrawals, etc. and it triggers the gRPC changes based on these updates. \n\nPlease refer to the [Wiki](https://github.com/ios-xr/Solenoid/wiki) for further documentation.\n\n#### Current Limitations:\n\nAs of now, the IOS-XR does not support YANG models that can add true BGP or Application routes to the RIB table. As a workaround, static routes are added instead. Be aware of the limits of static routes before using this application.\n\n\nRESTconf is not available on public images of the IOS-XR 6.X. If you are interested in testing RESTconf, please reach out to your Cisco account team or contact Lisa Roach directly.\n\n### Vagrant:\n\nFor an easy Solenoid-in-a-box demonstration, please refer to the [vagrant](https://github.com/ios-xr/Solenoid/tree/master/vagrant) directory. Here you will be able to download a fully functional vagrant environment that has Solenoid up and running already. \n\n### Usage:\nCheck the out [XR-Docs](https://xrdocs.github.io/application-hosting/tutorials/2016-09-28-solenoid-inject-routes-into-cisco-s-rib-table-using-grpc/) tutorial for a walkthrough of setting up a Solenoid LXC and playing with the demo.\n\nThis installation and testing process (minus the integration tests) can run in any Linux environment. To fully use the application, it must be connected to a running IOS-XR 6.1+ device. It is recommended that Solenoid be run in an LXC on the IOS-XR you wish to control, see [Creating a Solenoid LXC tarball](https://github.com/ios-xr/Solenoid/wiki/Create-your-own-Solenoid-LXC-tarball) for information about creating your own LXC.\n\nStep 1: Clone this repo and cd into Solenoid.\n\nStep 2: It is highly recommended you install and use a [virtualenv](https://virtualenv.pypa.io/en/stable/).\n\n```\npip install virtualenv\n\nvirtualenv venv\n\nsource venv/bin/activate\n```\n\nStep 3: Install gRPC (if you are using gRPC). Note: if you experience errors at this step and are not using a virtualenv, we encourage reconsidering using virtualenv. It often makes these problems go away. Otherwise, please consult [grpcio documentation](https://pypi.python.org/pypi/grpcio) for assistance.\n\n`pip install grpcio`\n\nStep 4: Install Solenoid.\n\n```python setup.py install```\n\nStep 5 : Create a solenoid.config file in your top-level solenoid directory and fill in the values in the key:value pair. Please refer to the Config File section of the wiki for more information.\n\n```\n[default]\ntransport: transport  # Either gRPC or RESTconf\nip: ip_address        # IP address of the destination RIB table (the XR device you intend to control)\nport: port number     # Depends on what is configured for your gRPC or RESTconf servers\nusername: username    # Username for the router\npassword: password    # Password for the router\n```\n\nExample:\n\n```\n[IOS-XRv]\ntransport: gRPC\nip: 192.168.1.2\nport: 57777\nusername: vagrant\npassword: vagrant\n```\n\nStep 6 (optional): Create a filter.txt file to include the ranges of prefixes to be filtered with. This is a whitelist of prefixes, so all of these will be accepted and all others will be dropped. Single prefixes are also acceptable. Example:\n\n```\n1.1.1.0/32-1.1.2.0/32\n10.1.1.0/32-10.1.5.0/32\n10.1.1.6/32\n192.168.1.0/28-192.168.2.0/28\n```\n\nStep 7: Set up [exaBGP] (https://github.com/Exa-Networks/exabgp). Form a neighborship with your BGP network.\n\nStep 8: Change your exaBGP configuration file to run the edit_rib.py script. The important part is the process monitor-neighbors section, the rest is basic exaBGP configuration.\n\n\nExample:\n\n```\ngroup test {\n        router-id x.x.x.x;\n\n        process monitor-neighbors {\n            encoder json;\n            receive {\n                parsed;\n                updates;\n                neighbor-changes;\n            }\n            run /your/python/location /path/to/solenoid/solenoid/edit_rib.py;\n        }\n\n        neighbor y.y.y.y {\n            local-address x.x.x.x;\n            local as ####;\n            peer-as ####;\n        }\n\n}\n\n```\n\nIf you chose to add a filter file, you must add the path to the file in the run call with the file flag -f (be sure to include the quotes):\n\n```\nrun /your/python/location /path/to//solenoid/solenoid/edit_rib.py -f '/path/to/filter/file';\n```\n\nStep 9: Launch your exaBGP instance. You should see the syslog HTTP status codes if it is successful.\n\n###Testing\n\nIn order to run the full suite of unit tests, ensure that grpcio is installed. Run the tests with the following command from the Solenoid/ directory:\n\n```\npython -m unittest discover solenoid.tests.mock\n```\n\nIf you only wish to use RESTconf and will not be testing the gRPC code, feel free to run the following individual tests:\n\n```\npython -m unittest solenoid.tests.mock.test_rib_rest\n\npython -m unittest solenoid.tests.mock.test_rib_general\n```\n\nThe following is expected output from the unit tests:\n\n```\npython -m unittest discover solenoid.tests.mock\n............................\n----------------------------------------------------------------------\nRan 28 tests in 0.042s\n\nOK\n```\n\nIf you recieve the final status of 'OK' you are good to go!\n\nTo run integration testing, run the following command from the Solenoid/ directory. **CAUTION This will make changes to your router's RIB table! Do not run this code in a production environment!**\n\nFor these tests to run, you must provide a properly formatted solenoid.config file, as described in step 3, and ensure that no other instance of Solenoid is currently running.\n\n```\npython -m unittest discover solenoid.tests.integration\n```\n\nExpected output:\n\n```\npython -m unittest discover solenoid.tests.integration\nThu, 01 Sep 2016 22:21:41 | INFO     | 19738  | solenoid      | ANNOUNCE | OK\n.Thu, 01 Sep 2016 22:21:41 | INFO     | 19738  | solenoid      | WITHDRAW | OK\n.Thu, 01 Sep 2016 22:21:42 | INFO     | 19738  | solenoid      | ANNOUNCE | OK\n.Thu, 01 Sep 2016 22:21:42 | INFO     | 19738  | solenoid      | WITHDRAW | OK\n.Thu, 01 Sep 2016 22:21:42 | INFO     | 19738  | solenoid      | EOR message\n.\n----------------------------------------------------------------------\nRan 5 tests in 0.890s\n\nOK\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fios-xr%2FSolenoid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fios-xr%2FSolenoid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fios-xr%2FSolenoid/lists"}