Add in activation support

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/openbmc-sfw b/openbmc-sfw
index 16a98f4..192869a 100755
--- a/openbmc-sfw
+++ b/openbmc-sfw
@@ -28,7 +28,7 @@
                              verify=False)
         j = r.json()
         if j['status'] != 'ok':
-            raise Exception("Failed to query entries: \n" + r.text)
+            raise Exception("Failed to query software: \n" + r.text)
 
         events = j['data']
 
@@ -39,7 +39,7 @@
 
         j = r.json()
         if j['status'] != 'ok':
-            raise Exception("Failed to get event " + image + ": \n" + r.text)
+            raise Exception("Failed to get image " + image + ": \n" + r.text)
 
         return j['data']
 
@@ -56,6 +56,17 @@
 
         return j['data']
 
+    def activate_image(self, image_id):
+        r = self.session.put(self.url + "/xyz/openbmc_project/software/" + image_id + "/attr/RequestedActivation", 
+                             data="xyz.openbmc_project.Software.Activation.RequestedActivations.Active",
+                             verify=False)
+        
+        j = r.json()
+        if j['status'] != 'ok':
+            raise Exception("Failed to activate image " + image_id + ": \n" + r.text)
+
+        return j['data']
+
 
 def do_list_sfw(args):
     s = BMC(server=args.server)
@@ -72,6 +83,10 @@
     s = BMC(server=args.server)
     s.upload_image(args.image)
 
+def do_activate_image(args):
+    s = BMC(server=args.server)
+    s.activate_image(args.image_id)
+
 parser = argparse.ArgumentParser()
 parser.add_argument('--server', help='hostname or IP of BMC', type=str,
                     required=True)
@@ -88,6 +103,10 @@
 image_upload.add_argument('image', help='The image to upload')
 image_upload.set_defaults(func=do_upload_image)
 
+image_activate = subparsers.add_parser('activate', help='Activate input image id')
+image_activate.add_argument('image_id', help='The image id to activate')
+image_activate.set_defaults(func=do_activate_image)
+
 args = parser.parse_args()
 
 if 'func' in args: