aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/tests/11_user_scalability/scenario/rbac_250.py
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2017-07-06 15:35:12 +0200
committerasteroide <thomas.duval@orange.com>2017-07-06 15:35:12 +0200
commit19dd4e461d1239754bd1a82e30f2a770c99a7f90 (patch)
tree28c57a5802c805dbbe10e760dff159e499fc9622 /moonv4/tests/11_user_scalability/scenario/rbac_250.py
parent53a64609bd5b3f02a3bdf7d85030db8f2028cada (diff)
Add test files for the evaluation
Change-Id: Ieceeef68ce701b913aaccd900218fbee896f48df
Diffstat (limited to 'moonv4/tests/11_user_scalability/scenario/rbac_250.py')
-rw-r--r--moonv4/tests/11_user_scalability/scenario/rbac_250.py89
1 files changed, 89 insertions, 0 deletions
diff --git a/moonv4/tests/11_user_scalability/scenario/rbac_250.py b/moonv4/tests/11_user_scalability/scenario/rbac_250.py
new file mode 100644
index 00000000..614fbf52
--- /dev/null
+++ b/moonv4/tests/11_user_scalability/scenario/rbac_250.py
@@ -0,0 +1,89 @@
+import random
+
+pdp_name = "pdp1"
+policy_name = "RBAC policy example"
+model_name = "RBAC"
+policy_genre = "authz"
+
+SUBJECT_NUMBER = 250
+OBJECT_NUMBER = 250
+ROLE_NUMBER = 100
+
+subjects = {}
+for _id in range(SUBJECT_NUMBER):
+ subjects["user{}".format(_id)] = ""
+objects = {}
+for _id in range(OBJECT_NUMBER):
+ objects["vm{}".format(_id)] = ""
+actions = {
+ "start": "",
+ "stop": "",
+ "pause": "",
+ "unpause": "",
+ "destroy": "",
+}
+
+subject_categories = {"role": "", }
+object_categories = {"id": "", }
+action_categories = {"action-type": "", }
+
+subject_data = {"role": {"admin": "", "*": ""}}
+for _id in range(ROLE_NUMBER):
+ subject_data["role"]["role{}".format(_id)] = ""
+object_data = {"id": {"*": ""}}
+for _id in range(OBJECT_NUMBER):
+ object_data["id"]["vm{}".format(_id)] = ""
+action_data = {"action-type": {
+ "vm-read": "",
+ "vm-write": "",
+ "*": ""
+}}
+
+subject_assignments = {}
+for _id in range(SUBJECT_NUMBER):
+ _role = "role{}".format(random.randrange(ROLE_NUMBER))
+ subject_assignments["user{}".format(_id)] = [{"role": _role}, {"role": "*"}]
+object_assignments = {"vm0": ({"id": "vm0"}, {"id": "*"}), "vm1": ({"id": "vm1"}, {"id": "*"})}
+for _id in range(OBJECT_NUMBER):
+ object_assignments["vm{}".format(_id)] = [{"id": "vm{}".format(_id)}, {"id": "*"}]
+action_assignments = {
+ "start": ({"action-type": "vm-write"}, {"action-type": "*"}),
+ "stop": ({"action-type": "vm-write"}, {"action-type": "*"}),
+ "pause": ({"action-type": "vm-read"}, {"action-type": "*"}),
+ "unpause": ({"action-type": "vm-read"}, {"action-type": "*"}),
+ "destroy": ({"action-type": "vm-write"}, {"action-type": "*"}),
+}
+
+meta_rule = {
+ "rbac": {"id": "", "value": ("role", "id", "action-type")},
+}
+
+rules = {
+ "rbac": [
+ {
+ "rule": ("admin", "vm0", "vm-read"),
+ "instructions": (
+ {"decision": "grant"},
+ )
+ },
+ {
+ "rule": ("admin", "vm0", "vm-write"),
+ "instructions": (
+ {"decision": "grant"},
+ )
+ },
+ ]
+}
+
+for _id in range(SUBJECT_NUMBER):
+ _role = "role{}".format(random.randrange(ROLE_NUMBER))
+ _vm = "vm{}".format(random.randrange(OBJECT_NUMBER))
+ _action = random.choice(list(action_data['action-type'].keys()))
+ rules["rbac"].append(
+ {
+ "rule": (_role, _vm, _action),
+ "instructions": (
+ {"decision": "grant"},
+ )
+ },
+ )