def run_servers_connectivity_test(self, servers): # select one from the servers net_id_list = servers.keys() net_id = net_id_list[0] other_net_id_list = net_id_list[1:] username, password = self.get_image_userpass() nsv = self.tp_svrs[net_id] serv = nsv['server'] floatingip = self.create_floatingip_for_server(serv, client_mgr=self.manager) msg = ("Associate floatingip[%s] to server[%s]" % (floatingip, serv['name'])) self._check_floatingip_connectivity(floatingip, serv, should_connect=True, msg=msg) serv_fip = floatingip['floating_ip_address'] dmgr.rm_sshkey(serv_fip) ssh_client = dmgr.get_remote_client_by_password( serv_fip, username, password) not_reachable_list = [] for nid in other_net_id_list: o_svr = servers[nid]['server'] o_net = servers[nid]['network'] o_ipaddr = self.get_server_fixed_ip(o_svr, o_net) reachable = dmgr.is_reachable(ssh_client, o_ipaddr) if not reachable: not_reachable_list.append(o_ipaddr) self.assertTrue( len(not_reachable_list) == 0, ("Following Servers are not reachable: %s" % not_reachable_list))
def run_servers_connectivity_test(self, servers): # select one from the servers net_id_list = servers.keys() net_id = net_id_list[0] other_net_id_list = net_id_list[1:] username, password = self.get_image_userpass() nsv = self.servers[net_id] serv = nsv['server'] floatingip = self.create_floatingip_for_server( serv, client_mgr=self.admin_manager) msg = ("Associate floatingip[%s] to server[%s]" % (floatingip, serv['name'])) self._check_floatingip_connectivity( floatingip, serv, should_connect=True, msg=msg) serv_fip = floatingip.floating_ip_address dmgr.rm_sshkey(serv_fip) ssh_client = dmgr.get_remote_client_by_password( serv_fip, username, password) not_reachable_list = [] for nid in other_net_id_list: o_svr = servers[nid]['server'] o_net = servers[nid]['network'] o_ipaddr = self.get_server_fixed_ip(o_svr, o_net) reachable = dmgr.is_reachable(ssh_client, o_ipaddr) if not reachable: not_reachable_list.append(o_ipaddr) self.assertTrue( len(not_reachable_list) == 0, ("Following Servers are not reachable: %s" % not_reachable_list))
def create_floatingip_for_server(self, server): username, password = self.get_image_userpass() floatingip = super(TestDnsSearchDomainBasicOps, self).create_floatingip_for_server( server, client_mgr=self.admin_manager) msg = ("Associate floatingip[%s] to server[%s]" % (floatingip, server['name'])) self._check_floatingip_connectivity( floatingip, server, should_connect=True, msg=msg) serv_fip = floatingip['floating_ip_address'] dmgr.rm_sshkey(serv_fip) ssh_client = dmgr.get_remote_client_by_password( serv_fip, username, password) return (floatingip, ssh_client)
def create_floatingip_for_server(self, server): username, password = self.get_image_userpass() floatingip = super(TestDnsSearchDomainBasicOps, self).create_floatingip_for_server( server, client_mgr=self.admin_manager) msg = ("Associate floatingip[%s] to server[%s]" % (floatingip, server['name'])) self._check_floatingip_connectivity( floatingip, server, should_connect=True, msg=msg) serv_fip = floatingip.floating_ip_address dmgr.rm_sshkey(serv_fip) ssh_client = dmgr.get_remote_client_by_password( serv_fip, username, password) return (floatingip, ssh_client)
def create_floatingip_for_server(self, server): # project/tenant create the server, not the ADMIN username, password = self.get_image_userpass() # Only admin can create resource with tenant_id attributes, so # always providing the admin_manager as client to create_floatingip # as scenario/manager.py always insert tenant_id attribe # while creating the serve.. floatingip = super(TestXnetMultiSubnetsOps, self).create_floatingip_for_server( server, external_network_id=self.public_network_id, client_mgr=self.admin_manager) msg = ("Associate floatingip[%s] to server[%s]" % (floatingip, server['name'])) self._check_floatingip_connectivity( floatingip, server, should_connect=True, msg=msg) serv_fip = floatingip['floating_ip_address'] dmgr.rm_sshkey(serv_fip) ssh_client = dmgr.get_remote_client_by_password( serv_fip, username, password) return (floatingip, ssh_client)