add rest api for network and monitoring
diff --git a/src/emuvim/cli/rest/__init__.py b/src/emuvim/cli/rest/__init__.py
old mode 100644
new mode 100755
diff --git a/src/emuvim/cli/rest/compute.py b/src/emuvim/cli/rest/compute.py
old mode 100644
new mode 100755
index bdef0ec..29e65dc
--- a/src/emuvim/cli/rest/compute.py
+++ b/src/emuvim/cli/rest/compute.py
@@ -27,19 +27,20 @@
                'command':args.get("docker_command"),
                'network':nw_list}
 
-        responce = put("%s/restapi/compute/%s/%s/start" %
+        response = put("%s/restapi/compute/%s/%s/start" %
                        (args.get("endpoint"),
                         args.get("datacenter"),
                         args.get("name")),
                        json = json.dumps(req))
-        pp.pprint(responce.json())
+        pp.pprint(response.json())
+
     def stop(self, args):
 
-        responce = get("%s/restapi/compute/%s/%s/stop" %
+        response = get("%s/restapi/compute/%s/%s/stop" %
                        (args.get("endpoint"),
                         args.get("datacenter"),
                         args.get("name")))
-        pp.pprint(responce.json())
+        pp.pprint(response.json())
 
     def list(self,args):
 
diff --git a/src/emuvim/cli/rest/datacenter.py b/src/emuvim/cli/rest/datacenter.py
old mode 100644
new mode 100755
diff --git a/src/emuvim/cli/rest/monitor.py b/src/emuvim/cli/rest/monitor.py
new file mode 100755
index 0000000..2ed1402
--- /dev/null
+++ b/src/emuvim/cli/rest/monitor.py
@@ -0,0 +1,110 @@
+from requests import get, put, delete
+from tabulate import tabulate
+import pprint
+import argparse
+import json
+from emuvim.cli import prometheus
+
+pp = pprint.PrettyPrinter(indent=4)
+
+class RestApiClient():
+
+    def __init__(self):
+        self.cmds = {}
+
+    def execute_command(self, args):
+        if getattr(self, args["command"]) is not None:
+            # call the local method with the same name as the command arg
+            getattr(self, args["command"])(args)
+        else:
+            print("Command not implemented.")
+
+    def setup_metric(self, args):
+        vnf_name = self._parse_vnf_name(args.get("vnf_name"))
+        vnf_interface = self._parse_vnf_interface(args.get("vnf_name"))
+
+        response = put("%s/restapi/monitor/%s/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_name,
+                        vnf_interface,
+                        args.get("metric")))
+        pp.pprint(response.json())
+
+    def stop_metric(self, args):
+        vnf_name = self._parse_vnf_name(args.get("vnf_name"))
+        vnf_interface = self._parse_vnf_interface(args.get("vnf_name"))
+
+        response = delete("%s/restapi/monitor/%s/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_name,
+                        vnf_interface,
+                        args.get("metric")))
+        pp.pprint(response.json())
+
+    def setup_flow(self, args):
+        vnf_name = self._parse_vnf_name(args.get("vnf_name"))
+        vnf_interface = self._parse_vnf_interface(args.get("vnf_name"))
+
+        response = put("%s/restapi/monitor/%s/%s/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_name,
+                        vnf_interface,
+                        args.get("metric"),
+                        args.get("cookie")))
+
+        pp.pprint(response.json())
+
+    def stop_flow(self, args):
+        vnf_name = self._parse_vnf_name(args.get("vnf_name"))
+        vnf_interface = self._parse_vnf_interface(args.get("vnf_name"))
+
+        response = delete("%s/restapi/monitor/%s/%s/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_name,
+                        vnf_interface,
+                        args.get("metric"),
+                        args.get("cookie")))
+
+        pp.pprint(response.json())
+
+    def _parse_vnf_name(self, vnf_name_str):
+        vnf_name = vnf_name_str.split(':')[0]
+        return vnf_name
+
+    def _parse_vnf_interface(self, vnf_name_str):
+        try:
+            vnf_interface = vnf_name_str.split(':')[1]
+        except:
+            vnf_interface = None
+
+        return vnf_interface
+
+parser = argparse.ArgumentParser(description='son-emu monitor')
+parser.add_argument(
+    "command",
+    choices=['setup_metric', 'stop_metric', 'setup_flow', 'stop_flow','prometheus'],
+    help="setup/stop a metric/flow to be monitored or query Prometheus")
+parser.add_argument(
+    "--vnf_name", "-vnf", dest="vnf_name",
+    help="vnf name:interface to be monitored")
+parser.add_argument(
+    "--metric", "-m", dest="metric",
+    help="tx_bytes, rx_bytes, tx_packets, rx_packets")
+parser.add_argument(
+    "--cookie", "-c", dest="cookie",
+    help="flow cookie to monitor")
+parser.add_argument(
+    "--query", "-q", dest="query",
+    help="prometheus query")
+parser.add_argument(
+    "--datacenter", "-d", dest="datacenter",
+    help="Data center where the vnf is deployed")
+parser.add_argument(
+    "--endpoint", "-e", dest="endpoint",
+    default="http://127.0.0.1:5000",
+    help="UUID of the plugin to be manipulated.")
+
+def main(argv):
+    args = vars(parser.parse_args(argv))
+    c = RestApiClient()
+    c.execute_command(args)
\ No newline at end of file
diff --git a/src/emuvim/cli/rest/network.py b/src/emuvim/cli/rest/network.py
new file mode 100755
index 0000000..e7687f6
--- /dev/null
+++ b/src/emuvim/cli/rest/network.py
@@ -0,0 +1,109 @@
+from requests import get,put, delete
+from tabulate import tabulate
+import pprint
+import argparse
+import json
+
+pp = pprint.PrettyPrinter(indent=4)
+
+class RestApiClient():
+
+    def __init__(self):
+        self.cmds = {}
+
+    def execute_command(self, args):
+        if getattr(self, args["command"]) is not None:
+            # call the local method with the same name as the command arg
+            getattr(self, args["command"])(args)
+        else:
+            print("Command not implemented.")
+
+    def add(self, args):
+        vnf_src_name = self._parse_vnf_name(args.get("source"))
+        vnf_dst_name = self._parse_vnf_name(args.get("destination"))
+
+        params = self._create_dict(
+            vnf_src_interface=self._parse_vnf_interface(args.get("source")),
+            vnf_dst_interface=self._parse_vnf_interface(args.get("destination")),
+            weight=args.get("weight"),
+            match=args.get("match"),
+            bidirectional=args.get("bidirectional"),
+            cookie=args.get("cookie"))
+
+        response = put("%s/restapi/network/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_src_name,
+                        vnf_dst_name),
+                       json=json.dumps(params))
+        pp.pprint(response.json())
+
+    def remove(self, args):
+        vnf_src_name = self._parse_vnf_name(args.get("source"))
+        vnf_dst_name = self._parse_vnf_name(args.get("destination"))
+
+        params = self._create_dict(
+            vnf_src_interface=self._parse_vnf_interface(args.get("source")),
+            vnf_dst_interface=self._parse_vnf_interface(args.get("destination")),
+            weight=args.get("weight"),
+            match=args.get("match"),
+            bidirectional=args.get("bidirectional"),
+            cookie=args.get("cookie"))
+
+        response = delete("%s/restapi/network/%s/%s" %
+                       (args.get("endpoint"),
+                        vnf_src_name,
+                        vnf_dst_name),
+                       json=json.dumps(params))
+        pp.pprint(response.json())
+
+    def _parse_vnf_name(self, vnf_name_str):
+        vnf_name = vnf_name_str.split(':')[0]
+        return vnf_name
+
+    def _parse_vnf_interface(self, vnf_name_str):
+        try:
+            vnf_interface = vnf_name_str.split(':')[1]
+        except:
+            vnf_interface = None
+
+        return vnf_interface
+
+    def _create_dict(self, **kwargs):
+        return kwargs
+
+parser = argparse.ArgumentParser(description='son-emu network')
+parser.add_argument(
+    "command",
+    choices=['add', 'remove'],
+    help="Action to be executed.")
+parser.add_argument(
+    "--datacenter", "-d", dest="datacenter",
+    help="Data center to in which the network action should be initiated")
+parser.add_argument(
+    "--source", "-src", dest="source",
+    help="vnf name of the source of the chain")
+parser.add_argument(
+    "--destination", "-dst", dest="destination",
+    help="vnf name of the destination of the chain")
+parser.add_argument(
+    "--weight", "-w", dest="weight",
+    help="weight metric to calculate the path")
+parser.add_argument(
+    "--match", "-m", dest="match",
+    help="string holding extra matches for the flow entries")
+parser.add_argument(
+    "--bidirectional", "-b", dest="bidirectional",
+    action='store_true',
+    help="add/remove the flow entries from src to dst and back")
+parser.add_argument(
+    "--cookie", "-c", dest="cookie",
+    help="cookie for this flow, as easy to use identifier (eg. per tenant/service)")
+parser.add_argument(
+    "--endpoint", "-e", dest="endpoint",
+    default="http://127.0.0.1:5000",
+    help="UUID of the plugin to be manipulated.")
+
+def main(argv):
+    args = vars(parser.parse_args(argv))
+    c = RestApiClient()
+    c.execute_command(args)
\ No newline at end of file