summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2014-04-21 04:27:27 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-04-21 20:55:35 +0900
commitd8407d445d850b119a3027d1a3501ae00d99fbcb (patch)
treeaa386005020cf2e84d87836e6b7900fc9a069f97
parent8b07123c91d337488e11cb72be84e4375669d9bb (diff)
bgp: avoid the trouble of having to explicitly specify IDs in configuration
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/rtconf/base.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ryu/services/protocols/bgp/rtconf/base.py b/ryu/services/protocols/bgp/rtconf/base.py
index 7b625fd3..154dcca0 100644
--- a/ryu/services/protocols/bgp/rtconf/base.py
+++ b/ryu/services/protocols/bgp/rtconf/base.py
@@ -19,6 +19,7 @@
from abc import ABCMeta
from abc import abstractmethod
import logging
+import uuid
from types import BooleanType
from types import IntType
from types import LongType
@@ -263,8 +264,7 @@ class ConfWithId(BaseConf):
UPDATE_DESCRIPTION_EVT = 'update_description_evt'
VALID_EVT = frozenset([UPDATE_NAME_EVT, UPDATE_DESCRIPTION_EVT])
- REQUIRED_SETTINGS = frozenset([ID])
- OPTIONAL_SETTINGS = frozenset([NAME, DESCRIPTION])
+ OPTIONAL_SETTINGS = frozenset([ID, NAME, DESCRIPTION])
def __init__(self, **kwargs):
super(ConfWithId, self).__init__(**kwargs)
@@ -278,7 +278,6 @@ class ConfWithId(BaseConf):
@classmethod
def get_req_settings(cls):
self_confs = super(ConfWithId, cls).get_req_settings()
- self_confs.update(ConfWithId.REQUIRED_SETTINGS)
return self_confs
@classmethod
@@ -289,6 +288,8 @@ class ConfWithId(BaseConf):
def _init_opt_settings(self, **kwargs):
super(ConfWithId, self)._init_opt_settings(**kwargs)
+ self._settings[ConfWithId.ID] = \
+ compute_optional_conf(ConfWithId.ID, str(uuid.uuid4()), **kwargs)
self._settings[ConfWithId.NAME] = \
compute_optional_conf(ConfWithId.NAME, str(self), **kwargs)
self._settings[ConfWithId.DESCRIPTION] = \