Commit 4f57a536 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Adapted Interdomain to common proto folder

- Moved config variables to new config framework
- Removed unneeded Config variables
parent b102e196
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -11,23 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging

# General settings
LOG_LEVEL = logging.WARNING

# gRPC settings
GRPC_SERVICE_PORT = 10010
GRPC_MAX_WORKERS  = 10
GRPC_GRACE_PERIOD = 60

# Prometheus settings
METRICS_PORT = 9192

# Dependency micro-service connection settings
CONTEXT_SERVICE_HOST = '127.0.0.1'
CONTEXT_SERVICE_PORT = 1010

SLICE_SERVICE_HOST = '127.0.0.1'
SLICE_SERVICE_PORT = 4040
+5 −6
Original line number Diff line number Diff line
@@ -13,10 +13,9 @@
# limitations under the License.

import logging, socket
from common.Constants import DEFAULT_CONTEXT_UUID
from common.Settings import get_setting
from common.Constants import DEFAULT_CONTEXT_UUID, ServiceNameEnum
from common.Settings import get_service_host, get_service_port_grpc
from common.proto.context_pb2 import TeraFlowController
from interdomain.Config import GRPC_SERVICE_PORT
from interdomain.client.InterdomainClient import InterdomainClient

LOGGER = logging.getLogger(__name__)
@@ -38,13 +37,13 @@ class RemoteDomainClients:
        interdomain_client = InterdomainClient(host=host, port=port)
        request = TeraFlowController()
        request.context_id.context_uuid.uuid = DEFAULT_CONTEXT_UUID # pylint: disable=no-member
        request.ip_address = get_setting('INTERDOMAINSERVICE_SERVICE_HOST', default='0.0.0.0')
        request.port = int(get_setting('INTERDOMAINSERVICE_SERVICE_PORT_GRPC', default=GRPC_SERVICE_PORT))
        request.ip_address = get_service_host(ServiceNameEnum.INTERDOMAIN)
        request.port = int(get_service_port_grpc(ServiceNameEnum.INTERDOMAIN))

        reply = interdomain_client.Authenticate(request)
        if not reply.authenticated:
            msg = 'Authentication against {:s}:{:d} rejected'
            raise Exception(msg.format(str(remote_teraflow_ip), GRPC_SERVICE_PORT))
            raise Exception(msg.format(str(remote_teraflow_ip), port))

        self.peer_domain[domain_name] = interdomain_client