def update_GC(self): """ Method to update the GC by sending it the nodes status regarding CPU and SOC """ while True: try: self.monitor.update_nodes() matched_subs = self.dds.writer.matched_subscriptions for sub_info in matched_subs: sub_name = sub_info['name'] print(matched_subs) for node in self.monitor.all_nodes.items: data = {} data["Identificador"] = "Node_Status" data["NodeId"] = node.metadata.name data["TerminationPointId"] = str(node.usage['cpu']) data["LinkId"] = str(node.SoC) if node.pods.anyPodRunningVNF(lambda x: x.metadata.name.startswith('vnf')): data["SourceNode"] = "1" else: data["SourceNode"] = "0" data["DestinationNode"] = self.localdds self.dds.writer.instance.set_dictionary(data) dt = int(datetime.now().timestamp() * 1000000000) self.dds.writer.write(source_timestamp=dt) time.sleep(self.time_interval_multideployment) except Exception as e: print(str(e))