You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/10/13 13:06:57 UTC

[34/50] stratos git commit: remove-* commands, update-* commands added

remove-* commands, update-* commands added

Signed-off-by: Imesh Gunaratne <im...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/154f3057
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/154f3057
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/154f3057

Branch: refs/heads/stratos-4.1.x
Commit: 154f3057af608b6c1be461418aa3f83837a876e5
Parents: efd23ec
Author: Milindu Sanoj Kumarage <ag...@gmail.com>
Authored: Mon Aug 10 01:08:52 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue Oct 13 16:32:48 2015 +0530

----------------------------------------------------------------------
 .../src/main/python/cli/CLI.py                  | 677 +++++++++++++++++--
 .../src/main/python/cli/Stratos.py              | 210 +++++-
 2 files changed, 823 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/154f3057/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
index dd9c70a..e9960f9 100755
--- a/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
+++ b/components/org.apache.stratos.python.cli/src/main/python/cli/CLI.py
@@ -16,6 +16,7 @@
 # under the License.
 
 from cmd2 import *
+from rpm._rpm import te
 from Utils import *
 from Stratos import *
 import Configs
@@ -46,6 +47,7 @@ class CLI(Cmd):
     # User
      * list-users
      * add-user
+     * update-user
      * remove-user
 
     """
@@ -83,7 +85,7 @@ class CLI(Cmd):
     def do_add_user(self, line , opts=None):
         """Add a new user to the system"""
         try:
-            user = Stratos.add_users(opts.username, opts.password, opts.role_name, opts.first_name, opts.last_name,
+            user = Stratos.add_users(opts.username_user, opts.password_user, opts.role_name, opts.first_name, opts.last_name,
                                        opts.email, opts.profile_name)
             if user:
                 print("User successfully created")
@@ -94,6 +96,30 @@ class CLI(Cmd):
 
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-s', '--username_user', type="str", help="Username of the user"),
+        make_option('-a', '--password_user', type="str", help="Password of the user"),
+        make_option('-r', '--role_name', type="str", help="Role name of the user"),
+        make_option('-f', '--first_name', type="str", help="First name of the user"),
+        make_option('-l', '--last_name', type="str", help="Last name of the user"),
+        make_option('-e', '--email', type="str", help="Email of the user"),
+        make_option('-o', '--profile_name', type="str", help="Profile name of the user")
+    ])
+    @auth
+    def do_update_user(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            user = Stratos.update_user(opts.username_user, opts.password_user, opts.role_name, opts.first_name, opts.last_name,
+                                       opts.email, opts.profile_name)
+            if user:
+                print("User successfully updated")
+            else:
+                print("Error updating the user")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
     ])
     @auth
@@ -112,6 +138,227 @@ class CLI(Cmd):
             self.perror("Authentication Error")
 
     """
+    # Applications
+     * list-applications
+     * add-application
+     * remove-application
+
+    """
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_list_applications(self, line , opts=None):
+        """Illustrate the base class method use."""
+        applications = Stratos.list_applications()
+        if not applications:
+            print("No applications found")
+        else:
+            table = PrintableTable()
+            rows = [["Application ID", "Alias", "Status"]]
+            for application in applications:
+                PrintableJSON(application).pprint()
+                rows.append([application['applicationId'], application['alias'], application['status']])
+            table.add_rows(rows)
+            table.print_table()
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_application(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-application [-f <resource path>]")
+            else:
+                add_application = Stratos.add_application(open(opts.json_file_path, 'r').read())
+                if add_application:
+                    print("Application added successfully")
+                else:
+                    print("Error adding application")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_remove_application(self, application , opts=None):
+        """Delete a specific user"""
+        try:
+            if not application:
+                print("usage: remove-application [application]")
+            else:
+                application_removed = Stratos.remove_application(application)
+                if application_removed:
+                    print("You have successfully removed application: "+application)
+                else:
+                    print("Could not delete application : "+application)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    """
+    # Tenants
+     * list-tenants
+     * list-tenants-by-partial-domain
+     * describe-tenant
+     * add-tenant
+     * activate-tenant
+     * deactivate-tenant
+
+    """
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_list_tenants(self, line , opts=None):
+        """Illustrate the base class method use."""
+        tenants = Stratos.list_tenants()
+        table = PrintableTable()
+        rows = [["Domain", "Tenant ID", "Email", " State", "Created Date"]]
+        for tenant in tenants:
+            rows.append([tenant['tenantDomain'], tenant['tenantId'], tenant['email'],
+                         "Active" if tenant['active'] else "De-Active", datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d %H:%M:%S')])
+        table.add_rows(rows)
+        table.print_table()
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_list_tenants_by_partial_domain(self, partial_domain , opts=None):
+        """Illustrate the base class method use."""
+        tenants = Stratos.list_tenants_by_partial_domain(partial_domain)
+        table = PrintableTable()
+        rows = [["Domain", "Tenant ID", "Email", " State", "Created Date"]]
+        for tenant in tenants:
+            rows.append([tenant['tenantDomain'], tenant['tenantId'], tenant['email'],
+                         "Active" if tenant['active'] else "De-Active", datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d %H:%M:%S')])
+        table.add_rows(rows)
+        table.print_table()
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_describe_tenant(self, tenant_domain_name, opts=None):
+        """Retrieve details of a specific tenant."""
+        if not tenant_domain_name:
+            print("usage: describe-tenant [Domain-Name]")
+        else:
+            try:
+                tenant = Stratos.describe_tenant(tenant_domain_name)
+                if not tenant:
+                    print("Tenant not found")
+                else:
+                    print("-------------------------------------")
+                    print("Tenant Information:")
+                    print("-------------------------------------")
+                    print("Tenant domain: "+tenant['tenantDomain'])
+                    print("ID: "+str(tenant['tenantId']))
+                    print("Active: "+str(tenant['active']))
+                    print("Email: "+tenant['email'])
+                    print("Created date: "+datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d %H:%M:%S'))
+                    print("-------------------------------------")
+            except requests.HTTPError as e:
+                self.perror("Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-s', '--username_user', type="str", help="Username of the tenant"),
+        make_option('-a', '--password_user', type="str", help="Password of the tenant"),
+        make_option('-d', '--domain_name', type="str", help="domain name of the tenant"),
+        make_option('-f', '--first_name', type="str", help="First name of the tenant"),
+        make_option('-l', '--last_name', type="str", help="Last name of the tenant"),
+        make_option('-e', '--email', type="str", help="Email of the tenant")
+    ])
+    @auth
+    def do_add_tenant(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            tenant = Stratos.add_tenant(opts.username_user, opts.first_name, opts.last_name, opts.password_user,
+                                        opts.domain_name, opts.email)
+            if tenant:
+                print("Tenant added successfully : "+opts.domain_name)
+            else:
+                print("Error creating the tenant : "+opts.domain_name)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-s', '--username_user', type="str", help="Username of the tenant"),
+        make_option('-a', '--password_user', type="str", help="Password of the tenant"),
+        make_option('-d', '--domain_name', type="str", help="domain name of the tenant"),
+        make_option('-f', '--first_name', type="str", help="First name of the tenant"),
+        make_option('-l', '--last_name', type="str", help="Last name of the tenant"),
+        make_option('-e', '--email', type="str", help="Email of the tenant"),
+        make_option('-i', '--tenant_id', type="str", help="ID of the tenant")
+    ])
+    @auth
+    def do_update_tenant(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            tenant = Stratos.update_tenant(opts.username_user, opts.first_name, opts.last_name, opts.password_user,
+                                           opts.domain_name, opts.email, opts.tenant_id)
+            if tenant:
+                print("Tenant updated successfully : "+opts.domain_name)
+            else:
+                print("Error updating the tenant : "+opts.domain_name)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_activate_tenant(self, tenant_domain, opts=None):
+        """Add a new user to the system"""
+        try:
+            if not tenant_domain:
+                print("usage: activate-tenant <TENANT_DOMAIN> ")
+            else:
+                activate_tenant = Stratos.activate_tenant(tenant_domain)
+                if activate_tenant:
+                    print("You have successfully activated the tenant : "+tenant_domain)
+                else:
+                    print("Could not activate tenant : "+tenant_domain)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_deactivate_tenant(self, tenant_domain, opts=None):
+        """Add a new user to the system"""
+        try:
+            if not tenant_domain:
+                print("usage: deactivate-tenant <TENANT_DOMAIN> ")
+            else:
+                activate_tenant = Stratos.deactivate_tenant(tenant_domain)
+                if activate_tenant:
+                    print("You have successfully deactivated the tenant : "+tenant_domain)
+                else:
+                    print("Could not deactivate tenant : "+tenant_domain)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    """
     # Cartridges
      * list-cartridges
      * describe-cartridge
@@ -167,6 +414,46 @@ class CLI(Cmd):
 
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_cartridge(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-cartridge [-f <resource path>]")
+            else:
+                cartridge = Stratos.add_cartridge(open(opts.json_file_path, 'r').read())
+                if cartridge:
+                    print("Cartridge added successfully")
+                else:
+                    print("Error adding Cartridge")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_update_cartridge(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: update-cartridge [-f <resource path>]")
+            else:
+                cartridge = Stratos.update_cartridge(open(opts.json_file_path, 'r').read())
+                if cartridge:
+                    print("Cartridge updated successfully")
+                else:
+                    print("Error updating Cartridge")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
     ])
     @auth
@@ -188,6 +475,7 @@ class CLI(Cmd):
     # Cartridge groups
      * list-cartridge-groups
      * describe-cartridge-group
+     * add-cartridge-group
      * remove-cartridge-group
 
     """
@@ -204,10 +492,10 @@ class CLI(Cmd):
             print("No cartridge groups found")
         else:
             table = PrintableTable()
-            rows = [["Name", "No. of cartridges", "No of groups", "Dependency scaling"]]
+            rows = [["Name", "No. of cartridges", "No of groups"]]
             for cartridge_group in cartridge_groups:
                 rows.append([cartridge_group['name'], len(cartridge_group['cartridges']),
-                             len(cartridge_group['cartridges']), len(cartridge_group['dependencies'])])
+                             len(cartridge_group['cartridges'])])
             table.add_rows(rows)
             table.print_table()
 
@@ -228,6 +516,47 @@ class CLI(Cmd):
             print("Service Group : "+group_definition_name)
             PrintableJSON(cartridge_group).pprint()
 
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_cartridge_group(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-cartridge-group [-f <resource path>]")
+            else:
+                cartridge_group = Stratos.add_cartridge_group(open(opts.json_file_path, 'r').read())
+                if cartridge_group:
+                    print("Cartridge group added successfully")
+                else:
+                    print("Error adding Cartridge group")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_update_cartridge_group(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: update-cartridge-group [-f <resource path>]")
+            else:
+                cartridge = Stratos.update_cartridge_group(open(opts.json_file_path, 'r').read())
+                if cartridge:
+                    print("Cartridge group updated successfully")
+                else:
+                    print("Error updating Cartridge group")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
@@ -251,6 +580,7 @@ class CLI(Cmd):
     # Deployment Policies
      * list-deployment-policies
      * describe-deployment-policy
+     * update-deployment-policy
      * remove-deployment-policy
 
     """
@@ -289,6 +619,27 @@ class CLI(Cmd):
         else:
             PrintableJSON(deployment_policy).pprint()
 
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_update_deployment_policy(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: update-deployment-policy [-f <resource path>]")
+            else:
+                cartridge = Stratos.update_deployment_policy(open(opts.json_file_path, 'r').read())
+                if cartridge:
+                    print("Deployment policy updated successfully")
+                else:
+                    print("Error updating Deployment policy")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
@@ -312,6 +663,7 @@ class CLI(Cmd):
     # Network Partitions
      * list-deployment-policies
      * describe-deployment-policy
+     * update-deployment-policy
      * remove-deployment-policy
 
     """
@@ -350,6 +702,26 @@ class CLI(Cmd):
 
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_update_network_partition(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: update-network-partition [-f <resource path>]")
+            else:
+                cartridge = Stratos.update_network_partition(open(opts.json_file_path, 'r').read())
+                if cartridge:
+                    print("Network partition updated successfully")
+                else:
+                    print("Error updating Network partition")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
     ])
     @auth
@@ -371,6 +743,7 @@ class CLI(Cmd):
     # Auto-scaling policies
      * list-autoscaling-policies
      * describe-autoscaling-policy
+     * update-autoscaling-policy
      * remove-autoscaling-policy
 
     """
@@ -412,17 +785,37 @@ class CLI(Cmd):
 
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_update_autoscaling_policy(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: update-autoscaling-policy [-f <resource path>]")
+            else:
+                autoscaling_policy = Stratos.update_autoscaling_policy(open(opts.json_file_path, 'r').read())
+                if autoscaling_policy:
+                    print("Cartridge updated successfully")
+                else:
+                    print("Error updating Cartridge")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
         make_option('-p', '--password', type="str", help="Password of the user")
     ])
     @auth
     def do_remove_autoscaling_policy(self, autoscaling_policy_id , opts=None):
-        """Delete a cartridge"""
+        """Delete a autoscaling_policy"""
         try:
             if not autoscaling_policy_id:
                 print("usage: remove-autoscaling-policy [application-id]")
             else:
-                cartridge_removed = Stratos.remove_autoscaling_policy(autoscaling_policy_id)
-                if cartridge_removed:
+                autoscaling_policy_removed = Stratos.remove_autoscaling_policy(autoscaling_policy_id)
+                if autoscaling_policy_removed:
                     print("Successfully deleted Auto-scaling policy : "+autoscaling_policy_id)
                 else:
                     print("Auto-scaling policy not found : "+autoscaling_policy_id)
@@ -472,6 +865,7 @@ class CLI(Cmd):
         if not kubernetes_cluster:
             print("Kubernetes cluster not found")
         else:
+            print("Kubernetes cluster: "+kubernetes_cluster_id)
             PrintableJSON(kubernetes_cluster).pprint()
 
     @options([
@@ -520,13 +914,13 @@ class CLI(Cmd):
     ])
     @auth
     def do_remove_kubernetes_cluster(self, kubernetes_cluster_id, opts=None):
-        """Delete a cartridge"""
+        """Delete a kubernetes cluster"""
         try:
             if not kubernetes_cluster_id:
                 print("usage: remove-kubernetes-cluster [cluster-id]")
             else:
-                cartridge_removed = Stratos.remove_autoscaling_policy(kubernetes_cluster_id)
-                if cartridge_removed:
+                kubernetes_cluster_removed = Stratos.remove_kubernetes_cluster(kubernetes_cluster_id)
+                if kubernetes_cluster_removed:
                     print("Successfully un-deployed kubernetes cluster : "+kubernetes_cluster_id)
                 else:
                     print("Kubernetes cluster not found : "+kubernetes_cluster_id)
@@ -535,46 +929,47 @@ class CLI(Cmd):
 
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
-        make_option('-p', '--password', type="str", help="Password of the user")
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-c', '--cluster_id', type="str", help="Cluster id of Kubernets cluster"),
+        make_option('-o', '--host_id', type="str", help="Host id of Kubernets cluster")
     ])
     @auth
-    def do_list_applications(self, line , opts=None):
-        """Illustrate the base class method use."""
-        applications = Stratos.list_applications()
-        if not applications:
-            print("No applications found")
-        else:
-            table = PrintableTable()
-            rows = [["Type", "Category", "Name", "Description", "Version", "Multi-Tenant"]]
-            for application in applications:
-                rows.append([application['type'], application['category'], application['displayName'],
-                             application['description'], application['version'], application['multiTenant']])
-            table.add_rows(rows)
-            table.print_table()
+    def do_remove_kubernetes_host(self, line, opts=None):
+        """Delete a kubernetes host"""
+        try:
+            if not opts.cluster_id or not opts.host_id:
+                print("usage: remove-kubernetes-host [-c cluster-id] [-o host-id]")
+            else:
+                kubernetes_host_removed = Stratos.remove_kubernetes_host(opts.cluster_id, opts.host_id)
+                if kubernetes_host_removed:
+                    print("Successfully un-deployed kubernetes host : "+opts.host_id)
+                else:
+                    print("Kubernetes host not found : "+opts.cluster_id+"/"+opts.host_id)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
 
 
+    """
+    # Domain Mapping
+     * list-domain-mappings
+
+    """
     @options([
         make_option('-u', '--username', type="str", help="Username of the user"),
-        make_option('-p', '--password', type="str", help="Password of the user"),
-        make_option('-t', '--tenant_domain', type="str", help="Cluster ID")
+        make_option('-p', '--password', type="str", help="Password of the user")
     ])
     @auth
-    def do_activate_tenant(self, line , opts=None):
-        """Retrieve detailed information on all Kubernetes-CoreOS Clusters."""
-        if not opts.tenant_domain:
-            print("usage: list-kubernetes-hosts [-c <tenant domain>]")
-            return
-        kubernetes_cluster_hosts = Stratos.list_kubernetes_hosts(opts.cluster_id)
-        if not kubernetes_cluster_hosts:
-            print("No kubernetes hosts found")
-        else:
-            table = PrintableTable()
-            rows = [["Host ID", "Hostname", "Private IP Address", "Public IP Address"]]
-            for kubernetes_cluster_host in kubernetes_cluster_hosts:
-                rows.append([kubernetes_cluster_host['hostId'], kubernetes_cluster_host['hostname'],
-                             kubernetes_cluster_host['privateIPAddress'], kubernetes_cluster_host['publicIPAddress']])
-            table.add_rows(rows)
-            table.print_table()
+    def do_list_domain_mappings(self, application_id , opts=None):
+        """Illustrate the base class method use."""
+        tenants = Stratos.list_domain_mappings(application_id)
+        table = PrintableTable()
+        rows = [["Domain", "Tenant ID", "Email", " State", "Created Date"]]
+        for tenant in tenants:
+            rows.append([tenant['tenantDomain'], tenant['tenantId'], tenant['email'],
+                         "Active" if tenant['active'] else "De-Active", datetime.datetime.fromtimestamp(tenant['createdDate']/1000).strftime('%Y-%m-%d %H:%M:%S')])
+        table.add_rows(rows)
+        table.print_table()
+
 
     @options([])
     def do_deploy_user(self, line , opts=None):
@@ -599,4 +994,202 @@ class CLI(Cmd):
         if not application_signup:
             print("Application signup not found")
         else:
-            PrintableJSON(application_signup).pprint()
\ No newline at end of file
+            PrintableJSON(application_signup).pprint()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_remove_domain_mappings(self, domain , opts=None):
+        """Delete a specific user"""
+        try:
+            if not domain:
+                print("usage: remove-domain-mappings [domain]")
+            else:
+                domain_removed = Stratos.remove_domain_mappings(domain)
+                if domain_removed:
+                    print("You have successfully deleted domain: "+domain)
+                else:
+                    print("Could not delete domain: "+domain)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_remove_application_signup(self, signup , opts=None):
+        """Delete a specific user"""
+        try:
+            if not signup:
+                print("usage: remove-application-signup [signup]")
+            else:
+                signup_removed = Stratos.remove_application_signup(signup)
+                if signup_removed:
+                    print("You have successfully remove signup: "+signup)
+                else:
+                    print("Could not delete application signup: "+signup)
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_describe_application_runtime(self, line , opts=None):
+        """Retrieve details of a specific auto-scaling policy."""
+        if not line.split():
+            print("usage: describe-application-runtime [application-id]")
+            return
+        application_runtime = Stratos.describe_application_runtime(line)
+        if not application_runtime:
+            print("Application runtime not found")
+        else:
+            PrintableJSON(application_runtime).pprint()
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user")
+    ])
+    @auth
+    def do_describe_application(self, line , opts=None):
+        """Retrieve details of a specific auto-scaling policy."""
+        if not line.split():
+            print("usage: describe-application [application-id]")
+            return
+        application = Stratos.describe_application(line)
+        if not application:
+            print("Application not found")
+        else:
+            PrintableJSON(application).pprint()
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_network_partition(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-network-partition [-f <resource path>]")
+            else:
+                tenant = Stratos.add_network_partition(open(opts.json_file_path, 'r').read())
+                if tenant:
+                    print("Network partition added successfully")
+                else:
+                    print("Error creating network partition")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_kubernetes_cluster(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-kubernetes-cluster [-f <resource path>]")
+            else:
+                tenant = Stratos.add_kubernetes_cluster(open(opts.json_file_path, 'r').read())
+                if tenant:
+                    print("Kubernertes cluster added successfully")
+                else:
+                    print("Error creating network partition")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_domain_mapping(self, application_id, opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-domain-mapping [-f <resource path>]")
+            else:
+                tenant = Stratos.add_domain_mapping(application_id, """{
+  "domainMappings": [
+    {
+      "cartridgeAlias": "tomcat",
+      "domainName": "agentmilindu.com",
+      "contextPath": "/abc/app"
+    }
+  ]
+}""")
+                if tenant:
+                    print(" Domain mapping added successfully")
+                else:
+                    print("Error creating domain mapping")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_deployment_policy(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-deployment-policy [-f <resource path>]")
+            else:
+                deployment_policy = Stratos.add_deployment_policy(open(opts.json_file_path, 'r').read())
+                if deployment_policy:
+                    print("Deployment policy added successfully")
+                else:
+                    print("Error creating deployment policy")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+
+    @options([
+        make_option('-u', '--username', type="str", help="Username of the user"),
+        make_option('-p', '--password', type="str", help="Password of the user"),
+        make_option('-f', '--json_file_path', type="str", help="Path of the JSON file")
+    ])
+    @auth
+    def do_add_autoscaling_policy(self, line , opts=None):
+        """Add a new user to the system"""
+        try:
+            if not opts.json_file_path:
+                print("usage: add-autoscaling-policy [-f <resource path>]")
+            else:
+                autoscaling_policy = Stratos.add_autoscaling_policy(open(opts.json_file_path, 'r').read())
+                if autoscaling_policy:
+                    print("Autoscaling policy added successfully")
+                else:
+                    print("Error adding autoscaling policy")
+        except AuthenticationError as e:
+            self.perror("Authentication Error")
+

http://git-wip-us.apache.org/repos/asf/stratos/blob/154f3057/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
index 2555d4c..164833b 100755
--- a/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
+++ b/components/org.apache.stratos.python.cli/src/main/python/cli/Stratos.py
@@ -16,6 +16,7 @@
 # under the License.
 
 import requests
+import json
 import Configs
 from cli.exceptions.AuthenticationError import AuthenticationError
 
@@ -30,12 +31,13 @@ class Stratos:
     # Users
      * list-users
      * add-users
+     * update-users
      * remove-user
 
     """
     @staticmethod
     def list_users():
-        return Stratos.get('users', error_message='No applications found')
+        return Stratos.get('users', error_message='No users found')
 
     @staticmethod
     def add_users(username, password, role_name, first_name, last_name, email, profile_name):
@@ -47,7 +49,19 @@ class Stratos:
             "lastName": last_name,
             "email": email
         }
-        return Stratos.post('users', data,  error_message='No applications found')
+        return Stratos.post('users', json.dumps(data),  error_message='No applications found')
+
+    @staticmethod
+    def update_user(username, password, role_name, first_name, last_name, email, profile_name):
+        data = {
+            "userName": username,
+            "credential": password,
+            "role": role_name,
+            "firstName": first_name,
+            "lastName": last_name,
+            "email": email
+        }
+        return Stratos.put('users', json.dumps(data),  error_message='No applications found')
 
     @staticmethod
     def remove_user(name):
@@ -55,28 +69,81 @@ class Stratos:
 
     """
     # Applications
+     * list-applications
+     * add-application
+     * remove-application
 
     """
     @staticmethod
     def list_applications():
-        r = requests.get(Configs.stratos_api_url + 'applications',
-                         auth=(Configs.stratos_username, Configs.stratos_password), verify=False)
-        if r.status_code == 200:
-            return r.json()
-        elif r.status_code == 400:
-            raise requests.HTTPError()
-        elif r.status_code == 401:
-            raise AuthenticationError()
-        elif r.status_code == 404:
-            if r.json() and r.json()['errorMessage'] == "No applications found":
-                return []
-            else:
-                raise requests.HTTPError()
+        return Stratos.get('applications', error_message='No applications found')
+
+    @staticmethod
+    def remove_application(application):
+        return Stratos.delete('application/'+application)
+
+    """
+    # Tenants
+     * list-tenants
+     * list-tenants-by-partial-domain
+     * describe-tenant
+     * add-tenant
+     * activate-tenant
+     * deactivate-tenant
+
+    """
+    @staticmethod
+    def list_tenants():
+        return Stratos.get('tenants', error_message='No cartridges found')
+
+    @staticmethod
+    def list_tenants_by_partial_domain(partial_domain):
+        return Stratos.get('tenants/search/'+partial_domain, error_message='No cartridges found')
+
+    @staticmethod
+    def describe_tenant(tenant_domain_name):
+        return Stratos.get('tenants/'+tenant_domain_name, error_message='No cartridge found')
+
+    @staticmethod
+    def add_tenant(username, first_name, last_name, password, domain_name, email):
+        data = {
+            "admin": username,
+            "firstName": first_name,
+            "lastName": last_name,
+            "adminPassword": password,
+            "tenantDomain": domain_name,
+            "email": email,
+            "active": "true"
+        }
+        return Stratos.post('tenants', json.dumps(data),  error_message='No tenant found')
+
+    @staticmethod
+    def update_tenant(username, first_name, last_name, password, domain_name, email, tenant_id):
+        data = {
+            "tenantId": tenant_id,
+            "admin": username,
+            "firstName": first_name,
+            "lastName": last_name,
+            "adminPassword": password,
+            "tenantDomain": domain_name,
+            "email": email,
+            "active": "true"
+        }
+        return Stratos.put('tenants', json.dumps(data),  error_message='No tenant found')
+
+    @staticmethod
+    def activate_tenant(tenant_domain):
+        return Stratos.put('tenants/activate/'+tenant_domain, "",  error_message='No tenant found')
+
+    @staticmethod
+    def deactivate_tenant(tenant_domain):
+        return Stratos.put('tenants/deactivate/'+tenant_domain, "",  error_message='No tenant found')
 
     """
     # Cartridges
      * list-cartridges
      * describe-cartridge
+     * add-cartridge
      * remove-cartridges
 
     """
@@ -89,6 +156,14 @@ class Stratos:
         return Stratos.get('cartridges/'+cartridge_type, error_message='No cartridge found')
 
     @staticmethod
+    def add_cartridge(json):
+        return Stratos.post('cartridges', json,  error_message='No cartridge found')
+
+    @staticmethod
+    def update_cartridge(json):
+        return Stratos.put('cartridges', json,  error_message='No cartridge found')
+
+    @staticmethod
     def remove_cartridge(cartridge_type):
         return Stratos.delete('cartridges/'+cartridge_type)
 
@@ -96,6 +171,7 @@ class Stratos:
     # Cartridge groups
      * list-cartridge-groups
      * describe-cartridge-group
+     * update-cartridges-group
      * remove-cartridges-group
 
     """
@@ -109,6 +185,14 @@ class Stratos:
         return Stratos.get('cartridgeGroups/'+group_definition_name, error_message='No cartridge groups found')
 
     @staticmethod
+    def add_cartridge_group(json):
+        return Stratos.post('cartridgeGroups', json,  error_message='No cartridge group found')
+
+    @staticmethod
+    def update_cartridge_group(json):
+        return Stratos.put('cartridgeGroups', json,  error_message='No cartridge found')
+
+    @staticmethod
     def remove_cartridge_group(group_definition_name):
         return Stratos.delete('cartridgeGroups/'+group_definition_name)
 
@@ -116,6 +200,7 @@ class Stratos:
     # Deployment Policy
      * list-deployment-policies
      * describe-deployment-policy
+     * update-deployment-policy
      * remove-deployment-policy
 
     """
@@ -128,6 +213,10 @@ class Stratos:
         return Stratos.get('deploymentPolicies/'+ deployment_policy_name,
                            error_message='No deployment policies found')
     @staticmethod
+    def update_deployment_policy(json):
+        return Stratos.put('deploymentPolicies', json,  error_message='No deployment policies found')
+
+    @staticmethod
     def remove_deployment_policy(deployment_policy_id):
         return Stratos.delete('deploymentPolicies/'+deployment_policy_id)
 
@@ -135,6 +224,7 @@ class Stratos:
     # Network partitions
      * list-network-partitions
      * describe-network-partition
+     * update-network-partition
      * remove-network-partition
 
     """
@@ -144,8 +234,12 @@ class Stratos:
 
     @staticmethod
     def describe_network_partition(network_partition_id):
-        return Stratos.get('networkPartitions/'+ network_partition_id,
+        return Stratos.get('networkPartitions/'+network_partition_id,
                            error_message='No network partitions found')
+    @staticmethod
+    def update_network_partition(json):
+        return Stratos.put('networkPartitions', json,  error_message='No cartridge found')
+
 
     @staticmethod
     def remove_network_partition(network_partition_id):
@@ -155,6 +249,7 @@ class Stratos:
     # Auto-scaling policies
      * list-autoscaling-policies
      * describe-autoscaling-policy
+     * update-autoscaling-policy
      * remove-autoscaling-policy
 
     """
@@ -192,16 +287,21 @@ class Stratos:
                            error_message='Kubernetes cluster not found')
     @staticmethod
     def describe_kubernetes_master(kubernetes_cluster_id):
-        return Stratos.get('kubernetesClusters/'+ kubernetes_cluster_id+'/master',
-                           error_message='No kubernetes clusters found')
+        return Stratos.get('kubernetesClusters/'+kubernetes_cluster_id+'/master', error_message='No kubernetes clusters found')
 
     @staticmethod
+    def remove_kubernetes_cluster(kubernetes_cluster_id):
+        return Stratos.delete('kubernetesClusters/'+kubernetes_cluster_id,
+                              error_message="Autoscaling policy not found")
+    @staticmethod
+    def remove_kubernetes_host(kubernetes_cluster_id, host_id):
+        return Stratos.delete('kubernetesClusters/'+kubernetes_cluster_id+"/hosts/"+host_id,
+                              error_message="Autoscaling policy not found")
+    @staticmethod
     def describe_application_signup(application_id):
         return Stratos.get('applications/'+ application_id + '/signup',
                            error_message='No signup application found')
 
-
-
     """
     # Utils
 
@@ -210,7 +310,7 @@ class Stratos:
     def get(resource, error_message):
         r = requests.get(Configs.stratos_api_url + resource,
                          auth=(Configs.stratos_username, Configs.stratos_password), verify=False)
-        # print(r.text)
+        print(r.text)
         if r.status_code == 200:
             return r.json()
         elif r.status_code == 400:
@@ -242,11 +342,36 @@ class Stratos:
 
     @staticmethod
     def post(resource, data,  error_message):
-        r = requests.post(Configs.stratos_api_url + resource, data,
+        headers = {'content-type': 'application/json'}
+        r = requests.post(Configs.stratos_api_url + resource, data, headers=headers,
                           auth=(Configs.stratos_username, Configs.stratos_password), verify=False)
+        print(r)
+        print(r.text)
+        if r.status_code == 200:
+            return r.json()
+        elif r.status_code == 201:
+            return True
+        elif r.status_code == 400:
+            raise requests.HTTPError()
+        elif r.status_code == 401:
+            raise AuthenticationError()
+        elif r.status_code == 404:
+            if r.text and r.json() and r.json()['errorMessage'] == error_message:
+                return []
+            else:
+                raise requests.HTTPError()
+
+    @staticmethod
+    def put(resource, data,  error_message):
+        headers = {'content-type': 'application/json'}
+        r = requests.put(Configs.stratos_api_url + resource, data, headers=headers,
+                         auth=(Configs.stratos_username, Configs.stratos_password), verify=False)
+        print(r)
         print(r.text)
         if r.status_code == 200:
             return r.json()
+        elif r.status_code == 201:
+            return True
         elif r.status_code == 400:
             raise requests.HTTPError()
         elif r.status_code == 401:
@@ -257,3 +382,44 @@ class Stratos:
             else:
                 raise requests.HTTPError()
 
+
+    #kithule is confused
+
+    @staticmethod
+    def remove_domain_mappings(domain):
+        return Stratos.delete('domainMappings/'+domain)
+
+    def remove_application_signup(signup):
+        return Stratos.delete('applicationSignup/'+signup)
+
+    def describe_application_runtime(application):
+        return Stratos.get('applicationRuntime/'+application, error_message='No application runtime found')
+
+    def describe_application(application):
+        return Stratos.get('application/'+application, error_message='No application found')
+
+    @staticmethod
+    def add_network_partition(json):
+        return Stratos.post('networkPartitions', json,  error_message='No network partition found')
+
+    @staticmethod
+    def add_kubernetes_cluster(json):
+        return Stratos.post('kubernetesClusters', json,  error_message='No kubernetes cluster found')
+
+    @staticmethod
+    def add_domain_mapping(application_id, json):
+        return Stratos.post('applications/'+application_id+'/domainMappings', json,  error_message='No domain mapping found')
+
+    @staticmethod
+    def add_deployment_policy(json):
+        return Stratos.post('deploymentPolicies', json,  error_message='No deployment policy found')
+
+    @staticmethod
+    def add_autoscaling_policy(json):
+        return Stratos.post('autoscalingPolicies', json,  error_message='No autoscaling policy found')
+
+    @staticmethod
+    def add_application(json):
+        return Stratos.post('applications', json,  error_message='No application found')
+
+