Coder Social home page Coder Social logo

pysros's Introduction

Python 3 for Nokia Service Router Operating System (pySROS)

Overview

The pySROS libraries provide a model-driven management interface for Python developers to integrate with supported Nokia routers running the Service Router Operating System (SR OS).

The libraries provide an Application Programming Interface (API) for developers to create applications that can interact with Nokia SR OS devices, whether those applications are executed from a development machine or directly on the router.

When a developer uses only libraries and constructs supported on SR OS, a single application may be executed from a development machine or ported directly to an SR OS node where the application is executed.

Pre-requisites

In order to use the pySROS library the following pre-requisites must be met:

  • One or more SR OS node
    • Running in model-driven mode
    • Running SR OS 21.7.R1 or greater (to execute applications on the SR OS device)
    • With NETCONF enabled and accessible by an authorized user (to execute applications remotely)
  • A Python 3 interpreter of version 3.10 or newer when using the pySROS library to execute applications remotely

License

Copyright 2021-2024 Nokia.

The license is located here.

Reporting issues

Issues, suggestions, and enhancements are welcome. Please use the Nokia support process. Issues raised in GitHub may be considered for inclusion into the project by Nokia. Pull requests are not accepted.

Installation

Multiple installation methods are available:

Note: It is recommended to use Python virtual environments where appropriate.

PyPi

The preferred method of installation of the pySROS libraries is to install directly from the Python Package index (PyPi) using the pip tool.

The pySROS project is located on PyPi.org.

The libraries can be downloaded and installed by using the following:

pip install pysros

To upgrade to the latest release use:

pip install --upgrade pysros

Nokia support portal

The pySROS libraries are available for download from the portal for registered customers.

The obtained file can be unzipped and subsequently installed using:

python3 setup.py install

GitHub

The pySROS libraries are available for download from GitHub.

The obtained file can be installed using:

git clone https://github.com/nokia/pysros
python3 setup.py install

Documentation and examples

Guidance documentation is available in the SR OS System Management Guide.

API documentation is provided in this repository and may be compiled from source using:

cd docs
pip3 install -r requirements.txt
make html

The built documentation will be available in the docs/build/html directory.

Alternative formats may be selected after the make command instead of the html attribute. Some of these include:

  • singlehtml
  • man
  • text

Further reading and assistance

pysros's People

Contributors

csatarigergely 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pysros's Issues

lxml dependency

When installing pysros on Win10, theres a lxml dependency which sometimes gives an error when trying to install.

The way around it for me was to download lxml version 4.9.0 for python 3.11 here and change the requirements.txt and setup.py files to support lxml version 4.9.0.

Set empty leaf

It seems that there is a problem setting empty leaf like in CPM actions:
example:
Container({'entry-id': Leaf(1195), 'description': Leaf('TWAMP_LIGHT_ALLOW_FOR_P2P'), 'match': Container({'protocol': Leaf('udp'), 'src-ip': Container({'ip-prefix-list': Leaf('prefix-p2p-backbone')}), 'src-port': Container({'eq': Leaf(862)})}), 'action': Container({'accept': Leaf(Empty)})})

The highlighted part always fail as "Invalid value"

Commit Comment

Is there a way to specify a commit comment using the commit() function?

Thanks

Unable to establish connection without known_hosts file

Hello,
I faced an issue that I cannot connect to the router with pySROS without checking SSH key. Connection fails with this message:
RuntimeError: Cannot create connection - Unknown host key [omitted] for [ip.add.re.ss] as I do not have known_hosts file.
Tried to add 'hostkey_verify=False' as a parameter to connect() function, but it didn't work: TypeError: connect() got an unexpected keyword argument 'hostkey_verify'
Looks like adding 'hostkey_verify=False' to Connection object here solves the issue.
Could you please implement that?

Some info about the setup:
python3.6
pysros==21.7.2
router IXR7250-e 21.7.R1
host "CentOS Linux 7 (Core)"

Add option to use SSH Tunnels

Scenario
In my team's setup we use virtualized routers and connect to them using the hypervisors (Ubuntu) as jump hosts for SSH tunneling. We have used ncclient in the past and relied on it working with SSH Tunnels configured in ~/.ssh/config. This is currently not possible with pySROS though it could be.

Proposed change
Modify the definition of management::connect

def connect(*, host, port=830, username, password, yang_directory=None,

and the creation of a Connection object therein

return Connection(host=host, port=port, username=username, password=password,

to allow for an optional parameter ssh_config that is passed to the ncclient manager via the Connection constructor and set to None by default. If None, this parameter will change nothing. If this parameter is True, the ncclient will use a platform-specific value as an SSH configuration file. If set to a path, the file located at this path will be used by ncclient instead.

Advantages
It is a relatively small change and allows flexibility for users to use, test and develop scripts using pySROS through SSH tunnels.

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.