-
Notifications
You must be signed in to change notification settings - Fork 1
/
netsim_manager.py
executable file
·75 lines (62 loc) · 1.56 KB
/
netsim_manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/python3
from netsim_manager.manager import NetsimManager
import click
@click.group('cli')
@click.pass_context
@click.version_option()
def cli(ctx):
ctx.obj = NetsimManager()
@cli.command('init')
@click.pass_context
def init(ctx):
"""Initialize netsim network"""
ctx.obj.initialize_network()
@cli.command('onboard')
@click.pass_context
def onboard(ctx):
"""Onboard netsim devices on running NSO instance"""
ctx.obj.onboard()
@cli.command('load')
@click.pass_context
def load(ctx):
"""Load day0 config for netsim devices"""
ctx.obj.load()
@cli.command('save')
@click.pass_context
def save(ctx):
"""Save current config as day0 for devices"""
ctx.obj.save()
@cli.command('list')
@click.pass_context
def list_devices(ctx):
"""List existing devices on current netsim managed instance"""
ctx.obj.list_devices()
@cli.command('start')
@click.pass_context
def start(ctx):
"""Start current netsim instance"""
ctx.obj.start()
@cli.command('stop')
@click.pass_context
def stop(ctx):
"""Stop current netsim instance"""
ctx.obj.stop()
@cli.command('remove')
@click.pass_context
def remove(ctx):
"""Removes devices from running NSO instance"""
ctx.obj.remove()
@cli.command('delete')
@click.pass_context
def delete(ctx):
"""Removes devices from running NSO instance"""
ctx.obj.delete()
@cli.command('get-settings')
@click.pass_context
def get_settings(ctx):
"""Removes devices from running NSO instance"""
ctx.obj.print_settings()
def main():
cli(prog_name="cli")
if __name__ == '__main__':
main()