diff --git a/README.rst b/README.rst index 7a69727..2e53f67 100644 --- a/README.rst +++ b/README.rst @@ -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 `__ +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 ----------- @@ -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 diff --git a/examples/print-netim-devices-raw.py b/examples/print-netim-devices-raw.py new file mode 100644 index 0000000..311908f --- /dev/null +++ b/examples/print-netim-devices-raw.py @@ -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() +