def get_host(self, _id=None, name=None, address=None, **filters): ret = UnityHostList.get(self._cli, name='not found') if address: host_ip_ports = UnityHostIpPortList.get(self._cli, address=address) if host_ip_ports: ret = host_ip_ports[0].host else: ret = self._get_unity_rsc(UnityHostList, _id=_id, name=name, **filters) return ret
def get_host(self, _id=None, name=None, address=None, **filters): ret = UnityHostList.get(self._cli, name='not found') if address: host_ip_ports = UnityHostIpPortList.get(self._cli, address=address) if host_ip_ports: ret = host_ip_ports[0].host else: ret = self._get_unity_rsc(UnityHostList, _id=_id, name=name, **filters) return ret
def test_get_by_ip(self): ip_ports = UnityHostIpPortList(cli=t_rest(), address='10.244.209.90') assert_that(len(ip_ports), equal_to(1)) assert_that(ip_ports[0].address, equal_to('10.244.209.90'))
def test_get_all(self): ip_ports = UnityHostIpPortList(cli=t_rest()) assert_that(len(ip_ports), equal_to(8))