From c5a7aaf83d500ec7c4b02d4cfddaf86b85182b2c Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Mon, 17 Sep 2018 17:35:35 +0800 Subject: Add gateway in subnet table JIRA: COMPASS-618 Change-Id: I3800d2aa7a38616484eb76390e6a623645dc441c Signed-off-by: Harry Huang --- compass-deck/db/api/network.py | 8 ++++---- compass-deck/db/models.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'compass-deck/db') diff --git a/compass-deck/db/api/network.py b/compass-deck/db/api/network.py index e2bf7d3..e505344 100644 --- a/compass-deck/db/api/network.py +++ b/compass-deck/db/api/network.py @@ -25,16 +25,16 @@ from compass.db import exception from compass.db import models -SUPPORTED_FIELDS = ['subnet', 'name'] +SUPPORTED_FIELDS = ['subnet', 'name', 'gateway'] RESP_FIELDS = [ - 'id', 'name', 'subnet', 'created_at', 'updated_at' + 'id', 'name', 'subnet', 'gateway', 'created_at', 'updated_at' ] ADDED_FIELDS = ['subnet'] -OPTIONAL_ADDED_FIELDS = ['name'] +OPTIONAL_ADDED_FIELDS = ['name', 'gateway'] IGNORE_FIELDS = [ 'id', 'created_at', 'updated_at' ] -UPDATED_FIELDS = ['subnet', 'name'] +UPDATED_FIELDS = ['subnet', 'name', 'gateway'] def _check_subnet(subnet): diff --git a/compass-deck/db/models.py b/compass-deck/db/models.py index 5f8fb52..929f4dc 100644 --- a/compass-deck/db/models.py +++ b/compass-deck/db/models.py @@ -1864,6 +1864,7 @@ class Subnet(BASE, TimestampMixin, HelperMixin): id = Column(Integer, primary_key=True) name = Column(String(80), unique=True, nullable=True) subnet = Column(String(80), unique=True, nullable=False) + gateway = Column(String(80), unique=True, nullable=True) host_networks = relationship( HostNetwork, -- cgit 1.2.3-korg