- self.tasklet = tasklet
- self.reg = None
-
- @property
- def dts(self):
- """The DTS instance used by this tasklet"""
- return self.tasklet.dts
-
- @property
- def log(self):
- """The logger used by this tasklet"""
- return self.tasklet.log
-
- @property
- def loop(self):
- """The event loop used by this tasklet"""
- return self.tasklet.loop
-
- @property
- def accounts(self):
- """The known openmano cloud accounts"""
- accounts = list()
- for acc in self.tasklet.cloud_accounts:
- if acc.account_type == "openmano":
- accounts.append(acc.account_msg)
-
- return accounts
+ super().__init__(log, dts, loop)
+
+ self._ro_sub = mano_dts.ROAccountConfigSubscriber(
+ self.log,
+ self.dts,
+ self.loop,
+ callback=self.on_ro_account_change
+ )
+ self.ro_accounts = {}
+
+ def on_ro_account_change(self, ro_account, action):
+ if action in [ RwDts.QueryAction.CREATE, RwDts.QueryAction.UPDATE ]:
+ self.ro_accounts[ro_account.name] = ro_account
+ elif action == RwDts.QueryAction.DELETE and ro_account.name in self.ro_accounts:
+ del self.ro_accounts[ro_account.name]