if json_msg.get("Content-type") != "application/json": self.loginfo("do_fwd: weird content type: %s" % json_msg.get("Content-type")) continue # Extract the JSON structure try: json_report = json.loads(json_msg.get_payload()) except Exception, e: self.loginfo("do_fwd: can't decode json: %s" % str(e)); continue curi=NIname(uri) curi.validate_ni_url() metadata = NetInfMetaData(curi.get_canonical_ni_url()) self.loginfo("Metadata I got: %s" % str(json_report)) metadata.insert_resp_metadata(json_report) # if I've the role GET_RES and there's locators then # follow those now if ct_msg == None and self.check_role(GET_RES): self.loginfo("I'm a GET_RES type of node - going to try follow") self.loginfo("meta: %s" % str(json_report)) # check for locators locators = metadata.get_loclist() self.loginfo("locs: %s" % str(locators)) # try follow locators for loc in locators: self.loginfo("GET_RES following: %s" % loc) # Send GET request to destination server try:
logger.info("do_fwd: weird content type: %s" % json_msg.get("Content-type")) continue # Extract the JSON structure try: json_report = json.loads(json_msg.get_payload()) except Exception, e: logger.info("do_fwd: can't decode json: %s" % str(e)); continue curi=NIname(uri) curi.validate_ni_url() metadata = NetInfMetaData(curi.get_canonical_ni_url()) logger.info("Metadata I got: %s" % str(json_report)) metadata.insert_resp_metadata(json_report) # will do json.loads again... # removed GET_RES handling present in do_get_fwd in nifwd.py / bengta # all good break out of loop break # make up stuff to return # print "do_fwd: success" if metadata is None: return False, metadata, fname return True,metadata,fname #---------------------------------------------------------------------- #