Ask Your Question
0

How do i get my gateway address in heat?

asked 2016-08-25 17:04:37 -0500

foo gravatar image

updated 2016-09-20 11:55:44 -0500

zaneb gravatar image

I'm new to heat and i'm trying to find out what my gateway address is that was assigned by neutron. I've been able to get my ip and prefix information, but I'm not sure how to get my gateway. if someone has a basic yaml they can share that returns the VM's ip, prefix or netmask, and gateway address, that would be great. thanks in advance.

...
  port:
    type: OS::Neutron::Port
    properties:
      name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" }, "port"]]} 
      network: { get_param: network }
...

outputs:
  ip:
    value: { get_attr: [port, fixed_ips, 0, ip_address] }
  network:
    value: { get_attr: [port, subnets, 0, cidr] }
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2016-08-26 21:30:31 -0500

foo gravatar image

updated 2016-09-20 11:57:35 -0500

zaneb gravatar image

The information I was looking for was actually under OS::Neutron::Port

resources:
  port:
    type: OS::Neutron::Port
    properties:
      name: {"Fn::Join": ["-", [{ get_param: "OS::stack_name" }, "port"]]}
      network: { get_param: network }
...

outputs:
  gateway:
    value: { get_attr: [port, subnets, 0, gateway_ip] }
edit flag offensive delete link more
0

answered 2016-08-25 19:11:50 -0500

first of all, the gateway ip address belongs to subnet resource, and it will be assigned to the OS within the VM by subnet DHCP service when connecting to a network or a network port. So you can not query gateway ip from resource with type "OS::Nova::Server" within heat template.

Usually, when you use a subnet, the gateway ip is provided by user. see http://docs.openstack.org/developer/heat/template_guide/openstack.html#OS::Neutron::Subnet-prop-gateway_ip (OS::Neutron::Subnet#gateway_ip).

So you can run command openstack subnet show <subnet-id> to get gateway ip. where the subnet id can be found from the port resource of your VM.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-08-25 17:04:37 -0500

Seen: 892 times

Last updated: Sep 20 '16