Revert "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 reverts commit 7c50a8e3575d56c295b3e0d402aecc37c9d1e427.
This commit is contained in:
parent
f16f1f91a0
commit
2b0eaa60d6
3
TODO
3
TODO
@ -9,9 +9,6 @@ CRUD IP Allocations
|
|||||||
* CRUD MacAddressRanges
|
* 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
|
* 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:
|
Later:
|
||||||
Maybe implement a straight passthrough driver for testing and debugging purposes
|
Maybe implement a straight passthrough driver for testing and debugging purposes
|
||||||
|
@ -216,18 +216,6 @@ class Port(BASEV2, HasId, HasTenant):
|
|||||||
ip_addresses = orm.relationship(IPAddress, backref=orm.backref("ports"))
|
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):
|
class MacAddress(BASEV2, HasTenant):
|
||||||
__tablename__ = "quark_mac_addresses"
|
__tablename__ = "quark_mac_addresses"
|
||||||
address = sa.Column(sa.BigInteger(), primary_key=True)
|
address = sa.Column(sa.BigInteger(), primary_key=True)
|
||||||
@ -236,6 +224,7 @@ class MacAddress(BASEV2, HasTenant):
|
|||||||
nullable=False)
|
nullable=False)
|
||||||
deallocated = sa.Column(sa.Boolean())
|
deallocated = sa.Column(sa.Boolean())
|
||||||
deallocated_at = sa.Column(sa.DateTime())
|
deallocated_at = sa.Column(sa.DateTime())
|
||||||
|
orm.relationship(Port, backref="mac_address")
|
||||||
|
|
||||||
|
|
||||||
class MacAddressRange(BASEV2, HasId):
|
class MacAddressRange(BASEV2, HasId):
|
||||||
@ -243,7 +232,6 @@ class MacAddressRange(BASEV2, HasId):
|
|||||||
cidr = sa.Column(sa.String(255), nullable=False)
|
cidr = sa.Column(sa.String(255), nullable=False)
|
||||||
first_address = sa.Column(sa.BigInteger(), nullable=False)
|
first_address = sa.Column(sa.BigInteger(), nullable=False)
|
||||||
last_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):
|
class Network(BASEV2, HasTenant, HasId):
|
||||||
|
@ -490,7 +490,6 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
if k in port["port"]:
|
if k in port["port"]:
|
||||||
port["port"].pop(k)
|
port["port"].pop(k)
|
||||||
|
|
||||||
addresses = []
|
|
||||||
with session.begin():
|
with session.begin():
|
||||||
port_id = uuidutils.generate_uuid()
|
port_id = uuidutils.generate_uuid()
|
||||||
net_id = port["port"]["network_id"]
|
net_id = port["port"]["network_id"]
|
||||||
@ -523,15 +522,10 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
new_port["mac_address"] = mac["address"]
|
new_port["mac_address"] = mac["address"]
|
||||||
new_port["tenant_id"] = context.tenant_id
|
new_port["tenant_id"] = context.tenant_id
|
||||||
|
|
||||||
session.add(new_port)
|
for a in addresses:
|
||||||
|
session.add(a)
|
||||||
session.add(mac)
|
session.add(mac)
|
||||||
for addr in addresses:
|
session.add(new_port)
|
||||||
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"],
|
new_port["mac_address"] = str(netaddr.EUI(new_port["mac_address"],
|
||||||
dialect=netaddr.mac_unix))
|
dialect=netaddr.mac_unix))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user