Runtest tests for Keystonev3 module

Change-Id: Iafdd9018bceb92a63205650230d533879fe14dd5
Related-Prod: PROD-22183 (PROD:22183)
diff --git a/runtest/salttest/modules/openstack/init.sls b/runtest/salttest/modules/openstack/init.sls
index ab16a8d..aec8eac 100644
--- a/runtest/salttest/modules/openstack/init.sls
+++ b/runtest/salttest/modules/openstack/init.sls
@@ -2,6 +2,7 @@
 - runtest.salttest.modules.openstack.glance
 - runtest.salttest.modules.openstack.glancev2
 - runtest.salttest.modules.openstack.keystone
+- runtest.salttest.modules.openstack.keystonev3
 - runtest.salttest.modules.openstack.nova
 - runtest.salttest.modules.openstack.novav21
 - runtest.salttest.modules.openstack.neutron
diff --git a/runtest/salttest/modules/openstack/keystonev3.sls b/runtest/salttest/modules/openstack/keystonev3.sls
new file mode 100644
index 0000000..1646a49
--- /dev/null
+++ b/runtest/salttest/modules/openstack/keystonev3.sls
@@ -0,0 +1,496 @@
+{%- set Keystone_Test_Domain = 'TestDomain' %}
+{%- set Keystone_Test_Project = 'TestProject' %}
+{%- set Keystone_Test_User = 'TestKeystoneUser' %}
+{%- set Keystone_Test_Service = 'TestKeystoneService' %}
+{%- set Keystone_Test_Role = 'TestKeystoneRole' %}
+{%- set Keystone_Test_Role_Implies = 'TestKeystoneRole2' %}
+{%- set Keystone_Test_Group = 'TestKeystoneGroup' %}
+
+keystonev3_domain_create:
+  module.run:
+    - name: keystonev3.domain_create
+    - kwargs:
+        cloud_name: admin_identity
+        description: Test_Keystone_Domain
+        enabled: true
+        name: {{ Keystone_Test_Domain }}
+
+keystonev3_project_create:
+  module.run:
+    - name: keystonev3.project_create
+    - kwargs:
+        cloud_name: admin_identity
+        name: {{ Keystone_Test_Project }}
+        description: Keystene_v3_test_project
+        domain_id: {{ Keystone_Test_Domain }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_user_create:
+  module.run:
+    - name: keystonev3.user_create
+    - kwargs:
+        cloud_name: admin_identity
+        name: {{ Keystone_Test_User }}
+        description: Test_Keystone_User
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_group_create:
+  module.run:
+    - name: keystonev3.group_create
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+        name: {{ Keystone_Test_Group }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_service_create:
+  module.run:
+    - name: keystonev3.service_create
+    - kwargs:
+        cloud_name: admin_identity
+        type: image
+        name: {{ Keystone_Test_Service }}
+        description: Keystone_service_description
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_role_create:
+  module.run:
+    - name: keystonev3.role_create
+    - kwargs:
+        cloud_name: admin_identity
+        name: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_role_implies_create:
+  module.run:
+    - name: keystonev3.role_create
+    - kwargs:
+        cloud_name: admin_identity
+        name: {{ Keystone_Test_Role_Implies }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_endpoint_create:
+ module.run:
+    - name: keystonev3.endpoint_create
+    - kwargs:
+        cloud_name: admin_identity
+        interface: public
+        url: http://example.com/identity/v3/endpoints/828384
+        service_id: {{ Keystone_Test_Service }}
+    - require:
+      - keystonev3_service_create
+
+keystonev3_role_inference_rule_create:
+ module.run:
+    - name: keystonev3.role_inference_rule_create
+    - kwargs:
+        cloud_name: admin_identity
+        prior_role_id: {{ Keystone_Test_Role }}
+        implies_role_id: {{ Keystone_Test_Role_Implies }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_role_implies_create
+
+keystonev3_role_inference_rule_confirm:
+ module.run:
+    - name: keystonev3.role_inference_rule_confirm
+    - kwargs:
+        cloud_name: admin_identity
+        prior_role_id: {{ Keystone_Test_Role }}
+        implies_role_id: {{ Keystone_Test_Role_Implies }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_role_implies_create
+
+keystonev3_role_assign_for_user_on_project:
+  module.run:
+    - name: keystonev3.role_assign_for_user_on_project
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_user_create
+      - keystonev3_project_create
+
+keystonev3_role_assign_for_user_on_domain:
+  module.run:
+    - name: keystonev3.role_assign_for_user_on_domain
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_user_create
+      - keystonev3_domain_create
+
+keystonev3_group_user_add:
+  module.run:
+    - name: keystonev3.group_user_add
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+        user_id: {{ Keystone_Test_User }}
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_group_user_check:
+  module.run:
+    - name: keystonev3.group_user_check
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+        user_id: {{ Keystone_Test_User }}
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_role_assign_check_for_user_on_project:
+  module.run:
+    - name: keystonev3.role_assign_check_for_user_on_project
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_user_create
+      - keystonev3_project_create
+
+keystonev3_role_assign_check_for_user_on_domain:
+  module.run:
+    - name: keystonev3.role_assign_check_for_user_on_domain
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_user_create
+      - keystonev3_domain_create
+
+keystonev3_role_get_details:
+  module.run:
+    - name: keystonev3.role_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_create
+
+keystonev3_group_get_details:
+  module.run:
+    - name: keystonev3.group_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+    - require:
+      - keystonev3_group_create
+
+keystonev3_service_list:
+  module.run:
+    - name: keystonev3.service_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_service_create
+
+keystonev3_project_list:
+  module.run:
+    - name: keystonev3.project_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_project_create
+
+keystonev3_user_list:
+  module.run:
+    - name: keystonev3.user_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_role_list:
+  module.run:
+    - name: keystonev3.role_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_role_create
+
+keystonev3_domain_list:
+  module.run:
+    - name: keystonev3.domain_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_endpoint_list:
+  module.run:
+    - name: keystonev3.endpoint_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_endpoint_create
+
+keystonev3_group_user_list:
+  module.run:
+    - name: keystonev3.group_user_list
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_role_assignment_list:
+  module.run:
+    - name: keystonev3.role_assignment_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_role_inference_rule_list:
+  module.run:
+    - name: keystonev3.role_inference_rule_list
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_role_inference_rule_create
+
+keystonev3_role_inference_rule_for_role_list:
+  module.run:
+    - name: keystonev3.role_inference_rule_for_role_list
+    - kwargs:
+        cloud_name: admin_identity
+        prior_role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_role_inference_rule_create
+
+keystonev3_service_update:
+  module.run:
+    - name: keystonev3.service_update
+    - kwargs:
+        cloud_name: admin_identity
+        service_id: {{ Keystone_Test_Service }}
+        description: Keystone_service_UPDATED_description
+    - require:
+      - keystonev3_service_create
+
+keystonev3_project_update:
+  module.run:
+    - name: keystonev3.project_update
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+        description: Keystone_updated_description
+    - require:
+      - keystonev3_project_create
+
+keystonev3_group_update:
+  module.run:
+    - name: keystonev3.group_update
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+        description: Group_Updated_Description
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_user_update:
+  module.run:
+    - name: keystonev3.user_update
+    - kwargs:
+        cloud_name: admin_identity
+        user_id: {{ Keystone_Test_User }}
+        description: Updated_Test_Keystone_User
+    - require:
+      - keystonev3_user_create
+
+keystonev3_role_inference_rule_get:
+  module.run:
+    - name: keystonev3.role_inference_rule_get
+    - kwargs:
+        cloud_name: admin_identity
+        prior_role_id: {{ Keystone_Test_Role }}
+        implies_role_id: {{ Keystone_Test_Role_Implies }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_role_implies_create
+
+keystonev3_domain_update:
+  module.run:
+    - name: keystonev3.domain_update
+    - kwargs:
+        cloud_name: admin_identity
+        enabled: false
+        domain_id: {{ Keystone_Test_Domain }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_project_get_details:
+  module.run:
+    - name: keystonev3.project_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+    - require:
+      - keystonev3_project_create
+
+keystonev3_service_get_details:
+  module.run:
+    - name: keystonev3.service_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        service_id: {{ Keystone_Test_Service }}
+    - require:
+      - keystonev3_service_create
+
+keystonev3_user_get_details:
+  module.run:
+    - name: keystonev3.user_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        user_id: {{ Keystone_Test_User }}
+    - require:
+      - keystonev3_role_create
+
+keystonev3_domain_get_details:
+  module.run:
+    - name: keystonev3.domain_get_details
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+    - require:
+      - keystonev3_domain_create
+
+keystonev3_role_unassign_for_user_on_project:
+  module.run:
+    - name: keystonev3.role_unassign_for_user_on_project
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_project_create
+      - keystonev3_user_create
+      - keystonev3_role_create
+
+keystonev3_role_unassign_for_user_on_domain:
+  module.run:
+    - name: keystonev3.role_unassign_for_user_on_domain
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+        user_id: {{ Keystone_Test_User }}
+        role_id: {{ Keystone_Test_Role }}
+    - require:
+      - keystonev3_domain_create
+      - keystonev3_user_create
+      - keystonev3_role_create
+
+keystonev3_service_delete:
+  module.run:
+    - name: keystonev3.service_delete
+    - kwargs:
+        cloud_name: admin_identity
+        service_id: {{ Keystone_Test_Service }}
+    - require:
+      - keystonev3_service_create
+
+keystonev3_role_inference_rule_delete:
+  module.run:
+    - name: keystonev3.role_inference_rule_delete
+    - kwargs:
+        cloud_name: admin_identity
+        prior_role_id: {{ Keystone_Test_Role }}
+        implies_role_id: {{ Keystone_Test_Role_Implies }}
+    - require:
+      - keystonev3_role_create
+      - keystonev3_role_implies_create
+
+keystonev3_role_delete:
+  module.run:
+    - name: keystonev3.role_delete
+    - args:
+      - {{ Keystone_Test_Role }}
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_role_create
+
+keystonev3_role_implies_delete:
+  module.run:
+    - name: keystonev3.role_delete
+    - args:
+      - {{ Keystone_Test_Role_Implies }}
+    - kwargs:
+        cloud_name: admin_identity
+    - require:
+      - keystonev3_role_implies_create
+
+keystonev3_group_user_remove:
+  module.run:
+    - name: keystonev3.group_user_remove
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+        user_id: {{ Keystone_Test_User }}
+    - require:
+      - keystonev3_user_create
+      - keystonev3_group_create
+
+keystonev3_user_delete:
+  module.run:
+    - name: keystonev3.user_delete
+    - kwargs:
+        cloud_name: admin_identity
+        user_id: {{ Keystone_Test_User }}
+    - require:
+      - keystonev3_user_create
+
+keystonev3_group_delete:
+  module.run:
+    - name: keystonev3.group_delete
+    - kwargs:
+        cloud_name: admin_identity
+        group_id: {{ Keystone_Test_Group }}
+    - require:
+      - keystonev3_group_create
+
+keystonev3_project_delete:
+  module.run:
+    - name: keystonev3.project_delete
+    - kwargs:
+        cloud_name: admin_identity
+        project_id: {{ Keystone_Test_Project }}
+    - require:
+      - keystonev3_project_create
+
+keystonev3_domain_delete:
+  module.run:
+    - name: keystonev3.domain_delete
+    - kwargs:
+        cloud_name: admin_identity
+        domain_id: {{ Keystone_Test_Domain }}
+    - require:
+      - keystonev3_domain_create
diff --git a/runtest/salttest/states/openstack/init.sls b/runtest/salttest/states/openstack/init.sls
index 23e4247..fc8eedc 100644
--- a/runtest/salttest/states/openstack/init.sls
+++ b/runtest/salttest/states/openstack/init.sls
@@ -6,3 +6,4 @@
 - runtest.salttest.states.openstack.glancev2
 - runtest.salttest.states.openstack.cinderv3
 - runtest.salttest.states.openstack.heatv1
+- runtest.salttest.states.openstack.keystonev3
diff --git a/runtest/salttest/states/openstack/keystonev3.sls b/runtest/salttest/states/openstack/keystonev3.sls
new file mode 100644
index 0000000..d869409
--- /dev/null
+++ b/runtest/salttest/states/openstack/keystonev3.sls
@@ -0,0 +1,77 @@
+{%- set Keystone_Test_Domain = 'TestDomain' %}
+{%- set Keystone_Test_Project = 'TestProject' %}
+{%- set Keystone_Test_User = 'TestKeystoneUser' %}
+{%- set Keystone_Test_Service = 'TestKeystoneService' %}
+{%- set Keystone_Test_Role = 'TestKeystoneRole' %}
+{%- set Keystone_Test_Endpoint = 'TestKeystoneEndpoint' %}
+
+keystonev3_service_present:
+  keystonev3.service_present:
+  - name: {{ Keystone_Test_Service }}
+  - type: image
+  - cloud_name: admin_identity
+
+keystonev3_endpoint_present:
+  keystonev3.endpoint_present:
+  - name: {{ Keystone_Test_Endpoint }}
+  - url: http://example.com/identity/v3/endpoints/222222
+  - interface: public
+  - service_id: {{ Keystone_Test_Service }}
+  - cloud_name: admin_identity
+
+keystonev3_project_present:
+  keystonev3.project_present:
+  - name: {{ Keystone_Test_Project }}
+  - cloud_name: admin_identity
+  - domain_id: default
+
+keystonev3_user_present:
+  keystonev3.user_present:
+  - name: {{ Keystone_Test_User }}
+  - cloud_name: admin_identity
+
+keystonev3_role_present:
+  keystonev3.role_present:
+  - name: {{ Keystone_Test_Role }}
+  - cloud_name: admin_identity
+
+keystonev3_user_role_assigned:
+  keystonev3.user_role_assigned:
+  - name: {{ Keystone_Test_User }}
+  - cloud_name: admin_identity
+  - role_id: {{ Keystone_Test_Role }}
+  - project_id: {{ Keystone_Test_Project }}
+
+keystonev3_endpoint_absent:
+  keystonev3.endpoint_absent:
+  - name: {{ Keystone_Test_Endpoint }}
+  - interface: public
+  - service_id: {{ Keystone_Test_Service }}
+  - cloud_name: admin_identity
+
+keystonev3_user_role_unassign:
+  keystonev3.user_role_unassign:
+  - name: {{ Keystone_Test_User }}
+  - role_id: {{ Keystone_Test_Role }}
+  - cloud_name: admin_identity
+  - project_id: {{ Keystone_Test_Project }}
+
+keystonev3_role_absent:
+  keystonev3.role_absent:
+  - name: {{ Keystone_Test_Role }}
+  - cloud_name: admin_identity
+
+keystonev3_service_absent:
+  keystonev3.service_absent:
+  - name: {{ Keystone_Test_Service }}
+  - cloud_name: admin_identity
+
+keystonev3_project_absent:
+  keystonev3.project_absent:
+  - name: {{ Keystone_Test_Project }}
+  - cloud_name: admin_identity
+
+keystonev3_user_absent:
+  keystonev3.user_absent:
+  - name: {{ Keystone_Test_User }}
+  - cloud_name: admin_identity