How to associate floating IP to a port using openstacksdk?

304 views Asked by At

I am programming openstack operations using openstacksdk. I was taking reference from this link. I have to achieve below using openstacksdk:

#openstack floating ip set --port <port ID> <FIP>

But am not able to find any functions described in openstasksdk.

1

There are 1 answers

0
Uday On

I did not find any straight forward sdk library for this. But I achieved using below:

create_stack(name, tags=None, template_file=None, template_url=None, template_object=None, files=None, rollback=True, wait=False, timeout=3600, environment_files=None, **parameters)

and HOT:

heat_template_version: 2013-05-23
parameters:
  ingress_fip_id:
    type: string
    description: Floating ip address ID to associate it with ingress port.
  ingress_port_id:
    type: string
    description: ingress port ID.

resources:
  associate_fip:
    type: OS::Neutron::FloatingIPAssociation
    properties:
      floatingip_id: { get_param: ingress_fip_id }
      port_id: { get_param: ingress_port_id }