'0123456789abcdef0123456789abcdef', 'cidr' => '10.60.0.0/24', 'gateway' => '10.60.0.1', ]; $ports = [ ['private_ip' => '10.60.0.9', 'mac_address' => '02:00:00:00:00:09', 'host_id' => 1], ['private_ip' => '10.60.0.2', 'mac_address' => '02:00:00:00:00:02', 'host_id' => 1], ['private_ip' => '10.60.0.8', 'mac_address' => '02:00:00:00:00:08', 'host_id' => 2], ['private_ip' => '10.60.0.3', 'mac_address' => '02:00:00:00:00:03', 'host_id' => 2], ]; $transports = [ 1 => ['transport_address' => '172.16.10.11', 'transport_prefix_length' => 24, 'transport_interface' => 'br-private', 'mtu' => 1500], 2 => ['transport_address' => '172.16.10.12', 'transport_prefix_length' => 24, 'transport_interface' => 'br-private', 'mtu' => 1500], ]; $projection = CloudVpcProjection::build($vpc, $ports, $transports, 3); $assert($projection[1]['digest'] === 'c14a86ae5ec448e9977c9da5102d82889b5c705896474f43cb2af38977ad64e2', 'PHP projection digest drifted from Go json.Marshal contract.'); $assert($projection[1]['network']['local_ports'][0]['ip'] === '10.60.0.2' && $projection[1]['network']['peer_routes'][0]['ip'] === '10.60.0.3', 'Projection addresses were not canonically sorted.'); $assert(CloudVpcProjection::bridgeName($vpc['vpc_key']) === 'vcfefd87aeec7b', 'PHP bridge name drifted from the Agent derivation.'); try { $invalid = $transports; $invalid[2]['transport_address'] = '172.16.11.12'; CloudVpcProjection::build($vpc, $ports, $invalid, 3); throw new RuntimeException('Off-link VPC underlay was accepted.'); } catch (CloudError $error) { $assert($error->httpStatus === 409, 'Off-link VPC underlay returned the wrong status.'); } echo "VPC projection and Go digest contract passed.\n";