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)
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)
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)
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)
示例#5
0
def assert_no_connectivity_between(host, from_port, to_port):
    with pytest.raises(PingFailed):
        ssh_ping(source=host.address, password=host.root_password,
                 destination=to_port.fixed_ips[0]['ip_address'],
                 netns=from_port.name)
示例#6
0
def _ping(host, from_port, to_port):
    ssh_ping(source=host.address, password=host.root_password,
             destination=to_port.fixed_ips[0]['ip_address'],
             netns=from_port.name)
def _ping_successful(source, password, destination, data_size):
    try:
        ssh_ping(source, password, destination, data_size)
        return True
    except PingFailed:
        return False
def _ping_successful(source, password, destination, data_size):
    try:
        ssh_ping(source, password, destination, data_size)
        return True
    except PingFailed:
        return False
def assert_no_connectivity_between(host, from_port, to_port):
    with pytest.raises(PingFailed):
        ssh_ping(source=host.address, password=host.root_password,
                 destination=to_port.fixed_ips[0]['ip_address'],
                 netns=from_port.name)
def _ping(host, from_port, to_port):
    ssh_ping(source=host.address, password=host.root_password,
             destination=to_port.fixed_ips[0]['ip_address'],
             netns=from_port.name)