def test_security_groups_allow_icmp(system, ovs_cluster, host_in_ovs_cluster,
                                    host_0, host_1,
                                    default_ovn_provider_client,
                                    ovn_physnet_small_mtu,
                                    vm_in_ovn_network_up,
                                    vnic_attached_to_ovn_network):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])
    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(
                      other_host.address,
                      other_host.root_password,
                      VM0_NAME,
                      MAX_ICMP_DATA_SIZE
                  ),
                  success_criteria=lambda success: success)

    with _enable_port_security(vnic_attached_to_ovn_network,
                               default_ovn_provider_client):
        with pytest.raises(PingFailed, match=r'status code 1'):
            ssh_ping(other_host.address,
                     other_host.root_password,
                     VM0_NAME,
                     data_size=MAX_ICMP_DATA_SIZE)

        with _allow_icmp_from_host(other_host):
            syncutil.sync(exec_func=_ping_successful,
                          exec_func_args=(
                              other_host.address,
                              other_host.root_password,
                              VM0_NAME,
                              MAX_ICMP_DATA_SIZE
                          ),
                          success_criteria=lambda success: success)
示例#2
0
def test_security_groups_allow_icmp(system, ovs_cluster, host_in_ovs_cluster,
                                    host_0, host_1,
                                    default_ovn_provider_client,
                                    ovn_physnet_small_mtu,
                                    vm_in_ovn_network_up,
                                    vnic_attached_to_ovn_network):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])
    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)

    with _enable_port_security(vnic_attached_to_ovn_network,
                               default_ovn_provider_client):
        with pytest.raises(PingFailed, match=r'status code 1'):
            ssh_ping(other_host.address,
                     other_host.root_password,
                     VM0_NAME,
                     data_size=MAX_ICMP_DATA_SIZE)

        with _allow_icmp_from_host(other_host):
            syncutil.sync(exec_func=_ping_successful,
                          exec_func_args=(other_host.address,
                                          other_host.root_password, VM0_NAME,
                                          MAX_ICMP_DATA_SIZE),
                          success_criteria=lambda success: success)
示例#3
0
 def deactivate(self):
     self.wait_for_up_status()
     syncutil.sync(exec_func=self._service.deactivate,
                   exec_func_args=(),
                   timeout=3 * 60,
                   error_criteria=Host._is_error_non_transient)
     self.wait_for_maintenance_status()
示例#4
0
 def wait_until_available(self):
     syncutil.sync(
         exec_func=lambda: self.is_provider_available(
             self.get_sdk_type().name
         ),
         exec_func_args=(),
         success_criteria=lambda s: s
     )
示例#5
0
def test_connect_vm_to_external_physnet(system, ovs_cluster,
                                        host_in_ovs_cluster, host_0, host_1,
                                        vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)
示例#6
0
 def deactivate(self):
     self.wait_for_up_status()
     syncutil.sync(
         exec_func=self._service.deactivate,
         exec_func_args=(),
         timeout=3 * 60,
         error_criteria=Host._is_error_non_transient
     )
     self.wait_for_maintenance_status()
def test_connect_vm_to_external_physnet(system, ovs_cluster,
                                        host_in_ovs_cluster, host_0, host_1,
                                        vm_in_ovn_network_up):
        other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

        syncutil.sync(exec_func=_ping_successful,
                      exec_func_args=(
                          other_host.address,
                          other_host.root_password,
                          VM0_NAME,
                          MAX_ICMP_DATA_SIZE
                      ),
                      success_criteria=lambda success: success)
示例#8
0
def test_max_mtu_size(system, ovs_cluster, host_in_ovs_cluster, host_0, host_1,
                      ovn_physnet_small_mtu, vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(other_host.address, other_host.root_password,
                                  VM0_NAME, MAX_ICMP_DATA_SIZE),
                  success_criteria=lambda success: success)

    with pytest.raises(PingFailed, match=r'status code 1'):
        ssh_ping(other_host.address,
                 other_host.root_password,
                 VM0_NAME,
                 data_size=MAX_ICMP_DATA_SIZE + 1)
示例#9
0
def engine(fqdn, env, artifacts_path):
    with suite.collect_artifacts(env, artifacts_path, 'pre-tests'):
        engine = env.get_vms()[ENGINE_DOMAIN]

        ANSWER_FILE_TMP = '/tmp/answer-file'

        engine.copy_to(ANSWER_FILE_SRC, ANSWER_FILE_TMP)
        engine.ssh([
            'engine-setup',
            '--config-append={}'.format(ANSWER_FILE_TMP),
            '--accept-defaults',
        ])
        syncutil.sync(exec_func=_get_engine_api,
                      exec_func_args=(engine, ),
                      success_criteria=lambda api: isinstance(api, Connection))
        return engine
示例#10
0
def engine(fqdn, env, artifacts_path):
    with suite.collect_artifacts(env, artifacts_path, 'pre-tests'):
        engine = env.get_vms()[ENGINE_DOMAIN]

        ANSWER_FILE_TMP = '/tmp/answer-file'

        engine.copy_to(ANSWER_FILE_SRC, ANSWER_FILE_TMP)
        engine.ssh(
            [
                'engine-setup',
                '--config-append={}'.format(ANSWER_FILE_TMP),
                '--accept-defaults',
            ]
        )
        syncutil.sync(exec_func=_get_engine_api,
                      exec_func_args=(engine,),
                      success_criteria=lambda api: isinstance(api, Connection))
        return engine
def test_max_mtu_size(system, ovs_cluster, host_in_ovs_cluster, host_0, host_1,
                      ovn_physnet_small_mtu, vm_in_ovn_network_up):
    other_host = _other_host(host_in_ovs_cluster, [host_0, host_1])

    syncutil.sync(exec_func=_ping_successful,
                  exec_func_args=(
                      other_host.address,
                      other_host.root_password,
                      VM0_NAME,
                      MAX_ICMP_DATA_SIZE
                  ),
                  success_criteria=lambda success: success)

    with pytest.raises(PingFailed, match=r'status code 1'):
        ssh_ping(other_host.address,
                 other_host.root_password,
                 VM0_NAME,
                 data_size=MAX_ICMP_DATA_SIZE + 1)
示例#12
0
def engine_storage_ipv6(engine):
    """
    lago creates a storage network with an ipv6 subnet and connects it to NIC
    eth1 of its VMs but does not assign an ip (v6) to the NIC.
    this function connects to the engine VM using its ssh API to:
    * assign an ipv6 address to the NIC
    * wait for the address to be assigned (it might take up to a few seconds)
    * retrieve the address
    :return: the ipv6 address as string
    :raise: timeout exception if global ipv6 address not found on NIC
    """
    STORAGE_NET_NIC_NAME = 'eth1'
    _assign_ipv6(engine, STORAGE_NET_NIC_NAME)
    return syncutil.sync(exec_func=_get_ipv6,
                         exec_func_args=(engine, STORAGE_NET_NIC_NAME),
                         success_criteria=lambda ipv6: ipv6 != '',
                         timeout=10)
示例#13
0
def engine_storage_ipv6(engine):
    """
    lago creates a storage network with an ipv6 subnet and connects it to NIC
    eth1 of its VMs but does not assign an ip (v6) to the NIC.
    this function connects to the engine VM using its ssh API to:
    * assign an ipv6 address to the NIC
    * wait for the address to be assigned (it might take up to a few seconds)
    * retrieve the address
    :return: the ipv6 address as string
    :raise: timeout exception if global ipv6 address not found on NIC
    """
    STORAGE_NET_NIC_NAME = 'eth1'
    _assign_ipv6(engine, STORAGE_NET_NIC_NAME)
    return syncutil.sync(exec_func=_get_ipv6,
                         exec_func_args=(engine, STORAGE_NET_NIC_NAME),
                         success_criteria=lambda ipv6: ipv6 != '',
                         timeout=10)
示例#14
0
 def deactivate(self):
     syncutil.sync(exec_func=self._deactivate,
                   exec_func_args=(),
                   success_criteria=lambda s: s)
示例#15
0
 def wait_for_up_status(self):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == types.DiskStatus.OK)
示例#16
0
 def wait_for_up_status(self, timeout=HOST_TIMEOUT_SHORT):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=self._host_up_status_success_criteria,
                   timeout=timeout)
示例#17
0
 def wait_for_snapshot_removal(self, snapshot_id):
     syncutil.sync(exec_func=self._is_snapshot_present,
                   exec_func_args=(),
                   success_criteria=lambda present: not present)
示例#18
0
 def _sync_disk_attachment(self, disk_attachment_id):
     syncutil.sync(exec_func=self._is_disk_attachment_active,
                   exec_func_args=(disk_attachment_id, ),
                   success_criteria=lambda s: s)
示例#19
0
 def _wait_for_status(self, status):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status,
                   timeout=60 * 5)
示例#20
0
 def _wait_for_sd_status(self, sd, status):
     sd_service = self._sd_service(sd)
     syncutil.sync(exec_func=lambda: sd_service.get().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
示例#21
0
 def deactivate_storage_domain_sync(self, sd):
     syncutil.sync(
         exec_func=self.deactivate_storage_domain,
         exec_func_args=(sd,),
         error_criteria=error.sd_deactivation_error_not_due_to_busy)
示例#22
0
 def wait_for_networks_in_sync(self, networks=None):
     syncutil.sync(exec_func=self.networks_in_sync,
                   exec_func_args=(networks, ),
                   success_criteria=lambda s: s)
示例#23
0
 def wait_for_non_operational_status(self):
     NONOP = HostStatus.NON_OPERATIONAL
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == NONOP)
示例#24
0
 def wait_for_up_status(self, timeout=HOST_TIMEOUT_SHORT):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=self._host_up_status_success_criteria,
                   timeout=timeout)
示例#25
0
 def destroy_sync(self):
     syncutil.sync(
         exec_func=self.destroy,
         exec_func_args=(),
         error_criteria=error.sd_destroy_error_not_due_to_busy)
示例#26
0
 def wait_for_up_status(self, timeout=5 * 60):
     yield
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=self._host_up_status_success_criteria,
                   timeout=timeout)
示例#27
0
 def wait_for_maintenance_status(self):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == HostStatus.MAINTENANCE)
示例#28
0
 def wait_for_networks_in_sync(self, networks=None):
     syncutil.sync(exec_func=self.networks_in_sync,
                   exec_func_args=(networks,),
                   success_criteria=lambda s: s)
示例#29
0
 def wait_for_ready_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.READY)
示例#30
0
 def _wait_for_sd_status(self, sd, status):
     sd_service = self._sd_service(sd)
     syncutil.sync(exec_func=lambda: sd_service.get().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
示例#31
0
 def wait_for_non_operational_status(self):
     NONOP = HostStatus.NON_OPERATIONAL
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == NONOP)
示例#32
0
 def _wait_for_status(self, status):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == status)
示例#33
0
def wait_for_template_ok_status(system, template_name):
    syncutil.sync(
        exec_func=_get_template,
        exec_func_args=(system.templates_service, template_name),
        success_criteria=_check_template
    )
示例#34
0
 def wait_for_maintenance_status(self):
     syncutil.sync(exec_func=lambda: self.get_sdk_type().status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == HostStatus.MAINTENANCE)
示例#35
0
def wait_for_template_ok_status(system, template_name):
    syncutil.sync(exec_func=_get_template,
                  exec_func_args=(system.templates_service, template_name),
                  success_criteria=_check_template)
示例#36
0
 def wait_for_snapshot_removal(self, snapshot_id):
     syncutil.sync(
         exec_func=self._is_snapshot_present,
         exec_func_args=(),
         success_criteria=lambda present: not present
     )
示例#37
0
 def _wait_for_status(self, statuses):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s in statuses)
示例#38
0
 def wait_until_available(self):
     syncutil.sync(exec_func=lambda: self.is_provider_available(
         self.get_sdk_type().name),
                   exec_func_args=(),
                   success_criteria=lambda s: s)
示例#39
0
 def deactivate_storage_domain_sync(self, sd):
     syncutil.sync(
         exec_func=self.deactivate_storage_domain,
         exec_func_args=(sd, ),
         error_criteria=error.sd_deactivation_error_not_due_to_busy)
示例#40
0
 def _sync_disk_attachment(self, disk_attachment_id):
     syncutil.sync(
         exec_func=self._is_disk_attachment_active,
         exec_func_args=(disk_attachment_id,),
         success_criteria=lambda s: s
     )
示例#41
0
 def destroy_sync(self):
     syncutil.sync(exec_func=self.destroy,
                   exec_func_args=(),
                   error_criteria=error.sd_destroy_error_not_due_to_busy)
示例#42
0
 def wait_for_ready_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.READY
     )
示例#43
0
 def wait_for_up_status(self):
     syncutil.sync(exec_func=lambda: self.status,
                   exec_func_args=(),
                   success_criteria=lambda s: s == types.DiskStatus.OK)
示例#44
0
 def wait_for_preview_status(self):
     syncutil.sync(
         exec_func=lambda: self.get_sdk_type().snapshot_status,
         exec_func_args=(),
         success_criteria=lambda status: status == SnapshotStatus.IN_PREVIEW
     )