diff --git a/api-daemon/migrations/versions/bae4d5a77c74_pvc_version_0_9_18.py b/api-daemon/migrations/versions/bae4d5a77c74_pvc_version_0_9_18.py new file mode 100644 index 00000000..a9a452e8 --- /dev/null +++ b/api-daemon/migrations/versions/bae4d5a77c74_pvc_version_0_9_18.py @@ -0,0 +1,28 @@ +"""PVC version 0.9.18 + +Revision ID: bae4d5a77c74 +Revises: 3efe890e1d87 +Create Date: 2021-06-02 15:41:40.061806 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bae4d5a77c74' +down_revision = '3efe890e1d87' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.execute('ALTER TABLE network ALTER COLUMN vni TYPE TEXT') + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.execute('ALTER TABLE network ALTER COLUMN vni TYPE INTEGER USING vni::integer') + # ### end Alembic commands ### diff --git a/api-daemon/pvcapid/models.py b/api-daemon/pvcapid/models.py index 6d3e2255..8aa825f6 100755 --- a/api-daemon/pvcapid/models.py +++ b/api-daemon/pvcapid/models.py @@ -78,6 +78,7 @@ class DBNetworkElement(db.Model): id = db.Column(db.Integer, primary_key=True) network_template = db.Column(db.Integer, db.ForeignKey("network_template.id"), nullable=False) vni = db.Column(db.Integer, nullable=False) + vni2 = db.Column(db.Text, nullable=False) def __init__(self, network_template, vni): self.network_template = network_template diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index 524f174e..e049f5e2 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -268,7 +268,7 @@ def create_template_network_element(name, vni): networks = [] found_vni = False for network in networks: - if int(network['vni']) == int(vni): + if network['vni'] == vni: found_vni = True if found_vni: retmsg = {'message': 'The VNI "{}" in network template "{}" already exists.'.format(vni, name)}