murano-apps/PaloAlto/package/Classes/PaloAltoNode.yaml

101 lines
2.6 KiB
YAML

# 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.
Namespaces:
=: com.mirantis
std: io.murano
res: io.murano.resources
sys: io.murano.system
netsfc: org.openstack.networkingSfc
Name: PaloAltoNode
Extends: netsfc:Instance
Properties:
name:
Usage: InOut
Contract: $.string().notNull()
flavor:
Usage: InOut
Contract: $.string()
image:
Usage: InOut
Contract: $.string()
keyname:
Usage: InOut
Contract: $.string()
network:
Usage: InOut
Contract: $.class(res:Network)
Methods:
.init:
Body:
- $._environment: $.find(std:Environment).require()
getInternalIp:
Body:
- Return: $.ipAddresses.first()
getSecondIp:
Body:
- Return: $.ipAddresses[1]
spawnInstance:
Arguments:
- name:
Contract: $.string().notNull()
- flavor:
Contract: $.string()
- image:
Contract: $.string()
- keyname:
Contract: $.string()
- network:
Contract: $.class(res:Network)
- portNum:
Contract: $.int()
Default: 1
Body:
- $._environment.reporter.report($this, format( 'Creating {0} VM with {1} port(s)...',
$.name, $portNum))
- Repeat: $portNum
Do:
- $port: new(netsfc:NeutronPort, $this, network => $network)
- $.ports: $.ports.append($port)
- $.deploy()
- $._environment.reporter.report($this, format( 'VM {0} deployed', $.name))
deploySoftware:
Arguments:
- role:
Contract: $.string().notNull()
Body:
- $resources: new(sys:Resources)
- $template: $resources.yaml('PaloAltoDeploy.template').bind(dict(role => $role))
- $.agent.call($template, $resources)
configureSoftware:
Arguments:
- role:
Contract: $.string().notNull()
- backends:
Contract: $.string().notNull()
Body:
- $resources: new(sys:Resources)
- $template: $resources.yaml('PaloAltoConfigure.template').bind(dict(role => $role,
backends => $backends))
- $.agent.call($template, $resources)