Added in the new port ip address association table but didn't remove the port_id association yet from the IP address. Deallocation needs to be reworked
This commit is contained in:
parent
fa50eedc38
commit
7c50a8e357
3
TODO
3
TODO
@ -9,6 +9,9 @@ CRUD IP Allocations
|
||||
* CRUD MacAddressRanges
|
||||
* AIC doesn't support creating multiple switches on the same network. i.e. if we expand past the port count per switch, undefined
|
||||
|
||||
We may want to override the existing sessionmaker. Things it chooses to do, like disabling expiration and autocommiting, are discouraged by the docs
|
||||
Implementation of Zope Interfaces to abstract base class all the things, as well as represent pluggable all the things
|
||||
|
||||
|
||||
Later:
|
||||
Maybe implement a straight passthrough driver for testing and debugging purposes
|
||||
|
@ -210,6 +210,18 @@ class Port(BASEV2, HasId, HasTenant):
|
||||
ip_addresses = orm.relationship(IPAddress, backref=orm.backref("ports"))
|
||||
|
||||
|
||||
class PortIPAddressAssociation(BASEV2, HasId):
|
||||
__tablename__ = "quark_port_ip_address_associations"
|
||||
port_id = sa.Column(sa.String(36), sa.ForeignKey("quark_ports.id"),
|
||||
nullable=False)
|
||||
ip_address_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey("quark_ip_addresses.id"),
|
||||
nullable=False)
|
||||
port = orm.relationship(Port, uselist=False, backref="association")
|
||||
ip_address = orm.relationship(IPAddress, uselist=False,
|
||||
backref="association")
|
||||
|
||||
|
||||
class MacAddress(BASEV2, HasTenant):
|
||||
__tablename__ = "quark_mac_addresses"
|
||||
address = sa.Column(sa.BigInteger(), primary_key=True)
|
||||
@ -218,7 +230,6 @@ class MacAddress(BASEV2, HasTenant):
|
||||
nullable=False)
|
||||
deallocated = sa.Column(sa.Boolean())
|
||||
deallocated_at = sa.Column(sa.DateTime())
|
||||
orm.relationship(Port, backref="mac_address")
|
||||
|
||||
|
||||
class MacAddressRange(BASEV2, HasId):
|
||||
@ -226,6 +237,7 @@ class MacAddressRange(BASEV2, HasId):
|
||||
cidr = sa.Column(sa.String(255), nullable=False)
|
||||
first_address = sa.Column(sa.BigInteger(), nullable=False)
|
||||
last_address = sa.Column(sa.BigInteger(), nullable=False)
|
||||
mac_addresses = orm.relationship(MacAddress, backref="mac_address_range")
|
||||
|
||||
|
||||
class Network(BASEV2, HasTenant, HasId):
|
||||
|
@ -489,6 +489,7 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
if k in port["port"]:
|
||||
port["port"].pop(k)
|
||||
|
||||
addresses = []
|
||||
with session.begin():
|
||||
port_id = uuidutils.generate_uuid()
|
||||
net_id = port["port"]["network_id"]
|
||||
@ -520,10 +521,15 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||
new_port["addresses"] = addresses
|
||||
new_port["mac_address"] = mac["address"]
|
||||
|
||||
for a in addresses:
|
||||
session.add(a)
|
||||
session.add(mac)
|
||||
session.add(new_port)
|
||||
session.add(mac)
|
||||
for addr in addresses:
|
||||
addr["port"] = new_port
|
||||
assoc = models.PortIPAddressAssociation()
|
||||
assoc["port"] = new_port
|
||||
assoc["ip_address"] = addr
|
||||
session.add(addr)
|
||||
session.add(assoc)
|
||||
|
||||
new_port["mac_address"] = str(netaddr.EUI(new_port["mac_address"],
|
||||
dialect=netaddr.mac_unix))
|
||||
|
Loading…
Reference in New Issue
Block a user