s/quantum/neutron/ and fix client
diff --git a/xos/openstack_xos/client.py b/xos/openstack_xos/client.py
index fabf739..6ec7bc2 100644
--- a/xos/openstack_xos/client.py
+++ b/xos/openstack_xos/client.py
@@ -3,8 +3,8 @@
from keystoneclient.v2_0 import client as keystone_client
#from glance import client as glance_client
import glanceclient
- from novaclient.v2 import client as nova_client
- from neutronclient import client as quantum_client
+ from novaclient.v2 import client as nova_client
+ from neutronclient.v2_0 import client as neutron_client
has_openstack = True
except:
has_openstack = False
@@ -154,11 +154,11 @@
def __getattr__(self, name):
return getattr(self.client, name)
-class QuantumClient(Client):
+class NeutronClient(Client):
def __init__(self, *args, **kwds):
Client.__init__(self, *args, **kwds)
if has_openstack:
- self.client = quantum_client.Client(username=self.username,
+ self.client = neutron_client.Client(username=self.username,
password=self.password,
tenant_name=self.tenant,
auth_url=self.url,
@@ -188,7 +188,7 @@
self.glanceclient = GlanceClient('1', endpoint=glance_endpoint, token=token.id, **kwds)
self.nova = NovaClient(*args, **kwds)
# self.nova_db = NovaDB(*args, **kwds)
- self.quantum = QuantumClient(*args, **kwds)
+ self.neutron = NeutronClient(*args, **kwds)
@require_enabled
diff --git a/xos/openstack_xos/driver.py b/xos/openstack_xos/driver.py
index 5b1040e..a5a27ee 100644
--- a/xos/openstack_xos/driver.py
+++ b/xos/openstack_xos/driver.py
@@ -181,53 +181,53 @@
return 1
def create_router(self, name, set_gateway=True):
- routers = self.shell.quantum.list_routers(name=name)['routers']
+ routers = self.shell.neutron.list_routers(name=name)['routers']
if routers:
router = routers[0]
else:
- router = self.shell.quantum.create_router({'router': {'name': name}})['router']
+ router = self.shell.neutron.create_router({'router': {'name': name}})['router']
# add router to external network
if set_gateway:
- nets = self.shell.quantum.list_networks()['networks']
+ nets = self.shell.neutron.list_networks()['networks']
for net in nets:
if net['router:external'] == True:
- self.shell.quantum.add_gateway_router(router['id'],
+ self.shell.neutron.add_gateway_router(router['id'],
{'network_id': net['id']})
return router
def delete_router(self, id):
- routers = self.shell.quantum.list_routers(id=id)['routers']
+ routers = self.shell.neutron.list_routers(id=id)['routers']
for router in routers:
- self.shell.quantum.delete_router(router['id'])
+ self.shell.neutron.delete_router(router['id'])
# remove router form external network
- #nets = self.shell.quantum.list_networks()['networks']
+ #nets = self.shell.neutron.list_networks()['networks']
#for net in nets:
# if net['router:external'] == True:
- # self.shell.quantum.remove_gateway_router(router['id'])
+ # self.shell.neutron.remove_gateway_router(router['id'])
def add_router_interface(self, router_id, subnet_id):
- router = self.shell.quantum.show_router(router_id)['router']
- subnet = self.shell.quantum.show_subnet(subnet_id)['subnet']
+ router = self.shell.neutron.show_router(router_id)['router']
+ subnet = self.shell.neutron.show_subnet(subnet_id)['subnet']
if router and subnet:
- self.shell.quantum.add_interface_router(router_id, {'subnet_id': subnet_id})
+ self.shell.neutron.add_interface_router(router_id, {'subnet_id': subnet_id})
def delete_router_interface(self, router_id, subnet_id):
- router = self.shell.quantum.show_router(router_id)
- subnet = self.shell.quantum.show_subnet(subnet_id)
+ router = self.shell.neutron.show_router(router_id)
+ subnet = self.shell.neutron.show_subnet(subnet_id)
if router and subnet:
- self.shell.quantum.remove_interface_router(router_id, {'subnet_id': subnet_id})
+ self.shell.neutron.remove_interface_router(router_id, {'subnet_id': subnet_id})
def create_network(self, name, shared=False):
- nets = self.shell.quantum.list_networks(name=name)['networks']
+ nets = self.shell.neutron.list_networks(name=name)['networks']
if nets:
net = nets[0]
else:
- net = self.shell.quantum.create_network({'network': {'name': name, 'shared': shared}})['network']
+ net = self.shell.neutron.create_network({'network': {'name': name, 'shared': shared}})['network']
return net
def delete_network(self, id):
- nets = self.shell.quantum.list_networks()['networks']
+ nets = self.shell.neutron.list_networks()['networks']
for net in nets:
if net['id'] == id:
# delete_all ports
@@ -235,18 +235,18 @@
# delete all subnets:
for subnet_id in net['subnets']:
self.delete_subnet(subnet_id)
- self.shell.quantum.delete_network(net['id'])
+ self.shell.neutron.delete_network(net['id'])
return 1
def delete_network_ports(self, network_id):
- ports = self.shell.quantum.list_ports()['ports']
+ ports = self.shell.neutron.list_ports()['ports']
for port in ports:
if port['network_id'] == network_id:
- self.shell.quantum.delete_port(port['id'])
+ self.shell.neutron.delete_port(port['id'])
return 1
def delete_subnet_ports(self, subnet_id):
- ports = self.shell.quantum.list_ports()['ports']
+ ports = self.shell.neutron.list_ports()['ports']
for port in ports:
delete = False
for fixed_ip in port['fixed_ips']:
@@ -254,17 +254,17 @@
delete=True
break
if delete:
- self.shell.quantum.delete_port(port['id'])
+ self.shell.neutron.delete_port(port['id'])
return 1
def create_subnet(self, name, network_id, cidr_ip, ip_version, start, end):
- #nets = self.shell.quantum.list_networks(name=network_name)['networks']
+ #nets = self.shell.neutron.list_networks(name=network_name)['networks']
#if not nets:
# raise Exception, "No such network: %s" % network_name
#net = nets[0]
subnet = None
- subnets = self.shell.quantum.list_subnets()['subnets']
+ subnets = self.shell.neutron.list_subnets()['subnets']
for snet in subnets:
if snet['cidr'] == cidr_ip and snet['network_id'] == network_id:
subnet = snet
@@ -282,22 +282,22 @@
'host_routes': [{'destination':'169.254.169.254/32','nexthop':metadata_ip}],
'gateway_ip': None,
'allocation_pools': allocation_pools}}
- subnet = self.shell.quantum.create_subnet(subnet)['subnet']
+ subnet = self.shell.neutron.create_subnet(subnet)['subnet']
# self.add_external_route(subnet)
return subnet
def update_subnet(self, id, fields):
- return self.shell.quantum.update_subnet(id, fields)
+ return self.shell.neutron.update_subnet(id, fields)
def delete_subnet(self, id):
- #return self.shell.quantum.delete_subnet(id=id)
+ #return self.shell.neutron.delete_subnet(id=id)
# inefficient but fault tolerant
- subnets = self.shell.quantum.list_subnets()['subnets']
+ subnets = self.shell.neutron.list_subnets()['subnets']
for subnet in subnets:
if subnet['id'] == id:
self.delete_subnet_ports(subnet['id'])
- self.shell.quantum.delete_subnet(id)
+ self.shell.neutron.delete_subnet(id)
self.delete_external_route(subnet)
return 1
@@ -310,7 +310,7 @@
if not routes:
routes = self.get_external_routes()
- ports = self.shell.quantum.list_ports()['ports']
+ ports = self.shell.neutron.list_ports()['ports']
gw_ip = subnet['gateway_ip']
subnet_id = subnet['id']
@@ -325,7 +325,7 @@
if fixed_ip['subnet_id'] == subnet_id and fixed_ip['ip_address'] == gw_ip:
gw_port = port
router_id = gw_port['device_id']
- router = self.shell.quantum.show_router(router_id)['router']
+ router = self.shell.neutron.show_router(router_id)['router']
if router and router.get('external_gateway_info'):
ext_net = router['external_gateway_info']['network_id']
for port in ports:
@@ -347,7 +347,7 @@
return 1
def delete_external_route(self, subnet):
- ports = self.shell.quantum.list_ports()['ports']
+ ports = self.shell.neutron.list_ports()['ports']
gw_ip = subnet['gateway_ip']
subnet_id = subnet['id']
@@ -362,7 +362,7 @@
if fixed_ip['subnet_id'] == subnet_id and fixed_ip['ip_address'] == gw_ip:
gw_port = port
router_id = gw_port['device_id']
- router = self.shell.quantum.show_router(router_id)['router']
+ router = self.shell.neutron.show_router(router_id)['router']
ext_net = router['external_gateway_info']['network_id']
for port in ports:
if port['device_id'] == router_id and port['network_id'] == ext_net:
@@ -397,24 +397,24 @@
tenant = self.shell.nova.tenant
tenant = self.shell.keystone.tenants.find(name=tenant)
search_opts = {"tenant_id": tenant.id, "shared": False}
- private_networks = self.shell.quantum.list_networks(**search_opts)
+ private_networks = self.shell.neutron.list_networks(**search_opts)
return private_networks
def get_shared_networks(self):
search_opts = {"shared": True}
- shared_networks = self.shell.quantum.list_networks(**search_opts)
+ shared_networks = self.shell.neutron.list_networks(**search_opts)
return shared_networks
def get_network_subnet(self, network_id):
subnet_id = None
subnet = None
if network_id:
- os_networks = self.shell.quantum.list_networks(id=network_id)["networks"]
+ os_networks = self.shell.neutron.list_networks(id=network_id)["networks"]
if os_networks:
os_network = os_networks[0]
if os_network['subnets']:
subnet_id = os_network['subnets'][0]
- os_subnets = self.shell.quantum.list_subnets(id=subnet_id)['subnets']
+ os_subnets = self.shell.neutron.list_subnets(id=subnet_id)['subnets']
if os_subnets:
subnet = os_subnets[0]['cidr']
diff --git a/xos/openstack_xos/manager.py b/xos/openstack_xos/manager.py
index ae288bd..50b3fd4 100644
--- a/xos/openstack_xos/manager.py
+++ b/xos/openstack_xos/manager.py
@@ -239,7 +239,7 @@
self.driver.delete_tenant(slice.tenant_id)
# delete external route
subnet = None
- subnets = self.driver.shell.quantum.list_subnets()['subnets']
+ subnets = self.driver.shell.neutron.list_subnets()['subnets']
for snet in subnets:
if snet['id'] == slice.subnet_id:
subnet = snet
@@ -268,7 +268,7 @@
def get_next_subnet(self):
# limit ourself to 10.0.x.x for now
valid_subnet = lambda net: net.startswith('10.0')
- subnets = self.driver.shell.quantum.list_subnets()['subnets']
+ subnets = self.driver.shell.neutron.list_subnets()['subnets']
ints = [int(IPNetwork(subnet['cidr']).ip) for subnet in subnets \
if valid_subnet(subnet['cidr'])]
ints.sort()
@@ -280,13 +280,13 @@
@require_enabled
def save_subnet(self, subnet):
if not subnet.subnet_id:
- quantum_subnet = self.driver.create_subnet(name= subnet.slice.name,
+ neutron_subnet = self.driver.create_subnet(name= subnet.slice.name,
network_id=subnet.slice.network_id,
cidr_ip = subnet.cidr,
ip_version=subnet.ip_version,
start = subnet.start,
end = subnet.end)
- subnet.subnet_id = quantum_subnet['id']
+ subnet.subnet_id = neutron_subnet['id']
# add subnet as interface to slice's router
self.driver.add_router_interface(subnet.slice.router_id, subnet.subnet_id)
#add_route = 'route add -net %s dev br-ex gw 10.100.0.5' % self.cidr
@@ -472,7 +472,7 @@
def save_network_template(self, template):
if (template.shared_network_name) and (not template.shared_network_id):
- os_networks = self.driver.shell.quantum.list_networks(name=template.shared_network_name)['networks']
+ os_networks = self.driver.shell.neutron.list_networks(name=template.shared_network_name)['networks']
if os_networks:
template.shared_network_id = os_networks[0]["id"]
@@ -521,7 +521,7 @@
# Get a list of all shared networks in OS
- os_networks = self.driver.shell.quantum.list_networks()['networks']
+ os_networks = self.driver.shell.neutron.list_networks()['networks']
os_networks_by_name = {}
os_networks_by_id = {}
for os_network in os_networks:
diff --git a/xos/synchronizers/base/steps/sync_instances.py b/xos/synchronizers/base/steps/sync_instances.py
index 335ca4a..2862474 100644
--- a/xos/synchronizers/base/steps/sync_instances.py
+++ b/xos/synchronizers/base/steps/sync_instances.py
@@ -75,7 +75,7 @@
#driver = self.driver.client_driver(caller=instance.creator, tenant=instance.slice.name, controller=instance.controllerNetwork)
driver = self.driver.admin_driver(tenant='admin', controller=instance.node.site_deployment.controller)
- nets = driver.shell.quantum.list_networks()['networks']
+ nets = driver.shell.neutron.list_networks()['networks']
for net in nets:
if net['name'] in network_templates:
nics.append(net['id'])
diff --git a/xos/synchronizers/base/steps/sync_ports.py b/xos/synchronizers/base/steps/sync_ports.py
index 4c6681f..8f2b66d 100644
--- a/xos/synchronizers/base/steps/sync_ports.py
+++ b/xos/synchronizers/base/steps/sync_ports.py
@@ -12,7 +12,7 @@
provides=[Port]
observes=Port
- # The way it works is to enumerate the all of the ports that quantum
+ # The way it works is to enumerate the all of the ports that neutron
# has, and then work backward from each port's network-id to determine
# which Network is associated from the port.
@@ -51,7 +51,7 @@
continue
try:
driver = self.driver.admin_driver(controller = controller)
- ports = driver.shell.quantum.list_ports()["ports"]
+ ports = driver.shell.neutron.list_ports()["ports"]
except:
logger.log_exc("failed to get ports from controller %s" % controller)
continue
@@ -63,7 +63,7 @@
# in the data model, so build up a list of which ids map to which network
# templates.
try:
- neutron_networks = driver.shell.quantum.list_networks()["networks"]
+ neutron_networks = driver.shell.neutron.list_networks()["networks"]
except:
print "failed to get networks from controller %s" % controller
continue
@@ -109,7 +109,7 @@
if network.template.shared_network_name:
# If it's a shared network template, then more than one network
- # object maps to the quantum network. We have to do a whole bunch
+ # object maps to the neutron network. We have to do a whole bunch
# of extra work to find the right one.
networks = network.template.network_set.all()
network = None
@@ -180,7 +180,7 @@
client = OpenStackClient(controller=controller, **auth) # cacert=self.config.nova_ca_ssl_cert,
driver = OpenStackDriver(client=client)
- neutron_port = driver.shell.quantum.create_port({"port": {"network_id": cn.net_id}})["port"]
+ neutron_port = driver.shell.neutron.create_port({"port": {"network_id": cn.net_id}})["port"]
port.port_id = neutron_port["id"]
if neutron_port["fixed_ips"]:
port.ip = neutron_port["fixed_ips"][0]["ip_address"]
diff --git a/xos/synchronizers/openstack/steps/sync_instances.py b/xos/synchronizers/openstack/steps/sync_instances.py
index e1561b5..7bd01c3 100644
--- a/xos/synchronizers/openstack/steps/sync_instances.py
+++ b/xos/synchronizers/openstack/steps/sync_instances.py
@@ -118,7 +118,7 @@
#driver = self.driver.client_driver(caller=instance.creator, tenant=instance.slice.name, controller=instance.controllerNetwork)
driver = self.driver.admin_driver(tenant='admin', controller=instance.node.site_deployment.controller)
- nets = driver.shell.quantum.list_networks()['networks']
+ nets = driver.shell.neutron.list_networks()['networks']
for net in nets:
if net['name'] in network_templates:
nics.append({"kind": "net", "value": net['id'], "network": None})
diff --git a/xos/synchronizers/openstack/steps/sync_ports.py b/xos/synchronizers/openstack/steps/sync_ports.py
index 1aeaef3..afb8321 100644
--- a/xos/synchronizers/openstack/steps/sync_ports.py
+++ b/xos/synchronizers/openstack/steps/sync_ports.py
@@ -12,7 +12,7 @@
provides=[Port]
observes=Port
- # The way it works is to enumerate the all of the ports that quantum
+ # The way it works is to enumerate the all of the ports that neutron
# has, and then work backward from each port's network-id to determine
# which Network is associated from the port.
@@ -78,7 +78,7 @@
continue
try:
driver = self.driver.admin_driver(controller = controller)
- ports = driver.shell.quantum.list_ports()["ports"]
+ ports = driver.shell.neutron.list_ports()["ports"]
except:
logger.log_exc("failed to get ports from controller %s" % controller)
continue
@@ -90,7 +90,7 @@
# in the data model, so build up a list of which ids map to which network
# templates.
try:
- neutron_networks = driver.shell.quantum.list_networks()["networks"]
+ neutron_networks = driver.shell.neutron.list_networks()["networks"]
except:
print "failed to get networks from controller %s" % controller
continue
@@ -136,7 +136,7 @@
if network.template.shared_network_name:
# If it's a shared network template, then more than one network
- # object maps to the quantum network. We have to do a whole bunch
+ # object maps to the neutron network. We have to do a whole bunch
# of extra work to find the right one.
networks = network.template.network_set.all()
network = None
@@ -198,7 +198,7 @@
if neutron_port_name:
args["name"] = neutron_port_name
- neutron_port = driver.shell.quantum.create_port({"port": args})["port"]
+ neutron_port = driver.shell.neutron.create_port({"port": args})["port"]
port.port_id = neutron_port["id"]
if neutron_port["fixed_ips"]:
port.ip = neutron_port["fixed_ips"][0]["ip_address"]
@@ -220,7 +220,7 @@
logger.info("calling openstack to destroy port %s" % port.port_id)
try:
driver = self.get_driver(port)
- driver.shell.quantum.delete_port(port.port_id)
+ driver.shell.neutron.delete_port(port.port_id)
except:
logger.log_exc("failed to delete port %s from neutron" % port.port_id)
return
diff --git a/xos/synchronizers/vtn/steps/sync_port_addresses.py b/xos/synchronizers/vtn/steps/sync_port_addresses.py
index bbc6c99..d662ff3 100644
--- a/xos/synchronizers/vtn/steps/sync_port_addresses.py
+++ b/xos/synchronizers/vtn/steps/sync_port_addresses.py
@@ -84,7 +84,7 @@
continue
try:
driver = self.driver.admin_driver(controller = controller)
- ports = driver.shell.quantum.list_ports()["ports"]
+ ports = driver.shell.neutron.list_ports()["ports"]
except:
logger.log_exc("failed to get ports from controller %s" % controller)
continue
@@ -124,7 +124,7 @@
if changed:
logger.info("updating port %s" % port)
- driver.shell.quantum.update_port(port.port_id, {"port": {"allowed_address_pairs": aaps}})
+ driver.shell.neutron.update_port(port.port_id, {"port": {"allowed_address_pairs": aaps}})