Loading deploy/crdb.sh +0 −3 Original line number Diff line number Diff line Loading @@ -171,9 +171,6 @@ function crdb_drop_database_single() { kubectl exec -i --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \ ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \ --execute "DROP DATABASE IF EXISTS ${CRDB_DATABASE};" kubectl exec -i --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \ ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \ --execute "DROP DATABASE IF EXISTS ${CRDB_DATABASE_QOSPROFILE};" echo } Loading deploy/tfs.sh +0 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,6 @@ kubectl create secret generic kfk-kpi-data --namespace ${TFS_K8S_NAMESPACE} --ty --from-literal=KFK_SERVER_PORT=${KFK_SERVER_PORT} printf "\n" echo "Create secret with NATS data" NATS_CLIENT_PORT=$(kubectl --namespace ${NATS_NAMESPACE} get service ${NATS_NAMESPACE} -o 'jsonpath={.spec.ports[?(@.name=="client")].port}') if [ -z "$NATS_CLIENT_PORT" ]; then Loading my_deploy.sh +3 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,9 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene # Uncomment to activate Monitoring Framework (new) #export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api telemetry analytics automation" # Uncomment to activate QoS Profiles #export TFS_COMPONENTS="${TFS_COMPONENTS} qos_profile" # Uncomment to activate BGP-LS Speaker #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" Loading src/qos_profile/requirements.in +1 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. psycopg2-binary==2.9.* SQLAlchemy==1.4.* sqlalchemy-cockroachdb==1.4.* Loading src/qos_profile/service/__main__.py +12 −24 Original line number Diff line number Diff line Loading @@ -12,47 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. import os import logging, signal, sys, threading from prometheus_client import start_http_server from common.Constants import ServiceNameEnum from common.Settings import ( ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port, wait_for_environment_variables ) from common.Settings import get_log_level, get_metrics_port from common.tools.database.GenericDatabase import Database from qos_profile.service.database.models.QoSProfile import QoSProfileModel from .QoSProfileService import QoSProfileService from .database.models.QoSProfile import QoSProfileModel LOG_LEVEL = get_log_level() logging.basicConfig(level=LOG_LEVEL, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s") LOGGER = logging.getLogger(__name__) terminate = threading.Event() LOGGER : logging.Logger = None def signal_handler(signal, frame): # pylint: disable=redefined-outer-name def signal_handler(signal, frame): # pylint: disable=redefined-outer-name,unused-argument LOGGER.warning('Terminate signal received') terminate.set() def main(): global LOGGER # pylint: disable=global-statement log_level = get_log_level() logging.basicConfig(level=log_level, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s") LOGGER = logging.getLogger(__name__) wait_for_environment_variables([ get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST ), get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC), ]) LOGGER.info('Starting...') signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) LOGGER.info('Starting...') # Start metrics server metrics_port = get_metrics_port() start_http_server(metrics_port) db_manager = Database(db_name=os.getenv('CRDB_DATABASE'), model=QoSProfileModel) # Get Database Engine instance and initialize database, if needed db_manager = Database(QoSProfileModel) try: db_manager.create_database() Loading @@ -61,7 +49,7 @@ def main(): LOGGER.exception('Failed to check/create the database: {:s}'.format(str(db_manager.db_engine.url))) raise e # Starting service service # Starting service grpc_service = QoSProfileService(db_manager.db_engine) grpc_service.start() Loading Loading
deploy/crdb.sh +0 −3 Original line number Diff line number Diff line Loading @@ -171,9 +171,6 @@ function crdb_drop_database_single() { kubectl exec -i --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \ ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \ --execute "DROP DATABASE IF EXISTS ${CRDB_DATABASE};" kubectl exec -i --namespace ${CRDB_NAMESPACE} cockroachdb-0 -- \ ./cockroach sql --certs-dir=/cockroach/cockroach-certs --url=${CRDB_CLIENT_URL} \ --execute "DROP DATABASE IF EXISTS ${CRDB_DATABASE_QOSPROFILE};" echo } Loading
deploy/tfs.sh +0 −1 Original line number Diff line number Diff line Loading @@ -163,7 +163,6 @@ kubectl create secret generic kfk-kpi-data --namespace ${TFS_K8S_NAMESPACE} --ty --from-literal=KFK_SERVER_PORT=${KFK_SERVER_PORT} printf "\n" echo "Create secret with NATS data" NATS_CLIENT_PORT=$(kubectl --namespace ${NATS_NAMESPACE} get service ${NATS_NAMESPACE} -o 'jsonpath={.spec.ports[?(@.name=="client")].port}') if [ -z "$NATS_CLIENT_PORT" ]; then Loading
my_deploy.sh +3 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,9 @@ export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_gene # Uncomment to activate Monitoring Framework (new) #export TFS_COMPONENTS="${TFS_COMPONENTS} kpi_manager kpi_value_writer kpi_value_api telemetry analytics automation" # Uncomment to activate QoS Profiles #export TFS_COMPONENTS="${TFS_COMPONENTS} qos_profile" # Uncomment to activate BGP-LS Speaker #export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker" Loading
src/qos_profile/requirements.in +1 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. psycopg2-binary==2.9.* SQLAlchemy==1.4.* sqlalchemy-cockroachdb==1.4.* Loading
src/qos_profile/service/__main__.py +12 −24 Original line number Diff line number Diff line Loading @@ -12,47 +12,35 @@ # See the License for the specific language governing permissions and # limitations under the License. import os import logging, signal, sys, threading from prometheus_client import start_http_server from common.Constants import ServiceNameEnum from common.Settings import ( ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port, wait_for_environment_variables ) from common.Settings import get_log_level, get_metrics_port from common.tools.database.GenericDatabase import Database from qos_profile.service.database.models.QoSProfile import QoSProfileModel from .QoSProfileService import QoSProfileService from .database.models.QoSProfile import QoSProfileModel LOG_LEVEL = get_log_level() logging.basicConfig(level=LOG_LEVEL, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s") LOGGER = logging.getLogger(__name__) terminate = threading.Event() LOGGER : logging.Logger = None def signal_handler(signal, frame): # pylint: disable=redefined-outer-name def signal_handler(signal, frame): # pylint: disable=redefined-outer-name,unused-argument LOGGER.warning('Terminate signal received') terminate.set() def main(): global LOGGER # pylint: disable=global-statement log_level = get_log_level() logging.basicConfig(level=log_level, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s") LOGGER = logging.getLogger(__name__) wait_for_environment_variables([ get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST ), get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC), ]) LOGGER.info('Starting...') signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) LOGGER.info('Starting...') # Start metrics server metrics_port = get_metrics_port() start_http_server(metrics_port) db_manager = Database(db_name=os.getenv('CRDB_DATABASE'), model=QoSProfileModel) # Get Database Engine instance and initialize database, if needed db_manager = Database(QoSProfileModel) try: db_manager.create_database() Loading @@ -61,7 +49,7 @@ def main(): LOGGER.exception('Failed to check/create the database: {:s}'.format(str(db_manager.db_engine.url))) raise e # Starting service service # Starting service grpc_service = QoSProfileService(db_manager.db_engine) grpc_service.start() Loading