|
1 | 1 | import copy |
2 | 2 | import ipaddress |
3 | | -from test.integration.helpers import get_test_label |
| 3 | +from test.integration.helpers import ( |
| 4 | + get_test_label, |
| 5 | + wait_for_condition, |
| 6 | +) |
4 | 7 |
|
5 | 8 | import pytest |
6 | 9 |
|
|
16 | 19 | LinodeInterfacePublicIPv6Options, |
17 | 20 | LinodeInterfacePublicIPv6RangeOptions, |
18 | 21 | LinodeInterfacePublicOptions, |
| 22 | + LinodeInterfaceRDMAVPCIPv4AddressOptions, |
| 23 | + LinodeInterfaceRDMAVPCIPv4Options, |
| 24 | + LinodeInterfaceRDMAVPCOptions, |
19 | 25 | LinodeInterfaceVLANOptions, |
20 | 26 | LinodeInterfaceVPCIPv4AddressOptions, |
21 | 27 | LinodeInterfaceVPCIPv4Options, |
@@ -43,6 +49,22 @@ def build_interface_public_ipv4(firewall, ip_address): |
43 | 49 | ) |
44 | 50 |
|
45 | 51 |
|
| 52 | +def build_interface_rdma_vpc_ipv4(subnet_id: int): |
| 53 | + return LinodeInterfaceOptions( |
| 54 | + firewall_id=-1, |
| 55 | + rdma_vpc=LinodeInterfaceRDMAVPCOptions( |
| 56 | + subnet_id=subnet_id, |
| 57 | + ipv4=LinodeInterfaceRDMAVPCIPv4Options( |
| 58 | + addresses=[ |
| 59 | + LinodeInterfaceRDMAVPCIPv4AddressOptions( |
| 60 | + address="auto", primary=True |
| 61 | + ) |
| 62 | + ] |
| 63 | + ), |
| 64 | + ), |
| 65 | + ) |
| 66 | + |
| 67 | + |
46 | 68 | def create_linode_with_legacy_config( |
47 | 69 | client, ip_address, label, firewall, authorized_key |
48 | 70 | ): |
@@ -75,6 +97,22 @@ def create_linode_with_standard_interfaces( |
75 | 97 | return linode |
76 | 98 |
|
77 | 99 |
|
| 100 | +def create_multiple_rdma_interfaces(amount: int, subnet_id: int): |
| 101 | + """ |
| 102 | + Creates multiple VPC RDMA interfaces that may be needed for RDMA Linode instance |
| 103 | +
|
| 104 | + Note: |
| 105 | + At least 8 separate VPC RDMA interfaces need to be created for a single RDMA linode instance |
| 106 | + """ |
| 107 | + interfaces = list() |
| 108 | + |
| 109 | + for _ in range(amount): |
| 110 | + rdma_iface = build_interface_rdma_vpc_ipv4(subnet_id) |
| 111 | + interfaces.append(rdma_iface) |
| 112 | + |
| 113 | + return interfaces |
| 114 | + |
| 115 | + |
78 | 116 | def test_linode_create_with_linode_interfaces( |
79 | 117 | create_vpc_with_subnet, |
80 | 118 | linode_with_linode_interfaces, |
@@ -458,3 +496,61 @@ def test_linode_interfaces_with_reserved_ips( |
458 | 496 | assert reserved_ips_list[0].reserved == True |
459 | 497 | assert reserved_ips_list[0].linode_id is None |
460 | 498 | assert reserved_ips_list[0].assigned_entity is None |
| 499 | + |
| 500 | + |
| 501 | +@pytest.mark.skip( |
| 502 | + reason="Linode with RDMA interfaces requires manual infra changes at the moment" |
| 503 | +) |
| 504 | +def test_linode_interfaces_with_rdma_vpc_type( |
| 505 | + request, |
| 506 | + test_linode_client, |
| 507 | + create_vpc_with_subnet, |
| 508 | + create_vpc_with_subnet_and_rdma_type, |
| 509 | +): |
| 510 | + client = test_linode_client |
| 511 | + vpc, subnet = create_vpc_with_subnet |
| 512 | + vpc_rdma, subnet_rdma = create_vpc_with_subnet_and_rdma_type |
| 513 | + |
| 514 | + # Include RDMA VPC interfaces |
| 515 | + multi_ifaces = create_multiple_rdma_interfaces(8, subnet_rdma.id) |
| 516 | + |
| 517 | + # Include (at least one) regular interface |
| 518 | + multi_ifaces.append( |
| 519 | + LinodeInterfaceOptions( |
| 520 | + firewall_id=-1, |
| 521 | + default_route=LinodeInterfaceDefaultRouteOptions( |
| 522 | + ipv4=True, |
| 523 | + ), |
| 524 | + vpc=LinodeInterfaceVPCOptions( |
| 525 | + subnet_id=subnet.id, |
| 526 | + ipv4=LinodeInterfaceVPCIPv4Options( |
| 527 | + addresses=[ |
| 528 | + LinodeInterfaceVPCIPv4AddressOptions( |
| 529 | + address="auto", |
| 530 | + primary=True, |
| 531 | + ) |
| 532 | + ], |
| 533 | + ), |
| 534 | + ), |
| 535 | + ), |
| 536 | + ) |
| 537 | + |
| 538 | + instance = client.linode.instance_create( |
| 539 | + label="go-test-rdma-" + get_test_label(), |
| 540 | + root_pass="aComplex@Password123", |
| 541 | + image="linode/ubuntu24.04", |
| 542 | + region=vpc.region, |
| 543 | + # ltype="TBD", |
| 544 | + # host_id="TBD", |
| 545 | + interface_generation=InterfaceGeneration.LINODE, |
| 546 | + interfaces=multi_ifaces, |
| 547 | + booted=False, |
| 548 | + ) |
| 549 | + request.addfinalizer(instance.delete) |
| 550 | + |
| 551 | + def get_linode_status(): |
| 552 | + return instance.status == "offline" |
| 553 | + |
| 554 | + wait_for_condition(5, 180, get_linode_status) |
| 555 | + |
| 556 | + assert len(instance.linode_interfaces) == len(multi_ifaces) |
0 commit comments