Skip to content

Commit

Permalink
Adding templates for sub-interface
Browse files Browse the repository at this point in the history
Closes-Bug: #1599653

Change-Id: I1c9bc0b56877295ec2607f21027cf8cf325c5b91
  • Loading branch information
savithruml committed Jul 6, 2016
1 parent ab50c6b commit 508743b
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 0 deletions.
22 changes: 22 additions & 0 deletions contrail_heat/new_envs/contrail-create-subint.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
parameters:

#Int eth0
private_net_name_0: eth0-network
private_net_cidr_0: 192.168.1.0/24
private_net_gateway_0: 192.168.1.1

#Sub-Int eth0.50

private_net_name_1: eth0.50-network
private_net_cidr_1: 2.2.2.0/24
private_net_gateway_1: 2.2.2.1
vlan_tag_1: 50
VMI_name_1: leftSUB_50
VMI_name_2: rightSUB_50

#Parent Port-Stats

server_left_name: left_VM
server_right_name: right_VM
flavor: m1.tiny
image: heat-si-snapshot
132 changes: 132 additions & 0 deletions contrail_heat/new_templates/contrail-create-subint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
heat_template_version: 2014-10-16

description: HOT to create sub-interfaces on a server instance using Contrail V2 plugin

parameters:
private_net_name_0:
type: string
private_net_cidr_0:
type: string
private_net_gateway_0:
type: string
private_net_name_1:
type: string
private_net_cidr_1:
type: string
private_net_gateway_1:
type: string
vlan_tag_1:
type: number
VMI_name_1:
type: string
VMI_name_2:
type: string
server_left_name:
type: string
server_right_name:
type: string
image:
type: string
flavor:
type: string

resources:
private_net_0:
type: OS::Neutron::Net
properties:
name: { get_param: private_net_name_0 }

private_subnet_0:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net_0 }
cidr: { get_param: private_net_cidr_0 }
gateway_ip: { get_param: private_net_gateway_0 }

server_1:
type: OS::Nova::Server
properties:
name: { get_param: server_left_name }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- network: { get_resource: private_net_0 }

server_2:
type: OS::Nova::Server
properties:
name: { get_param: server_right_name }
image: { get_param: image }
flavor: { get_param: flavor }
networks:
- network: { get_resource: private_net_0 }

private_net_1:
type: OS::Neutron::Net
properties:
name: { get_param: private_net_name_1 }

private_subnet_1:
type: OS::Neutron::Subnet
properties:
network_id: { get_resource: private_net_1 }
cidr: { get_param: private_net_cidr_1 }
gateway_ip: { get_param: private_net_gateway_1 }

template_VirtualMachineInterface_1:
type: OS::ContrailV2::VirtualMachineInterface
properties:
name: { get_param: VMI_name_1 }
virtual_network_refs: [{ get_resource: private_net_1 }]
virtual_machine_interface_properties:
{
virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: vlan_tag_1 },
}
virtual_machine_interface_mac_addresses:
{
virtual_machine_interface_mac_addresses_mac_address: [{ get_attr: [server_1, addresses, get_param: private_net_name_0, 0, "OS-EXT-IPS-MAC:mac_addr"] }],
}
virtual_machine_interface_refs: [{ get_attr: [server_1, addresses, get_param: private_net_name_0, 0, "port"] }]

template_VirtualMachineInterface_2:
type: OS::ContrailV2::VirtualMachineInterface
properties:
name: { get_param: VMI_name_2 }
virtual_network_refs: [{ get_resource: private_net_1 }]
virtual_machine_interface_properties:
{
virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: vlan_tag_1 },
}
virtual_machine_interface_mac_addresses:
{
virtual_machine_interface_mac_addresses_mac_address: [{ get_attr: [server_2, addresses, get_param: private_net_name_0, 0, "OS-EXT-IPS-MAC:mac_addr"] }]
}
virtual_machine_interface_refs: [{ get_attr: [server_2, addresses, get_param: private_net_name_0, 0, "port"] }]

instanceIP_1_1:
type: OS::ContrailV2::InstanceIp
depends_on: [ template_VirtualMachineInterface_1 ]
properties:
virtual_network_refs: [{ get_resource: private_net_1 }]
virtual_machine_interface_refs: [{ get_resource: template_VirtualMachineInterface_1 }]

instanceIP_1_2:
type: OS::ContrailV2::InstanceIp
depends_on: [ template_VirtualMachineInterface_2 ]
properties:
virtual_network_refs: [{ get_resource: private_net_1 }]
virtual_machine_interface_refs: [{ get_resource: template_VirtualMachineInterface_2 }]

outputs:
server_1_mac:
description: Server_1 Mac-Address
value: { get_attr: [server_1, addresses, get_param: private_net_name_0, 0, "OS-EXT-IPS-MAC:mac_addr"] }
server_1_port_uuid:
description: Server_1 port UUID
value: { get_attr: [server_1, addresses, get_param: private_net_name_0, 0, "port"] }
server_2_mac:
description: Server_2 Mac-Address
value: { get_attr: [server_2, addresses, get_param: private_net_name_0, 0, "OS-EXT-IPS-MAC:mac_addr"] }
server_2_port_uuid:
description: Server_2 port UUID
value: { get_attr: [server_2, addresses, get_param: private_net_name_0, 0, "port"] }

0 comments on commit 508743b

Please sign in to comment.