2caca2c00a62ed1093e40fb38bdef86f2cada599
3 (c) 2016 by Manuel Peuster <manuel.peuster@upb.de>
8 from tabulate
import tabulate
13 pp
= pprint
.PrettyPrinter(indent
=4)
15 class ZeroRpcClient(object):
18 self
.c
= zerorpc
.Client()
19 # TODO connect to DCNetwork API
20 #self.c.connect("tcp://127.0.0.1:4242") # TODO hard coded for now. we'll change this later
21 self
.c
.connect("tcp://127.0.0.1:5151")
24 def execute_command(self
, args
):
25 if getattr(self
, args
["command"]) is not None:
26 # call the local method with the same name as the command arg
27 getattr(self
, args
["command"])(args
)
29 print "Command not implemented."
31 def get_rate(self
, args
):
33 r
= self
.c
.monitor_get_rate(
35 args
.get("direction"))
40 parser
= argparse
.ArgumentParser(description
='son-emu network')
43 help="Action to be executed: get_rate")
45 "--vnf_name", "-vnf", dest
="vnf_name",
46 help="vnf name to be monitored")
48 "--direction", "-d", dest
="direction",
49 help="in (ingress rate) or out (egress rate)")
52 print "This is the son-emu monitor CLI."
53 print "Arguments: %s" % str(argv
)
54 args
= vars(parser
.parse_args(argv
))
56 c
.execute_command(args
)