From ae47f63e90b5fa312f20ed92d66ba049727dd528 Mon Sep 17 00:00:00 2001 From: Niculut <laurentiu.niculut@hpe.com> Date: Thu, 7 Dec 2023 13:16:29 +0100 Subject: [PATCH] alligned to the latest release --- controller/Orchestrator.py | 62 +- icgparser/DomlParserUtilities.py | 123 +- .../IntermediateRepresentationUtility.py | 7 +- icgparser/ModelParser.py | 97 +- icgparser/ModelResourcesUtilities.py | 11 +- icgparser/PiacereInternalToolsIntegrator.py | 9 +- icgparser/doml/v1/nginx-openstack_v1.domlx | 269 +- icgparser/doml/v2/doml_v2.3.ecore | 423 ++ input_file_generated/ir.json | 3500 +++++++++++++++-- .../nginx_openstack/nginx/config.yaml | 4 +- .../nginx_openstack/nginx/inventory.j2 | 8 +- .../nginx_openstack/nginx/ssh_key.j2 | 2 +- .../nginx_openstack/terraform/config.yaml | 4 - .../nginx_openstack/terraform/main.tf | 80 +- .../nginx_openstack/terraform/output.tf | 14 - plugin/AnsiblePlugin.py | 29 +- plugin/DockerComposePlugin.py | 29 +- requirements.txt | 2 +- template-location.properties | 12 +- templates/ansible/centos/elasticsearch.tpl | 16 +- .../ansible/centos/external_code_main.tpl | 15 + templates/ansible/centos/inventory.tpl | 14 +- templates/ansible/centos/postgres.tpl | 2 +- .../performance_monitoring/main.yml | 2 + .../performance_monitoring/vars/main.yaml | 4 + .../security_monitoring/.gitignore | 1 + .../security_monitoring/README.md | 14 +- .../security_monitoring/build-wazuh-agent.yml | 2 + .../security_monitoring/config/ossec.conf.j2 | 10 + .../deploy-wazuh-agent.yml | 44 +- .../deploy-wazuh-docker-agent.yml | 2 + .../security_monitoring/inventory.txt | 8 +- templates/ansible/saas/SaaSDBMS.tpl | 42 + templates/ansible/saas/config.tpl | 18 + templates/ansible/saas/inventory.tpl | 18 + templates/ansible/saas/ssh_key.tpl | 18 + .../ansible/ubuntu/external_code_main.tpl | 15 + templates/ansible/ubuntu/inventory.tpl | 14 +- templates/ansible/ubuntu/postgres.tpl | 2 +- templates/docker_compose/docker_compose.tpl | 19 +- templates/docker_compose/inventory.tpl | 13 +- templates/docker_compose/main.tpl | 9 + templates/docker_compose/ssh_key.tpl | 6 +- templates/terraform/aws/autoscaling_group.tpl | 18 +- templates/terraform/aws/network.tpl | 2 +- templates/terraform/aws/port_rule.tpl | 17 +- templates/terraform/aws/ssh_key.tpl | 2 +- templates/terraform/aws/virtual_machine.tpl | 2 +- .../terraform/aws/virtual_machine_out.tpl | 4 + templates/terraform/ionos/datacenter.tpl | 2 +- templates/terraform/open_stack/network.tpl | 42 +- .../terraform/open_stack/virtual_machine.tpl | 51 +- .../open_stack/virtual_machine_out.tpl | 8 +- templates/terraform/vsphere/config.tpl | 5 +- .../terraform/vsphere/data_resources.tpl | 5 +- templates/terraform/vsphere/datacenter.tpl | 1 - templates/terraform/vsphere/datastore.tpl | 3 +- templates/terraform/vsphere/init.tpl | 4 - templates/terraform/vsphere/network.tpl | 4 +- .../terraform/vsphere/virtual_machine.tpl | 41 +- .../terraform/vsphere/virtual_machine_out.tpl | 4 +- templates/terraform/vsphere/vm_image.tpl | 5 +- utility/Graph.py | 51 + 63 files changed, 4669 insertions(+), 595 deletions(-) create mode 100644 icgparser/doml/v2/doml_v2.3.ecore create mode 100644 templates/ansible/centos/external_code_main.tpl create mode 100644 templates/ansible/cross-platform/security_monitoring/.gitignore create mode 100644 templates/ansible/saas/SaaSDBMS.tpl create mode 100644 templates/ansible/saas/config.tpl create mode 100644 templates/ansible/saas/inventory.tpl create mode 100644 templates/ansible/saas/ssh_key.tpl create mode 100644 templates/ansible/ubuntu/external_code_main.tpl create mode 100644 utility/Graph.py diff --git a/controller/Orchestrator.py b/controller/Orchestrator.py index 6dcf09b..6dfb255 100644 --- a/controller/Orchestrator.py +++ b/controller/Orchestrator.py @@ -25,6 +25,7 @@ from icgparser import ModelParser, PiacereInternalToolsIntegrator, IntermediateR from icgparser.ModelResourcesUtilities import ModelResources, get_ir_key_name from plugin import AnsiblePlugin, TerraformPlugin, TemplateUtils, DockerComposePlugin from utility.FileParsingUtility import replace_none_with_empty_str +from utility.Graph import Graph class CompressFolder: @@ -55,27 +56,46 @@ def choose_plugin(parameters, template_generated_folder): # os.system('rm -f /opt/output_files_generated/*') logging.info("Choosing plugin") metadata_root_folder = {"iac": []} + # Inner function to be called when visiting graph of container dependencies + def append_container_name(container_name): + metadata_root_folder["iac"].append(container_name) for step in parameters["steps"]: - if step["programming_language"] == "ansible": - logging.info("Ansible Plugin chosen") - step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] - metadata_root_folder["iac"].append(step_name) - # input_data = step["data"] - AnsiblePlugin.create_files(step, template_generated_folder) - elif step["programming_language"] == "terraform": - logging.info("Terraform Plugin chosen") - metadata_root_folder["iac"].append("terraform") - input_data = step["data"] - iac_output_folder = template_generated_folder + "terraform" - # plugin_metadata = {"input": ["openstack_username", "openstack_password", "openstack_auth_url"], - plugin_metadata = {"input": [], "output": [], "engine": "terraform"} - save_file(plugin_metadata, iac_output_folder + "/config.yaml", output_extensions="YAML") - TerraformPlugin.create_files(input_data, iac_output_folder) - elif step["programming_language"] == "docker-compose": - logging.info("Docker Compose Plugin chosen") - # input_data = step["data"] - metadata_root_folder["iac"].append("docker-compose") - DockerComposePlugin.create_files(step, template_generated_folder) + if step: + if step["programming_language"] == "ansible": + ### IMPORTANT, TO SOLVE + ### ADDED EXPLICIT EXCEPTION FOR SIMPA UC + ### + if step["step_name"] == "security_monitoring" or step["step_name"] == "performance_monitoring": + logging.info("Ansible Plugin chosen") + step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] + metadata_root_folder["iac"].append(step_name) + # input_data = step["data"] + AnsiblePlugin.create_files(step, template_generated_folder) + else: + logging.info("Ansible Plugin chosen") + step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] + metadata_root_folder["iac"].append(step_name) + # input_data = step["data"] + AnsiblePlugin.create_files(step, template_generated_folder) + elif step["programming_language"] == "terraform": + logging.info("Terraform Plugin chosen") + metadata_root_folder["iac"].append("terraform") + input_data = step["data"] + iac_output_folder = template_generated_folder + "terraform" + # plugin_metadata = {"input": ["openstack_username", "openstack_password", "openstack_auth_url"], + plugin_metadata = {"input": [], "output": [], "engine": "terraform"} + save_file(plugin_metadata, iac_output_folder + "/config.yaml", output_extensions="YAML") + TerraformPlugin.create_files(input_data, iac_output_folder) + elif step["programming_language"] == "docker-compose": + logging.info("Docker Compose Plugin chosen") + input_data = step["data"] + # metadata_root_folder["iac"].append("docker-compose") + container_graph = DockerComposePlugin.create_container_dependency_graph(input_data, + Graph(f=append_container_name)) + # visiting the graph; container names are appended in the right order to the ilst metadata_root_folder["iac"] + container_graph.visit() + extra_param = parameters["steps"][0]["data"]["containerImages"] + DockerComposePlugin.create_files(step, template_generated_folder, extra_param) gaiax_file = create_gaiax_file(parameters) save_file(gaiax_file, template_generated_folder + "/gaiax_self_description.yaml", output_extensions="YAML") save_file(metadata_root_folder, template_generated_folder + "/config.yaml", output_extensions="YAML") @@ -208,6 +228,7 @@ def create_iac_from_doml(model, is_multiecore_metamodel, metamodel_directory): PiacereInternalToolsIntegrator.add_files_for_piacere_internal_tools(template_generated_folder) create_iac_from_intermediate_representation(intermediate_representation) compress_folder_info = compress_iac_folder(template_generated_folder) + #shutil.rmtree(template_generated_folder) return compress_folder_info @@ -231,4 +252,5 @@ def create_iac_from_doml_path(model_path, is_multiecore_metamodel, metamodel_dir PiacereInternalToolsIntegrator.add_files_for_piacere_internal_tools(template_generated_folder) create_iac_from_intermediate_representation(intermediate_representation) compress_folder_info = compress_iac_folder(template_generated_folder) + #shutil.rmtree(template_generated_folder) return compress_folder_info diff --git a/icgparser/DomlParserUtilities.py b/icgparser/DomlParserUtilities.py index e78b2fd..01d391a 100644 --- a/icgparser/DomlParserUtilities.py +++ b/icgparser/DomlParserUtilities.py @@ -15,13 +15,14 @@ import logging -from pyecore.ecore import EOrderedSet, EEnumLiteral +from pyecore.ecore import EOrderedSet, EEnumLiteral, EcoreUtils from pyecore.resources import ResourceSet, URI, global_registry import pyecore.ecore as Ecore # This gets a reference to the Ecore metamodel implementation TO_BE_PARSED_RESOURCES = {} METAMODEL_SECTIONS = ["doml", "commons", "application", "infrastructure", "concrete", "optimization"] METAMODEL_DIRECTORY = "icgparser/doml" +NAVIGATED_REFERENCES = [] doml_layers = { "active_infrastructure_layer": "activeInfrastructure", @@ -82,18 +83,29 @@ def get_concrete_layer(doml_model): concretization_layer = doml_model.eGet(doml_layers["active_infrastructure_layer"]) return concretization_layer - def save_annotations(from_object, to_object): - print(f'Saving annotation from {from_object.name}') + #print(f'Saving annotation from {from_object.name}') if not to_object: to_object = {} - for annotation in from_object.annotations: - to_object[annotation.key] = annotation.value + try: + for annotation in from_object.annotations: + if "SProperty" in str(type(annotation)) or "BProperty" in str(type(annotation)) or "FProperty" in str(type(annotation)) or "IProperty" in str(type(annotation)): + to_object[annotation.key] = annotation.value + elif "ListProperty" in str(type(annotation)): + list_object = {} + for value in annotation.values: + list_object[value.key] = value.value + to_object[annotation.key] = list_object + else: + # Don't know which case is covered here, so... + logging.info(f"Met Annotation of type {str(type(annotation))}") + to_object[annotation.key] = annotation.values + except: + logging.info(f"No Annotation in element type {str(type(from_object))}") return to_object - def save_attributes(from_object, to_object, skip_component_name=False): - print(f'Saving attributes from {from_object.name}') + #print(f'Saving attributes from {from_object.name}') if not to_object: to_object = {} for attribute in from_object.eClass.eAllAttributes(): @@ -115,6 +127,19 @@ def save_attributes(from_object, to_object, skip_component_name=False): return to_object +def update_missing_parsed_list_resources(resource, reference, is_to_be_parsed): + for attribute in resource.eClass.eAllAttributes(): + resource_name = attribute.name + if is_to_be_parsed and not (resource_name in TO_BE_PARSED_RESOURCES): + print(f'Adding {resource_name} as missing parsed resource') + TO_BE_PARSED_RESOURCES[resource_name] = {"resource": resource, + "reference": reference} ## TODO introdurre interfaccia + elif not is_to_be_parsed and (resource_name in TO_BE_PARSED_RESOURCES): + print(f'Removing {resource_name} to the missing parsed resource') + del TO_BE_PARSED_RESOURCES[resource_name] + else: + print(f'update_missing_parsed_resources: skipping {resource_name}') + def update_missing_parsed_resources(resource, reference, is_to_be_parsed): resource_name = resource.name if is_to_be_parsed and not (resource_name in TO_BE_PARSED_RESOURCES): @@ -136,13 +161,15 @@ def save_references_info(from_object, to_object): logging.info(f'{ref.name} is a list') object_representation_list = [] for reference_object in get_reference_list_if_exists(from_object, ref): - logging.info(f'Adding info for ref_link "{reference_object.name}"') - object_representation = {} - object_representation = save_annotations(reference_object, object_representation) - object_representation = save_attributes(reference_object, object_representation) - object_representation = save_references_link(reference_object, object_representation) - save_references_info(reference_object, object_representation) - object_representation_list.append(object_representation) + logging.info(f'{reference_object} is the list type') + if reference_object.name: + logging.info(f'Adding info for ref_link "{reference_object.name}"') + object_representation = {} + object_representation = save_annotations(reference_object, object_representation) + object_representation = save_attributes(reference_object, object_representation) + object_representation = save_references_link(reference_object, object_representation) + save_references_info(reference_object, object_representation) + object_representation_list.append(object_representation) to_object[ref.name] = object_representation_list logging.info(f"References added: {to_object}") # save_references_info(reference_object, to_object) @@ -160,8 +187,31 @@ def save_references_info(from_object, to_object): def save_references_link(from_object, to_object): ## TODO refactoring refs = from_object.eClass.eAllReferences() for ref in refs: - if get_reference_list_if_exists(from_object, ref): + reference_object_list = get_reference_list_if_exists(from_object, ref) + if reference_object_list: + #if get_reference_list_if_exists(from_object, ref): logging.info(f'{ref.name} is a list, skipping it') + logging.info(f'{reference_object_list}') + object_representation_list = [] + for reference_object in reference_object_list: + object_representation = {} + #object_representation = save_annotations(reference_object, object_representation) + object_representation = save_attributes(reference_object, object_representation) + if not reference_object in NAVIGATED_REFERENCES: + NAVIGATED_REFERENCES.append(reference_object) + object_representation = save_annotations(reference_object, object_representation) + object_representation = save_references_link(reference_object, object_representation) + #save_references_info(reference_object, object_representation) + #save_references_info(reference_object, object_representation) + object_representation_list.append(object_representation) + #update_missing_parsed_list_resources(reference_object, reference=ref, is_to_be_parsed=True) + if not ref.name in to_object: + to_object[ref.name] = object_representation_list + else: + key = "infra_" + ref.name + print(f'Renaming references key from {ref.name} into {key}') + to_object[key] = object_representation_list + logging.info(f"References added: {object_representation_list}") ## TODO trattare la lista elif from_object.eGet(ref.name): logging.info(f'Adding reference "{ref.name}" location') @@ -192,27 +242,40 @@ def save_inner_components(from_object, to_object): def save_inner_component(component, to_object): if not isinstance(component, EOrderedSet): # TODO espandere info logging.info("Saving inner component") - if component.name is not None: - object_name = component.eClass.name + "_" + component.name + if "Property" in str(type(component)): + if component.key is not None: + object_name = component.eClass.name + "_" + component.key + to_object[object_name] = component.value else: - logging.warning(f'Object name not available, changing it using class name: {component.eClass.name}') - object_name = component.eClass.name - print(f'Saving information from object {object_name}') - inner_component = save_attributes(component, {}) - save_references_link(component, inner_component) - to_object[object_name] = inner_component + if component.name is not None: + object_name = component.eClass.name + "_" + component.name + else: + logging.warning(f'Object name not available, changing it using class name: {component.eClass.name}') + object_name = component.eClass.name + print(f'Saving information from object {object_name}') + inner_component = save_attributes(component, {}) + save_references_link(component, inner_component) + to_object[object_name] = inner_component return to_object def add_infrastructure_information(infrastructure_element, to_object): - print(f'Saving infrastructure information from {infrastructure_element.name}') - update_missing_parsed_resources(infrastructure_element, is_to_be_parsed=False, reference=None) - save_attributes(infrastructure_element, to_object, skip_component_name=True) - save_references_link(infrastructure_element, to_object) - save_inner_components(infrastructure_element, to_object) + #print(f'Infrastructure information {infrastructure_element}') + print(f'Infrastructure information type {str(type(infrastructure_element))}') + if not "Property" in str(type(infrastructure_element)): + print(f'Saving infrastructure information from {infrastructure_element.name}') + update_missing_parsed_resources(infrastructure_element, is_to_be_parsed=False, reference=None) + save_attributes(infrastructure_element, to_object, skip_component_name=True) + save_references_link(infrastructure_element, to_object) + save_inner_components(infrastructure_element, to_object) + else: + print(f'Saving infrastructure information from {infrastructure_element.key}') + update_missing_parsed_resources(infrastructure_element, is_to_be_parsed=False, reference=None) + save_attributes(infrastructure_element, to_object, skip_component_name=True) + save_references_link(infrastructure_element, to_object) + save_inner_components(infrastructure_element, to_object) return to_object - def retrieve_missing_parsed_resources(): return TO_BE_PARSED_RESOURCES @@ -249,5 +312,3 @@ def hasMaps(object): except: logging.info("No maps found") return False - - diff --git a/icgparser/IntermediateRepresentationUtility.py b/icgparser/IntermediateRepresentationUtility.py index 1a74e0c..1ecfda0 100644 --- a/icgparser/IntermediateRepresentationUtility.py +++ b/icgparser/IntermediateRepresentationUtility.py @@ -9,9 +9,10 @@ def find_objects(object_name: ModelResources, intermediate_representation): steps = intermediate_representation[ir_step_name] object_ir_name = get_ir_key_name(object_name) for step in steps: - data = step[get_ir_key_name(ModelResources.DATA)] - if object_ir_name in data.keys(): - return data[object_ir_name] + if step: + data = step[get_ir_key_name(ModelResources.DATA)] + if object_ir_name in data.keys(): + return data[object_ir_name] return [] diff --git a/icgparser/ModelParser.py b/icgparser/ModelParser.py index b970499..2f66daf 100644 --- a/icgparser/ModelParser.py +++ b/icgparser/ModelParser.py @@ -27,15 +27,16 @@ # ------------------------------------------------------------------------- import logging import re -from icgparser import DomlParserUtilities +from icgparser import DomlParserUtilities, IntermediateRepresentationUtility from icgparser.DomlParserUtilities import get_reference_list_if_exists, get_resources_from_concrete_layer, \ - get_infrastructure_element_from, get_external_references, save_references_info -from icgparser.ModelResourcesUtilities import ModelResourcesUtilities + get_infrastructure_element_from, get_external_references, save_references_info, update_missing_parsed_resources +from icgparser.ModelResourcesUtilities import ModelResourcesUtilities, ModelResources from plugin.PluginUtility import find_external_plugins_name, find_resources_names_for_plugin OUTPUT_BASE_DIR_PATH = "output_files_generated/" doml_layers = { "active_infrastructure_layer": "activeInfrastructure", + "infrastructure_layer": "infrastructure", } @@ -55,8 +56,10 @@ def include_missing_objects_from_infrastructure_layer(to_step): infra_object_representation) infra_object_representation = DomlParserUtilities.add_infrastructure_information(obj["resource"], infra_object_representation) - - ir_key_name = to_camel_case(obj["reference"].eType.name) + if "SecurityGroup" in str(type(obj["reference"])): + ir_key_name = "securityGroup" + else: + ir_key_name = to_camel_case(obj["reference"].eType.name) if ir_key_name in to_step["data"].keys(): to_step["data"][ir_key_name].append(infra_object_representation) else: @@ -86,8 +89,8 @@ def save_object_from_concrete_layer(object): object_representation = DomlParserUtilities.save_references_link(object, object_representation) object_representation = DomlParserUtilities.save_concrete_references_info(object, object_representation) if DomlParserUtilities.hasMaps(object): - object_representation = DomlParserUtilities.add_infrastructure_information(object.maps, - object_representation) + object_representation = DomlParserUtilities.add_infrastructure_information(object.maps, + object_representation) return object_representation @@ -103,6 +106,8 @@ def parse_infrastructural_objects(doml_model): infra_object_step = {"programming_language": "terraform"} ## TODO refactoring: generalize concretization_layer = doml_model.eGet(doml_layers["active_infrastructure_layer"]) providers = concretization_layer.providers + infa_layer = doml_model.eGet(doml_layers["infrastructure_layer"]) + for provider in providers: logging.info(f'Searching objects to be generates for provider "{provider.name}"') infra_object_step["data"] = {} ## TODO refactoring, fix (maybe list?): generalize @@ -110,6 +115,13 @@ def parse_infrastructural_objects(doml_model): infra_object_step = include_provide_info_from_concrete_layer(provider, infra_object_step) infra_object_step = include_infra_object_from_concrete_layer(provider, infra_object_step) + try: + infra_sec_groups = infa_layer.securityGroups + for infra_sec_group in infra_sec_groups: + logging.info(f'Found security group name "{infra_sec_group.name}"') + update_missing_parsed_resources(infra_sec_group, reference=infra_sec_group, is_to_be_parsed=True) + except: + logging.info(f'No security group found') infra_object_step = include_missing_objects_from_infrastructure_layer(infra_object_step) return infra_object_step @@ -125,24 +137,77 @@ def parse_application_layer(deployment, infra_object_step): application_object_step = {"programming_language": "ansible", "data": {}} deployment_component_name = deployment.component.name - logging.info(f'Parsing deployment for component {deployment_component_name}') + deployment_component_type = deployment.component.eClass.name + logging.info(f'Parsing deployment for component {deployment_component_name} of type {deployment_component_type}') object_representation = {} application_resource = deployment.eGet("component") - vm = deployment.eGet("node") - try: - for infra_vm in infra_object_step.get("data").get("vms"): - if infra_vm.get("infra_element_name") == vm.name: - ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi - object_representation["nodes"] = [infra_vm] - except Exception: - logging.error(f"parsing error: no vm {vm.name} found for deployment {deployment_component_name}") + + if deployment_component_type == "SoftwareComponent" or deployment_component_type == "DBMS": + vm = deployment.eGet("node") + # Looking for VM named vm.name + found = False + try: + if "autoScalingGroups" in infra_object_step.get("data").keys(): + for ag in infra_object_step.get("data").get("autoScalingGroups"): + ag_vm = next(v for k, v in ag.items() if k.lower().startswith('virtualmachine')) + if ag_vm.get("name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [ag_vm] + found = True + ## Can be optimized by doing further searches only if not found? + for infra_vm in infra_object_step.get("data").get("virtualMachine"): + if infra_vm.get("infra_element_name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [infra_vm] + found = True + elif "group" in infra_object_step.get("data").keys(): + for ag in infra_object_step.get("data").get("group"): + ag_vm = next(v for k, v in ag.items() if k.lower().startswith('virtualmachine')) + if ag_vm.get("name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [ag_vm] + found = True + for infra_vm in infra_object_step.get("data").get("vms"): + if infra_vm.get("infra_element_name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [infra_vm] + found = True + if not found and "vms" in infra_object_step.get("data").keys(): + for infra_vm in infra_object_step.get("data").get("vms"): + if infra_vm.get("infra_element_name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [infra_vm] + found = True + if not found and "virtualMachine" in infra_object_step.get("data").keys(): + for infra_vm in infra_object_step.get("data").get("virtualMachine"): + if infra_vm.get("infra_element_name") == vm.name: + ## TODO fake list, refactoring -> far diventare lista nodi? nel monitoring sono più nodi + object_representation["nodes"] = [infra_vm] + found = True + if not found: + logging.error(f"VM missing: no vm {vm.name} found for deployment {deployment_component_name}") + + except Exception: + logging.error(f"parsing error: no vm {vm.name} found for deployment {deployment_component_name}") + + elif deployment_component_type == "SaaSDBMS": + # Include exec_env information into saas IR + execenv = deployment.eGet("node") + # @@@@ + for infra_execenv in infra_object_step.get("data").get("executionEnvironments"): + if infra_execenv.get("infra_element_name") == execenv.name: + object_representation["nodes"] = [infra_execenv] +# Further application layer component types should be handled here object_representation = DomlParserUtilities.save_annotations(application_resource, object_representation) object_representation = DomlParserUtilities.save_attributes(application_resource, object_representation) + object_representation = DomlParserUtilities.save_references_info(application_resource, object_representation) application_object_step["data"][deployment_component_name] = object_representation application_object_step["step_name"] = deployment_component_name + application_object_step["step_type"] = deployment_component_type + return application_object_step diff --git a/icgparser/ModelResourcesUtilities.py b/icgparser/ModelResourcesUtilities.py index d07cea9..f8852c3 100644 --- a/icgparser/ModelResourcesUtilities.py +++ b/icgparser/ModelResourcesUtilities.py @@ -10,6 +10,7 @@ class ModelResources(Enum): NETWORKS = 6, SECURITY_GROUPS = 7, AUTOSCALING_GROUPS = 8, + STEP_TYPE = 9, def from_model_resources_to_ir_names_version1(model_resource: ModelResources): switcher = { @@ -21,6 +22,7 @@ def from_model_resources_to_ir_names_version1(model_resource: ModelResources): 6: "networks", 7: "computingGroup", 8: "group", + 9: "step_type" } if model_resource.value[0]: resource_number = model_resource.value[0] @@ -38,7 +40,8 @@ def from_model_resources_to_ir_names_version2(model_resource: ModelResources): 5: "vms", 6: "networks", 7: "securityGroup", - 8: "group", + 8: "autoScalingGroups", + 9: "step_type" } if model_resource.value[0]: resource_number = model_resource.value[0] @@ -71,10 +74,14 @@ class ModelResourcesUtilities: switcher = { "1": from_model_resources_to_ir_names_version1(model_resource), "2": from_model_resources_to_ir_names_version2(model_resource), + "2.0": from_model_resources_to_ir_names_version2(model_resource), "2.2": from_model_resources_to_ir_names_version2(model_resource), "2.2.2": from_model_resources_to_ir_names_version2(model_resource), + "2.3": from_model_resources_to_ir_names_version2(model_resource), + "3.0": from_model_resources_to_ir_names_version2(model_resource), + "3.1": from_model_resources_to_ir_names_version2(model_resource), } - return switcher.get(self.doml_version, from_model_resources_to_ir_names_version1(model_resource)) + return switcher.get(self.doml_version, from_model_resources_to_ir_names_version2(model_resource)) def set_doml_version(self, doml_version): self.doml_version = doml_version diff --git a/icgparser/PiacereInternalToolsIntegrator.py b/icgparser/PiacereInternalToolsIntegrator.py index 3064ea2..4a4ee75 100644 --- a/icgparser/PiacereInternalToolsIntegrator.py +++ b/icgparser/PiacereInternalToolsIntegrator.py @@ -16,6 +16,7 @@ def create_piacere_agents_ansible_step(piacere_component_name, intermediate_repr if vms or autoscaling_group_vms: intermediate_repr_step = {"programming_language": "ansible", "step_name": step_name, + "step_type": "SoftwareComponent", "data": {step_name: {"name": step_name}}} intermediate_repr_step["data"][step_name]["nodes"] = [] if vms: @@ -62,18 +63,22 @@ def add_internal_tool_information(intermediate_representation): def add_files_for_monitoring_agents(template_generated_folder_path): monitoring_folder_path = template_generated_folder_path + "performance_monitoring" + if not os.path.exists(monitoring_folder_path): + os.makedirs(monitoring_folder_path) logging.info(f"Adding monitoring agents folder in {monitoring_folder_path}") monitoring_folder = "templates/ansible/cross-platform/performance_monitoring" - if not monitoring_folder: + if not os.path.exists(monitoring_folder): os.makedirs(monitoring_folder) copy_tree("templates/ansible/cross-platform/performance_monitoring", monitoring_folder_path) def add_files_for_security_agents(template_generated_folder_path): security_folder_path = template_generated_folder_path + "security_monitoring" + if not os.path.exists(security_folder_path): + os.makedirs(security_folder_path) logging.info(f"Adding monitoring agents folder in {security_folder_path}") security_folder = "templates/ansible/cross-platform/security_monitoring" - if not security_folder: + if not os.path.exists(security_folder): os.makedirs(security_folder) copy_tree("templates/ansible/cross-platform/security_monitoring", security_folder_path) diff --git a/icgparser/doml/v1/nginx-openstack_v1.domlx b/icgparser/doml/v1/nginx-openstack_v1.domlx index e760e78..cbebc75 100644 --- a/icgparser/doml/v1/nginx-openstack_v1.domlx +++ b/icgparser/doml/v1/nginx-openstack_v1.domlx @@ -1,51 +1,240 @@ <?xml version="1.0" encoding="ASCII"?> -<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" name="nio3_test_exec_env" activeInfrastructure="//@concretizations.0"> +<commons:DOMLModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:app="http://www.piacere-project.eu/doml/application" xmlns:commons="http://www.piacere-project.eu/doml/commons" xmlns:infra="http://www.piacere-project.eu/doml/infrastructure" xmlns:opt="http://www.piacere-project.eu/doml/optimization" name="uc3_openstack" activeConfiguration="//@configurations.0" activeInfrastructure="//@concretizations.0"> + <application name="app"> + <components xsi:type="app:SoftwareComponent" name="iwg"> + <exposedInterfaces name="net_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="osint" consumedInterfaces="//@application/@components.0/@exposedInterfaces.0 //@application/@components.3/@exposedInterfaces.0 //@application/@components.2/@exposedInterfaces.1"> + <exposedInterfaces name="osint_info"/> + </components> + <components xsi:type="app:SoftwareComponent" name="ewcf" consumedInterfaces="//@application/@components.4/@exposedInterfaces.0"> + <exposedInterfaces name="ewcf_restapi_if"/> + <exposedInterfaces name="ewcf_kafka_if"/> + </components> + <components xsi:type="app:SaaS" name="external_twitter"> + <exposedInterfaces name="get_twitter" endPoint="https://twitter_api/get"/> + </components> + <components xsi:type="app:SaaS" name="external_firebase"> + <exposedInterfaces name="get_firebase" endPoint="https://firebase_api/get"/> + </components> + </application> <infrastructure name="infra"> - <nodes xsi:type="infra:VirtualMachine" name="vm1" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> - <ifaces name="i1" endPoint="10.83.18.92" belongsTo="//@infrastructure/@networks.0"/> + <nodes xsi:type="infra:VirtualMachine" name="igw_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos" configInterface="//@infrastructure/@nodes.0/@ifaces.0"> + <annotations xsi:type="commons:BProperty" key="config_drive" value="true"/> + <ifaces name="igw_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="igw_vm_net2" belongsTo="//@infrastructure/@networks.2/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> </nodes> - <nodes xsi:type="infra:VirtualMachine" name="vm2" os="centos7_64Guest" memory_mb="1024.0" cpu_count="2" credentials="//@infrastructure/@credentials.0" generatedFrom="//@infrastructure/@generators.0"> - <ifaces name="i1" endPoint="10.83.18.88" belongsTo="//@infrastructure/@networks.0"/> + <nodes xsi:type="infra:VirtualMachine" name="osint_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos" configInterface="//@infrastructure/@nodes.1/@ifaces.0"> + <annotations xsi:type="commons:BProperty" key="config_drive" value="true"/> + <ifaces name="osint_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="osint_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.0" associated="//@infrastructure/@securityGroups.0"/> </nodes> - <generators xsi:type="infra:VMImage" name="img" generatedVMs="//@infrastructure/@nodes.0 //@infrastructure/@nodes.1"/> - <storages name="disk0" label="disk0" size_gb="100"/> - <credentials xsi:type="commons:KeyPair" name="ssh_key" algorithm="RSA" bits="4096"/> - <networks name="net1" protocol="tcp/ip" addressRange="/24" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.0"> - <gateways name="g1" address="10.83.18.65"/> + <nodes xsi:type="infra:VirtualMachine" name="ewcf_vm" os="CentOS-7-2111" credentials="//@infrastructure/@credentials.0" sizeDescription="small-centos" configInterface="//@infrastructure/@nodes.2/@ifaces.0"> + <annotations xsi:type="commons:BProperty" key="config_drive" value="true"/> + <ifaces name="ewcf_vm_oam" belongsTo="//@infrastructure/@networks.0/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net1" belongsTo="//@infrastructure/@networks.1/@subnets.2" associated="//@infrastructure/@securityGroups.0"/> + <ifaces name="ewcf_vm_net3" belongsTo="//@infrastructure/@networks.3/@subnets.1" associated="//@infrastructure/@securityGroups.0"/> + </nodes> + <generators xsi:type="infra:ContainerImage" name="test_consumer_4_kafka_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-consumer_4_kafka:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.3"/> + <generators xsi:type="infra:ContainerImage" name="test_producer_4_kafka_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-producer_4_kafka:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.4"/> + <generators xsi:type="infra:ContainerImage" name="cont_zookeeper_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.2"/> + <generators xsi:type="infra:ContainerImage" name="cont_kafka_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.1"/> + <generators xsi:type="infra:ContainerImage" name="go_poster_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/go_poster:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.6"/> + <generators xsi:type="infra:ContainerImage" name="ewcf_rest_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/restapi:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.9"/> + <generators xsi:type="infra:ContainerImage" name="hello_mongo_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/hello-mongo:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.7"/> + <generators xsi:type="infra:ContainerImage" name="node_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/node:18.12.1" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.8"/> + <generators xsi:type="infra:ContainerImage" name="golang_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/golang:1.16-alpine" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.5"/> + <generators xsi:type="infra:ContainerImage" name="mongodb_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" kind="IMAGE" generatedContainers="//@infrastructure/@groups.2/@services.3"/> + <generators xsi:type="infra:ContainerImage" name="tis_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tis:1.0" kind="IMAGE" generatedContainers="//@infrastructure/@groups.1/@services.0"/> + <generators xsi:type="infra:ContainerImage" name="tia_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tia:1.0" kind="IMAGE" generatedContainers="//@infrastructure/@groups.1/@services.1"/> + <generators xsi:type="infra:ContainerImage" name="twr_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/twr:1.0" kind="IMAGE" generatedContainers="//@infrastructure/@groups.1/@services.2"/> + <generators xsi:type="infra:ContainerImage" name="python_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" kind="IMAGE" generatedContainers="//@infrastructure/@groups.0/@services.0"/> + <generators xsi:type="infra:ContainerImage" name="ivre_web_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/web:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.2/@services.0"/> + <generators xsi:type="infra:ContainerImage" name="ivre_db_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/db:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.2/@services.1"/> + <generators xsi:type="infra:ContainerImage" name="ivre_client_img" uri="optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/client:latest" kind="IMAGE" generatedContainers="//@infrastructure/@groups.2/@services.2"/> + <storages name="ext_sto_1" label="vm_storage" size_gb="512"/> + <storages name="ext_sto_2" label="vm_storage" size_gb="512"/> + <credentials xsi:type="commons:KeyPair" name="ssh_key" user="ubuntu" key="/home/ubuntu/.ssh/ssh_key_aws.pub" algorithm="RSA" bits="4096"/> + <groups xsi:type="infra:ContainerGroup" name="ewcf_cont_group"> + <services name="cont_python" generatedFrom="//@infrastructure/@generators.13"> + <hostConfigs host="//@infrastructure/@nodes.2"/> + </services> + <services name="cont_kafka" generatedFrom="//@infrastructure/@generators.3" networks="//@infrastructure/@groups.0/@networks.0"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <environment_variables key="KAFKA_ADVERTISED_HOST_NAME" value="kafka"/> + <environment_variables key="KAFKA_CREATE_TOPICS" value="stats:1:1"/> + <environment_variables key="KAFKA_AUTO_CREATE_TOPICS_ENABLE" value="true"/> + <environment_variables key="KAFKA_ZOOKEEPER_CONNECT" value="zookeeper:2181"/> + <configurations container_port="9092" vm_port="9092" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_zookeeper" generatedFrom="//@infrastructure/@generators.2" networks="//@infrastructure/@groups.0/@networks.0"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="2181" vm_port="2181" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_test_consumer_4_kafka" generatedFrom="//@infrastructure/@generators.0" networks="//@infrastructure/@groups.0/@networks.0" dependsOn="//@infrastructure/@groups.0/@services.0 //@infrastructure/@groups.0/@services.1 //@infrastructure/@groups.0/@services.2"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5012" vm_port="5013" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_test_producer_4_kafka" generatedFrom="//@infrastructure/@generators.1" networks="//@infrastructure/@groups.0/@networks.0" dependsOn="//@infrastructure/@groups.0/@services.0"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5014" vm_port="5015" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_golang" generatedFrom="//@infrastructure/@generators.8"> + <hostConfigs host="//@infrastructure/@nodes.2"/> + </services> + <services name="cont_go_poster" generatedFrom="//@infrastructure/@generators.4" dependsOn="//@infrastructure/@groups.0/@services.5"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5009" vm_port="5008" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_hello_mongo" generatedFrom="//@infrastructure/@generators.6"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5003" vm_port="5002" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_node" generatedFrom="//@infrastructure/@generators.7"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5005" vm_port="5004" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_ewcf_rest" generatedFrom="//@infrastructure/@generators.5" dependsOn="//@infrastructure/@groups.0/@services.7 //@infrastructure/@groups.0/@services.8"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="5007" vm_port="5006" iface="//@infrastructure/@nodes.2/@ifaces.1"/> + </hostConfigs> + </services> + <networks name="kafka_net" containerNetworkName="kafka_net"/> + </groups> + <groups xsi:type="infra:ContainerGroup" name="osint_cont_group"> + <services name="cont_tis" generatedFrom="//@infrastructure/@generators.10"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="90" vm_port="8090" iface="//@infrastructure/@nodes.1/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_tia" generatedFrom="//@infrastructure/@generators.11"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="91" vm_port="8091" iface="//@infrastructure/@nodes.1/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_twr" generatedFrom="//@infrastructure/@generators.12"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="92" vm_port="8092" iface="//@infrastructure/@nodes.1/@ifaces.0"/> + </hostConfigs> + </services> + </groups> + <groups xsi:type="infra:ContainerGroup" name="igw_cont_group"> + <services name="cont_ivre_web" generatedFrom="//@infrastructure/@generators.14"> + <hostConfigs host="//@infrastructure/@nodes.0"> + <configurations container_port="85" vm_port="8085" iface="//@infrastructure/@nodes.0/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_ivre_db" generatedFrom="//@infrastructure/@generators.15" dependsOn="//@infrastructure/@groups.2/@services.3"> + <hostConfigs host="//@infrastructure/@nodes.0"> + <configurations container_port="86" vm_port="8086" iface="//@infrastructure/@nodes.0/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_ivre_client" generatedFrom="//@infrastructure/@generators.16"> + <hostConfigs host="//@infrastructure/@nodes.0"> + <configurations container_port="87" vm_port="8087" iface="//@infrastructure/@nodes.0/@ifaces.0"/> + </hostConfigs> + </services> + <services name="cont_mongodb" generatedFrom="//@infrastructure/@generators.9"> + <hostConfigs host="//@infrastructure/@nodes.2"> + <configurations container_port="85" vm_port="8085" iface="//@infrastructure/@nodes.2/@ifaces.0"/> + </hostConfigs> + </services> + </groups> + <securityGroups name="sg" ifaces="//@infrastructure/@nodes.0/@ifaces.0 //@infrastructure/@nodes.0/@ifaces.1 //@infrastructure/@nodes.0/@ifaces.2 //@infrastructure/@nodes.1/@ifaces.0 //@infrastructure/@nodes.1/@ifaces.1 //@infrastructure/@nodes.1/@ifaces.2 //@infrastructure/@nodes.2/@ifaces.0 //@infrastructure/@nodes.2/@ifaces.1 //@infrastructure/@nodes.2/@ifaces.2"> + <rules name="icmp" protocol="ICMP" fromPort="-1" toPort="-1"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="http" kind="INGRESS" protocol="TCP" fromPort="80" toPort="80"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="https" kind="INGRESS" protocol="TCP" fromPort="443" toPort="443"> + <cidr>0.0.0.0/0</cidr> + </rules> + <rules name="ssh" kind="INGRESS" protocol="TCP" fromPort="22" toPort="22"> + <cidr>0.0.0.0/0</cidr> + </rules> + </securityGroups> + <networks name="oam"> + <subnets name="subnet_oam_igw" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.0"/> + <subnets name="subnet_oam_osint" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.0"/> + <subnets name="subnet_oam_ewcf" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.0"/> + </networks> + <networks name="net1"> + <subnets name="subnet_net1_igw" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + <subnets name="subnet_net1_osint" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.0 //@infrastructure/@networks.1/@subnets.2"/> + <subnets name="subnet_net1_ewcf" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.1" connectedTo="//@infrastructure/@networks.1/@subnets.1"/> + </networks> + <networks name="net2"> + <subnets name="subnet_net2_igw" connectedIfaces="//@infrastructure/@nodes.0/@ifaces.2"/> + </networks> + <networks name="net3"> + <subnets name="subnet_net3_osint" connectedIfaces="//@infrastructure/@nodes.1/@ifaces.2"/> + <subnets name="subnet_net3_ewcf" connectedIfaces="//@infrastructure/@nodes.2/@ifaces.2"/> </networks> </infrastructure> <concretizations name="con_infra"> - <providers name="vsphere"> - <annotations xsi:type="commons:SProperty" key="username" value="vc_username"/> - <annotations xsi:type="commons:SProperty" key="password" value="vc_password"/> - <annotations xsi:type="commons:SProperty" key="vsphere_server" value="psvc10000002.cd.sigov.si"/> - <annotations xsi:type="commons:BProperty" key="allow_unverified_ssl" value="true"/> - <resources name="dc" preexisting="true" type="vsphere_datacenter" gname="PIACDC"/> - <resources name="cl" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_compute_cluster" gname="PIACC"/> - <resources name="pool" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" type="vsphere_resource_pool" gname="Piacere"/> - <vms name="con_vm1" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.0"> - <annotations xsi:type="commons:SProperty" key="host_name" value="simpa-test00-piacere"/> - <annotations xsi:type="commons:SProperty" key="domain" value="tri.lan"/> - <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> - <annotations xsi:type="commons:SProperty" key="disk" value="disk0"/> - <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> - </vms> - <vms name="con_vm2" refs="//@concretizations.0/@providers.0/@resources.2 //@concretizations.0/@providers.0/@storages.0 //@concretizations.0/@providers.0/@vmImages.0" maps="//@infrastructure/@nodes.1"> - <annotations xsi:type="commons:SProperty" key="host_name" value="simpa-test00-piacere"/> - <annotations xsi:type="commons:SProperty" key="domain" value="tri.lan"/> - <annotations xsi:type="commons:SProperty" key="guest_id" value="centos7_64Guest"/> - <annotations xsi:type="commons:SProperty" key="disk" value="disk1"/> - <annotations xsi:type="commons:IProperty" key="disk_size" value="100"/> - </vms> - <vmImages name="template" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@generators.0"> - <annotations xsi:type="commons:SProperty" key="vsphere_virtual_machine_name" value="c7tmp"/> - </vmImages> - <networks name="network" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@networks.0"> - <annotations xsi:type="commons:SProperty" key="vsphere_network_name" value="Nested-ESXi"/> + <providers name="openstack"> + <vms name="concrete_osint_vm" maps="//@infrastructure/@nodes.1"/> + <vms name="concrete_igw_vm" maps="//@infrastructure/@nodes.0"/> + <vms name="concrete_ewcf_vm" maps="//@infrastructure/@nodes.2"/> + <containerImages name="concrete_cont_kafka_img" maps="//@infrastructure/@generators.3"/> + <containerImages name="concrete_cont_zookeeper_img" maps="//@infrastructure/@generators.2"/> + <containerImages name="concrete_test_consumer_4_kafka_img" maps="//@infrastructure/@generators.0"/> + <containerImages name="concrete_test_producer_4_kafka_img" maps="//@infrastructure/@generators.1"/> + <containerImages name="concrete_go_poster_img" maps="//@infrastructure/@generators.4"/> + <containerImages name="concrete_ewct_rest_img" maps="//@infrastructure/@generators.5"/> + <containerImages name="concrete_hello_mondo_img" maps="//@infrastructure/@generators.6"/> + <containerImages name="concrete_node_img" maps="//@infrastructure/@generators.7"/> + <containerImages name="concrete_golang_img" maps="//@infrastructure/@generators.8"/> + <containerImages name="concrete_mongodb_img" maps="//@infrastructure/@generators.9"/> + <containerImages name="concrete_tis_img" maps="//@infrastructure/@generators.10"/> + <containerImages name="tia_img" maps="//@infrastructure/@generators.11"/> + <containerImages name="concrete_twr_img" maps="//@infrastructure/@generators.12"/> + <containerImages name="concrete_python_img" maps="//@infrastructure/@generators.13"/> + <containerImages name="concrete_ivre_web_img" maps="//@infrastructure/@generators.14"/> + <containerImages name="concrete_ivre_db_img" maps="//@infrastructure/@generators.15"/> + <containerImages name="concrete_ivre_client_img" maps="//@infrastructure/@generators.16"/> + <networks name="concrete_oam" resourceName="external" preexisting="true" protocol="TCP/IP" maps="//@infrastructure/@networks.0"> + <subnets name="concrete_subnet_oam_igw" resourceName="external" preexisting="true" maps="//@infrastructure/@networks.0/@subnets.0"/> + <subnets name="concrete_subnet_oam_osint" resourceName="external" preexisting="true" maps="//@infrastructure/@networks.0/@subnets.1"/> + <subnets name="concrete_subnet_oam_ewcf" resourceName="external" preexisting="true" maps="//@infrastructure/@networks.0/@subnets.2"/> + </networks> + <networks name="concrete_net1" protocol="TCP/IP" addressRange="16.0.2.0/24" maps="//@infrastructure/@networks.1"> + <subnets name="concrete_subnet_net1_igw" addressRange="16.0.2.0/26" maps="//@infrastructure/@networks.1/@subnets.0"/> + <subnets name="concrete_subnet_net1_osint" addressRange="16.0.2.64/26" maps="//@infrastructure/@networks.1/@subnets.1"/> + <subnets name="concrete_subnet_net1_ewcf" addressRange="16.0.2.128/26" maps="//@infrastructure/@networks.1/@subnets.2"/> + </networks> + <networks name="concrete_net2" protocol="TCP/IP" addressRange="16.0.3.0/24" maps="//@infrastructure/@networks.2"> + <subnets name="subnet_net2_igw" addressRange="16.0.3.0/25"/> + </networks> + <networks name="concrete_net3" protocol="TCP/IP" addressRange="16.0.4.0/24" maps="//@infrastructure/@networks.3"> + <subnets name="subnet_net3_osint" addressRange="16.0.4.0/25"/> + <subnets name="subnet_net3_ewcf" addressRange="16.0.4.128/25"/> </networks> - <storages name="datastore" preexisting="true" refs="//@concretizations.0/@providers.0/@resources.0" maps="//@infrastructure/@storages.0"> - <annotations xsi:type="commons:SProperty" key="vsphere_datastore_name" value="NFSShare01"/> - </storages> + <storages name="concrete_ext_sto_mongo1" refs="//@concretizations.0/@providers.0/@vms.1" maps="//@infrastructure/@storages.0"/> + <storages name="concrete_ext_sto_mongo2" refs="//@concretizations.0/@providers.0/@vms.2" maps="//@infrastructure/@storages.1"/> </providers> </concretizations> + <optimization name="opt"> + <objectives xsi:type="opt:MeasurableObjective" kind="min" property="cost"/> + <objectives xsi:type="opt:MeasurableObjective" kind="max" property="performance"/> + <objectives xsi:type="opt:MeasurableObjective" kind="max" property="availability"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req1" description="cost <= 600" property="cost" max="600.0"/> + <nonfunctionalRequirements xsi:type="commons:RangedRequirement" name="req2" description="performance >= 7%" property="performance" min="7.0"/> + <nonfunctionalRequirements name="req3" description="elements" property="VM VM VM Storage Storage"/> + </optimization> + <configurations name="config1"> + <deployments component="//@application/@components.1" node="//@infrastructure/@nodes.1"/> + <deployments component="//@application/@components.0" node="//@infrastructure/@nodes.0"/> + <deployments component="//@application/@components.2" node="//@infrastructure/@nodes.2"/> + </configurations> </commons:DOMLModel> diff --git a/icgparser/doml/v2/doml_v2.3.ecore b/icgparser/doml/v2/doml_v2.3.ecore new file mode 100644 index 0000000..cbff3c6 --- /dev/null +++ b/icgparser/doml/v2/doml_v2.3.ecore @@ -0,0 +1,423 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="doml" nsURI="http://www.piacere-project.eu/doml" nsPrefix="doml"> + <eAnnotations source="emf.gen"> + <details key="basePackage" value="eu.piacere.doml"/> + <details key="fileExtensions" value="domlx"/> + <details key="complianceLevel" value="JDK80"/> + </eAnnotations> + <eSubpackages name="commons" nsURI="http://www.piacere-project.eu/doml/commons" + nsPrefix="commons"> + <eClassifiers xsi:type="ecore:EClass" name="DOMLModel" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="2.2"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="application" eType="#//application/ApplicationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="infrastructure" eType="#//infrastructure/InfrastructureLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="concretizations" upperBound="-1" + eType="#//concrete/ConcreteInfrastructure" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="optimization" eType="#//optimization/OptimizationLayer" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configurations" upperBound="-1" + eType="#//commons/Configuration" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeConfiguration" + eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="activeInfrastructure" + eType="#//concrete/ConcreteInfrastructure"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="functionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Property" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BProperty" eSuperTypes="#//commons/Property"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtensionElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metaclassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DOMLElement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="annotations" upperBound="-1" + eType="#//commons/Property" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="contributesTo" upperBound="-1" + eType="#//commons/Requirement" eOpposite="#//commons/Requirement/predicatesOn"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Configuration" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="deployments" upperBound="-1" + eType="#//commons/Deployment" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeployableElement" abstract="true"/> + <eClassifiers xsi:type="ecore:EClass" name="Deployment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="component" lowerBound="1" + eType="#//commons/DeployableElement"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="node" lowerBound="1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="predicatesOn" upperBound="-1" + eType="#//commons/DOMLElement" eOpposite="#//commons/DOMLElement/contributesTo"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RangedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumeratedRequirement" eSuperTypes="#//commons/Requirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentRequirement" abstract="true" + eSuperTypes="#//commons/Requirement"/> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeTypeRequirement" eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="validTypes" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToNodeWithPropertyRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DeploymentToSpecificNodeRequirement" + eSuperTypes="#//commons/DeploymentRequirement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="validElements" upperBound="-1" + eType="#//infrastructure/InfrastructureElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Credentials" abstract="true" eSuperTypes="#//commons/DOMLElement"/> + <eClassifiers xsi:type="ecore:EClass" name="KeyPair" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="user" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="keyfile" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="algorithm" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="bits" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="UserPass" eSuperTypes="#//commons/Credentials"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="username" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="password" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Source" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entry" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="backend" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + </eSubpackages> + <eSubpackages name="application" nsURI="http://www.piacere-project.eu/doml/application" + nsPrefix="app"> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="components" upperBound="-1" + eType="#//application/ApplicationComponent" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ApplicationComponent" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareComponent" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="isPersistent" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="consumedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="src" eType="#//commons/Source" + containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DBMS" eSuperTypes="#//application/SoftwareComponent"/> + <eClassifiers xsi:type="ecore:EClass" name="SaaS" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="licenseCost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="exposedInterfaces" upperBound="-1" + eType="#//application/SoftwareInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SaaSDBMS" eSuperTypes="#//application/SaaS"/> + <eClassifiers xsi:type="ecore:EClass" name="SoftwareInterface" eSuperTypes="#//application/ApplicationComponent"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtApplicationComponent" eSuperTypes="#//application/ApplicationComponent #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="infrastructure" nsURI="http://www.piacere-project.eu/doml/infrastructure" + nsPrefix="infra"> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generators" upperBound="-1" + eType="#//infrastructure/ComputingNodeGenerator" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//infrastructure/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//infrastructure/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" upperBound="-1" + eType="#//commons/Credentials" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="groups" upperBound="-1" + eType="#//infrastructure/ComputingGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroups" upperBound="-1" + eType="#//infrastructure/SecurityGroup" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//infrastructure/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/MonitoringRule" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="MonitoringRule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="condition" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategyConfigurationString" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="groupedNodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" eOpposite="#//infrastructure/ComputingNode/group"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AutoScalingGroup" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="machineDefinition" lowerBound="1" + eType="#//infrastructure/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="min" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="max" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject" + defaultValueLiteral="1"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="securityGroup" eType="#//infrastructure/SecurityGroup" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="loadBalancer" eType="#//infrastructure/LoadBalancerKind" + defaultValueLiteral="DEFAULT"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="LoadBalancerKind"> + <eLiterals name="DEFAULT"/> + <eLiterals name="INTERNAL" value="1"/> + <eLiterals name="EXTERNAL" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Rule" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RuleKind"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fromPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="toPort" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cidr" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RuleKind"> + <eLiterals name="EGRESS"/> + <eLiterals name="INGRESS" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SecurityGroup" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="rules" upperBound="-1" + eType="#//infrastructure/Rule" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/associated"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="AvailabilityGroup" eSuperTypes="#//infrastructure/ComputingGroup"/> + <eClassifiers xsi:type="ecore:EClass" name="InfrastructureElement" abstract="true" + eSuperTypes="#//commons/DOMLElement #//commons/DeployableElement"/> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNode" abstract="true" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="architecture" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="os" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="memory_mb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="storage" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cpu_count" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="location" eType="#//infrastructure/Location" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="credentials" eType="#//commons/Credentials"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" eType="#//infrastructure/ComputingGroup" + eOpposite="#//infrastructure/ComputingGroup/groupedNodes"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="disabledMonitorings" + upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingNodeGenerator" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/GeneratorKind"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="GeneratorKind"> + <eLiterals name="SCRIPT"/> + <eLiterals name="IMAGE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedVMs" upperBound="-1" + eType="#//infrastructure/VirtualMachine" eOpposite="#//infrastructure/VirtualMachine/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//infrastructure/ComputingNodeGenerator"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedContainers" + upperBound="-1" eType="#//infrastructure/Container" eOpposite="#//infrastructure/Container/generatedFrom"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="PhysicalComputingNode" eSuperTypes="#//infrastructure/ComputingNode"/> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sizeDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/VMImage" + eOpposite="#//infrastructure/VMImage/generatedVMs"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Location" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="region" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="zone" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerConfig" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="container_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vm_port" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="host" eType="#//infrastructure/ComputingNode"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="iface" eType="#//infrastructure/NetworkInterface"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="#//infrastructure/ComputingNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="generatedFrom" eType="#//infrastructure/ContainerImage" + eOpposite="#//infrastructure/ContainerImage/generatedContainers"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="configs" upperBound="-1" + eType="#//infrastructure/ContainerConfig" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="protocol" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="addressRange" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedIfaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" eOpposite="#//infrastructure/NetworkInterface/belongsTo"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="gateways" upperBound="-1" + eType="#//infrastructure/InternetGateway" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="subnets" upperBound="-1" + eType="#//infrastructure/Subnet" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Subnet" eSuperTypes="#//infrastructure/Network"> + <eStructuralFeatures xsi:type="ecore:EReference" name="connectedTo" upperBound="-1" + eType="#//infrastructure/Subnet"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="NetworkInterface" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="speed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="endPoint" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="belongsTo" eType="#//infrastructure/Network" + eOpposite="#//infrastructure/Network/connectedIfaces"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="associated" eType="#//infrastructure/SecurityGroup" + eOpposite="#//infrastructure/SecurityGroup/ifaces"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="InternetGateway" eSuperTypes="#//infrastructure/NetworkInterface"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="address" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="size_gb" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//infrastructure/InfrastructureElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="ifaces" upperBound="-1" + eType="#//infrastructure/NetworkInterface" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="RoleKind"> + <eLiterals name="NONE"/> + <eLiterals name="MANAGER" value="1"/> + <eLiterals name="WORKER" value="2"/> + <eLiterals name="MASTER" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SwarmRole" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//infrastructure/RoleKind"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1" + eType="#//infrastructure/ComputingNode" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Swarm" eSuperTypes="#//infrastructure/ComputingGroup"> + <eStructuralFeatures xsi:type="ecore:EReference" name="roles" upperBound="-1" + eType="#//infrastructure/SwarmRole" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtInfrastructureElement" eSuperTypes="#//infrastructure/InfrastructureElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="concrete" nsURI="http://www.piacere-project.eu/doml/concrete" + nsPrefix="concrete"> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteInfrastructure" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="providers" upperBound="-1" + eType="#//concrete/RuntimeProvider" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RuntimeProvider" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="resources" upperBound="-1" + eType="#//concrete/GenericResource" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vms" upperBound="-1" + eType="#//concrete/VirtualMachine" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="vmImages" upperBound="-1" + eType="#//concrete/VMImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="containerImages" upperBound="-1" + eType="#//concrete/ContainerImage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="networks" upperBound="-1" + eType="#//concrete/Network" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="storages" upperBound="-1" + eType="#//concrete/Storage" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="faas" upperBound="-1" + eType="#//concrete/FunctionAsAService" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="group" upperBound="-1" + eType="#//concrete/ComputingGroup" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConcreteElement" abstract="true" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="configurationScript" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="preexisting" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject" + defaultValueLiteral="false"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="refs" upperBound="-1" + eType="#//concrete/ConcreteElement"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="GenericResource" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="gname" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VirtualMachine" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VirtualMachine"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="VMImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/VMImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ContainerImage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ContainerImage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Network" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Network"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="Storage" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/Storage"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="FunctionAsAService" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/FunctionAsAService"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ComputingGroup" eSuperTypes="#//concrete/ConcreteElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="maps" eType="#//infrastructure/ComputingGroup"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtConcreteElement" eSuperTypes="#//concrete/ConcreteElement #//commons/ExtensionElement"/> + </eSubpackages> + <eSubpackages name="optimization" nsURI="http://www.piacere-project.eu/doml/optimization" + nsPrefix="optimization"> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationLayer" eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EReference" name="startingHint" eType="#//commons/Configuration"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="solutions" upperBound="-1" + eType="#//optimization/OptimizationSolution" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" upperBound="-1" + eType="#//optimization/OptimizationObjective" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="nonfunctionalRequirements" + upperBound="-1" eType="#//commons/Requirement" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ObjectiveValue"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="cost" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="availability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="performance" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloatObject"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationSolution" eSuperTypes="#//commons/Configuration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="objectives" eType="#//optimization/ObjectiveValue" + containment="true"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="decisions" upperBound="-1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="OptimizationObjective" abstract="true" + eSuperTypes="#//commons/DOMLElement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="Max"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="property" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CountObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="MeasurableObjective" eSuperTypes="#//optimization/OptimizationObjective"/> + <eClassifiers xsi:type="ecore:EClass" name="ExtOptimizationObjective" eSuperTypes="#//optimization/OptimizationObjective #//commons/ExtensionElement"/> + </eSubpackages> +</ecore:EPackage> diff --git a/input_file_generated/ir.json b/input_file_generated/ir.json index e36cae6..34a4513 100644 --- a/input_file_generated/ir.json +++ b/input_file_generated/ir.json @@ -1,186 +1,1731 @@ { - "output_path": "output_files_generated/nio3_test_exec_env/", + "output_path": "output_files_generated/uc3_openstack/", "steps": [ { "data": { + "computingNode": [ + { + "BProperty_config_drive": true, + "NetworkInterface_ewcf_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + "NetworkInterface_ewcf_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + }, + "NetworkInterface_ewcf_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "ewcf_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "ewcf_vm", + "os": "CentOS-7-2111", + "sizeDescription": "small-centos" + }, + { + "BProperty_config_drive": true, + "NetworkInterface_igw_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + "NetworkInterface_igw_vm_net2": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + "NetworkInterface_igw_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "igw_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "igw_vm", + "os": "CentOS-7-2111", + "sizeDescription": "small-centos" + } + ], + "containerImage": [ + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_kafka" + } + ], + "infra_element_name": "cont_kafka_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_zookeeper" + } + ], + "infra_element_name": "cont_zookeeper_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_test_consumer_4_kafka" + } + ], + "infra_element_name": "test_consumer_4_kafka_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-consumer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_test_producer_4_kafka" + } + ], + "infra_element_name": "test_producer_4_kafka_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-producer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_go_poster" + } + ], + "infra_element_name": "go_poster_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/go_poster:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ewcf_rest" + } + ], + "infra_element_name": "ewcf_rest_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/restapi:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_mongodb" + } + ], + "infra_element_name": "mongodb_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_tis" + } + ], + "infra_element_name": "tis_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tis:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_tia" + } + ], + "infra_element_name": "tia_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tia:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_twr" + } + ], + "infra_element_name": "twr_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/twr:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_web" + } + ], + "infra_element_name": "ivre_web_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/web:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_db" + } + ], + "infra_element_name": "ivre_db_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/db:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_client" + } + ], + "infra_element_name": "ivre_client_img", + "kind": "IMAGE", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/client:latest" + } + ], + "containerImages": [ + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "cont_kafka_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 9092, + "iface": "ewcf_vm_oam", + "vm_port": 9092 + } + ], + "environment_variables": [ + { + "key": "KAFKA_ADVERTISED_HOST_NAME", + "value": "kafka" + }, + { + "key": "KAFKA_CREATE_TOPICS", + "value": "stats:1:1" + }, + { + "key": "KAFKA_AUTO_CREATE_TOPICS_ENABLE", + "value": "true" + }, + { + "key": "KAFKA_ZOOKEEPER_CONNECT", + "value": "zookeeper:2181" + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "cont_kafka_img", + "kind": "IMAGE", + "maps": "cont_kafka_img", + "name": "concrete_cont_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "cont_zookeeper_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 2181, + "iface": "ewcf_vm_oam", + "vm_port": 2181 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_zookeeper", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "cont_zookeeper_img", + "kind": "IMAGE", + "maps": "cont_zookeeper_img", + "name": "concrete_cont_zookeeper_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": "python_img", + "hostConfigs": [ + { + "host": "ewcf_vm" + } + ], + "name": "cont_python" + }, + { + "disabledMonitorings": [], + "name": "cont_kafka" + }, + { + "disabledMonitorings": [], + "name": "cont_zookeeper" + } + ], + "disabledMonitorings": [], + "generatedFrom": "test_consumer_4_kafka_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5012, + "iface": "ewcf_vm_oam", + "vm_port": 5013 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_test_consumer_4_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "test_consumer_4_kafka_img", + "kind": "IMAGE", + "maps": "test_consumer_4_kafka_img", + "name": "concrete_test_consumer_4_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-consumer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "name": "cont_python" + } + ], + "disabledMonitorings": [], + "generatedFrom": "test_producer_4_kafka_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5014, + "iface": "ewcf_vm_oam", + "vm_port": 5015 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_test_producer_4_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "test_producer_4_kafka_img", + "kind": "IMAGE", + "maps": "test_producer_4_kafka_img", + "name": "concrete_test_producer_4_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-producer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": "golang_img", + "hostConfigs": [ + { + "host": "ewcf_vm" + } + ], + "name": "cont_golang" + } + ], + "disabledMonitorings": [], + "generatedFrom": "go_poster_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5009, + "iface": "ewcf_vm_oam", + "vm_port": 5008 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_go_poster" + } + ], + "infra_element_name": "go_poster_img", + "kind": "IMAGE", + "maps": "go_poster_img", + "name": "concrete_go_poster_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/go_poster:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": "hello_mongo_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5003, + "iface": "ewcf_vm_oam", + "vm_port": 5002 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_hello_mongo" + }, + { + "disabledMonitorings": [], + "generatedFrom": "node_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5005, + "iface": "ewcf_vm_oam", + "vm_port": 5004 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_node" + } + ], + "disabledMonitorings": [], + "generatedFrom": "ewcf_rest_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 5007, + "iface": "ewcf_vm_net1", + "vm_port": 5006 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_ewcf_rest" + } + ], + "infra_element_name": "ewcf_rest_img", + "kind": "IMAGE", + "maps": "ewcf_rest_img", + "name": "concrete_ewct_rest_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/restapi:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_hello_mongo" + } + ], + "infra_element_name": "hello_mongo_img", + "kind": "IMAGE", + "maps": "hello_mongo_img", + "name": "concrete_hello_mondo_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/hello-mongo:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_node" + } + ], + "infra_element_name": "node_img", + "kind": "IMAGE", + "maps": "node_img", + "name": "concrete_node_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/node:18.12.1" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_golang" + } + ], + "infra_element_name": "golang_img", + "kind": "IMAGE", + "maps": "golang_img", + "name": "concrete_golang_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/golang:1.16-alpine" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "mongodb_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 85, + "iface": "ewcf_vm_oam", + "vm_port": 8085 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_mongodb" + } + ], + "infra_element_name": "mongodb_img", + "kind": "IMAGE", + "maps": "mongodb_img", + "name": "concrete_mongodb_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "tis_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 90, + "iface": "osint_vm_oam", + "vm_port": 8090 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_tis" + } + ], + "infra_element_name": "tis_img", + "kind": "IMAGE", + "maps": "tis_img", + "name": "concrete_tis_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tis:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "tia_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 91, + "iface": "osint_vm_oam", + "vm_port": 8091 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_tia" + } + ], + "infra_element_name": "tia_img", + "kind": "IMAGE", + "maps": "tia_img", + "name": "tia_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tia:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "twr_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 92, + "iface": "osint_vm_oam", + "vm_port": 8092 + } + ], + "host": "ewcf_vm" + } + ], + "name": "cont_twr" + } + ], + "infra_element_name": "twr_img", + "kind": "IMAGE", + "maps": "twr_img", + "name": "concrete_twr_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/twr:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_python" + } + ], + "infra_element_name": "python_img", + "kind": "IMAGE", + "maps": "python_img", + "name": "concrete_python_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "ivre_web_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 85, + "iface": "igw_vm_oam", + "vm_port": 8085 + } + ], + "host": "igw_vm" + } + ], + "name": "cont_ivre_web" + } + ], + "infra_element_name": "ivre_web_img", + "kind": "IMAGE", + "maps": "ivre_web_img", + "name": "concrete_ivre_web_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/web:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "name": "cont_mongodb" + } + ], + "disabledMonitorings": [], + "generatedFrom": "ivre_db_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 86, + "iface": "igw_vm_oam", + "vm_port": 8086 + } + ], + "host": "igw_vm" + } + ], + "name": "cont_ivre_db" + } + ], + "infra_element_name": "ivre_db_img", + "kind": "IMAGE", + "maps": "ivre_db_img", + "name": "concrete_ivre_db_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/db:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": "ivre_client_img", + "hostConfigs": [ + { + "configurations": [ + { + "container_port": 87, + "iface": "igw_vm_oam", + "vm_port": 8087 + } + ], + "host": "igw_vm" + } + ], + "name": "cont_ivre_client" + } + ], + "infra_element_name": "ivre_client_img", + "kind": "IMAGE", + "maps": "ivre_client_img", + "name": "concrete_ivre_client_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/client:latest" + } + ], "credentials": [ { "algorithm": "RSA", "bits": 4096, - "infra_element_name": "ssh_key" + "infra_element_name": "ssh_key", + "key": "/home/ubuntu/.ssh/ssh_key_aws.pub", + "user": "ubuntu" } ], - "networks": [ + "network": [ { - "InternetGateway_g1": { - "address": "10.83.18.65", - "name": "g1" - }, - "addressRange": "/24", - "dc": { - "gname": "PIACDC", - "name": "dc", - "preexisting": true, - "type": "vsphere_datacenter" - }, - "infra_element_name": "net1", - "maps": "net1", - "name": "network", - "preexisting": true, - "protocol": "tcp/ip", - "vsphere_network_name": "Nested-ESXi" + "connectedIfaces": [ + { + "name": "igw_vm_oam" + } + ], + "infra_element_name": "subnet_oam_igw", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "igw_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "infra_element_name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "subnet_net2_igw", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "osint_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + { + "name": "subnet_net1_ewcf", + "protocol": "TCP/IP" + } + ], + "infra_element_name": "subnet_net1_osint", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "osint_vm_net3" + } + ], + "infra_element_name": "subnet_net3_osint", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_oam" + } + ], + "infra_element_name": "subnet_oam_ewcf", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "infra_element_name": "subnet_net1_ewcf", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "subnet_net3_ewcf", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "osint_vm_oam" + } + ], + "infra_element_name": "subnet_oam_osint", + "protocol": "TCP/IP" } ], - "provider_info": [ + "networkInterface": [ + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_osint", + "infra_element_name": "osint_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "infra_element_name": "igw_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "infra_element_name": "ewcf_vm_oam" + }, { - "allow_unverified_ssl": true, - "password": "vc_password", - "provider_name": "vsphere", - "username": "vc_username", - "vsphere_server": "psvc10000002.cd.sigov.si" + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "infra_element_name": "ewcf_vm_net1" } ], - "resources": [ + "networks": [ { - "gname": "PIACDC", - "name": "dc", + "Subnet_subnet_oam_ewcf": { + "connectedIfaces": [ + { + "name": "ewcf_vm_oam" + } + ], + "name": "subnet_oam_ewcf", + "protocol": "TCP/IP" + }, + "Subnet_subnet_oam_igw": { + "connectedIfaces": [ + { + "name": "igw_vm_oam" + } + ], + "name": "subnet_oam_igw", + "protocol": "TCP/IP" + }, + "Subnet_subnet_oam_osint": { + "connectedIfaces": [ + { + "name": "osint_vm_oam" + } + ], + "name": "subnet_oam_osint", + "protocol": "TCP/IP" + }, + "infra_element_name": "oam", + "infra_sgs": [ + "icmp", + "http", + "https", + "ssh" + ], + "infra_subnets": [ + { + "connectedIfaces": [ + { + "name": "igw_vm_oam" + } + ], + "name": "subnet_oam_igw", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "osint_vm_oam" + } + ], + "name": "subnet_oam_osint", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_oam" + } + ], + "name": "subnet_oam_ewcf", + "protocol": "TCP/IP" + } + ], + "maps": "oam", + "name": "concrete_oam", "preexisting": true, - "type": "vsphere_datacenter" + "protocol": "TCP/IP", + "resourceName": "external", + "subnets": [ + { + "maps": "subnet_oam_igw", + "name": "concrete_subnet_oam_igw", + "preexisting": true, + "resourceName": "external" + }, + { + "maps": "subnet_oam_osint", + "name": "concrete_subnet_oam_osint", + "preexisting": true, + "resourceName": "external" + }, + { + "maps": "subnet_oam_ewcf", + "name": "concrete_subnet_oam_ewcf", + "preexisting": true, + "resourceName": "external" + } + ] }, { - "dc": { - "gname": "PIACDC", - "name": "dc", - "preexisting": true, - "type": "vsphere_datacenter" + "Subnet_subnet_net1_ewcf": { + "connectedIfaces": [ + { + "name": "ewcf_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_ewcf", + "protocol": "TCP/IP" }, - "gname": "PIACC", - "name": "cl", - "preexisting": true, - "type": "vsphere_compute_cluster" + "Subnet_subnet_net1_igw": { + "connectedIfaces": [ + { + "name": "igw_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + "Subnet_subnet_net1_osint": { + "connectedIfaces": [ + { + "name": "osint_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + { + "name": "subnet_net1_ewcf", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + }, + "addressRange": "16.0.2.0/24", + "infra_element_name": "net1", + "infra_sgs": [ + "icmp", + "http", + "https", + "ssh" + ], + "infra_subnets": [ + { + "connectedIfaces": [ + { + "name": "igw_vm_net1" + } + ], + "connectedTo": [ + { + "connectedIfaces": [ + { + "name": "osint_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_net1" + } + ], + "connectedTo": [ + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_ewcf", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + } + ], + "name": "subnet_net1_igw", + "protocol": "TCP/IP" + }, + { + "name": "subnet_net1_osint", + "protocol": "TCP/IP" + }, + { + "name": "subnet_net1_ewcf", + "protocol": "TCP/IP" + } + ], + "maps": "net1", + "name": "concrete_net1", + "preexisting": false, + "protocol": "TCP/IP", + "subnets": [ + { + "addressRange": "16.0.2.0/26", + "maps": "subnet_net1_igw", + "name": "concrete_subnet_net1_igw", + "preexisting": false + }, + { + "addressRange": "16.0.2.64/26", + "maps": "subnet_net1_osint", + "name": "concrete_subnet_net1_osint", + "preexisting": false + }, + { + "addressRange": "16.0.2.128/26", + "maps": "subnet_net1_ewcf", + "name": "concrete_subnet_net1_ewcf", + "preexisting": false + } + ] }, { - "dc": { - "gname": "PIACDC", - "name": "dc", - "preexisting": true, - "type": "vsphere_datacenter" + "Subnet_subnet_net2_igw": { + "connectedIfaces": [ + { + "name": "igw_vm_net2" + } + ], + "name": "subnet_net2_igw", + "protocol": "TCP/IP" }, - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" + "addressRange": "16.0.3.0/24", + "infra_element_name": "net2", + "infra_sgs": [ + "icmp", + "http", + "https", + "ssh" + ], + "infra_subnets": [ + { + "connectedIfaces": [ + { + "name": "igw_vm_net2" + } + ], + "name": "subnet_net2_igw", + "protocol": "TCP/IP" + } + ], + "maps": "net2", + "name": "concrete_net2", + "preexisting": false, + "protocol": "TCP/IP", + "subnets": [ + { + "addressRange": "16.0.3.0/25", + "name": "subnet_net2_igw", + "preexisting": false + } + ] + }, + { + "Subnet_subnet_net3_ewcf": { + "connectedIfaces": [ + { + "name": "ewcf_vm_net3" + } + ], + "name": "subnet_net3_ewcf", + "protocol": "TCP/IP" + }, + "Subnet_subnet_net3_osint": { + "connectedIfaces": [ + { + "name": "osint_vm_net3" + } + ], + "name": "subnet_net3_osint", + "protocol": "TCP/IP" + }, + "addressRange": "16.0.4.0/24", + "infra_element_name": "net3", + "infra_sgs": [ + "icmp", + "http", + "https", + "ssh" + ], + "infra_subnets": [ + { + "connectedIfaces": [ + { + "name": "osint_vm_net3" + } + ], + "name": "subnet_net3_osint", + "protocol": "TCP/IP" + }, + { + "connectedIfaces": [ + { + "name": "ewcf_vm_net3" + } + ], + "name": "subnet_net3_ewcf", + "protocol": "TCP/IP" + } + ], + "maps": "net3", + "name": "concrete_net3", + "preexisting": false, + "protocol": "TCP/IP", + "subnets": [ + { + "addressRange": "16.0.4.0/25", + "name": "subnet_net3_osint", + "preexisting": false + }, + { + "addressRange": "16.0.4.128/25", + "name": "subnet_net3_ewcf", + "preexisting": false + } + ] } ], - "storages": [ + "provider_info": [ + { + "provider_name": "openstack" + } + ], + "securityGroup": [ { - "dc": { - "gname": "PIACDC", - "name": "dc", - "preexisting": true, - "type": "vsphere_datacenter" + "Rule_http": { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 }, - "infra_element_name": "disk0", - "label": "disk0", - "maps": "disk0", - "name": "datastore", - "preexisting": true, - "size_gb": 100, - "vsphere_datastore_name": "NFSShare01" + "Rule_https": { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + "Rule_icmp": { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + "Rule_ssh": { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + }, + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + }, + { + "name": "osint_vm_oam" + }, + { + "name": "osint_vm_net1" + }, + { + "name": "osint_vm_net3" + }, + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "sg", + "rules": [ + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + } + ] } ], - "vmImages": [ - { - "dc": { - "gname": "PIACDC", - "name": "dc", - "preexisting": true, - "type": "vsphere_datacenter" - }, - "infra_element_name": "img", - "kind": "SCRIPT", - "maps": "img", - "name": "template", - "preexisting": true, - "vsphere_virtual_machine_name": "c7tmp" + "storages": [ + { + "concrete_igw_vm": { + "maps": "igw_vm", + "name": "concrete_igw_vm", + "preexisting": false + }, + "infra_element_name": "ext_sto_1", + "label": "vm_storage", + "maps": "ext_sto_1", + "name": "concrete_ext_sto_mongo1", + "preexisting": false, + "refs": [ + { + "maps": "igw_vm", + "name": "concrete_igw_vm", + "preexisting": false + } + ], + "size_gb": 512 + }, + { + "concrete_ewcf_vm": { + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "preexisting": false + }, + "infra_element_name": "ext_sto_2", + "label": "vm_storage", + "maps": "ext_sto_2", + "name": "concrete_ext_sto_mongo2", + "preexisting": false, + "refs": [ + { + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "preexisting": false + } + ], + "size_gb": 512 } ], "vms": [ { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.92", - "name": "i1" + "BProperty_config_drive": true, + "NetworkInterface_osint_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" }, - "cpu_count": 2, - "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "NetworkInterface_osint_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + "NetworkInterface_osint_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "osint_vm_oam", + "credentials": "ssh_key", "disabledMonitorings": [], - "disk": "disk0", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm1", - "maps": "vm1", - "memory_mb": 1024.0, - "name": "con_vm1", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" - }, - "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true - } + "ifaces": [ + { + "associated": [ + { + "ifaces": [ + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + { + "name": "osint_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + } + ], + "name": "sg", + "rules": [ + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + } + ] + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" + }, + { + "name": "osint_vm_net1" + }, + { + "name": "osint_vm_net3" + } + ], + "infra_element_name": "osint_vm", + "maps": "osint_vm", + "name": "concrete_osint_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" }, { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.88", - "name": "i1" + "BProperty_config_drive": true, + "NetworkInterface_igw_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + "NetworkInterface_igw_vm_net2": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + "NetworkInterface_igw_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" }, - "cpu_count": 2, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "igw_vm_oam", "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "disabledMonitorings": [], + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "igw_vm", + "maps": "igw_vm", + "name": "concrete_igw_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + }, + { + "BProperty_config_drive": true, + "NetworkInterface_ewcf_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + "NetworkInterface_ewcf_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + }, + "NetworkInterface_ewcf_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "ewcf_vm_oam", + "credentials": "ssh_key", "disabledMonitorings": [], - "disk": "disk1", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm2", - "maps": "vm2", - "memory_mb": 1024.0, - "name": "con_vm2", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" - }, - "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true - } + "ifaces": [ + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "ewcf_vm", + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" } ] }, @@ -192,86 +1737,304 @@ "name": "performance_monitoring", "nodes": [ { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.92", - "name": "i1" + "BProperty_config_drive": true, + "NetworkInterface_osint_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" }, - "cpu_count": 2, - "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "NetworkInterface_osint_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" }, - "disabledMonitorings": [], - "disk": "disk0", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm1", - "maps": "vm1", - "memory_mb": 1024.0, - "name": "con_vm1", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" + "NetworkInterface_osint_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "osint_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "associated": [ + { + "ifaces": [ + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + { + "name": "osint_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + } + ], + "name": "sg", + "rules": [ + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + } + ] + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" + }, + { + "name": "osint_vm_net1" + }, + { + "name": "osint_vm_net3" + } + ], + "infra_element_name": "osint_vm", + "maps": "osint_vm", + "name": "concrete_osint_vm", + "os": "CentOS-7-2111", "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true - } + "sizeDescription": "small-centos" }, { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.88", - "name": "i1" + "BProperty_config_drive": true, + "NetworkInterface_igw_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" }, - "cpu_count": 2, - "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "NetworkInterface_igw_vm_net2": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" }, + "NetworkInterface_igw_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "igw_vm_oam", + "credentials": "ssh_key", "disabledMonitorings": [], - "disk": "disk1", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm2", - "maps": "vm2", - "memory_mb": 1024.0, - "name": "con_vm2", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "igw_vm", + "maps": "igw_vm", + "name": "concrete_igw_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + }, + { + "BProperty_config_drive": true, + "NetworkInterface_ewcf_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + "NetworkInterface_ewcf_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" }, + "NetworkInterface_ewcf_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "ewcf_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "ewcf_vm", + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "os": "CentOS-7-2111", "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true - } + "sizeDescription": "small-centos" } ] } }, "programming_language": "ansible", - "step_name": "performance_monitoring" + "step_name": "performance_monitoring", + "step_type": "SoftwareComponent" }, { "data": { @@ -279,92 +2042,1295 @@ "name": "security_monitoring", "nodes": [ { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.92", - "name": "i1" + "BProperty_config_drive": true, + "NetworkInterface_osint_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" }, - "cpu_count": 2, + "NetworkInterface_osint_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + "NetworkInterface_osint_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "osint_vm_oam", "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "disabledMonitorings": [], + "ifaces": [ + { + "associated": [ + { + "ifaces": [ + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + { + "name": "osint_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + } + ], + "name": "sg", + "rules": [ + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + } + ] + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" + }, + { + "name": "osint_vm_net1" + }, + { + "name": "osint_vm_net3" + } + ], + "infra_element_name": "osint_vm", + "maps": "osint_vm", + "name": "concrete_osint_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + }, + { + "BProperty_config_drive": true, + "NetworkInterface_igw_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + "NetworkInterface_igw_vm_net2": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" }, + "NetworkInterface_igw_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "igw_vm_oam", + "credentials": "ssh_key", "disabledMonitorings": [], - "disk": "disk0", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm1", - "maps": "vm1", - "memory_mb": 1024.0, - "name": "con_vm1", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "igw_vm", + "maps": "igw_vm", + "name": "concrete_igw_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + }, + { + "BProperty_config_drive": true, + "NetworkInterface_ewcf_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + "NetworkInterface_ewcf_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" }, + "NetworkInterface_ewcf_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "ewcf_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "ewcf_vm", + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "os": "CentOS-7-2111", "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true + "sizeDescription": "small-centos" + } + ] + } + }, + "programming_language": "ansible", + "step_name": "security_monitoring", + "step_type": "SoftwareComponent" + }, + { + "data": { + "containerImages": [ + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_kafka" + } + ], + "kind": "IMAGE", + "name": "cont_kafka_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" + }, + "hostConfigs": [], + "name": "cont_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] } + ], + "infra_element_name": "cont_kafka_img", + "kind": "IMAGE", + "maps": "cont_kafka_img", + "name": "concrete_cont_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_zookeeper" + } + ], + "kind": "IMAGE", + "name": "cont_zookeeper_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" + }, + "hostConfigs": [], + "name": "cont_zookeeper", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "cont_zookeeper_img", + "kind": "IMAGE", + "maps": "cont_zookeeper_img", + "name": "concrete_cont_zookeeper_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_python" + } + ], + "kind": "IMAGE", + "name": "python_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" + }, + "hostConfigs": [], + "name": "cont_python" + }, + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_kafka" + } + ], + "kind": "IMAGE", + "name": "cont_kafka_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/kafka:latest" + }, + "hostConfigs": [], + "name": "cont_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + }, + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_zookeeper" + } + ], + "kind": "IMAGE", + "name": "cont_zookeeper_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/wurstmeister/zookeeper:latest" + }, + "hostConfigs": [], + "name": "cont_zookeeper", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_test_consumer_4_kafka" + } + ], + "kind": "IMAGE", + "name": "test_consumer_4_kafka_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-consumer_4_kafka:latest" + }, + "hostConfigs": [], + "name": "cont_test_consumer_4_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "test_consumer_4_kafka_img", + "kind": "IMAGE", + "maps": "test_consumer_4_kafka_img", + "name": "concrete_test_consumer_4_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-consumer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_python" + } + ], + "kind": "IMAGE", + "name": "python_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" + }, + "hostConfigs": [], + "name": "cont_python" + } + ], + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_test_producer_4_kafka" + } + ], + "kind": "IMAGE", + "name": "test_producer_4_kafka_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-producer_4_kafka:latest" + }, + "hostConfigs": [], + "name": "cont_test_producer_4_kafka", + "networks": [ + { + "containerNetworkName": "kafka_net", + "name": "kafka_net" + } + ] + } + ], + "infra_element_name": "test_producer_4_kafka_img", + "kind": "IMAGE", + "maps": "test_producer_4_kafka_img", + "name": "concrete_test_producer_4_kafka_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/piacere/piacere/test-producer_4_kafka:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_golang" + } + ], + "kind": "IMAGE", + "name": "golang_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/golang:1.16-alpine" + }, + "hostConfigs": [], + "name": "cont_golang" + } + ], + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_go_poster" + } + ], + "kind": "IMAGE", + "name": "go_poster_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/go_poster:latest" + }, + "hostConfigs": [], + "name": "cont_go_poster" + } + ], + "infra_element_name": "go_poster_img", + "kind": "IMAGE", + "maps": "go_poster_img", + "name": "concrete_go_poster_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/go_poster:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_hello_mongo" + } + ], + "kind": "IMAGE", + "name": "hello_mongo_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/hello-mongo:latest" + }, + "hostConfigs": [], + "name": "cont_hello_mongo" + }, + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_node" + } + ], + "kind": "IMAGE", + "name": "node_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/node:18.12.1" + }, + "hostConfigs": [], + "name": "cont_node" + } + ], + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ewcf_rest" + } + ], + "kind": "IMAGE", + "name": "ewcf_rest_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/restapi:latest" + }, + "hostConfigs": [], + "name": "cont_ewcf_rest" + } + ], + "infra_element_name": "ewcf_rest_img", + "kind": "IMAGE", + "maps": "ewcf_rest_img", + "name": "concrete_ewct_rest_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/restapi:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_hello_mongo" + } + ], + "kind": "IMAGE", + "name": "hello_mongo_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/hello-mongo:latest" + }, + "hostConfigs": [], + "name": "cont_hello_mongo" + } + ], + "infra_element_name": "hello_mongo_img", + "kind": "IMAGE", + "maps": "hello_mongo_img", + "name": "concrete_hello_mondo_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/hello-mongo:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_node" + } + ], + "kind": "IMAGE", + "name": "node_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/node:18.12.1" + }, + "hostConfigs": [], + "name": "cont_node" + } + ], + "infra_element_name": "node_img", + "kind": "IMAGE", + "maps": "node_img", + "name": "concrete_node_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/node:18.12.1" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_golang" + } + ], + "kind": "IMAGE", + "name": "golang_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/golang:1.16-alpine" + }, + "hostConfigs": [], + "name": "cont_golang" + } + ], + "infra_element_name": "golang_img", + "kind": "IMAGE", + "maps": "golang_img", + "name": "concrete_golang_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/golang:1.16-alpine" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_mongodb" + } + ], + "kind": "IMAGE", + "name": "mongodb_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" + }, + "hostConfigs": [], + "name": "cont_mongodb" + } + ], + "infra_element_name": "mongodb_img", + "kind": "IMAGE", + "maps": "mongodb_img", + "name": "concrete_mongodb_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_tis" + } + ], + "kind": "IMAGE", + "name": "tis_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tis:1.0" + }, + "hostConfigs": [], + "name": "cont_tis" + } + ], + "infra_element_name": "tis_img", + "kind": "IMAGE", + "maps": "tis_img", + "name": "concrete_tis_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tis:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_tia" + } + ], + "kind": "IMAGE", + "name": "tia_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tia:1.0" + }, + "hostConfigs": [], + "name": "cont_tia" + } + ], + "infra_element_name": "tia_img", + "kind": "IMAGE", + "maps": "tia_img", + "name": "tia_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/tia:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_twr" + } + ], + "kind": "IMAGE", + "name": "twr_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/twr:1.0" + }, + "hostConfigs": [], + "name": "cont_twr" + } + ], + "infra_element_name": "twr_img", + "kind": "IMAGE", + "maps": "twr_img", + "name": "concrete_twr_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/twr:1.0" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_python" + } + ], + "kind": "IMAGE", + "name": "python_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" + }, + "hostConfigs": [], + "name": "cont_python" + } + ], + "infra_element_name": "python_img", + "kind": "IMAGE", + "maps": "python_img", + "name": "concrete_python_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/python:3.7" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_web" + } + ], + "kind": "IMAGE", + "name": "ivre_web_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/web:latest" + }, + "hostConfigs": [], + "name": "cont_ivre_web" + } + ], + "infra_element_name": "ivre_web_img", + "kind": "IMAGE", + "maps": "ivre_web_img", + "name": "concrete_ivre_web_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/web:latest" + }, + { + "generatedContainers": [ + { + "dependsOn": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_mongodb" + } + ], + "kind": "IMAGE", + "name": "mongodb_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/mongo:4.2" + }, + "hostConfigs": [], + "name": "cont_mongodb" + } + ], + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_db" + } + ], + "kind": "IMAGE", + "name": "ivre_db_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/db:latest" + }, + "hostConfigs": [], + "name": "cont_ivre_db" + } + ], + "infra_element_name": "ivre_db_img", + "kind": "IMAGE", + "maps": "ivre_db_img", + "name": "concrete_ivre_db_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/db:latest" + }, + { + "generatedContainers": [ + { + "disabledMonitorings": [], + "generatedFrom": { + "generatedContainers": [ + { + "disabledMonitorings": [], + "name": "cont_ivre_client" + } + ], + "kind": "IMAGE", + "name": "ivre_client_img", + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/client:latest" + }, + "hostConfigs": [], + "name": "cont_ivre_client" + } + ], + "infra_element_name": "ivre_client_img", + "kind": "IMAGE", + "maps": "ivre_client_img", + "name": "concrete_ivre_client_img", + "preexisting": false, + "uri": "optima-piacere-docker-dev.artifact.tecnalia.com/wp7/ericsson/ivre/client:latest" + } + ] + }, + "programming_language": "docker-compose" + }, + { + "data": { + "osint": { + "consumedInterfaces": [ + { + "name": "net_info" }, { - "NetworkInterface_i1": { - "belongsTo": "net1", - "endPoint": "10.83.18.88", - "name": "i1" + "endPoint": "https://twitter_api/get", + "name": "get_twitter" + }, + { + "name": "ewcf_kafka_if" + } + ], + "exposedInterfaces": [ + { + "name": "osint_info" + } + ], + "isPersistent": false, + "name": "osint", + "nodes": [ + { + "BProperty_config_drive": true, + "NetworkInterface_osint_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" }, - "cpu_count": 2, - "credentials": "ssh_key", - "datastore": { - "maps": "disk0", - "name": "datastore", - "preexisting": true + "NetworkInterface_osint_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + "NetworkInterface_osint_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "osint_vm_oam", + "credentials": "ssh_key", "disabledMonitorings": [], - "disk": "disk1", - "disk_size": 100, - "domain": "tri.lan", - "generatedFrom": "img", - "guest_id": "centos7_64Guest", - "host_name": "simpa-test00-piacere", - "infra_element_name": "vm2", - "maps": "vm2", - "memory_mb": 1024.0, - "name": "con_vm2", - "os": "centos7_64Guest", - "pool": { - "gname": "Piacere", - "name": "pool", - "preexisting": true, - "type": "vsphere_resource_pool" + "ifaces": [ + { + "associated": [ + { + "ifaces": [ + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" + }, + { + "name": "osint_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_osint", + "name": "osint_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_osint", + "name": "osint_vm_net3" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + } + ], + "name": "sg", + "rules": [ + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": -1, + "kind": "EGRESS", + "name": "icmp", + "protocol": "ICMP", + "toPort": -1 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 80, + "kind": "INGRESS", + "name": "http", + "protocol": "TCP", + "toPort": 80 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 443, + "kind": "INGRESS", + "name": "https", + "protocol": "TCP", + "toPort": 443 + }, + { + "cidr": [ + "0.0.0.0/0" + ], + "fromPort": 22, + "kind": "INGRESS", + "name": "ssh", + "protocol": "TCP", + "toPort": 22 + } + ] + } + ], + "belongsTo": "subnet_oam_osint", + "name": "osint_vm_oam" + }, + { + "name": "osint_vm_net1" + }, + { + "name": "osint_vm_net3" + } + ], + "infra_element_name": "osint_vm", + "maps": "osint_vm", + "name": "concrete_osint_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + } + ] + } + }, + "programming_language": "ansible", + "step_name": "osint", + "step_type": "SoftwareComponent" + }, + { + "data": { + "iwg": { + "exposedInterfaces": [ + { + "name": "net_info" + } + ], + "isPersistent": false, + "name": "iwg", + "nodes": [ + { + "BProperty_config_drive": true, + "NetworkInterface_igw_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_igw", + "name": "igw_vm_net1" + }, + "NetworkInterface_igw_vm_net2": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net2_igw", + "name": "igw_vm_net2" }, + "NetworkInterface_igw_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_igw", + "name": "igw_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "igw_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "igw_vm_oam" + }, + { + "name": "igw_vm_net1" + }, + { + "name": "igw_vm_net2" + } + ], + "infra_element_name": "igw_vm", + "maps": "igw_vm", + "name": "concrete_igw_vm", + "os": "CentOS-7-2111", "preexisting": false, - "template": { - "maps": "img", - "name": "template", - "preexisting": true - } + "sizeDescription": "small-centos" } ] } }, "programming_language": "ansible", - "step_name": "security_monitoring" + "step_name": "iwg", + "step_type": "SoftwareComponent" }, { "data": { - "containerImages": [] + "ewcf": { + "consumedInterfaces": [ + { + "endPoint": "https://firebase_api/get", + "name": "get_firebase" + } + ], + "exposedInterfaces": [ + { + "name": "ewcf_restapi_if" + }, + { + "name": "ewcf_kafka_if" + } + ], + "isPersistent": false, + "name": "ewcf", + "nodes": [ + { + "BProperty_config_drive": true, + "NetworkInterface_ewcf_vm_net1": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net1_ewcf", + "name": "ewcf_vm_net1" + }, + "NetworkInterface_ewcf_vm_net3": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_net3_ewcf", + "name": "ewcf_vm_net3" + }, + "NetworkInterface_ewcf_vm_oam": { + "associated": [ + { + "name": "sg" + } + ], + "belongsTo": "subnet_oam_ewcf", + "name": "ewcf_vm_oam" + }, + "annotations": [ + { + "key": "config_drive", + "value": true + } + ], + "configInterface": "ewcf_vm_oam", + "credentials": "ssh_key", + "disabledMonitorings": [], + "ifaces": [ + { + "name": "ewcf_vm_oam" + }, + { + "name": "ewcf_vm_net1" + }, + { + "name": "ewcf_vm_net3" + } + ], + "infra_element_name": "ewcf_vm", + "maps": "ewcf_vm", + "name": "concrete_ewcf_vm", + "os": "CentOS-7-2111", + "preexisting": false, + "sizeDescription": "small-centos" + } + ] + } }, - "programming_language": "docker-compose" + "programming_language": "ansible", + "step_name": "ewcf", + "step_type": "SoftwareComponent" } ] } \ No newline at end of file diff --git a/output_files_generated/nginx_openstack/nginx/config.yaml b/output_files_generated/nginx_openstack/nginx/config.yaml index 5d4a476..a14930c 100644 --- a/output_files_generated/nginx_openstack/nginx/config.yaml +++ b/output_files_generated/nginx_openstack/nginx/config.yaml @@ -1,8 +1,8 @@ --- input: - - instance_server_public_ip_nginx_vm - - instance_server_private_key_ubuntu_nginx_vm + - instance_server_public_ip_vm1 + - instance_server_private_key_ssh_key_vm1 output: [] engine: ansible ... diff --git a/output_files_generated/nginx_openstack/nginx/inventory.j2 b/output_files_generated/nginx_openstack/nginx/inventory.j2 index 6b3e902..bc052bc 100644 --- a/output_files_generated/nginx_openstack/nginx/inventory.j2 +++ b/output_files_generated/nginx_openstack/nginx/inventory.j2 @@ -1,7 +1,13 @@ +[local] +127.0.0.1 + +[local:vars] +ansible_connection=local +instance_server_public_ip_vm1={{ instance_server_public_ip_vm1 }} [servers_for_nginx] -{{ instance_server_public_ip_nginx_vm }} +{{ instance_server_public_ip_vm1 }} doml_element_name=vm1 [servers_for_nginx:vars] ansible_connection=ssh diff --git a/output_files_generated/nginx_openstack/nginx/ssh_key.j2 b/output_files_generated/nginx_openstack/nginx/ssh_key.j2 index b3880a6..a6dfafd 100644 --- a/output_files_generated/nginx_openstack/nginx/ssh_key.j2 +++ b/output_files_generated/nginx_openstack/nginx/ssh_key.j2 @@ -1,2 +1,2 @@ -{{ instance_server_private_key_ubuntu_nginx_vm}} +{{ instance_server_private_key_ssh_key_vm1}} diff --git a/output_files_generated/nginx_openstack/terraform/config.yaml b/output_files_generated/nginx_openstack/terraform/config.yaml index 5baf71f..4a42f3d 100644 --- a/output_files_generated/nginx_openstack/terraform/config.yaml +++ b/output_files_generated/nginx_openstack/terraform/config.yaml @@ -9,8 +9,4 @@ input: - OS_PROJECT_NAME output: - - instance_server_public_key_ubuntu_nginx_vm - - instance_server_private_key_ubuntu_nginx_vm - - instance_server_public_ip_nginx_vm - ... diff --git a/output_files_generated/nginx_openstack/terraform/main.tf b/output_files_generated/nginx_openstack/terraform/main.tf index 7517686..01fce33 100644 --- a/output_files_generated/nginx_openstack/terraform/main.tf +++ b/output_files_generated/nginx_openstack/terraform/main.tf @@ -21,79 +21,39 @@ data "openstack_networking_network_v2" "external" { } - -# Create virtual machine -resource "openstack_compute_instance_v2" "nginx_vm" { - name = "nginx_host" - image_name = "Ubuntu-Focal-20.04-Daily-2022-04-19" - flavor_name = "small-centos" - key_pair = openstack_compute_keypair_v2.ubuntu.name - network { - port = openstack_networking_port_v2.i1_networking_port.id - - } -} - -# Create floating ip -resource "openstack_networking_floatingip_v2" "nginx_vm_floating_ip" { - pool = "external" - # fixed_ip = "" -} - -# Attach floating ip to instance -resource "openstack_compute_floatingip_associate_v2" "nginx_vm_floating_ip_association" { - floating_ip = openstack_networking_floatingip_v2.nginx_vm_floating_ip.address - instance_id = openstack_compute_instance_v2.nginx_vm.id -} - -# Router interface configuration - -resource "openstack_networking_router_interface_v2" "subnet1_router_interface" { - router_id = openstack_networking_router_v2.router.id - subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id +## Network +# Create Network +resource "openstack_networking_network_v2" "ext_net" { + name = "concrete_net" } - -# Attach networking port -resource "openstack_networking_port_v2" "i1_networking_port" { - name = "i1" - network_id = openstack_networking_network_v2.net1.id - admin_state_up = true - security_group_ids = [ openstack_compute_secgroup_v2.sg.id ] - fixed_ip { - subnet_id = openstack_networking_subnet_v2.subnet1_subnet.id - } +# Create router +resource "openstack_networking_router_v2" "router_ext_net" { + name = "router_ext_net" + external_network_id = data.openstack_networking_network_v2.external.id } - - -## Network - -# Create Network -resource "openstack_networking_network_v2" "net1" { - name = "nginx_net" -} - # Subnet -resource "openstack_networking_subnet_v2" "subnet1_subnet" { - name = "subnet1_subnet" - network_id = openstack_networking_network_v2.net1.id - cidr = "16.0.0.1/24" +resource "openstack_networking_subnet_v2" "concrete_subnet_subnet" { + name = "concrete_subnet_subnet" + network_id = openstack_networking_network_v2.ext_net.id + cidr = "10.0.0.0/24" dns_nameservers = ["8.8.8.8", "8.8.8.4"] } -# Create router -resource "openstack_networking_router_v2" "router" { ## 1router, not parametric - name = "router" - external_network_id = data.openstack_networking_network_v2.external.id #External network id +# Create router interface on subnet +resource "openstack_networking_router_interface_v2" "router_interface_ext_net_concrete_subnet_subnet" { + router_id = "${openstack_networking_router_v2.router_ext_net.id}" + subnet_id = "${openstack_networking_subnet_v2.concrete_subnet_subnet.id}" } + # Create ssh keys -resource "openstack_compute_keypair_v2" "ubuntu" { - name = "ubuntu" +resource "openstack_compute_keypair_v2" "ssh_key" { + name = "vm2user" # public_key = "" } @@ -126,7 +86,7 @@ resource "openstack_compute_secgroup_v2" "sg" { to_port = 22 ip_protocol = "tcp" cidr = "0.0.0.0/0" - } + } } diff --git a/output_files_generated/nginx_openstack/terraform/output.tf b/output_files_generated/nginx_openstack/terraform/output.tf index d94c1df..e69de29 100644 --- a/output_files_generated/nginx_openstack/terraform/output.tf +++ b/output_files_generated/nginx_openstack/terraform/output.tf @@ -1,14 +0,0 @@ - - -output "instance_server_public_key_ubuntu_nginx_vm" { - value = openstack_compute_keypair_v2.ubuntu.public_key -} - -output "instance_server_private_key_ubuntu_nginx_vm" { - value = openstack_compute_keypair_v2.ubuntu.private_key -} - -output "instance_server_public_ip_nginx_vm" { - value = openstack_compute_floatingip_associate_v2.nginx_vm_floating_ip_association.floating_ip -} - diff --git a/plugin/AnsiblePlugin.py b/plugin/AnsiblePlugin.py index 705e290..353ba4f 100644 --- a/plugin/AnsiblePlugin.py +++ b/plugin/AnsiblePlugin.py @@ -50,25 +50,40 @@ def create_template_file(parameters, language, operating_system, template_name): return template_filled +def is_external_code(resource_params): + return resource_params.get("src") + + def create_files(step, output_path): language = step[get_ir_key_name(ModelResources.LANGUAGE)] step_name = step[get_ir_key_name(ModelResources.STEP_NAME)] + step_type = step[get_ir_key_name(ModelResources.STEP_TYPE)] parameters = step["data"] for resource_name, resource in parameters.items(): logging.info("Creating template for resource '%s'", resource_name) - operating_system = find_operating_system(resource) - ansible_template_path = TemplateUtils.find_template_path(language, operating_system, resource_name) + if "SaaS" in step_type: + # handle SaaSDBMS and other SaaS types + operating_system = "saas" + else: + operating_system = find_operating_system(resource) + # for resource_params in parameters[resource_name]: + resource_params = parameters[resource_name] + if is_external_code(resource_params): + ansible_template_path = TemplateUtils.find_template_path(language, operating_system, "external_iac") + template = TemplateUtils.read_template(ansible_template_path) + elif "SaaS" in step_type: + ansible_template_path = TemplateUtils.find_template_path(language, operating_system, step_type) + else: + ansible_template_path = TemplateUtils.find_template_path(language, operating_system, resource_name) if ansible_template_path: - # for resource_params in parameters[resource_name]: - resource_params = parameters[resource_name] - ansible_output_file_path = output_path + "/".join([step_name, "main"]) + ".yml" inventory_output_file_path = output_path + "/".join([step_name, "inventory"]) + ".j2" config_output_file_path = output_path + "/".join([step_name, "config"]) + ".yaml" ssh_key_output_file_path = output_path + "/".join([step_name, "ssh_key.j2"]) - + if is_external_code(resource_params): + template = TemplateUtils.read_template(ansible_template_path) ### TODO Refactoring - if "," in ansible_template_path: + elif "," in ansible_template_path: ansible_template_path = ansible_template_path.split(",") template = TemplateUtils.read_template(ansible_template_path[0]) for i in range(1, len(ansible_template_path)): diff --git a/plugin/DockerComposePlugin.py b/plugin/DockerComposePlugin.py index 75b093c..164ab3d 100644 --- a/plugin/DockerComposePlugin.py +++ b/plugin/DockerComposePlugin.py @@ -2,6 +2,7 @@ import logging from icgparser.ModelResourcesUtilities import get_ir_key_name, ModelResources from plugin import TemplateUtils +from utility.Graph import Graph def search_containers_to_be_created(container_image_resource): @@ -16,18 +17,18 @@ def create_template_file(resource_name, parameters, extra_parameters, language): inventory_template_path = TemplateUtils.find_template_path(iac_language=False, key=language, resource_name=resource_name) template = TemplateUtils.read_template(inventory_template_path) - template_filled = TemplateUtils.edit_template(template, parameters) + template_filled = TemplateUtils.edit_template(template, parameters, extra_parameters) return template_filled -def create_metadata_files(resource_params, output_path, language): +def create_metadata_files(resource_params, output_path, language, extra_param=None): inventory_template_stored_path = output_path + "inventory.j2" ssh_template_stored_path = output_path + "ssh_key.j2" ansible_template_file_path = output_path + "main.yml" config_template_file_path = output_path + "config.yaml" - inventory_template_filled = create_template_file("inventory", resource_params, None, language) + inventory_template_filled = create_template_file("inventory", resource_params, extra_param, language) config_template_filled = create_template_file("config", resource_params, None, language) - ssh_key_template_filled = create_template_file("ssh_key", resource_params, None, language) + ssh_key_template_filled = create_template_file("ssh_key", resource_params, extra_param, language) ansible_template_filled = create_template_file("main", resource_params, None, language) TemplateUtils.write_template(inventory_template_filled, inventory_template_stored_path) @@ -36,7 +37,7 @@ def create_metadata_files(resource_params, output_path, language): TemplateUtils.write_template(ssh_key_template_filled, ssh_template_stored_path) -def create_files(step_data, output_path): +def create_files(step_data, output_path, extra_param=None): logging.info(f"Using Docker Compose Plugin for step {step_data}") language = step_data[get_ir_key_name(ModelResources.LANGUAGE)] parameters = step_data["data"] @@ -52,9 +53,23 @@ def create_files(step_data, output_path): template_path = TemplateUtils.find_template_path(iac_language=False, key=language, resource_name=resource_name) template = TemplateUtils.read_template(template_path) - template_filled = TemplateUtils.edit_template(template, container, resource_params) + template_filled = TemplateUtils.edit_template(template, container, extra_param) TemplateUtils.write_template(template_filled, template_stored_path) - create_metadata_files(container, output_base_folder_path, language) + create_metadata_files(container, output_base_folder_path, language, extra_param) logging.info(f"Docker compose files created for {container_name}") logging.info(f"Docker compose files created") + +def create_container_dependency_graph(parameters, graph): + images_list = parameters["containerImages"] + for image in images_list: + containers_list = image["generatedContainers"] + for container in containers_list: # usually just one, but... who knows? + container_name = container["name"] + graph.add_node(container_name) + if "dependsOn" in container: + dependencies_list = container["dependsOn"] + for dependency in dependencies_list: + dependency_name = dependency["name"] + graph.add_edge(container_name, dependency_name) + return graph diff --git a/requirements.txt b/requirements.txt index a970358..4fbade2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ Jinja2==3.0.3 -PyYAML==6.0 +PyYAML==6.0.1 fastapi~=0.74.1 uvicorn==0.17.5 pyecore~=0.12.2 diff --git a/template-location.properties b/template-location.properties index 183dff1..daf93f4 100644 --- a/template-location.properties +++ b/template-location.properties @@ -40,6 +40,7 @@ computingGroup = templates/terraform/aws/port_rule.tpl securityGroup = templates/terraform/aws/port_rule.tpl credentials = templates/terraform/aws/ssh_key.tpl group = templates/terraform/aws/autoscaling_group.tpl +autoscalinggroups = templates/terraform/aws/autoscaling_group.tpl [terraform.vsphere] provider_info = templates/terraform/vsphere/init.tpl @@ -48,6 +49,7 @@ networks = templates/terraform/vsphere/network.tpl vms = templates/terraform/vsphere/virtual_machine.tpl credentials = templates/terraform/vsphere/ssh_key.tpl resources = templates/terraform/vsphere/data_resources.tpl +vmimages = templates/terraform/vsphere/vm_image.tpl storages = templates/terraform/vsphere/datastore.tpl vms_out = templates/terraform/vsphere/virtual_machine_out.tpl @@ -70,6 +72,7 @@ elasticsearch = templates/ansible/ubuntu/elasticsearch_main.tpl,templates/ansibl postgres = templates/ansible/ubuntu/postgres.tpl performance_monitoring = templates/ansible/ubuntu/performance_monitoring_main.tpl security_monitoring = templates/ansible/ubuntu/security_monitoring_main.tpl +external_iac = templates/ansible/ubuntu/external_code_main.tpl [ansible.centos] mysql = templates/ansible/centos/mysql.tpl @@ -81,6 +84,7 @@ security_monitoring = templates/ansible/centos/security_monitoring_main.tpl inventory = templates/ansible/centos/inventory.tpl config = templates/ansible/centos/config.tpl ssh_key = templates/ansible/centos/ssh_key.tpl +external_iac = templates/ansible/centos/external_code_main.tpl [common] gaiax_self_description = templates/common/gaiax_self_description.yaml.tpl @@ -90,4 +94,10 @@ config = templates/docker_compose/config.tpl inventory = templates/docker_compose/inventory.tpl ssh_key = templates/docker_compose/ssh_key.tpl main = templates/docker_compose/main.tpl -containerimages = templates/docker_compose/docker_compose.tpl \ No newline at end of file +containerimages = templates/docker_compose/docker_compose.tpl + +[ansible.saas] +SaaSDBMS = templates/ansible/saas/SaaSDBMS.tpl +inventory = templates/ansible/saas/inventory.tpl +ssh_key = templates/ansible/saas/ssh_key.tpl +config = templates/ansible/saas/config.tpl diff --git a/templates/ansible/centos/elasticsearch.tpl b/templates/ansible/centos/elasticsearch.tpl index 05d0432..d6da8c0 100644 --- a/templates/ansible/centos/elasticsearch.tpl +++ b/templates/ansible/centos/elasticsearch.tpl @@ -6,16 +6,16 @@ - role: elastic.elasticsearch vars: es_data_dirs: - - "/opt/elasticsearch/data" - es_log_dir: "/opt/elasticsearch/logs" + - "{{ es_data_dirs }}" + es_log_dir: "{{ es_log_dir }}" es_config: - node.name: "node1" - cluster.name: "custom-cluster" - discovery.seed_hosts: "localhost:9301" - http.port: 9201 - transport.port: 9301 + node.name: "{{ node_name }}" + cluster.name: "{{ cluster_name }}" + discovery.seed_hosts: "{{ discovery_seed_hosts }}" + http.port: {{ http_port }} + transport.port: {{ transport_port }} node.data: false node.master: true bootstrap.memory_lock: true es_heap_size: 1g - es_api_port: 9201 \ No newline at end of file + es_api_port: {{ http_port }} \ No newline at end of file diff --git a/templates/ansible/centos/external_code_main.tpl b/templates/ansible/centos/external_code_main.tpl new file mode 100644 index 0000000..2344dae --- /dev/null +++ b/templates/ansible/centos/external_code_main.tpl @@ -0,0 +1,15 @@ +--- + +- hosts: local +{%if name == "nio3" %} vars: +{%- for node in nodes %} + instance_server_public_ip_{{ node.infra_element_name }}: "{% raw %}{{ hostvars['127.0.0.1'].instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %}" +{%- endfor %} + tasks: + - name: write hostname using jinja2 + ansible.builtin.template: + src: ../asset/inventory.j2 + dest: ../asset/inventory + - command: ansible-playbook -i ../asset/inventory "../asset/{{src.entry}}" +{%else %} tasks: + - command: ansible-playbook -i inventory "../asset/{{src.entry}}" {%- endif %} \ No newline at end of file diff --git a/templates/ansible/centos/inventory.tpl b/templates/ansible/centos/inventory.tpl index 8db3ec0..a044d41 100644 --- a/templates/ansible/centos/inventory.tpl +++ b/templates/ansible/centos/inventory.tpl @@ -13,13 +13,25 @@ # limitations under the License. #------------------------------------------------------------------------- #} +[local] +127.0.0.1 + +[local:vars] +ansible_connection=local +{%- for node in nodes %} +instance_server_public_ip_{{ node.infra_element_name }}={% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{%- endfor %} [{{ "servers_for_" ~ name }}] {%- for node in nodes %} -{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} doml_element_name={{ node.infra_element_name }} doml_element_type={{ node.vm_flavor }} {%- endfor %} [{{ "servers_for_" ~ name }}:vars] ansible_connection=ssh +{%- if nodes[0].template is defined %} +ansible_user=root +{%- else %} ansible_user=centos +{%- endif %} ansible_ssh_private_key_file=ssh_key diff --git a/templates/ansible/centos/postgres.tpl b/templates/ansible/centos/postgres.tpl index f9a2612..23474fe 100644 --- a/templates/ansible/centos/postgres.tpl +++ b/templates/ansible/centos/postgres.tpl @@ -15,7 +15,7 @@ #} --- -- hosts: DB +- hosts: {{ "servers_for_" ~ name }} become: yes pre_tasks: diff --git a/templates/ansible/cross-platform/performance_monitoring/main.yml b/templates/ansible/cross-platform/performance_monitoring/main.yml index 8b32d63..1c886ef 100644 --- a/templates/ansible/cross-platform/performance_monitoring/main.yml +++ b/templates/ansible/cross-platform/performance_monitoring/main.yml @@ -17,6 +17,7 @@ when: item is not defined with_items: - pma_deployment_id + - doml_element_name - pma_influxdb_bucket - pma_influxdb_token - pma_influxdb_org @@ -25,6 +26,7 @@ debug: msg: - "pma_deployment_id: {{ pma_deployment_id }}" + - "doml_element_name: {{ doml_element_name }}" - "pma_influxdb_bucket: {{ pma_influxdb_bucket }}" - "pma_influxdb_token: {{ pma_influxdb_token }}" - "pma_influxdb_org: {{ pma_influxdb_org }}" diff --git a/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml b/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml index 7119eb9..98d1f10 100644 --- a/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml +++ b/templates/ansible/cross-platform/performance_monitoring/vars/main.yaml @@ -18,6 +18,10 @@ telegraf_agent_output: telegraf_global_tags: - tag_name: deployment_id tag_value: "{{ pma_deployment_id }}" + - tag_name: doml_element_name + tag_value: "{{ doml_element_name }}" + - tag_name: doml_element_type + tag_value: "vm" telegraf_plugins_default: - plugin: cpu diff --git a/templates/ansible/cross-platform/security_monitoring/.gitignore b/templates/ansible/cross-platform/security_monitoring/.gitignore new file mode 100644 index 0000000..722d5e7 --- /dev/null +++ b/templates/ansible/cross-platform/security_monitoring/.gitignore @@ -0,0 +1 @@ +.vscode diff --git a/templates/ansible/cross-platform/security_monitoring/README.md b/templates/ansible/cross-platform/security_monitoring/README.md index 16225ff..9645446 100644 --- a/templates/ansible/cross-platform/security_monitoring/README.md +++ b/templates/ansible/cross-platform/security_monitoring/README.md @@ -6,7 +6,7 @@ Security Monitoring Agent (Wazuh agent) deployment as a docker ### Configuration -`vars.yml` include: +Important variables within `vars.yml` include these: ``` --- @@ -26,6 +26,8 @@ To run the playbook: ansible-playbook main.yml -i inventory.txt ``` +The Wazuh agent should be running as a process on the target infrastructure (e.g., a VM). + ## Usage - Docker To build the agent's docker image on `docker` host from the `inventory`, run this command: @@ -36,12 +38,18 @@ ansible-playbook build-wazuh-agent.yml -i inventory.txt You could also build the image manually and push it to some other docker registry. In this case you should change the variable for the image name within `vars.yml`. -To start the deployment, run this command: +### Running the agent and modifying Inventory file + +To start the deployment locally (local docker engine), run this command: ``` ansible-playbook deploy-wazuh-docker-agent.yml -i inventory.txt ``` +In order docker engine is on the other machine, change the inventory accordingly. + +### Configuration + Example of the configuration (`vars.yml`): ``` @@ -60,7 +68,7 @@ wazuh_agent_image_name: "wazuh-agent-image" piacere_deployment_id: "123e4567-e89b-12d3-a456-426614174002" ``` -All these variables can be overriden via environemnt. +All these variables can be overriden via environment. ### `Build Wazuh Agent` playbook diff --git a/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml b/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml index 93693cf..d88337b 100644 --- a/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml +++ b/templates/ansible/cross-platform/security_monitoring/build-wazuh-agent.yml @@ -1,5 +1,7 @@ --- - hosts: docker + connection: local + tasks: - name: include vars diff --git a/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 b/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 index b96de85..a571cc2 100644 --- a/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 +++ b/templates/ansible/cross-platform/security_monitoring/config/ossec.conf.j2 @@ -200,4 +200,14 @@ <location>/var/log/maillog</location> </localfile> + <localfile> + <log_format>syslog</log_format> + <location>/var/log/*</location> + </localfile> + + <localfile> + <log_format>syslog</log_format> + <location>/var/lib/docker/containers/*/*.log</location> + </localfile> + </ossec_config> \ No newline at end of file diff --git a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml index 408b261..f6d6dcf 100644 --- a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml +++ b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-agent.yml @@ -35,8 +35,9 @@ - name: Other distributions not supported ansible.builtin.shell: echo "only on Ubuntu or Debian" - when: ansible_distribution != 'Debian' and ansible_distribution != 'Ubuntu' + when: ansible_distribution != 'Debian' and ansible_distribution != 'Ubuntu' + # Setup for debian based distributions - name: System upgrade ansible.builtin.apt: name: "*" @@ -78,12 +79,46 @@ name: wazuh-agent when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + # Setup for CentOS + - name: Upgrade all packages + become: yes + ansible.builtin.yum: + name: '*' + state: latest + when: ansible_distribution == 'CentOS' + + - name: Add the Wazuh repository and install wazuh agent + become: yes + block: + - name: Import the GPG key + become: yes + ansible.builtin.rpm_key: + state: present + key: https://packages.wazuh.com/key/GPG-KEY-WAZUH + when: ansible_distribution == 'CentOS' + + - name: Add the repository + ansible.builtin.yum_repository: + name: wazuh + description: EL-\$releasever - Wazuh + baseurl: https://packages.wazuh.com/4.x/yum/ + gpgcheck: true + gpgkey: https://packages.wazuh.com/key/GPG-KEY-WAZUH + enabled: true + protect: true + + - name: Install wazuh-agent + ansible.builtin.yum: + name: wazuh-agent + state: latest + when: ansible_distribution == 'CentOS' + - name: Create config path ansible.builtin.file: path: "{{ service_config_dir }}" state: directory mode: 0755 - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS' - name: Copy config template to remote host become: yes @@ -92,7 +127,7 @@ dest: "/var/ossec/etc/ossec.conf" mode: 0644 register: config_changed - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS' - name: Start wazuh agent service become: yes @@ -107,4 +142,5 @@ ansible.builtin.systemd: name: wazuh-agent state: started - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' \ No newline at end of file + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS' + diff --git a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml index 2f50296..e499acd 100644 --- a/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml +++ b/templates/ansible/cross-platform/security_monitoring/deploy-wazuh-docker-agent.yml @@ -1,5 +1,7 @@ --- - hosts: docker + connection: local + tasks: - name: include vars diff --git a/templates/ansible/cross-platform/security_monitoring/inventory.txt b/templates/ansible/cross-platform/security_monitoring/inventory.txt index eac7201..06ff845 100644 --- a/templates/ansible/cross-platform/security_monitoring/inventory.txt +++ b/templates/ansible/cross-platform/security_monitoring/inventory.txt @@ -1,5 +1,5 @@ -[docker] -localhost - [sma_host] -localhost ansible_user=vagrant ansible_password=vagrant ansible_port=2222 \ No newline at end of file +localhost ansible_user=vagrant ansible_password=vagrant ansible_port=2222 + +[docker] +localhost \ No newline at end of file diff --git a/templates/ansible/saas/SaaSDBMS.tpl b/templates/ansible/saas/SaaSDBMS.tpl new file mode 100644 index 0000000..0b80969 --- /dev/null +++ b/templates/ansible/saas/SaaSDBMS.tpl @@ -0,0 +1,42 @@ +{# Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} + +--- +# from the first example in https://docs.ansible.com/ansible/5/collections/community/aws/rds_instance_module.html +# Note: These examples do not set authentication details, see the AWS Guide for details. +# create minimal instance in default VPC and default subnet group +- name: {{ name }} + community.aws.rds_instance: + # from saas_dbms oracledb + db_instance_identifier: {{ databaseName }} + engine: {{ engine }} + engine_version: {{ engineVersion }} + storage_encrypted: {{ encrypted }} + publicly_accessible: {{ publicly_accessible }} + # from exec_env concrete_oracledb_env + instance_type: {{ nodes[0].instance_type }} + storage_type: {{ nodes[0].storage_type }} + # from exec_env oracledb_env + # documentation says it should be integer + allocated_storage: {{ nodes[0].size }} + max_allocated_storage: {{ nodes[0].maxSize }} + region: {{ nodes[0].Location.region }} + availability_zone: {{ nodes[0].Location.zone }} + # Should the subnet_goup name be got from the Terraform output? + subnet_group: {{ nodes[0].network }} + # This is for the account to access the DB; for now we can go with the default account (oracle\oracle?) + # username: "{{ username }}" + # password: "{{ password }}" diff --git a/templates/ansible/saas/config.tpl b/templates/ansible/saas/config.tpl new file mode 100644 index 0000000..b78f8dd --- /dev/null +++ b/templates/ansible/saas/config.tpl @@ -0,0 +1,18 @@ +{# Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +{# +# Still TBD +#} diff --git a/templates/ansible/saas/inventory.tpl b/templates/ansible/saas/inventory.tpl new file mode 100644 index 0000000..b78f8dd --- /dev/null +++ b/templates/ansible/saas/inventory.tpl @@ -0,0 +1,18 @@ +{# Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +{# +# Still TBD +#} diff --git a/templates/ansible/saas/ssh_key.tpl b/templates/ansible/saas/ssh_key.tpl new file mode 100644 index 0000000..b78f8dd --- /dev/null +++ b/templates/ansible/saas/ssh_key.tpl @@ -0,0 +1,18 @@ +{# Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- +#} +{# +# Still TBD +#} diff --git a/templates/ansible/ubuntu/external_code_main.tpl b/templates/ansible/ubuntu/external_code_main.tpl new file mode 100644 index 0000000..2344dae --- /dev/null +++ b/templates/ansible/ubuntu/external_code_main.tpl @@ -0,0 +1,15 @@ +--- + +- hosts: local +{%if name == "nio3" %} vars: +{%- for node in nodes %} + instance_server_public_ip_{{ node.infra_element_name }}: "{% raw %}{{ hostvars['127.0.0.1'].instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %}" +{%- endfor %} + tasks: + - name: write hostname using jinja2 + ansible.builtin.template: + src: ../asset/inventory.j2 + dest: ../asset/inventory + - command: ansible-playbook -i ../asset/inventory "../asset/{{src.entry}}" +{%else %} tasks: + - command: ansible-playbook -i inventory "../asset/{{src.entry}}" {%- endif %} \ No newline at end of file diff --git a/templates/ansible/ubuntu/inventory.tpl b/templates/ansible/ubuntu/inventory.tpl index 9988722..7415a98 100644 --- a/templates/ansible/ubuntu/inventory.tpl +++ b/templates/ansible/ubuntu/inventory.tpl @@ -13,13 +13,25 @@ # limitations under the License. #------------------------------------------------------------------------- #} +[local] +127.0.0.1 + +[local:vars] +ansible_connection=local +{%- for node in nodes %} +instance_server_public_ip_{{ node.infra_element_name }}={% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{%- endfor %} [{{ "servers_for_" ~ name }}] {%- for node in nodes %} -{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ node.infra_element_name }} {% raw %}}}{% endraw %} doml_element_name={{ node.infra_element_name }} {%- endfor %} [{{ "servers_for_" ~ name }}:vars] ansible_connection=ssh +{%- if nodes[0].template is defined %} +ansible_user=root +{%- else %} ansible_user=ubuntu +{%- endif %} ansible_ssh_private_key_file=ssh_key diff --git a/templates/ansible/ubuntu/postgres.tpl b/templates/ansible/ubuntu/postgres.tpl index d59f60b..819d8aa 100644 --- a/templates/ansible/ubuntu/postgres.tpl +++ b/templates/ansible/ubuntu/postgres.tpl @@ -15,7 +15,7 @@ #} --- -- hosts: DB +- hosts: {{ "servers_for_" ~ name }} become: yes pre_tasks: diff --git a/templates/docker_compose/docker_compose.tpl b/templates/docker_compose/docker_compose.tpl index 239c40b..477d658 100644 --- a/templates/docker_compose/docker_compose.tpl +++ b/templates/docker_compose/docker_compose.tpl @@ -3,7 +3,22 @@ services: {{ name }}: image: {{ generatedFrom.uri }} restart: on-failure + {%- for image in extra_parameters %}{% if image["maps"] is sameas generatedFrom["name"] %}{% for cont in image["generatedContainers"] %}{% if cont["name"] is sameas name %}{% if "hostConfigs" in cont %} ports: - {%- for config in configs %} - - "{{ "127.0.0.1:" ~ config.container_port }}:{{ config.iface.name }}:{{ config.vm_port }}" + {%- for config in cont["hostConfigs"][0]["configurations"] %} + - "{{ config.container_port }}:{{ config.vm_port }}" {%- endfor %} + {%- if cont["hostConfigs"][0]["environment_variables"] is defined %} + environment: + {%- for environ in cont["hostConfigs"][0]["environment_variables"] %} + {{ environ.key }}: "{{ environ.value }}" + {%- endfor %}{% endif %} + {%- endif %}{% endif %}{% endfor %}{% endif %}{%- endfor %} +{%- if networks is defined %} + networks: + - {{ networks.0.name }} + +networks: + {{ networks.0.name }}: + name: {{ networks.0.containerNetworkName }} +{%- endif %} \ No newline at end of file diff --git a/templates/docker_compose/inventory.tpl b/templates/docker_compose/inventory.tpl index 5687052..54567c0 100644 --- a/templates/docker_compose/inventory.tpl +++ b/templates/docker_compose/inventory.tpl @@ -14,14 +14,13 @@ #------------------------------------------------------------------------- #} + [{{ "servers_for_" ~ name }}] -{%- for config in configs %} -{% raw %}{{ instance_server_public_ip_{% endraw %}{{ config.host.name }} {% raw %}}}{% endraw %} -{%- endfor %} +{%- for image in extra_parameters %}{% if image["maps"] is sameas generatedFrom["name"] %}{% for cont in image["generatedContainers"] %}{% if cont["name"] is sameas name %}{% if "hostConfigs" in cont %} +{% raw %}{{ instance_server_public_ip_{% endraw %}{{ cont.hostConfigs.0.host }} {% raw %}}}{% endraw %} +{%- endif %}{% endif %}{% endfor %}{% endif %}{%- endfor %} [{{ "servers_for_" ~ name }}:vars] ansible_connection=ssh -{%- for config in configs %} -ansible_user={%- if "ubuntu" in config.host.os.lower() %}ubuntu{%- elif "centos" in config.host.os.lower() %}centos{%- endif %} -{%- endfor %} -ansible_ssh_private_key_file=ssh_key +ansible_user=centos +ansible_ssh_private_key_file=ssh_key \ No newline at end of file diff --git a/templates/docker_compose/main.tpl b/templates/docker_compose/main.tpl index 60809d8..a5a15d8 100644 --- a/templates/docker_compose/main.tpl +++ b/templates/docker_compose/main.tpl @@ -2,6 +2,15 @@ - hosts: {{ "servers_for_" ~ name }} gather_facts: no become: yes + pre_tasks: + - name: install package + package: + name: "docker-ce" + state: present + - name: install package + package: + name: "docker-compose-plugin" + state: present tasks: - name: Copy over docker compose copy: diff --git a/templates/docker_compose/ssh_key.tpl b/templates/docker_compose/ssh_key.tpl index fd56742..2dcb26d 100644 --- a/templates/docker_compose/ssh_key.tpl +++ b/templates/docker_compose/ssh_key.tpl @@ -1,4 +1,2 @@ -{%- for config in configs %} -{%- raw %}{{ instance_server_private_key_{% endraw %}{{ config.host.credentials }}{% raw %}_{%- endraw %}{{config.host.name}}{% raw %} }} -{% endraw %} -{%- endfor %} +{%- for image in extra_parameters %}{% if image["maps"] is sameas generatedFrom["name"] %}{% for cont in image["generatedContainers"] %}{% if cont["name"] is sameas name %}{% if "hostConfigs" in cont %}{% raw %}{{ instance_server_private_key_ssh_key_{% endraw %}{{ cont.hostConfigs.0.host }} {% raw %}}}{% endraw %} +{%- endif %}{% endif %}{% endfor %}{% endif %}{%- endfor %} \ No newline at end of file diff --git a/templates/terraform/aws/autoscaling_group.tpl b/templates/terraform/aws/autoscaling_group.tpl index c46e66e..1958d2a 100644 --- a/templates/terraform/aws/autoscaling_group.tpl +++ b/templates/terraform/aws/autoscaling_group.tpl @@ -1,17 +1,19 @@ resource "aws_launch_template" "{{infra_element_name}}" { name_prefix = "{{name}}_" - //image_id = "ami-1a2b3c" {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.lower().startswith('virtualmachine') %} - instance_type = "{{value.sizeDescription}}" - image_id = "{{value.os}}" - {%- endif %}{% endif %}{% endfor %} +{% for image_el in extra_parameters["vmImages"] %}{%- if image_el["infra_element_name"] == value.generatedFrom %} image_id= "{{ image_el.image_name }}"{%- endif %}{% endfor %} + instance_type = "{% if 'sizeDescription' in value.keys() %}{{ sizeDescription }}{% elif 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" + {%- endif %}{% endif %}{% endfor %} +{% for key, value in context().items() %}{% if not callable(value)%}{% if key.startswith('NetworkInterface') %}{% if value.associated is defined %}{% if value.associated is string %} vpc_security_group_ids = [ aws_security_group.{{ value.associated }}_security_group.id ] {% else %} vpc_security_group_ids = [ aws_security_group.{{ value.associated[0].name }}_security_group.id ] {% endif %}{% endif %}{% endif %}{% endif %}{% endfor %} } resource "aws_autoscaling_group" "{{infra_element_name}}" { - desired_capacity = {{min}} - max_size = {{max}} - min_size = {{min}} - + desired_capacity = {{min}} + max_size = {{max}} + min_size = {{min}} +{%- for key, value in context().items() %}{% if not callable(value)%}{%- if key.startswith('NetworkInterface') %} + vpc_zone_identifier = [aws_subnet.{{ value.belongsTo ~ "_subnet"}}.id] +{%- endif %}{% endif %}{%- endfor %} launch_template { id = aws_launch_template.{{infra_element_name}}.id version = "$Latest" diff --git a/templates/terraform/aws/network.tpl b/templates/terraform/aws/network.tpl index 1a53ddd..304c60c 100644 --- a/templates/terraform/aws/network.tpl +++ b/templates/terraform/aws/network.tpl @@ -25,7 +25,7 @@ resource "aws_vpc" "{{infra_element_name}}" { # Subnet resource "aws_subnet" "{{value.name ~ "_subnet"}}" { vpc_id = aws_vpc.{{infra_element_name}}.id - cidr_block = "{{value.addressRange}}" + cidr_block = "{{ subnets | selectattr('maps', 'equalto', value.name) | map(attribute='addressRange') | first }}" map_public_ip_on_launch = false tags = { Name = "{{value.name}}" diff --git a/templates/terraform/aws/port_rule.tpl b/templates/terraform/aws/port_rule.tpl index 4bee5b6..09155ab 100644 --- a/templates/terraform/aws/port_rule.tpl +++ b/templates/terraform/aws/port_rule.tpl @@ -17,14 +17,17 @@ # CREATING SECURITY_GROUP resource "aws_security_group" "{{ infra_element_name ~ "_security_group" }}" { name = "{{ infra_element_name }}" - # description = "Security group rule for port {{ fromPort }}" - vpc_id = aws_vpc.{{vpc_name}}.id ##MISSING VPC NAME REFERENCE FROM DOML - {% for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} - {% if value == "INGRESS" %} ingress {% else %} egress {% endif %} { + vpc_id = aws_vpc.{{extra_parameters.networks[0].infra_element_name}}.id +{%- for key, value in context().items() %}{% if not callable(value)%} {%if value.kind and value.kind is defined %} + {% if value == "INGRESS" %}ingress{% else %}egress{%- endif %} { from_port = {{ value.fromPort }} to_port = {{ value.toPort }} protocol = "{{ value.protocol }}" - cidr_blocks = [{% for range in value.cidr %}"{{ range }}",{% endfor %}] + cidr_blocks = [{% for range in value.cidr %}"{{ range }}", {% endfor %}] } - {% endif %}{% endif %}{% endfor %} -} \ No newline at end of file +{%- endif %}{% endif %}{% endfor %} +} + +{# {% for net_el in extra_parameters["networks"] %}{% for sub_el in net_el %}{%- if sub_el.endswith(value["belongsTo"]) %} vpc_id = aws_vpc.{{net_el.infra_element_name}}.id ##MISSING VPC NAME REFERENCE FROM DOML +{%- endif %}{% endfor %}{% endfor %} +#} \ No newline at end of file diff --git a/templates/terraform/aws/ssh_key.tpl b/templates/terraform/aws/ssh_key.tpl index e953e39..2a004a1 100644 --- a/templates/terraform/aws/ssh_key.tpl +++ b/templates/terraform/aws/ssh_key.tpl @@ -15,5 +15,5 @@ #} resource "aws_key_pair" "{{infra_element_name}}" { key_name = "{{infra_element_name}}" - public_key = "{{keyfile}}" + public_key = "{{key}}" } \ No newline at end of file diff --git a/templates/terraform/aws/virtual_machine.tpl b/templates/terraform/aws/virtual_machine.tpl index e3307dd..72f41fe 100644 --- a/templates/terraform/aws/virtual_machine.tpl +++ b/templates/terraform/aws/virtual_machine.tpl @@ -15,7 +15,7 @@ #} resource "aws_instance" "{{infra_element_name}}" { - ami = "{{ os }}" +{% for image_el in extra_parameters["vmImages"] %}{%- if image_el["infra_element_name"] == generatedFrom %} ami = "{{ image_el.image_name }}"{%- endif %}{% endfor %} instance_type = "{% if 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" key_name = "{{credentials}}" {% if 'group' in context().keys() %}vpc_security_group_ids = [aws_security_group.{{group ~ "_security_group"}}.id]{% endif %} diff --git a/templates/terraform/aws/virtual_machine_out.tpl b/templates/terraform/aws/virtual_machine_out.tpl index f7da256..cb75ad1 100644 --- a/templates/terraform/aws/virtual_machine_out.tpl +++ b/templates/terraform/aws/virtual_machine_out.tpl @@ -24,4 +24,8 @@ output "instance_server_public_ip_{{ infra_element_name }}" { output "instance_public_dns_{{ infra_element_name }}" { value = aws_instance.{{infra_element_name}}.public_dns +} + +output "instance_server_private_key_{{ credentials }}_{{ infra_element_name }}" { + value = nonsensitive(tls_private_key.example.private_key_openssh) } \ No newline at end of file diff --git a/templates/terraform/ionos/datacenter.tpl b/templates/terraform/ionos/datacenter.tpl index a30fb00..1d805ae 100644 --- a/templates/terraform/ionos/datacenter.tpl +++ b/templates/terraform/ionos/datacenter.tpl @@ -16,6 +16,6 @@ resource "ionoscloud_datacenter" "dc_for_vm" { name = "{{gname}}" - location = "{% if 'vm_Region' in context().keys() %}{{ vm_Region }}{% else %}de/txl{% endif %}" + location = var.location description = "Piacere demo with IONOS, Terraform and Gaia-X orchestrator" } diff --git a/templates/terraform/open_stack/network.tpl b/templates/terraform/open_stack/network.tpl index e558567..e89ec9d 100644 --- a/templates/terraform/open_stack/network.tpl +++ b/templates/terraform/open_stack/network.tpl @@ -16,9 +16,34 @@ {##-------- Variables ##} {%- set var_network_name = infra_element_name -%} {%- set var_security_groups = infra_sgs -%} +{%- set preexinsting = preexisting -%} ## Network +{%- if preexisting %}{% if resourceName %} +# Retrieve Network +data "openstack_networking_network_v2" "{{ var_network_name }}" { + name = "{{ resourceName }}" +} + +{% for subnet in subnets %} +# Retrieve Subnet +data "openstack_networking_subnet_v2" "{{ subnet.name ~ "_subnet" }}" { + name = "{{ resourceName }}" +} +{% endfor %} +{% else %} +# Retrieve Network +data "openstack_networking_network_v2" "{{ var_network_name }}" { + name = "{{ name }}" +} +{% for subnet in subnets %} +# Retrieve Subnet +data "openstack_networking_subnet_v2" "{{ subnet.name ~ "_subnet" }}" { + name = "{{ subnet.name }}" +} +{% endfor %}{% endif %} +{%- else %} # Create Network resource "openstack_networking_network_v2" "{{ var_network_name }}" { name = "{{ name }}" @@ -27,22 +52,23 @@ resource "openstack_networking_network_v2" "{{ var_network_name }}" { # Create router resource "openstack_networking_router_v2" "router_{{ var_network_name }}" { name = "router_{{ var_network_name }}" - external_network_id = data.openstack_networking_network_v2.external.id #External network id + external_network_id = data.openstack_networking_network_v2.external.id } {##-------- Subnets Here ##} -{%- for key, value in context().items() -%}{%- if not callable(value) -%}{%-if key.startswith('Subnet') -%} +{%- for subnet in subnets %} # Subnet -resource "openstack_networking_subnet_v2" "{{ value.name ~ "_subnet" }}" { - name = "{{ value.name ~ "_subnet" }}" +resource "openstack_networking_subnet_v2" "{{ subnet.name ~ "_subnet" }}" { + name = "{{ subnet.name ~ "_subnet" }}" network_id = openstack_networking_network_v2.{{ var_network_name }}.id - cidr = "{{ value.addressRange }}" + cidr = "{{ subnet.addressRange }}" dns_nameservers = ["8.8.8.8", "8.8.8.4"] } # Create router interface on subnet -resource "openstack_networking_router_interface_v2" "router_interface_{{ var_network_name }}_{{ value.name ~ "_subnet" }}" { +resource "openstack_networking_router_interface_v2" "router_interface_{{ var_network_name }}_{{ subnet.name ~ "_subnet" }}" { router_id = "${openstack_networking_router_v2.router_{{ var_network_name }}.id}" - subnet_id = "${openstack_networking_subnet_v2.{{ value.name ~ "_subnet" }}.id}" + subnet_id = "${openstack_networking_subnet_v2.{{ subnet.name ~ "_subnet" }}.id}" } -{%-endif %}{% endif %}{% endfor %} \ No newline at end of file +{% endfor %} +{%- endif %} \ No newline at end of file diff --git a/templates/terraform/open_stack/virtual_machine.tpl b/templates/terraform/open_stack/virtual_machine.tpl index 3a7a4df..ea0d6e9 100644 --- a/templates/terraform/open_stack/virtual_machine.tpl +++ b/templates/terraform/open_stack/virtual_machine.tpl @@ -13,6 +13,7 @@ # limitations under the License. #------------------------------------------------------------------------- #} +{%- set preexinsting = extra_parameters["networks"]["preexisting"] -%} # Create virtual machine resource "openstack_compute_instance_v2" "{{ infra_element_name }}" { @@ -20,13 +21,17 @@ resource "openstack_compute_instance_v2" "{{ infra_element_name }}" { image_name = "{{ os }}" flavor_name = "{% if 'sizeDescription' in context().keys() %}{{ sizeDescription }}{% elif 'vm_flavor' in context().keys() %}{{ vm_flavor }}{% else %}{{ instance_type }}{% endif %}" key_pair = openstack_compute_keypair_v2.{{ credentials }}.name - {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} +{%- if 'BProperty_config_drive' in context().keys() %} + config_drive = true +{%- endif %} + {%- for key, value in context().items() %}{% if not callable(value)%}{%- if key.startswith('NetworkInterface') %} network { port = openstack_networking_port_v2.{{ value.name ~ "_networking_port"}}.id } - {%- endif %}{% endif %}{% endfor %} + {%- endif %}{% endif %}{%- endfor %} } +{% if not "configInterface" in context().keys() %} # Create floating ip resource "openstack_networking_floatingip_v2" "{{infra_element_name ~ "_floating_ip"}}" { pool = "external" @@ -38,28 +43,46 @@ resource "openstack_compute_floatingip_associate_v2" "{{ infra_element_name ~ "_ floating_ip = openstack_networking_floatingip_v2.{{ infra_element_name ~ "_floating_ip" }}.address instance_id = openstack_compute_instance_v2.{{ infra_element_name }}.id } +{% endif %} -# Router interface configuration {% for key, value in context().items() %}{% if not callable(value)%}{%- if key.startswith('NetworkInterface') %} -resource "openstack_networking_router_interface_v2" "{{ value.belongsTo ~ "_router_interface" }}" { - router_id = openstack_networking_router_v2.router.id - subnet_id = openstack_networking_subnet_v2.{{ value.belongsTo ~ "_subnet"}}.id + +{%- if value.associated is not defined %} +# Retrive default security group +data "openstack_compute_secgroup_v2" "default" { + name = "default" } +{%- endif %} {# adding security groups for interfaces #} -{%- if value.associated is defined %} # Attach networking port resource "openstack_networking_port_v2" "{{ value.name ~ "_networking_port" }}" { name = "{{ value.name }}" - network_id = openstack_networking_network_v2.{{ extra_parameters.networks[0].infra_element_name }}.id admin_state_up = true - security_group_ids = [ openstack_compute_secgroup_v2.{{ value.associated }}.id ] +{# Condition for security group association to networking port, if not define use default, if defined and doml older then 3.0 use string, if defined and doml version 3.1 or newer use element from list #} +{%- if value.associated is defined %}{% if value.associated is string %} security_group_ids = [ openstack_compute_secgroup_v2.{{ value.associated }}.id ] +{# TODO if more than one security group is associated to the networking port to add for cicle to take all sec_groups #} +{%- else %} security_group_ids = [ openstack_compute_secgroup_v2.{{ value.associated[0].name }}.id ]{% endif %} {# security_group_ids = [ {% for i in value["associated"] %}openstack_compute_secgroup_v2.{{ i.name }}.id {% endfor %}] #} +{%- else %} security_group_ids = [ openstack_compute_secgroup_v2.default.id ] +{%- endif %} +{%- for net_el in extra_parameters["networks"] %}{%- for sub_el in net_el["subnets"] %}{% if sub_el["maps"] is sameas value["belongsTo"] %}{%- if net_el["preexisting"] is sameas true %} + network_id = data.openstack_networking_network_v2.{{ net_el.infra_element_name }}.id + fixed_ip { +{%- if sub_el["preexisting"] is sameas true %} + subnet_id = data.openstack_networking_subnet_v2.{{ sub_el.name ~ "_subnet" }}.id +{%- else %} + subnet_id = openstack_networking_subnet_v2.{{ sub_el.name ~ "_subnet" }}.id +{%- endif %} + } +{%- else %} + network_id = openstack_networking_network_v2.{{ net_el.infra_element_name }}.id fixed_ip { - subnet_id = openstack_networking_subnet_v2.{{ value.belongsTo ~ "_subnet" }}.id + subnet_id = openstack_networking_subnet_v2.{{ sub_el.name ~ "_subnet" }}.id } +{%- endif %}{% endif %}{% endfor %}{%- endfor %} } -{%- endif%} - -{%- endif %}{% endif %}{% endfor %} - +resource "openstack_compute_interface_attach_v2" "{{ infra_element_name ~ "_port_association" }}" { + instance_id = openstack_compute_instance_v2.{{ infra_element_name }}.id + port_id = openstack_networking_port_v2.{{ value.name ~ "_networking_port" }}.id +}{% endif %}{% endif %}{% endfor %} \ No newline at end of file diff --git a/templates/terraform/open_stack/virtual_machine_out.tpl b/templates/terraform/open_stack/virtual_machine_out.tpl index 14b3aa3..4cee3d4 100644 --- a/templates/terraform/open_stack/virtual_machine_out.tpl +++ b/templates/terraform/open_stack/virtual_machine_out.tpl @@ -22,6 +22,12 @@ output "instance_server_private_key_{{ credentials }}_{{ infra_element_name }}" value = openstack_compute_keypair_v2.{{ credentials }}.private_key } +{%- if configInterface is defined %} +output "instance_server_public_ip_{{ infra_element_name }}" { + value = openstack_networking_port_v2.{{ configInterface }}_networking_port.all_fixed_ips.0 +} +{%- else %} output "instance_server_public_ip_{{ infra_element_name }}" { value = openstack_compute_floatingip_associate_v2.{{ infra_element_name ~ "_floating_ip_association" }}.floating_ip -} \ No newline at end of file +} +{%- endif %} \ No newline at end of file diff --git a/templates/terraform/vsphere/config.tpl b/templates/terraform/vsphere/config.tpl index 57da218..0a7d9ec 100644 --- a/templates/terraform/vsphere/config.tpl +++ b/templates/terraform/vsphere/config.tpl @@ -23,8 +23,7 @@ input: - VSPHERE_ALLOW_UNVERIFIED_SSL output: {% for vm in vms %} - - instance_server_public_key_{{ vm.credentials }} - - instance_public_ip_{{ vm.infra_element_name }} - - instance_public_dns_{{ vm.infra_element_name }} + - instance_server_private_key_{{ vm.credentials }}_{{ vm.infra_element_name }} + - instance_server_public_ip_{{ vm.infra_element_name }} {% endfor %} ... diff --git a/templates/terraform/vsphere/data_resources.tpl b/templates/terraform/vsphere/data_resources.tpl index f6f2f5a..739e5fa 100644 --- a/templates/terraform/vsphere/data_resources.tpl +++ b/templates/terraform/vsphere/data_resources.tpl @@ -1,6 +1,5 @@ data "{{type}}" "{{name}}" { - name = "{{gname}}" + name = "{% if 'gname' in context().keys() %}{{ gname }}{% else %}{{ resourceName }}{% endif %}" {%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} - datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} -{% endif %}{% endif %}{% endfor %} + datacenter_id = "${data.vsphere_datacenter.{{value.name}}.id}"{% endif %}{% endif %}{% endfor %} } diff --git a/templates/terraform/vsphere/datacenter.tpl b/templates/terraform/vsphere/datacenter.tpl index 7c62ba1..b77674e 100644 --- a/templates/terraform/vsphere/datacenter.tpl +++ b/templates/terraform/vsphere/datacenter.tpl @@ -1,6 +1,5 @@ {##-------- Variables ##} {%- set preexinsting = preexisting -%} - {%- if preexinsting %} data "vsphere_datacenter" "{{datacenter}}" { name = "{{datacenter}}" diff --git a/templates/terraform/vsphere/datastore.tpl b/templates/terraform/vsphere/datastore.tpl index f35c6b5..33a6670 100644 --- a/templates/terraform/vsphere/datastore.tpl +++ b/templates/terraform/vsphere/datastore.tpl @@ -2,7 +2,6 @@ data "vsphere_datastore" "{{name}}" { name = "{{vsphere_datastore_name}}" {%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} - datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} -{% endif %}{% endif %}{% endfor %} + datacenter_id = "${data.vsphere_datacenter.{{value.name}}.id}" {% endif %}{% endif %}{% endfor %} } {%- endif %} \ No newline at end of file diff --git a/templates/terraform/vsphere/init.tpl b/templates/terraform/vsphere/init.tpl index f161486..2f6b708 100644 --- a/templates/terraform/vsphere/init.tpl +++ b/templates/terraform/vsphere/init.tpl @@ -15,8 +15,4 @@ #} provider "vsphere" { - #user = VSPHERE_USER - #password = VSPHERE_PASSWORD - #vsphere_server = VSPHERE_SERVER - #allow_unverified_ssl = {{allow_unverified_ssl}} } diff --git a/templates/terraform/vsphere/network.tpl b/templates/terraform/vsphere/network.tpl index 5294d77..d014419 100644 --- a/templates/terraform/vsphere/network.tpl +++ b/templates/terraform/vsphere/network.tpl @@ -1,12 +1,10 @@ {##-------- Variables ##} {%- set preexinsting = preexisting -%} - {%- if preexinsting %} data "vsphere_network" "{{infra_element_name}}" { name = "{{vsphere_network_name}}" {%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} - datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} -{% endif %}{% endif %}{% endfor %} + datacenter_id = "${data.vsphere_datacenter.{{value.name}}.id}" {% endif %}{% endif %}{% endfor %} } {% else %} TODO diff --git a/templates/terraform/vsphere/virtual_machine.tpl b/templates/terraform/vsphere/virtual_machine.tpl index a31bafe..9972348 100644 --- a/templates/terraform/vsphere/virtual_machine.tpl +++ b/templates/terraform/vsphere/virtual_machine.tpl @@ -14,33 +14,41 @@ #------------------------------------------------------------------------- #} +variable "username" { + type = string + default = "esilab" +} + +variable "password" { + type = string + default = "NoNeedForSpecialChars04392" +} + # Create virtual machine resource "vsphere_virtual_machine" "{{ infra_element_name }}" { name = "{{ name }}" - {%- if pool and pool.preexisting %} - resource_pool_id = ${data.{{pool.type}}.{{ pool.name }}.id} - {%- endif %} - {%- if datastore and datastore.preexisting %} - datastore_id = ${data.vsphere_datastore.{{ datastore.name }}.id} - {%- endif %} +{%- if pool and pool.preexisting %} + resource_pool_id = "${data.{{pool.type}}.{{ pool.name }}.id}"{%- endif %} +{%- if datastore and datastore.preexisting %} + datastore_id = "${data.vsphere_datastore.{{ datastore.name }}.id}"{%- endif %} num_cpus = {% if 'vm_Virtual_CPU_Cores' in context().keys() %}{{ vm_Virtual_CPU_Cores }}{% else %}{{ cpu_count }}{% endif %} memory = {% if 'vm_Memory' in context().keys() %}{{ vm_Memory }}{% else %}{{ memory_mb }}{% endif %} guest_id = "{{guest_id}}" network_interface { - network_id = {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} ${data.vsphere_network.{{ value.belongsTo }}.id} - {%- endif %}{% endif %}{% endfor %} + network_id = {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} "${data.vsphere_network.{{ value.belongsTo }}.id}"{%- endif %}{% endif %}{% endfor %} } disk { - label = "{{disk}}" //TODO Missing attach option in DOML - datastore and disk are two different resources - size = {% if 'vm_Instance_Storage' in context().keys() %}{{ vm_Instance_Storage }}{% else %}{{ disk_size }}{% endif %} - +{% for store_el in extra_parameters["storages"] %} + label = "{{ store_el.label }}" + size = "{{ store_el.size_gb }}" +{% endfor %} } clone { - template_uuid = ${data.vsphere_virtual_machine.{{template.name}}.id} + template_uuid = "${data.vsphere_virtual_machine.{{template.name}}.id}" customize { linux_options { host_name = "{{host_name}}" @@ -48,10 +56,10 @@ resource "vsphere_virtual_machine" "{{ infra_element_name }}" { } network_interface { ipv4_address = {%- for key, value in context().items() %}{% if not callable(value)%}{%if key.startswith('NetworkInterface') %} "{{ value.endPoint }}"{%- endif %}{% endif %}{% endfor %} - ipv4_netmask = 27 //TODO retrieve in some way the netmask from the network (ICG Parser) + ipv4_netmask = 27 dns_server_list = ["10.81.34.36, 10.81.34.60"] } - ipv4_gateway = "10.83.18.65" //TODO the DOML v2.2 definition of gateway is still not implemented in IDE + ipv4_gateway = "10.83.18.65" } } @@ -59,7 +67,7 @@ resource "vsphere_virtual_machine" "{{ infra_element_name }}" { type = "ssh" user = "${var.username}" password = "${var.password}" - host = "${self.default_ip_address}" # TCN GBE + host = "${self.default_ip_address}" } provisioner "remote-exec" { @@ -70,8 +78,7 @@ resource "vsphere_virtual_machine" "{{ infra_element_name }}" { "chmod 700 /root/.ssh", "touch /root/.ssh/authorized_keys", "chmod 600 /root/.ssh/authorized_keys", - "echo -e '${tls_private_key.{{ credentials }}.public_key_openssh}' >> /root/.ssh/authorized_keys" # TCN GBE + "echo -e '${tls_private_key.{{ credentials }}.public_key_openssh}' >> /root/.ssh/authorized_keys" ] } - } \ No newline at end of file diff --git a/templates/terraform/vsphere/virtual_machine_out.tpl b/templates/terraform/vsphere/virtual_machine_out.tpl index 46abc72..6121a39 100644 --- a/templates/terraform/vsphere/virtual_machine_out.tpl +++ b/templates/terraform/vsphere/virtual_machine_out.tpl @@ -6,10 +6,10 @@ output "instance_server_private_key_{{ credentials }}_{{ infra_element_name }}" value = nonsensitive(tls_private_key.{{ credentials }}.private_key_openssh) } -output "instance_user_{{ infra_element_name }}" { +output "instance_server_user_{{ infra_element_name }}" { value = var.username } -output "instance_ip_{{ infra_element_name }}" { +output "instance_server_public_ip_{{ infra_element_name }}" { value = vsphere_virtual_machine.{{ infra_element_name }}.default_ip_address } \ No newline at end of file diff --git a/templates/terraform/vsphere/vm_image.tpl b/templates/terraform/vsphere/vm_image.tpl index e6570d9..2a43326 100644 --- a/templates/terraform/vsphere/vm_image.tpl +++ b/templates/terraform/vsphere/vm_image.tpl @@ -1,8 +1,7 @@ {%- if preexisting %} data "vsphere_virtual_machine" "{{name}}" { - name = "{{vsphere_virtual_machine_name}}" + name = "{{image_name}}" {%- for key, value in context().items() %}{% if value is mapping%}{% if value.type == "vsphere_datacenter"%} - datacenter_id = ${data.vsphere_datacenter.{{value.name}}.id} -{% endif %}{% endif %}{% endfor %} + datacenter_id = "${data.vsphere_datacenter.{{value.name}}.id}"{% endif %}{% endif %}{% endfor %} } {%- endif %} \ No newline at end of file diff --git a/utility/Graph.py b/utility/Graph.py new file mode 100644 index 0000000..5608295 --- /dev/null +++ b/utility/Graph.py @@ -0,0 +1,51 @@ +# Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------- + +class Graph: + # Contructor (given graph is optional) + def __init__(self, givengraph=None, f=print): + if givengraph is None: + self.nodes = {} + else: + self.nodes = givengraph + self.visited = [] + self.nodefunc = f + # Add node (adds a node with no dependencies) + def add_node(self, node): + self.nodes[node] = [] + # Add edge (adds a dependency to a node, if the node does not exist adds the node first) + def add_edge(self, fromnode, tonode): + if not fromnode in self.nodes: + self.add_node(fromnode) + if not tonode in self.nodes: + self.add_node(tonode) + self.nodes[fromnode].append(tonode) + # Method to visit graph or node + def visit(self, node=None): + if node is None: + if self.nodes: # if the graph is not empty + for nodekey in self.nodes.keys(): + self.visit(nodekey) + self.visited = [] + else: + if self.nodes[node]: # if the current node has dependencies + for dependency in self.nodes[node]: + self.visit(dependency) + if not node in self.visited: + self.nodefunc(node) + self.visited.append(node) + # Add a function to be executed for each node visited + def set_function(self, f=print): + self.nodefunc = f -- GitLab