The ooi.api.helpers_neutron Module

class ooi.api.helpers_neutron.OpenStackNeutron(neutron_endpoint)

Bases: ooi.api.helpers.BaseHelper

Class to interact with the neutron API.

assign_floating_ip(req, device_id)

assign floating ip to a server

Parameters:
  • req – the incoming request
  • device_id – device id
create_network(req, name, cidr, gateway=None, ip_version=None)

Create a full neutron network.

It creates a private network conected to the public one. It creates a full network objects stack: network, subnet, port, and router. In case of error, the objects already created are deleted.

Parameters:
  • req – the incoming request
  • name – network resource to manage
  • cidr – parameters with values
  • gateway – gateway ip
  • ip_version – ip version
create_port(req, network_id, device_id)

Add a port to the subnet

Returns the port information

Parameters:
  • req – the incoming network
  • network_id – network id
  • device_id – device id
create_resource(req, resource, parameters)

Create a resource.

Parameters:
  • req – the incoming request
  • resource – network resource to manage
  • parameters – parameters with values for the new network
delete_network(req, id)

Delete a full network.

Parameters:
  • req – the incoming request
  • id – net identification
delete_port(req, mac)

Delete a port to the subnet

Returns the port information

Parameters:
  • req – the incoming network
  • mac – link mac
delete_resource(req, resource, id)

Delete resource. It returns empty array

Parameters:
  • req – the incoming request
  • parameters – conain id

Get a specific network/server link

It shows a specific link (either private or public ip)

Parameters:
  • req – the incoming request
  • compute_id – server id
  • network_id – network id
  • ip – ip connected
get_network_details(req, id)

Get info from a network.

It returns json code from the server

Parameters:
  • req – the incoming network
  • id – net identification
get_network_id(req, mac, server_id=None)

Get the Network ID from the mac port

Parameters:
  • req – the incoming network
  • mac – mac port
  • server_id – id not use in neutron
get_resource(req, resource, id)

Get information from a resource.

Parameters:
  • req – the incoming request
  • resource – network resource to manage
  • id – subnet identification

List the network and compute links

It lists every private and public ip related to the servers of the tenant

Parameters:
  • req – the incoming request
  • network_id – id network
  • device_id – id device
list_networks(req)

List networks.

It returns json code from the server

Parameters:
  • req – the incoming request
  • parameters – query parameters
list_resources(req, resource, parameters=None)

List resources.

It returns json code from the server

Parameters:
  • req – the incoming request
  • resource – network resource to manage
  • parameters – query parameters
  • tenant – include tenant in the query parameters
release_floating_ip(req, iface)

release floating ip from a server

Parameters:
  • req – the incoming request
  • iface – link information
run_action(req, action, net_id)

Run an action on a network.

Parameters:
  • req – the incoming request
  • action – the action to run
  • net_id – server id to delete