Merge pull request #178 from mpeuster/master
authorpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 15 Sep 2016 17:20:02 +0000 (19:20 +0200)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Thu, 15 Sep 2016 17:20:02 +0000 (19:20 +0200)
Added priority field to network CLI.

src/emuvim/api/sonata/dummygatekeeper.py
src/emuvim/cli/rest/network.py

index 294ffed..8a9416c 100755 (executable)
@@ -120,7 +120,6 @@ class Service(object):
         self.eline_subnets_src = generate_subnet_strings(50, start=200, subnet_size=24, ip=1)
         self.eline_subnets_dst = generate_subnet_strings(50, start=200, subnet_size=24, ip=2)
 
-
     def onboard(self):
         """
         Do all steps to prepare this service to be instantiated
@@ -557,7 +556,7 @@ class Packages(fr.Resource):
             s = Service(service_uuid, file_hash, upload_path)
             GK.register_service_package(service_uuid, s)
             # generate the JSON result
-            return {"service_uuid": service_uuid, "size": size, "sha1": file_hash, "error": None}
+            return {"service_uuid": service_uuid, "size": size, "sha1": file_hash, "error": None}, 201
         except Exception as ex:
             LOG.exception("Service package upload failed:")
             return {"service_uuid": None, "size": 0, "sha1": None, "error": "upload failed"}, 500
index 4f6a32d..91051dd 100755 (executable)
@@ -53,7 +53,8 @@ class RestApiClient():
             weight=args.get("weight"),
             match=args.get("match"),
             bidirectional=args.get("bidirectional"),
-            cookie=args.get("cookie"))
+            cookie=args.get("cookie"),
+            priority=args.get("priority"))
 
         response = put("%s/restapi/network/%s/%s" %
                        (args.get("endpoint"),
@@ -72,7 +73,8 @@ class RestApiClient():
             weight=args.get("weight"),
             match=args.get("match"),
             bidirectional=args.get("bidirectional"),
-            cookie=args.get("cookie"))
+            cookie=args.get("cookie"),
+            priority=args.get("priority"))
 
         response = delete("%s/restapi/network/%s/%s" %
                        (args.get("endpoint"),
@@ -113,6 +115,9 @@ parser.add_argument(
 parser.add_argument(
     "--weight", "-w", dest="weight",
     help="weight edge attribute to calculate the path")
+parser.add_argument(
+    "--priority", "-p", dest="priority", default="0",
+    help="priority of flow rule")
 parser.add_argument(
     "--match", "-m", dest="match",
     help="string holding extra matches for the flow entries")
@@ -130,4 +135,4 @@ parser.add_argument(
 def main(argv):
     args = vars(parser.parse_args(argv))
     c = RestApiClient()
-    c.execute_command(args)
\ No newline at end of file
+    c.execute_command(args)