except Exception as e:
self.log.exception(e)
- finally:
+ try:
xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ except rift.tasklets.dts.ResponseError as e:
+ self._log.error("Reg handle is None during action {} for {}: {}".
+ format(action, self.__class__, e))
reg_event = asyncio.Event(loop=self.loop)
if xact.xact is None:
if action == rwdts.AppconfAction.INSTALL:
try:
- for cfg in self.reg.elements:
- if self.callback:
- self.callback(cfg, rwdts.QueryAction.CREATE)
+ if self.reg:
+ for cfg in self.reg.elements:
+ if self.callback:
+ self.callback(cfg, rwdts.QueryAction.CREATE)
+
+ else:
+ self._log.error("Reg handle is None during action {} for {}".
+ format(action, self.__class__))
+
except Exception as e:
self._log.exception("Adding config {} during restart failed: {}".
format(cfg, e))
""" on prepare callback """
self._log.debug("Subscriber DTS prepare for project %s: %s",
self.project, xact_info.query_action)
- xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ try:
+ xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ except rift.tasklets.dts.ResponseError as e:
+ self._log.error(
+ "Subscriber DTS prepare for project {}, action {} in class {} failed: {}".
+ format(self.project, xact_info.query_action, self.__class__, e))
acg_hdl = rift.tasklets.AppConfGroup.Handler(on_apply=on_apply)
with self.dts.appconf_group_create(handler=acg_hdl) as acg:
self._nsm.update_nsd(cfg)
else:
- self._log.error("No reg handle for {} for project {}".
+ # This can happen if we do the deregister
+ # during project delete before this is called
+ self._log.debug("No reg handle for {} for project {}".
format(self.__class__, self._project.name))
scratch.pop('nsds', None)
xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ xpath = self._project.add_project(NsdDtsHandler.XPATH)
self._log.debug(
"Registering for NSD config using xpath: %s",
- NsdDtsHandler.XPATH,
+ xpath,
)
acg_hdl = rift.tasklets.AppConfGroup.Handler(on_apply=on_apply)
# Need a list in scratch to store NSDs to create/update later
# acg._scratch['nsds'] = list()
self._regh = acg.register(
- xpath=self._project.add_project(NsdDtsHandler.XPATH),
+ xpath=xpath,
flags=rwdts.Flag.SUBSCRIBER | rwdts.Flag.DELTA_READY | rwdts.Flag.CACHE,
on_prepare=on_prepare)
@asyncio.coroutine
def on_prepare(dts, acg, xact, xact_info, ks_path, msg, scratch):
""" on prepare callback """
+ xpath = ks_path.to_xpath(NsdYang.get_schema())
self._log.debug("Got on prepare for VNFD (path: %s) (action: %s) (msg: %s)",
- ks_path.to_xpath(NsdYang.get_schema()), xact_info.query_action, msg)
+ xpath, xact_info.query_action, msg)
fref = ProtobufC.FieldReference.alloc()
fref.goto_whole_message(msg.to_pbcm())
vnfds = scratch.setdefault('vnfds', [])
vnfds.append(msg.id)
- xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ try:
+ xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ except rift.tasklets.dts.ResponseError as e:
+ self._log.error(
+ "VnfdDtsHandler in project {} with path {} for action {} failed: {}".
+ format(self._project, xpath, xact_info.query_action, e))
+
xpath = self._project.add_project(VnfdDtsHandler.XPATH)
self._log.debug(
self._conf_url = "https://{ip}:{port}/api/config". \
format(ip=self._ip,
port=self._rport)
-
+
self._nsrs = {}
self._nsds = {}
self._vnfds = {}
@asyncio.coroutine
def on_prepare(dts, acg, xact, xact_info, ks_path, msg, scratch):
""" on prepare callback """
+ xpath = ks_path.to_xpath(RwVnfmYang.get_schema())
self._log.debug("Got on prepare for VNFD (path: %s) (action: %s) (msg: %s)",
- ks_path.to_xpath(RwVnfmYang.get_schema()),
+ xpath,
xact_info.query_action, msg)
fref = ProtobufC.FieldReference.alloc()
fref.goto_whole_message(msg.to_pbcm())
# Delete a VNFD record
yield from self._vnfm.delete_vnfd(msg.id)
- xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ try:
+ xact_info.respond_xpath(rwdts.XactRspCode.ACK)
+ except rift.tasklets.dts.ResponseError as e:
+ self._log.error(
+ "VnfdDtsHandler in project {} with path {} for action {} failed: {}".
+ format(self._vnfm._project, xpath, xact_info.query_action, e))
xpath = self._vnfm._project.add_project(VnfdDtsHandler.XPATH)
self._log.debug("Registering for VNFD config using xpath: {}".