Skip to content
Open
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
23 changes: 23 additions & 0 deletions src/sampleShelldriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,26 @@ def example_command_with_cancellation(self, context, cancellation_token, user_pa
# private functions are always hidden
def _helper_method(self,title):
return "---====%s====---" % title

def get_inventory(self, context):
"""
:type context: cloudshell.shell.core.driver_context.AutoLoadCommandContext
"""
# example autoload return results
resources = [AutoLoadResource('Generic Chassis', 'Chassis 1', '1'),
AutoLoadResource('Generic Module', 'Module 1', '1/1'),
AutoLoadResource('Generic Port', 'Port 1', '1/1/1')]

attributes = [
AutoLoadAttribute('', 'Location', 'Santa Clara Lab'),
AutoLoadAttribute('', 'Model', 'Catalyst 3850'),
AutoLoadAttribute('', 'Vendor', 'Cisco'),
AutoLoadAttribute('1', 'Serial Number', 'JAE053002JD'),
AutoLoadAttribute('1', 'Model', 'WS-X4232-GB-RJ'),
AutoLoadAttribute('1/1', 'Model', 'WS-X4233-GB-EJ'),
AutoLoadAttribute('1/1', 'Serial Number', 'RVE056702UD'),
AutoLoadAttribute('1/1/1', 'IPv4 Address', '192.168.10.7')
]

result = AutoLoadDetails(resources, attributes)
return result