예제 #1
0
    def dts_cfg_prepare_cb(self, apih, xact, xactinfo, keyspec, msg, user_data):
        logger.info("**** DTS cfg prepare is called *****")
        logger.debug("apih is %s", apih)
        logger.debug("keyspec is %s", keyspec)
        logger.debug("msg is %s", msg)
        logger.debug("xactinfo is %s", xactinfo)
        logger.debug("userdata is %s", user_data)

        #Create a company object and return o/p
        company = RwDtsToyTaskletYang.Company()
        company.name = 'riftio'
        company.profile.industry='technology'
        company.profile.revenue = '$100,000,000,000'

        # Convert the gerneric type to a type that we understand
        if msg is not None :
          company = RwDtsToyTaskletYang.Company.from_pbcm(msg)

        if keyspec is not None :
          schema = RwDtsToyTaskletYang.Company.schema()
          pathentry = schema.keyspec_to_entry(keyspec)
          logger.debug(pathentry)
          if pathentry is not None:
            logger.debug("Received keyspec with path key %s", pathentry.key00.name)
          else:
            logger.debug("Oh-Oh  ----     Could not find path entry")

        logger.debug("member_register_xpath(cfgpath) returned")
        return (RwDts.MemberRspCode.ACTION_OK);
예제 #2
0
    def dts_prepare_cb(self, xact_info, action, keyspec, msg, user_data):
        logger.info("**** DTS prepare is called  (are regh, self, keyspec, msg, user_data all different or all self?) *****")
        logger.debug("xact_info is %s", xact_info)
        logger.debug("action is %s", action)
        logger.debug("keyspec is %s", keyspec)
        logger.debug("msg is %s", msg)
        logger.debug("user_data is %s", user_data)


        if keyspec is not None :
          schema = RwDtsToyTaskletYang.Company.schema()
          pathentry = schema.keyspec_to_entry(keyspec)
          logger.debug("Received path entry")
          logger.debug(pathentry)
          logger.debug(dir(pathentry))

        # Convert the gerneric type to a type that we understand
        xpath = 'C,/rw-dts-toy-tasklet:company[rw-dts-toy-tasklet:name=\'riftio\']'
        if action == RwDts.QueryAction.READ:
          xact_info.send_error_xpath(RwTypes.RwStatus.FAILURE,
                                     xpath, 
                                     "PYTHON TASKLET THROWING ERRORERRORERROR dts_prepare_cb")
          #Create a company object and return o/p
          company = RwDtsToyTaskletYang.Company()
          company.name = 'riftio'
          company.profile.industry='technology'
          company.profile.revenue = '$100,000,000,000'
          check_list.append("dts_prepare_cb read " + company.name)

          xact_info.respond_xpath(RwDts.XactRspCode.ACK,
                                  xpath,
                                  company.to_pbcm())
        else:
          if msg is not None :
            company = RwDtsToyTaskletYang.Company.from_pbcm(msg)

        # We ret async.  How does this end? Oh, it's ack above...
        logger.info("**** DTS dts_prepare_cb done, ret ASYNC *****")
        return (RwDts.MemberRspCode.ACTION_ASYNC)