summaryrefslogtreecommitdiffstats
path: root/compass-deck/db
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2018-09-17 17:35:35 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2018-09-17 17:35:35 +0800
commitc5a7aaf83d500ec7c4b02d4cfddaf86b85182b2c (patch)
tree693ae77643d286b8d1c20e37c56c1c71496b2601 /compass-deck/db
parent94a116a7152d2003b964dcb7cc644b1b866e42ce (diff)
Add gateway in subnet table
JIRA: COMPASS-618 Change-Id: I3800d2aa7a38616484eb76390e6a623645dc441c Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'compass-deck/db')
-rw-r--r--compass-deck/db/api/network.py8
-rw-r--r--compass-deck/db/models.py1
2 files changed, 5 insertions, 4 deletions
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,