SystemDump: Modify system dump commands based on latest schemas

Tested by:
python3 openbmctool.py -U root -P passwd -H hostname dump -t SystemDump list
python3 openbmctool.py -U root -P passwd -H hostname dump -t SystemDump create
python3 openbmctool.py -U root -P passwd -H hostname dump -t SystemDump delete -n 1
python3 openbmctool.py -U root -P passwd -H hostname dump -t SystemDump retrive -s /tmp/test -n 1

Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
Change-Id: I38b25c4b1d650e7cc63970b95dbe7993aaa75e46
diff --git a/thalerj/openbmctool.py b/thalerj/openbmctool.py
index 025cae7..00d3e60 100755
--- a/thalerj/openbmctool.py
+++ b/thalerj/openbmctool.py
@@ -63,8 +63,10 @@
 
         token = gettoken(args)
         self.conn = http.client.HTTPSConnection(args.host,port=443)
-        URI = "/redfish/v1/Systems/system/LogServices/SystemDump/Entries/"+str(args.dumpNum)+"/Actions/Oem/OpenBmc/LogEntry.DownloadLog"
-        self.conn.request("POST",URI, headers={"X-Auth-Token":token})
+
+        uri = "/redfish/v1/Systems/system/LogServices/Dump/attachment/"+args.dumpNum
+
+        self.conn.request("GET",uri, headers={"X-Auth-Token":token})
 
     def openTCPSocket(self):
         # Create a TCP/IP socket
@@ -109,11 +111,11 @@
                 s.close()
 
 def getsize(host,args,session):
-    url = "https://"+host+"/redfish/v1/Systems/system/LogServices/SystemDump/Entries/"+str(args.dumpNum)
+    url = "https://"+host+"/redfish/v1/Systems/system/LogServices/Dump/Entries/"+str(args.dumpNum)
     try:
         resp = session.get(url, headers=jsonHeader, verify=False, timeout=baseTimeout)
         if resp.status_code==200:
-            size = resp.json()["Oem"]["OpenBmc"]['SizeInB']
+            size = resp.json()["Oem"]["OpenBmc"]['AdditionalDataSizeBytes']
             return size
         else:
             return "Failed get Size"
@@ -1738,8 +1740,7 @@
          @param session: the active session to use
          @param args.json: boolean, if this flag is set to true, the output will be provided in json format for programmatic consumption
     """
-    print("in systemDumpList")
-    url = "https://"+host+"/redfish/v1/Systems/system/LogServices/"+args.dumpType+"/Entries"
+    url = "https://"+host+"/redfish/v1/Systems/system/LogServices/Dump/Entries"
     try:
         r = session.get(url, headers=jsonHeader, verify=False, timeout=baseTimeout)
         dumpList = r.json()
@@ -1769,7 +1770,7 @@
         else:
             dumpList.append(args.dumpNum)
         for dumpNum in dumpList:
-            url = 'https://'+host+'/redfish/v1/Systems/system/LogServices/'+args.dumpType+'/Entries/'+ str(dumpNum)
+            url = 'https://'+host+'/redfish/v1/Systems/system/LogServices/Dump/Entries/'+ str(dumpNum)
             try:
                 r = session.delete(url, headers=jsonHeader, json = {"data": []}, verify=False, timeout=baseTimeout)
                 if r.status_code == 200:
@@ -1796,7 +1797,7 @@
          @param session: the active session to use
          @param args.json: boolean, if this flag is set to true, the output will be provided in json format for programmatic consumption
     """
-    url = 'https://'+host+'/redfish/v1/Systems/system/LogServices/'+args.dumpType+'/Actions/LogService.ClearLog'
+    url = 'https://'+host+'/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog'
     try:
         r = session.post(url, headers=jsonHeader, json = {"data": []}, verify=False, timeout=baseTimeout)
         if(r.status_code == 200 and not args.json):
@@ -1819,12 +1820,10 @@
          @param session: the active session to use
          @param args.json: boolean, if this flag is set to true, the output will be provided in json format for programmatic consumption
     """
-    url =  'https://'+host+'/redfish/v1/Systems/system/LogServices/'+args.dumpType+'/Actions/Oem/Openbmc/LogService.CreateLog'
+    url =  'https://'+host+'/redfish/v1/Systems/system/LogServices/Dump/Actions/Oem/OemLogService.CollectDiagnosticData'
     try:
         r = session.post(url, headers=jsonHeader, json = {"data": []}, verify=False, timeout=baseTimeout)
-        if(r.status_code == 200 and not args.json):
-            return ('Dump successfully created')
-        elif(args.json):
+        if(r.status_code == 200):
             return r.json()
         else:
             return ('Failed to create dump')