Skip to content

Instantly share code, notes, and snippets.

@celebdor
Created April 10, 2018 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save celebdor/d018f147e011aed76a712f744a0e2b3f to your computer and use it in GitHub Desktop.
Save celebdor/d018f147e011aed76a712f744a0e2b3f to your computer and use it in GitHub Desktop.
# coding: utf-8
import keystoneauth1
from neutronclient.v2_0 import client as v2client
from neutronclient import client
import shade
cloud = shade.openstack_cloud()
octoadapter = keystoneauth1.adapter.Adapter(
session=cloud.keystone_session,
service_type=cloud.cloud_config.get_service_type('load-balancer'),
interface=cloud.cloud_config.get_interface('load-balancer'),
endpoint_override=cloud.cloud_config.get_endpoint('load-balancer'),
version=cloud.cloud_config.get_api_version('load-balancer'))
ofakeclient = client.Client(session=cloud.keystone_session)
nclient = v2client.Client(session=cloud.keystone_session)
octo_httpclient = client.construct_http_client(session=cloud.keystone_session, service_type='load-balancer')
ofakeclient.httpclient = octo_httpclient
print('List Octavia lbs with neutron client :P')
lbaasfk.list_lbaas_loadbalancers()
lbaasfk.create_lbaas_loadbalancer()
ofakeclient.create_loadbalancer({'loadbalancer': {'name': 'fejk', 'vip_subnet_id': 'e750d736-b41f-414a-bf7e-90f0f12fa90a' }})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment