Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example #3

Merged
merged 2 commits into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ with Riverbed appliances and solutions, and other network infrastructure devices

As part of the Riverbed SteelScript this module provides specific bindings for `Riverbed NetIM <https://www.riverbed.com/netim>`__

Quick start
-----------

.. code:: shell

# Build a docker image from latest code
docker build --tag steelscript:latest https://github.com/riverbed/steelscript.git

# Run the image in an interactive container
docker run -it steelscript:latest /bin/bash

# Replace the tokens {...} with actual values
python print-netim-devices-raw.py {NetIM Core fqdn or ip} --username {username} -password {password}

Contribute
-----------

Expand All @@ -21,7 +35,7 @@ Links
License
=======

Copyright (c) 2020 Riverbed Technology, Inc.
Copyright (c) 2021 Riverbed Technology, Inc.

SteelScript is licensed under the terms and conditions of the MIT License
accompanying the software ("License"). SteelScript is distributed "AS
Expand Down
54 changes: 54 additions & 0 deletions examples/print-netim-devices-raw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python
'''
' Riverbed Community SteelScript
'
' print-netim-devices-raw.py
'
' Encoding: UTF8
' End of Line Sequence: LF
'
' Description
'
' Print the list of the devices of the Device Manager in NetIM
'
' Usage:
'
' python print-netim-devices-raw.py {NetIM Core fqdn or ip} --username {username} -password {password}
''
' Usage:
'
' python print-netim-devices-raw.py 10.10.10.148 --username api --password password
'
' Copyright (c) 2021 Riverbed Technology, Inc.
' This software is licensed under the terms and conditions of the MIT License accompanying the software ("License"). This software is distributed "AS IS" as set forth in the License.
'''

#!/usr/bin/env python
from steelscript.common.app import Application
from steelscript.common.service import Service, UserAuth
from steelscript.netim.core.device import Device
import pprint

class SteelScriptApp(Application):
def add_positional_args(self):
self.add_positional_arg('host','NetIM Core fqdn or IP address')

def add_options(self, parser):
super(SteelScriptApp, self).add_options(parser)
self.add_standard_options()

def main(self):
host=(self.options.host)
username=(self.options.username)
password=(self.options.password)
auth = UserAuth(username=username, password=password)

netim_device = Device(host, auth)

device_list = netim_device.get_all_devices()

pprint.pprint(device_list)

if __name__ == '__main__':
SteelScriptApp().run()