Commit 5ec41796 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add parameters for ACME/RegistrarCSE; Editorial bugs fixed

parent 11c7f1b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1290,7 +1290,7 @@ func mec030_predicted_qos(latitudes string, longitudes string, timestamps string
		}
		sec, err := strconv.Atoi(ts[i])
		if err != nil {
			return nil, nil, errors.New("Wrong timeStamp value: " + ts[i])
			return nil, nil, errors.New("Wrong timestamp value: " + ts[i])
		}
		var routeInfo = RouteInfo{
			Location: &LocationInfo{
+2 −0
Original line number Diff line number Diff line
@@ -71,3 +71,5 @@ mec_port=443
mec_protocol=https
mec_platform=$MEC_PLATFORM
mec_sandbox_id=$MEC_SANDBOX_ID
cse_external_ip=$CSE_EXTERNAL_IP
cse_external_port=$CSE_EXTERNAL_PORT
+17 −7
Original line number Diff line number Diff line
@@ -38,9 +38,13 @@ class MECClient(object):
	"""
	# TODO doc

	__slots__ = ( # TODO 
	__slots__ = (
		'http_address',
		'http_port',
		'cse_external_ip',
		'cse_external_port',
		'mqtt_address',
		'mqtt_port',
		'cse_resourceID',
		'isStopped',
		'mecConnection',
@@ -53,14 +57,18 @@ class MECClient(object):

	# TODO move config handling to event handler

	def __init__(self, p_http_address: str, p_http_port: str, p_cse_resourceID: str) -> None:
	def __init__(self, p_http_address: str, p_http_port: str, p_cse_resourceID: str, p_cse_external_ip: str, p_cse_external_port: str, p_mqtt_address: str, p_mqtt_port: str) -> None:
		"""	Initialize the MEC client.
		"""
		self.http_address = p_http_address
		u = urlparse(self.http_address)
		self.http_address = u.hostname
		self.http_port = p_http_port
		self.cse_external_ip = p_cse_external_ip
		self.cse_external_port = p_cse_external_port
		self.cse_resourceID = p_cse_resourceID
		self.mqtt_address = p_mqtt_address
		self.mqtt_port = p_mqtt_port

		self.isStopped = False
		""" Flag to indicate whether the MEC client is stopped. """
@@ -77,7 +85,7 @@ class MECClient(object):
		self.register = None

		L.isInfo and L.log('MEC Client initialized')
	
		L.isInfo and L.log('MEC Client: self.http_address=' + str(self.http_address))

	def run(self) -> bool:
		"""	Initialize and run the MEC client as a BackgroundWorker/Actor.
@@ -195,6 +203,7 @@ class MECClient(object):
				'/' + Configuration.mec_sandbox_id + \
				'/' + Configuration.mec_platform + \
				'/iots/v1/registered_iot_platforms'
			L.isInfo and L.log('MEC Client: registerToMec=' + url)
			body_json = {}
			body_json['iotPlatformId'] = str(uuid.uuid4())
			userTransportInfoList = []
@@ -208,8 +217,8 @@ class MECClient(object):
			userTransportInfo['endpoint'] = {}
			userTransportInfo['endpoint']['addresses'] = []
			address = {}
			address['host'] = '172.29.10.56'
			address['port'] = 1883
			address['host'] = self.mqtt_address
			address['port'] = self.mqtt_port
			userTransportInfo['endpoint']['addresses'].append(address)
			userTransportInfo['security'] = {}
			userTransportInfo['implSpecificInfo'] = {}
@@ -226,13 +235,14 @@ class MECClient(object):
			customServicesTransportInfo['endpoint'] = {}
			customServicesTransportInfo['endpoint']['addresses'] = []
			address = {}
			address['host'] = self.http_address
			address['port'] = self.http_port
			address['host'] = self.cse_external_ip
			address['port'] = int(self.cse_external_port)
			customServicesTransportInfo['endpoint']['addresses'].append(address)
			customServicesTransportInfo['security'] = {}
			customServicesTransportInfoList.append(customServicesTransportInfo)
			body_json['customServicesTransportInfo'] = customServicesTransportInfoList
			body_json['enabled'] = True
			L.isInfo and L.log('MEC Client: body_json=' + str(body_json))

			tries = 0
			while tries < 5:
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ def startup(args:argparse.Namespace, **kwargs:Dict[str, Any]) -> bool:
		script = ScriptManager()				# Initialize the script manager
		action = ActionManager()				# Initialize the action manager

		mecClient = MECClient(Configuration.http_address, Configuration.http_port, Configuration.cse_resourceID)
		mecClient = MECClient(Configuration.http_address, Configuration.http_port, Configuration.cse_resourceID, Configuration.cse_external_ip, Configuration.cse_external_port, Configuration.mqtt_address, Configuration.mqtt_port)
												# Initialize the MEC client

		# → Experimental late loading
+2 −0
Original line number Diff line number Diff line
@@ -661,6 +661,8 @@ class Configuration(object):
	_args_mec_protocol:str = None
	_args_mec_platform:str = None
	_args_mec_sandbox_id:str = None
	_cse_external_ip:str = None
	_cse_external_port:str = None

	# Internal print function that takes the headless setting into account
	@staticmethod
Loading