Skip to content

Instantly share code, notes, and snippets.

@Ladas
Created May 30, 2016 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ladas/b1c186b9bbefe0122604ee27fcfb62cb to your computer and use it in GitHub Desktop.
Save Ladas/b1c186b9bbefe0122604ee27fcfb62cb to your computer and use it in GitHub Desktop.
Woroking Parameterized Tosca template
params = JSON.dump({'image_name' => 'cirros', 'flavor_name' => 'm1.small'})
service.vnfs.create(:vnf=>{:name=>"openwrtLadasParametrized",
:vnfd_id=>"ba49e22e-1d85-491f-859f-2d9afa2ab952",
:attributes => {:param_values => params}})
# replace https://github.com/openstack/tacker/blob/91f5a0ba309533ffea11718d9107883b41864552/tacker/vm/infra_drivers/heat/heat.py#L288
# with:
parsed_params = jsonutils.loads(dev_attrs.pop('param_values', '{}'))
for key, value in parsed_params.iteritems():
if isinstance(parsed_params[key], basestring):
parsed_params[key] = parsed_params[key].encode('utf-8')
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
description: OpenWRT with services, parametrized, by Ladas
metadata:
template_name: OpenWRT
topology_template:
inputs:
image_name:
type: string
description: Image Name
flavor_name:
type: string
description: Flavor Name
node_templates:
VDU1:
type: tosca.nodes.nfv.VDU.Tacker
properties:
image: { get_input: image_name }
flavor: { get_input: flavor_name }
config: |
param0: key1
param1: key2
mgmt_driver: openwrt
monitoring_policy:
name: ping
actions:
- {trigger: failure, action: respawn}
parameters:
count: "3"
interval: "10"
CP1:
type: tosca.nodes.nfv.CP.Tacker
properties:
management: true
requirements:
- virtualLink:
node: VL1
- virtualBinding:
node: VDU1
CP2:
type: tosca.nodes.nfv.CP.Tacker
requirements:
- virtualLink:
node: VL2
- virtualBinding:
node: VDU1
CP3:
type: tosca.nodes.nfv.CP.Tacker
requirements:
- virtualLink:
node: VL3
- virtualBinding:
node: VDU1
VL1:
type: tosca.nodes.nfv.VL
properties:
network_name: net_mgmt
vendor: Tacker
VL2:
type: tosca.nodes.nfv.VL
properties:
network_name: pkt_in
vendor: Tacker
VL3:
type: tosca.nodes.nfv.VL
properties:
network_name: pkt_out
vendor: Tacker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment