def __init__(self): super(InstanceCommand, self).__init__(self.command_options) if self.options._list: response = self.client.get('/api/v1/buyer/instances/list') instances = self.parse_response(response) for instance in instances: print model.Instance(instance) elif self.options._key: response = self.client.get('/api/v1/buyer/instance/%s' % self.options._key) instance = self.parse_response(response) print model.Instance(instance) elif self.options._delete: response = self.client.delete('/api/v1/buyer/instance/%s' % self.options._delete) self.parse_response(response, expected_status=httplib.NO_CONTENT) print 'Deleted\n' elif self.options._create: response = self.client.post('/api/v1/buyer/instances/list', data=dict( appliance=self.options._appliance, hardware=self.options._hardware)) instance = self.parse_response(response, expected_status=httplib.CREATED) print model.Instance(instance) else: self.parser.print_help()
def deploy_blueprint_template(request, template_name, product): template = model.Template(template_name) net = model.Network("node-int-net-01", True) inst = model.Instance('ubuntu', 'Ubuntu14.04init_deprecated', '2', '', False, [net]) service = model.Service(product.name, product) service.add_instance(inst) template.add_service(service) request.deploy_template(template)
def deploy_two_products_in_two_vms(request, template_name): atts = [] atts.append({'port': '8080'}) template = model.Template(template_name) product = model.Product('tomcat', 'io.murano.apps.apache.Tomcat', atts) net = model.Network("node-int-net-01", True) inst = model.Instance('ubuntu', 'Ubuntu14.04init_deprecated', '2', '', False, [net]) service = model.Service(product.name, product) service.add_instance(inst) template.add_service(service) product2 = model.Product('tomcat', 'io.murano.apps.apache.Tomcat', atts) inst2 = model.Instance('ubuntu', 'Ubuntu14.04init_deprecated', '2', '', False, [net]) service2 = model.Service(product2.name, product2) service2.add_instance(inst2) template.add_service(service2) request.deploy_template(template)
def deploy_no_network(request, template_name): atts = [] atts.append({'port': '8080'}) template = model.Template(template_name) product = model.Product('tomcat', 'io.murano.apps.apache.Tomcat', atts) inst = model.Instance('ubuntu', 'Ubuntu14.04init_deprecated', '2', '', False) service = model.Service(product.name, product) service.add_instance(inst) template.add_service(service) request.deploy_template(template)
def deploy_orion_chef(request, template_name): atts = [] atts.append({'port': '1026'}) product = model.Product('orionchef', 'io.murano.conflang.chef.GitChef', atts) template = model.Template(template_name) net = model.Network("node-int-net-01", True) inst = model.Instance('centos', 'CentOS-6.5init_deprecated', '2', 'demo4', False, [net]) service = model.Service(product.name, product) service.add_instance(inst) template.add_service(service) request.deploy_template(template)
def deploy_orion_docker(request, template_name): template = model.Template(template_name) net = model.Network("node-int-net-01", True) inst = model.Instance('ubuntu', 'Ubuntu14.04init_deprecated', '2', '', False, [net]) product = model.Product('docker', 'io.murano.apps.docker.DockerStandaloneHost') service = model.Service(product.name, product) service.add_instance(inst) atts = [] atts.append({'publish': True}) atts.append({'host': product.id}) product = model.Product('dockerorion', 'io.murano.apps.docker.DockerOrion', atts) service2 = model.Service(product.name, product) template.add_service(service) template.add_service(service2) request.deploy_template(template)