Commit fd7852f5 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed default properties bug and added more states in k8s interface

parent 8c12d5d8
tosca_definitions_version: "tosca_simple_yaml_1_0"
topology_template:
node_templates:
compute:
properties:
disk_size: "50000 MB"
mem_size: "6000 MB"
num_cores: 2
os: "Ubuntu 19.04"
user_name: "vm_user"
interfaces:
Standard:
create: "dumy.yaml"
type: "tosca.nodes.ARTICONF.VM.Compute"
compute_1:
properties:
disk_size: "50000 MB"
mem_size: "6000 MB"
num_cores: 2
os: "Ubuntu 19.04"
user_name: "vm_user"
interfaces:
Standard:
create: "dumy.yaml"
type: "tosca.nodes.ARTICONF.VM.Compute"
kubernetes:
properties:
min_masters_num: 1
min_workers_num: 1
requirements:
- host:
capability: "tosca.capabilities.ARTICONF.VM.topology"
node: "topology"
relationship: "tosca.relationships.HostedOn"
interfaces:
Standard:
create:
inputs:
inventory-file: "k8s_hosts"
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/install_k8s.yml"
type: "tosca.nodes.ARTICONF.Orchestrator.Kubernetes"
logspout:
properties:
environment:
publish: "127.0.0.1:8000:80"
ports:
- "8000:80"
volumes:
- "/etc/hostname:/etc/host_hostname:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
requirements:
- host:
capability: "tosca.capabilities.ARTICONF.Orchestrator"
node: "kubernetes"
relationship: "tosca.relationships.HostedOn"
type: "tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts:
image:
file: "gliderlabs/logspout:latest"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
mysql:
properties:
environment:
MYSQL_DATABASE: "wordpress"
MYSQL_PASSWORD: "wordpress"
MYSQL_ROOT_PASSWORD: "somewordpress"
MYSQL_USER: "wordpress"
ports:
- "3306:3306"
volumes:
- "db_data:/var/lib/mysql"
requirements:
- host:
capability: "tosca.capabilities.ARTICONF.Orchestrator"
node: "kubernetes"
relationship: "tosca.relationships.HostedOn"
type: "tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts:
image:
file: "mysql:5.7"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
topology:
properties:
domain: "UvA (Amsterdam, The Netherlands) XO Rack"
provider: "ExoGENI"
requirements:
- vm:
capability: "tosca.capabilities.ARTICONF.VM"
node: "compute"
relationship: "tosca.relationships.DependsOn"
- vm:
capability: "tosca.capabilities.ARTICONF.VM"
node: "compute_1"
relationship: "tosca.relationships.DependsOn"
interfaces:
CloudsStorm:
provision:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
type: "tosca.nodes.ARTICONF.VM.topology"
wordpress:
properties:
environment:
WORDPRESS_DB_HOST: "mysql:3306"
WORDPRESS_DB_NAME: "wordpress"
WORDPRESS_DB_PASSWORD: "wordpress"
WORDPRESS_DB_USER: "wordpress"
ports:
- "8000:80"
requirements:
- service:
node: "mysql"
relationship:
type: "tosca.relationships.DependsOn"
- host:
capability: "tosca.capabilities.ARTICONF.Orchestrator"
node: "kubernetes"
relationship: "tosca.relationships.HostedOn"
type: "tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts:
image:
file: "wordpress:latest"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
policies:
- scalability:
properties:
constraint_name: "cpu_load"
max_value: 90
targets:
- "wordpress"
type: "tosca.policies.ARTICONF.Performance.CPU"
- faultTolerance:
properties:
level: 1
targets:
- "mysql"
type: "tosca.policies.ARTICONF.FaultTolerance"
description: "TOSCA example"
imports:
- nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml"
- data: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/TOSCA/types/data.yml"
- capabilities: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml"
- policies: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml"
- interfaces: "https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml"
......@@ -71,8 +71,16 @@ interface_types:
default: k8s_hosts
playbook:
type: string
required: true
required: false
default: https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/ansible_playbooks/install_k8s.yml
install:
description: install Kubernetes
k8s_scale:
description: Set the number of replicas for a Deployment, ReplicaSet, or Replication Controller, or the parallelism attribute of a Job.
k8s_create:
description: create deployment on a k8s cluster
k8s_delete:
description: delete deployment on a k8s cluster
k8s_info:
description: get information on pods,services or deployments
import base64
import json
import logging
import os
import tempfile
import shutil
from collections import namedtuple
from stat import S_IREAD
import requests
from subprocess import Popen, PIPE
from numpy.distutils.system_info import openblas64__info
import ansible
import requests
from ansible.executor.playbook_executor import PlaybookExecutor
from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager
logger = logging.getLogger(__name__)
if not getattr(logger, 'handler_set', None):
logger.setLevel(logging.INFO)
h = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
h.setFormatter(formatter)
logger.addHandler(h)
logger.handler_set = True
def write_ansible_files(vms, interfaces, tmp_path):
......@@ -24,13 +38,13 @@ def write_ansible_files(vms, interfaces, tmp_path):
workers.append(attributes['public_ip'])
if ansible_ssh_private_key_file_path is None:
ansible_ssh_private_key_encoded = attributes['user_key_pair']['keys']['private_key']
ansible_ssh_private_key = base64.b64decode(ansible_ssh_private_key_encoded)
ansible_ssh_private_key = base64.b64decode(ansible_ssh_private_key_encoded).decode('utf-8')
ansible_ssh_private_key_file_path = tmp_path + "/id_rsa"
with open(ansible_ssh_private_key_file_path, "w") as ansible_ssh_private_key_file:
print(ansible_ssh_private_key, file=ansible_ssh_private_key_file)
os.chmod(ansible_ssh_private_key_file_path, S_IREAD)
if ansible_ssh_user == None:
if ansible_ssh_user is None:
ansible_ssh_user = vms[vm_name]['properties']['user_name']
k8s_hosts_path = tmp_path + "/k8s_hosts"
with open(k8s_hosts_path, "w") as k8s_hosts_file:
......@@ -52,7 +66,7 @@ def write_ansible_files(vms, interfaces, tmp_path):
image_url = interfaces['Standard']['create']['inputs']['playbook']
r = requests.get(image_url)
with open(tmp_path+"/playbook.yml", 'wb') as f:
with open(tmp_path + "/playbook.yml", 'wb') as f:
f.write(r.content)
return tmp_path
......@@ -61,10 +75,49 @@ def run(interfaces, vms):
tmp_path = tempfile.mkdtemp()
write_ansible_files(vms, interfaces, tmp_path)
p = Popen(["ansible-playbook", "-i", tmp_path+"/k8s_hosts", tmp_path+"/playbook.yml"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
p = Popen(["ansible-playbook", "-i", tmp_path + "/k8s_hosts", tmp_path + "/playbook.yml"], stdin=PIPE, stdout=PIPE,
stderr=PIPE)
output, err = p.communicate()
print(output)
print(err)
rc = p.returncode
return tmp_path
def execute_playbook(hosts, playbook_path, user, ssh_key_file, extra_vars, passwords):
if not os.path.exists(playbook_path):
logger.error('The playbook does not exist')
return '[ERROR] The playbook does not exist'
os.environ['ANSIBLE_HOST_KEY_CHECKING'] = 'false'
ansible.constants.HOST_KEY_CHECKING = False
os.environ['ANSIBLE_SSH_RETRIES'] = 'retry_count'
ansible.constants.ANSIBLE_SSH_RETRIES = 3
variable_manager = VariableManager()
loader = DataLoader()
# inventory = Inventory(loader=loader, variable_manager=variable_manager, host_list=hosts)
Options = namedtuple('Options',
['listtags', 'listtasks', 'listhosts', 'syntax', 'connection', 'module_path', 'forks',
'remote_user', 'private_key_file', 'ssh_common_args', 'ssh_extra_args', 'sftp_extra_args',
'scp_extra_args', 'become', 'become_method', 'become_user', 'verbosity', 'check',
'host_key_checking', 'retries'])
options = Options(listtags=False, listtasks=False, listhosts=False, syntax=False, connection='smart',
module_path=None, forks=None, remote_user=user, private_key_file=ssh_key_file, ssh_common_args='',
ssh_extra_args='', sftp_extra_args=None, scp_extra_args=None, become=True, become_method='sudo',
become_user='root', verbosity=None, check=False, host_key_checking=False, retries=retry_count)
variable_manager.extra_vars = extra_vars
# pbex = PlaybookExecutor(playbooks=[playbook_path],
# inventory=inventory,
# variable_manager=variable_manager,
# loader=loader,
# options=options,
# passwords=passwords,
# )
......@@ -2,11 +2,14 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e478ccae-5352-4e8e-9efb-3f5cda44e877" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../drip-deployer/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-deployer/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../TOSCA/types/interfaces.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../TOSCA/types/interfaces.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-deployer/service/ansible_service.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-deployer/service/ansible_service.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-deployer/service/tosca.py" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-deployer/service/tosca.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/__main__.py" beforeDir="false" afterPath="$PROJECT_DIR$/__main__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/planner/planner.py" beforeDir="false" afterPath="$PROJECT_DIR$/planner/planner.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/service/simple_spec_alayzer.py" beforeDir="false" afterPath="$PROJECT_DIR$/service/simple_spec_alayzer.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/tosca_helper.py" beforeDir="false" afterPath="$PROJECT_DIR$/util/tosca_helper.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/etc/UD/ExoGENI.yml" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/etc/UD/ExoGENI.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" beforeDir="false" afterPath="$PROJECT_DIR$/../drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -264,51 +267,51 @@
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state x="925" y="283" width="767" height="906" key="#__main__/67.34.2493.1406@67.34.2493.1406" timestamp="1575885420596" />
<state width="2155" height="582" key="DebuggerActiveHint" timestamp="1577715024259">
<state width="2155" height="582" key="DebuggerActiveHint" timestamp="1579096948545">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2155" height="582" key="DebuggerActiveHint/67.34.2493.1406@67.34.2493.1406" timestamp="1577715024259" />
<state width="2155" height="582" key="DebuggerActiveHint/67.34.2493.1406@67.34.2493.1406" timestamp="1579096948545" />
<state x="792" y="334" width="827" height="663" key="FileChooserDialogImpl" timestamp="1578326180157">
<screen x="67" y="34" width="1853" height="1046" />
</state>
<state x="792" y="334" width="827" height="663" key="FileChooserDialogImpl/67.34.1853.1046@67.34.1853.1046" timestamp="1578326180157" />
<state x="1043" y="437" width="530" height="598" key="FileChooserDialogImpl/67.34.2493.1406@67.34.2493.1406" timestamp="1575907769017" />
<state width="2465" height="381" key="GridCell.Tab.0.bottom" timestamp="1578935126552">
<state width="2437" height="407" key="GridCell.Tab.0.bottom" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="263" key="GridCell.Tab.0.bottom/67.34.1853.1046@67.34.1853.1046" timestamp="1578584059031" />
<state width="2465" height="381" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1578935126552" />
<state width="2465" height="381" key="GridCell.Tab.0.center" timestamp="1578935126549">
<state width="2437" height="407" key="GridCell.Tab.0.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state width="2437" height="407" key="GridCell.Tab.0.center" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="263" key="GridCell.Tab.0.center/67.34.1853.1046@67.34.1853.1046" timestamp="1578584059030" />
<state width="2465" height="381" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1578935126549" />
<state width="2465" height="381" key="GridCell.Tab.0.left" timestamp="1578935126545">
<state width="2437" height="407" key="GridCell.Tab.0.center/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state width="2437" height="407" key="GridCell.Tab.0.left" timestamp="1579098700842">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="263" key="GridCell.Tab.0.left/67.34.1853.1046@67.34.1853.1046" timestamp="1578584059030" />
<state width="2465" height="381" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1578935126545" />
<state width="2465" height="381" key="GridCell.Tab.0.right" timestamp="1578935126550">
<state width="2437" height="407" key="GridCell.Tab.0.left/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700842" />
<state width="2437" height="407" key="GridCell.Tab.0.right" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="1825" height="263" key="GridCell.Tab.0.right/67.34.1853.1046@67.34.1853.1046" timestamp="1578584059030" />
<state width="2465" height="381" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1578935126550" />
<state width="2465" height="413" key="GridCell.Tab.1.bottom" timestamp="1577720249209">
<state width="2437" height="407" key="GridCell.Tab.0.right/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state width="2437" height="407" key="GridCell.Tab.1.bottom" timestamp="1579098700844">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="413" key="GridCell.Tab.1.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1577720249209" />
<state width="2465" height="413" key="GridCell.Tab.1.center" timestamp="1577720249207">
<state width="2437" height="407" key="GridCell.Tab.1.bottom/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700844" />
<state width="2437" height="407" key="GridCell.Tab.1.center" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="413" key="GridCell.Tab.1.center/67.34.2493.1406@67.34.2493.1406" timestamp="1577720249207" />
<state width="2465" height="413" key="GridCell.Tab.1.left" timestamp="1577720249206">
<state width="2437" height="407" key="GridCell.Tab.1.center/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state width="2437" height="407" key="GridCell.Tab.1.left" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="413" key="GridCell.Tab.1.left/67.34.2493.1406@67.34.2493.1406" timestamp="1577720249206" />
<state width="2465" height="413" key="GridCell.Tab.1.right" timestamp="1577720249208">
<state width="2437" height="407" key="GridCell.Tab.1.left/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state width="2437" height="407" key="GridCell.Tab.1.right" timestamp="1579098700843">
<screen x="67" y="34" width="2493" height="1406" />
</state>
<state width="2465" height="413" key="GridCell.Tab.1.right/67.34.2493.1406@67.34.2493.1406" timestamp="1577720249208" />
<state width="2437" height="407" key="GridCell.Tab.1.right/67.34.2493.1406@67.34.2493.1406" timestamp="1579098700843" />
<state x="679" y="283" key="SettingsEditor" timestamp="1575885393075">
<screen x="67" y="34" width="2493" height="1406" />
</state>
......@@ -326,36 +329,21 @@
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>72</line>
<option name="timeStamp" value="8" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>67</line>
<option name="timeStamp" value="9" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/test_planner.py</url>
<line>22</line>
<option name="timeStamp" value="21" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/planner/planner.py</url>
<line>21</line>
<option name="timeStamp" value="22" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/venv/lib/python3.7/site-packages/toscaparser/tosca_template.py</url>
<line>114</line>
<option name="timeStamp" value="29" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/test/test_planner.py</url>
<line>36</line>
<option name="timeStamp" value="33" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/service/simple_spec_alayzer.py</url>
<line>142</line>
<option name="timeStamp" value="68" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
......
import logging
import yaml
from toscaparser.nodetemplate import NodeTemplate
from toscaparser.tosca_template import ToscaTemplate
from toscaparser.topology_template import TopologyTemplate
import operator
# import matplotlib.pyplot as plt
......@@ -19,6 +20,7 @@ class Planner:
self.tosca_template = ToscaTemplate(tosca_path)
elif yaml_dict_tpl:
self.yaml_dict_tpl = yaml_dict_tpl
logging.info('yaml_dict_tpl:\n' + str(yaml.dump(yaml_dict_tpl)))
self.tosca_template = ToscaTemplate(yaml_dict_tpl=yaml_dict_tpl)
self.tosca_node_types = self.tosca_template.nodetemplates[0].type_definition.TOSCA_DEF
......@@ -102,10 +104,10 @@ class Planner:
# Only add node that is not in node_templates
matching_node_type_name = next(iter(matching_node))
matching_node_template = tosca_helper.node_type_2_node_template(matching_node, self.all_custom_def)
# Add the requirements to the node we analyzed. e.g. docker needed host now we added the type and name of host
node = self.add_requirements(node, all_requirements, matching_node_template.name)
if not tosca_helper.contains_node_type(self.required_nodes, matching_node_type_name):
if not tosca_helper.contains_node_type(self.required_nodes, matching_node_type_name) and \
not tosca_helper.contains_node_type(self.tosca_template.nodetemplates, matching_node_type_name):
logging.info(' Adding: ' + str(matching_node_template.name))
self.required_nodes.append(matching_node)
# Find matching nodes for the new node's requirements
......@@ -139,9 +141,10 @@ class Planner:
else:
for all_requirement in all_requirements:
for parent_requirement in parent_requirements:
all_requirement_key = next(iter(all_requirement))
all_requirement_key = next(iter(all_requirement))
parent_requirement_key = next(iter(parent_requirement))
if all_requirement_key != parent_requirement_key and all_requirement[all_requirement_key]['capability'] != parent_requirement[parent_requirement_key]['capability']:
if all_requirement_key != parent_requirement_key and all_requirement[all_requirement_key][
'capability'] != parent_requirement[parent_requirement_key]['capability']:
all_requirements.append(parent_requirement)
logging.debug(' all_requirements: ' + str(all_requirements))
......
......@@ -129,16 +129,19 @@ class SimpleAnalyzer(SpecificationAnalyzer):
if default_properties:
for default_property in default_properties:
affected_node.get_properties_objects().append(default_property)
if 'properties' in affected_node.templates[next(iter(affected_node.templates))]:
for prop_name in affected_node.templates[next(iter(affected_node.templates))]['properties']:
if 'required' not in affected_node.templates[next(iter(affected_node.templates))]['properties'][
prop_name] and 'type' not in \
affected_node.templates[next(iter(affected_node.templates))]['properties'][prop_name]:
default_properties[prop_name] = \
affected_node.templates[next(iter(affected_node.templates))]['properties'][prop_name]
affected_node.templates[next(iter(affected_node.templates))]['properties'] = default_properties
node_name = next(iter(affected_node.templates))
if 'properties' in affected_node.templates[node_name]:
for prop_name in affected_node.templates[node_name]['properties']:
if isinstance(affected_node.templates[node_name]['properties'][prop_name], dict) or \
isinstance(affected_node.templates[node_name]['properties'][prop_name], str):
if 'required' in affected_node.templates[node_name]['properties'][prop_name] and \
affected_node.templates[node_name]['properties'][prop_name]['required'] and \
'default' in affected_node.templates[node_name]['properties'][prop_name] and \
prop_name not in default_properties:
default_properties[prop_name] = affected_node.templates[node_name]['properties'][prop_name]['default']
logging.info('Adding to : ' + str(affected_node.templates[node_name])+ ' properties: '+str(default_properties))
affected_node.templates[node_name]['properties'] = default_properties
return affected_node
else:
......
......@@ -151,7 +151,7 @@ def get_tosca_template_2_topology_template_dictionary(template):
def contains_node_type(node_types_list, node_type_name):
if node_types_list is None:
if not node_types_list:
return False
for node_type in node_types_list:
if isinstance(node_type, NodeTemplate):
......
#http://geni-images.renci.org/images/standard/ubuntu-comet/
#https://wiki.exogeni.net/doku.php?id=public:experimenters:resource_types:start
# To add image:
#1 got to http://geni-images.renci.org/images/standard/
#2 select descriptionimage e.g. : http://geni-images.renci.org/images/standard/centos-comet/centos7.6.1810.v3/centos7.6.1810.v3.xml
#3 download it: wget http://geni-images.renci.org/images/standard/centos-comet/centos7.6.1810.v3/centos7.6.1810.v3.xml
#4 get hash: sha1sum centos7.6.1810.v3.xml
#5 Add entry below
GlobalEntry: "https://geni.renci.org:11443/orca/xmlrpc"
DCMetaInfo:
- domain: "UvA (Amsterdam, The Netherlands) XO Rack"
......@@ -71,6 +77,46 @@ DCMetaInfo:
OS_URL: "http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID: "fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize: 50
- OS: "Centos 7.6"
CPU: 4
MEM: 12
VMType: "XOXLarge"
Price: null
DefaultSSHAccount: "root"
extraInfo:
OS_URL: "http://geni-images.renci.org/images/standard/centos-comet/centos7.6.1810.v3/centos7.6.1810.v3.xml"
OS_GUID: "c8aebe4cda3fd8d4272147297848007f719f2b87"
DiskSize: 75
- OS: "Centos 7.6"
CPU: 2
MEM: 6
VMType: "XOLarge"
Price: null
DefaultSSHAccount: "root"
extraInfo:
OS_URL: "http://geni-images.renci.org/images/standard/centos-comet/centos7.6.1810.v3/centos7.6.1810.v3.xml"
OS_GUID: "c8aebe4cda3fd8d4272147297848007f719f2b87"
DiskSize: 50
- OS: "Ubuntu 19.04"
CPU: 4
MEM: 12
VMType: "XOXLarge"
Price: null
DefaultSSHAccount: "root"
extraInfo:
OS_URL: "http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-19.04.v4/ubuntu-19.04.v4.xml"
OS_GUID: "c7baea709ee9c4b354a175a315c6cf74a1c1a1f5"
DiskSize: 75
- OS: "Ubuntu 19.04"
CPU: 2
MEM: 6
VMType: "XOLarge"
Price: null
DefaultSSHAccount: "root"
extraInfo:
OS_URL: "http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-19.04.v4/ubuntu-19.04.v4.xml"
OS_GUID: "c7baea709ee9c4b354a175a315c6cf74a1c1a1f5"
DiskSize: 50
- domain: "BBN/GPO (Boston, MA USA) XO Rack"
endpoint: "bbnvmsite.rdf#bbnvmsite"
country: USA
......
......@@ -317,20 +317,21 @@ class CloudStormService {
String rootKeyPairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ File.separator + subTopology.getSshKeyPairId();
Credential rootKeyPairCredential = new Credential();
rootKeyPairCredential.setProtocol("ssh");
Map<String, String> keys = new HashMap<>();
keys.put("private_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa"));
keys.put("public_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa.pub"));
rootKeyPairCredential.setKeys(keys);
Map<String, String> rootKeys = new HashMap<>();
rootKeys.put("private_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa"));
rootKeys.put("public_key", Converter.encodeFileToBase64Binary(rootKeyPairFolder + File.separator + "id_rsa.pub"));
rootKeyPairCredential.setKeys(rootKeys);
String userKyePairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH;
Credential userKeyPairCredential = new Credential();
userKeyPairCredential.setProtocol("ssh");
keys = new HashMap<>();
keys.put("private_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa"));
keys.put("public_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa.pub"));
userKeyPairCredential.setKeys(keys);
Map<String, String> userKyes = new HashMap<>();
userKyes.put("private_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa"));
userKyes.put("public_key", Converter.encodeFileToBase64Binary(userKyePairFolder + File.separator + "id_rsa.pub"));
userKeyPairCredential.setKeys(userKyes);
CloudsStormVMs cloudsStormVMs = objectMapper.readValue(new File(tempInputDirPath + TOPOLOGY_RELATIVE_PATH + File.separator + subTopology.getTopology() + ".yml"),
CloudsStormVMs.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment