def get_cn_ri_membership(self, ri_name=None, vn_fq_name=None ): ''' Return the peers (includes both bgp and xmpp peers) who are interested in this RI (across all families inet/evpn etc.) Data is got from Snh_ShowRoutingInstanceReq itself Returns a list of hostnames ''' ri_fq_name = None if vn_fq_name: ri_fq_name = get_ri_name(vn_fq_name) if ri_name: ri_fq_name = ri_name if not ri_fq_name: self.logger.debug('get_cn_ri_membership needs RI or vn name') return None path = 'Snh_ShowRoutingInstanceReq?name=%s' % ri_fq_name ri_resp = self.dict_get(path) if ri_resp is not None: self.logger.debug('No RI detail found for %s' % (ri_fq_name)) return xpath = ('./instances/list/ShowRoutingInstance/tables/list/' 'ShowRoutingInstanceTable/membership/ShowTableMembershipInfo/peers') peers_info = EtreeToDict(xpath).get_all_entry(ri_resp) all_peers = set() for info in peers_info: for x in info.get('peers') or []: all_peers.add(x['peer']) return list(all_peers)