X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwcm%2Fplugins%2Frwconman%2Frift%2Ftasklets%2Frwconmantasklet%2Frwconman_conagent.py;h=61f3a17629b2cdabd6f7fcbcd2f9fd1b1850ff77;hb=9ad945aab0b5a992e1df860bede8ecc9b143470e;hp=5578a357ccb80fba2b53dd0fb9498c401380a112;hpb=3f1ff0e426e6838e5b089805582dfd4a396e4b7e;p=osm%2FSO.git diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py index 5578a357..61f3a176 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/rwconman_conagent.py @@ -48,16 +48,17 @@ class ConfigAgentVnfrTypeError(Exception): class ConfigAccountHandler(object): - def __init__(self, dts, log, loop, on_add_config_agent, on_delete_config_agent): + def __init__(self, dts, log, loop, project, on_add_config_agent, on_delete_config_agent): self._log = log self._dts = dts self._loop = loop + self._project = project self._on_add_config_agent = on_add_config_agent self._on_delete_config_agent = on_delete_config_agent self._log.debug("creating config account handler") self.cloud_cfg_handler = rift.mano.config_agent.ConfigAgentSubscriber( - self._dts, self._log, + self._dts, self._log, self._project, rift.mano.config_agent.ConfigAgentCallbacks( on_add_apply=self.on_config_account_added, on_delete_apply=self.on_config_account_deleted, @@ -77,6 +78,10 @@ class ConfigAccountHandler(object): def register(self): self.cloud_cfg_handler.register() + def deregister(self): + self.cloud_cfg_handler.deregister() + + class RiftCMConfigPlugins(object): """ NSM Config Agent Plugins """ def __init__(self): @@ -117,7 +122,8 @@ class RiftCMConfigAgent(object): self._config_plugins = RiftCMConfigPlugins() self._config_handler = ConfigAccountHandler( - self._dts, self._log, self._loop, self._on_config_agent, self._on_config_agent_delete) + self._dts, self._log, self._loop, parent._project, + self._on_config_agent, self._on_config_agent_delete) self._plugin_instances = {} self._default_account_added = False @@ -179,7 +185,8 @@ class RiftCMConfigAgent(object): else: # Otherwise, instantiate a new plugin using the config agent account self._log.debug("Instantiting new config agent using class: %s", cap_inst) - new_instance = cap_inst(self._dts, self._log, self._loop, config_agent) + new_instance = cap_inst(self._dts, self._log, self._loop, + self._ConfigManagerConfig._project, config_agent) self._plugin_instances[cap_name] = new_instance # TODO (pjoseph): See why this was added, as this deletes the @@ -216,6 +223,11 @@ class RiftCMConfigAgent(object): for account in config_agents: self._on_config_agent(account) + def deregister(self): + self._log.debug("De-registering config agent nsm plugin manager". + format(self._ConfigManagerConfig._project)) + self._config_handler.deregister() + def set_config_agent(self, nsr, vnfr, method): if method == 'juju': agent_type = 'juju'