def __init__(self): self.config = ConfigParser.ConfigParser() self.config.readfp( open( r'/root/TRANSFORMER/Next_transform/fogflow/ngsildAdapter/module/config/config.ini' )) logger_obj = Handler() self.logger = logger_obj.get_logger()
def get_entityId(self): logger_obj=Handler() logger=logger_obj.get_logger() logger.info("Creating Entity") data=self.data data1=data['data'] data2=data1[0] entity_id=constant.id_value+data2['id'] logger.info("Entity has been created") return entity_id
def rest_client(): logger_obj = Handler() logger = logger_obj.get_logger() data = request.get_json() configobj = config_data() fog_url = configobj.get_fogflow_subscription_endpoint() url = constant.http + fog_url + constant.subscribe_uri payload = json.dumps(data) robj = Rest_client(url, payload) r = robj.post_request() logger.info("Forwarded Subscription to Fogflow.") return "subscribe"
def notify_server_for_orian(): logger_obj = Handler() logger = logger_obj.get_logger() data = request.get_json() message = 'notify data' + str(data) logger.info(message) dataObj = orian_convert_data(data) context = dataObj.get_data() logger.info("Data is converted to ngsi-ld") obj = patch_post() obj.data_convert_invoker(context, dataObj) return "notify"
def noify_server(): data = request.get_json() logger_obj = Handler() logger = logger_obj.get_logger() logger.debug("noify_server has been started") message = 'notify data' + str(data) logger.debug(message) dataObj = ngsi_data_creation(data) context = dataObj.get_ngsi_ld() logger.debug("Data is converted to ngsi-ld") obj = patch_post() obj.data_convert_invoker(context, dataObj) logger.info("noify_server has been end") return "notify"
def get_data(self): logger_obj=Handler() logger=logger_obj.get_logger() logger.info("Start converting ngsiv2 data to NGSI-LD") data=self.data data1=data['data'] data2=data1[0] relations=[] relation_url={} relations.append(constant.context_url) entity_data_type=data2['type'] relation_url[entity_data_type]=constant.brand_url+entity_data_type data_keys=self.get_keys(data2) relation_url=self.url_conversion(data_keys,relation_url) relations.append(relation_url) self.context['@context']=relations self.context['id']=constant.id_value+data2['id'] self.context['type']=data2['type'] self.add_entity(data_keys,data2) logger.info("Data has been converted to NGSI-LD") return self.context
def __init__(self): self.config = ConfigParser.ConfigParser() self.config.readfp( open(r'/opt/ngsildAdapter/module/config/config.ini')) logger_obj = Handler() self.logger = logger_obj.get_logger()
def __init__(self, context, metadata): self.meta_data = metadata self.context = context logger_obj = Handler() self.logger = logger_obj.get_logger()
def __init__(self, data): self.data = data self.context = {} logger_obj = Handler() self.logger = logger_obj.get_logger()
def __init__(self): logger_obj = Handler() self.logger = logger_obj.get_logger()