def _add_host_into_hostgroup(self, host_name, host_ip): """Associate host to hostgroup. If host group doesn't exist, create one. """ hostgroup_id = self._find_hostgroup(host_name) if hostgroup_id is None: hostgroup_id = self._create_hostgroup(host_name) hostid = self._find_host(host_name) if hostid is None: os_type = huawei_utils.get_conf_host_os_type(host_ip, self.xml_conf) hostid = self._add_host(host_name, os_type) self._associate_host_to_hostgroup(hostgroup_id, hostid) return hostid, hostgroup_id
def _add_host_into_hostgroup(self, host_name, host_ip): """Associate host to hostgroup. If host group doesn't exist, create one. """ hostgroup_id = self._find_hostgroup(host_name) if hostgroup_id is None: hostgroup_id = self._create_hostgroup(host_name) hostid = self._find_host(host_name) if hostid is None: os_type = huawei_utils.get_conf_host_os_type( host_ip, self.xml_conf) hostid = self._add_host(host_name, os_type) self._associate_host_to_hostgroup(hostgroup_id, hostid) return hostid, hostgroup_id
def test_get_conf_host_os_type(self): self.driver.restclient.login() host_os = huawei_utils.get_conf_host_os_type('100.97.10.30', self.configuration) self.assertEqual('0', host_os)