The openstack_dashboard.api.network_base ModuleΒΆ

Abstraction layer for networking functionalities.

This module defines internal APIs for duplicated features between OpenStack Compute and OpenStack Networking. The networking abstraction layer expects methods defined in this module.

class openstack_dashboard.api.network_base.FloatingIpManager[source]

Bases: object

Abstract class to implement Floating IP methods

The FloatingIP object returned from methods in this class must contains the following attributes:

  • id: ID of Floating IP

  • ip: Floating IP address

  • pool: ID of Floating IP pool from which the address is allocated

  • fixed_ip: Fixed IP address of a VIF associated with the address

  • port_id: ID of a VIF associated with the address

    (instance_id when Nova floating IP is used)

  • instance_id: Instance ID of an associated with the Floating IP

allocate(pool=None, tenant_id=None, **params)[source]

Allocates a floating IP to the tenant.

You must provide a pool name or id for which you would like to allocate a floating IP.

associate(floating_ip_id, port_id)[source]

Associates the floating IP to the port.

port_id is a fixed IP of an instance (Nova) or a port_id attached to a VNIC of an instance.

disassociate(floating_ip_id)[source]

Disassociates the floating IP specified.

get(floating_ip_id)[source]

Fetches the floating IP.

It returns a FloatingIp object corresponding to floating_ip_id.

get_target_id_by_instance(instance_id, target_list=None)[source]

Returns a target ID of floating IP association.

Based on a backend implementation.

Parameters:
  • instance_id – ID of target VM instance
  • target_list – (optional) a list returned by list_targets(). If specified, looking up is done against the specified list to save extra API calls to a back-end. Otherwise a target information is retrieved from a back-end inside the method.
is_simple_associate_supported()[source]

Returns True if the default floating IP pool is enabled.

is_supported()[source]

Returns True if floating IP feature is supported.

list(all_tenants=False)[source]

Fetches a list of all floating IPs.

A returned value is a list of FloatingIp object.

list_pools()[source]

Fetches a list of all floating IP pools.

A list of FloatingIpPool objects is returned. FloatingIpPool object is an APIResourceWrapper/APIDictWrapper where ‘id’ and ‘name’ attributes are defined.

list_target_id_by_instance(instance_id, target_list=None)[source]

Returns a list of instance’s target IDs of floating IP association.

Based on the backend implementation

Parameters:
  • instance_id – ID of target VM instance
  • target_list – (optional) a list returned by list_targets(). If specified, looking up is done against the specified list to save extra API calls to a back-end. Otherwise target list is retrieved from a back-end inside the method.
list_targets()[source]

Returns a list of association targets of instance VIFs.

Each association target is represented as FloatingIpTarget object. FloatingIpTarget is a APIResourceWrapper/APIDictWrapper and ‘id’ and ‘name’ attributes must be defined in each object. FloatingIpTarget.id can be passed as port_id in associate(). FloatingIpTarget.name is displayed in Floating Ip Association Form.

release(floating_ip_id)[source]

Releases a floating IP specified.

class openstack_dashboard.api.network_base.SecurityGroupManager[source]

Bases: object

Abstract class to implement Security Group methods

SecurityGroup object returned from methods in this class must contains the following attributes:

  • id: ID of Security Group (int for Nova, uuid for Neutron)
  • name
  • description
  • tenant_id
  • rules: A list of SecurityGroupRule objects

SecurityGroupRule object should have the following attributes (The attribute names and their formats are borrowed from nova security group implementation):

  • id
  • direction
  • ethertype
  • parent_group_id: security group the rule belongs to
  • ip_protocol
  • from_port: lower limit of allowed port range (inclusive)
  • to_port: upper limit of allowed port range (inclusive)
  • ip_range: remote IP CIDR (source for ingress, dest for egress). The value should be a format of “{‘cidr’: <cidr>}”
  • group: remote security group. The value should be a format of “{‘name’: <secgroup_name>}”
create(name, desc)[source]

Create a new security group.

It returns a SecurityGroup object created.

delete(sg_id)[source]

Delete the specified security group.

get(sg_id)[source]

Fetches the security group.

It returns a SecurityGroup object corresponding to sg_id.

list()[source]

Fetches a list all security groups.

A returned value is a list of SecurityGroup object.

list_by_instance(instance_id)[source]

Get security groups of an instance.

rule_create(parent_group_id, direction=None, ethertype=None, ip_protocol=None, from_port=None, to_port=None, cidr=None, group_id=None)[source]

Create a new security group rule.

Parameters:
  • parent_group_id – security group id a rule is created to
  • direction – ingress or egress
  • ethertype – ipv4, ipv6, ...
  • ip_protocol – tcp, udp, icmp
  • from_port – L4 port range min
  • to_port – L4 port range max
  • cidr – Source IP CIDR
  • group_id – ID of Source Security Group
rule_delete(sgr_id)[source]

Delete the specified security group rule.

update_instance_security_group(instance_id, new_security_group_ids)[source]

Update security groups of a specified instance.

Previous topic

The openstack_dashboard.api.heat Module

Next topic

The openstack_dashboard.api.base Module

Project Source

This Page