Skip to content
Snippets Groups Projects
Commit 08a77949 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Interdomain component:

- Added setting to (de)activate the topology abstractor module.
parent b9a00b18
No related branches found
No related tags found
2 merge requests!142Release TeraFlowSDN 2.1,!119Migration of Interdomain component and OECC/PSC'22 test to Release 2
...@@ -11,3 +11,14 @@ ...@@ -11,3 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from common.Settings import get_setting
SETTING_NAME_TOPOLOGY_ABSTRACTOR = 'TOPOLOGY_ABSTRACTOR'
TRUE_VALUES = {'Y', 'YES', 'TRUE', 'T', 'E', 'ENABLE', 'ENABLED'}
def is_topology_abstractor_enabled() -> bool:
is_enabled = get_setting(SETTING_NAME_TOPOLOGY_ABSTRACTOR, default=None)
if is_enabled is None: return False
str_is_enabled = str(is_enabled).upper()
return str_is_enabled in TRUE_VALUES
...@@ -18,6 +18,7 @@ from common.Constants import ServiceNameEnum ...@@ -18,6 +18,7 @@ from common.Constants import ServiceNameEnum
from common.Settings import ( from common.Settings import (
ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port, ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port,
wait_for_environment_variables) wait_for_environment_variables)
from interdomain.Config import is_topology_abstractor_enabled
from .topology_abstractor.TopologyAbstractor import TopologyAbstractor from .topology_abstractor.TopologyAbstractor import TopologyAbstractor
from .InterdomainService import InterdomainService from .InterdomainService import InterdomainService
from .RemoteDomainClients import RemoteDomainClients from .RemoteDomainClients import RemoteDomainClients
...@@ -63,14 +64,17 @@ def main(): ...@@ -63,14 +64,17 @@ def main():
grpc_service.start() grpc_service.start()
# Subscribe to Context Events # Subscribe to Context Events
topology_abstractor = TopologyAbstractor() topology_abstractor_enabled = is_topology_abstractor_enabled()
topology_abstractor.start() if topology_abstractor_enabled:
topology_abstractor = TopologyAbstractor()
topology_abstractor.start()
# Wait for Ctrl+C or termination signal # Wait for Ctrl+C or termination signal
while not terminate.wait(timeout=1.0): pass while not terminate.wait(timeout=1.0): pass
LOGGER.info('Terminating...') LOGGER.info('Terminating...')
topology_abstractor.stop() if topology_abstractor_enabled:
topology_abstractor.stop()
grpc_service.stop() grpc_service.stop()
remote_domain_clients.stop() remote_domain_clients.stop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment