Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@
<artifactId>cloud-plugin-network-netscaler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-aviz-ones</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-network-ovs</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,29 @@ JOIN (
GROUP BY object_store_id
) buckets_quota_sum_view ON `object_store`.id = buckets_quota_sum_view.object_store_id
SET `object_store`.allocated_size = buckets_quota_sum_view.total_quota;

-- Aviz ONES network plugin: one row per ONES Fabric Manager registered with addOnesProvider, scoped to a physical network
CREATE TABLE IF NOT EXISTS `cloud`.`ones_providers` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
`uuid` varchar(40) DEFAULT NULL,
`host_id` bigint unsigned NOT NULL COMMENT 'the pseudo host (type L2Networking) representing the controller',
`physical_network_id` bigint unsigned NOT NULL,
`provider_name` varchar(255) NOT NULL,
`device_name` varchar(255) NOT NULL,
`url` varchar(255) NOT NULL COMMENT 'ONES Fabric Manager API base URL',
`fabric_name` varchar(255) NOT NULL,
`login_url` varchar(1024) NOT NULL,
`username` varchar(255) NOT NULL,
`password` varchar(1024) NOT NULL COMMENT 'encrypted with the database key',
`client_cert_path` varchar(1024) DEFAULT NULL,
`client_key_path` varchar(1024) DEFAULT NULL,
`ca_cert_path` varchar(1024) DEFAULT NULL,
`gateway_url` varchar(1024) DEFAULT NULL COMMENT 'Aviz Gateway REST API',
`gateway_token` varchar(1024) DEFAULT NULL COMMENT 'its API token, encrypted with the database key',
`gateway_ca_cert_path` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uc_ones_providers__uuid` (`uuid`),
UNIQUE KEY `uc_ones_providers__physical_network_id` (`physical_network_id`),
CONSTRAINT `fk_ones_providers__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_ones_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
174 changes: 174 additions & 0 deletions plugins/network-elements/aviz-ones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Aviz ONES Network Plugin

Integrates Apache CloudStack with the **Aviz ONES** fabric manager, which runs the leaf-spine
fabric of GPU clusters built on the NVIDIA Spectrum-X reference architecture. An isolated guest
network in CloudStack is one **ONES tenant**: ONES isolates the tenant on the fabric (its own
VRF, VXLAN VNIs and north-south VLAN) and chooses its subnet; CloudStack runs the VMs and the
virtual router on it.

Scope: tenant lifecycle (create, delete) and the membership of hypervisor hosts in a tenant,
including the tenant's VF on a host's DPU where the hosts sit behind DPUs. InfiniBand (UFM) and
NVLink (NMX-C) configuration through ONES are out of scope.

## How a network maps onto a tenant

ONES, not CloudStack, chooses everything about a tenant: VLAN, VNIs, subnet, compute IP pool
and gateway. The plugin therefore creates the tenant when the network is created and takes the
network's addressing from ONES:

| CloudStack | From ONES |
|---|---|
| broadcast URI `vlan://<id>` | the tenant's north-south VLAN, which ONES trunks to the hypervisors' leaf ports and maps into the tenant's VRF; the KVM host tags it like any VLAN guest network |
| CIDR | the tenant subnet |
| gateway | the gateway ONES reports for the tenant |
| NIC addresses | only from the tenant's compute IP pool, a part of the subnet; the rest belongs to the fabric |

CloudStack asks for `gateway`/`netmask` when an isolated network is created from an offering
without SourceNat, before ONES has chosen the subnet. There a placeholder is passed: a gateway
outside the subnet ONES assigns (e.g. `10.255.255.1`/`255.255.255.0`) is ignored and the network
takes ONES's subnet and gateway; a gateway inside that subnet is used as given. Offerings with
SourceNat need neither.

Lifecycle:

| Network event | ONES |
|---|---|
| design (createNetwork) | create the tenant and wait for the operation to finish; on any later failure the tenant is deleted again |
| setup | record tenant name, VLAN, pool and L3 VNI in `network_details` |
| implement | put the network on the tenant's VLAN |
| allocate | pick NIC addresses from the tenant's pool |
| element prepare (a VM on a host) | add the host to the tenant, once per host, as a shared server (one hypervisor carries many tenants); on a host behind a DPU, also give the tenant one free VF of that DPU |
| shutdown | take the network's hosts out of the tenant, releasing their DPU VFs |
| trash (deleteNetwork) | delete the tenant |

In compute pools of a /27 or bigger the first nine addresses are left unused for the operator;
smaller pools are used from the first address. Tenant names are `cs` followed by ten hex digits
(ONES allows at most twelve characters).

## Design

The ONES controller is registered per physical network as a device, represented by a
pseudo-host (type `L2Networking`); every call to ONES goes through the agent Command/Answer
framework, as in the other SDN provider plugins.

| Class | Role |
|---|---|
| `OnesProviderVO` / `OnesProviderDao` | one row per registered controller in `ones_providers`; password and tokens stored encrypted |
| `AddOnesProviderCmd`, `UpdateOnesProviderCmd`, `DeleteOnesProviderCmd`, `ListOnesProvidersCmd` | provider API |
| `OnesResource` | the controller's `ServerResource`; dispatches the commands to the REST client |
| `CreateOnesTenantCommand`, `DeleteOnesTenantCommand`, `AllocateOnesServersCommand`, `DeallocateOnesServersCommand` | the southbound operations |
| `OnesApiClientImpl` | ONES REST client: logs in with a ONES user (and again on a 401); every change is sent asynchronously (`Prefer: respond-async`) and its operation polled until it finishes; TLS is always verified, optionally with a client certificate |
| `OnesGuestNetworkGuru` | the network lifecycle above |
| `OnesElement` | provider and services; adds hosts to the tenant as VMs are placed; keeps the tenant's edge in step |
| `OnesEdgeBuilder`, `ConfigureOnesEdgeCommand`, `RemoveOnesEdgeCommand` | the tenant's edge as CloudStack wants it, sent through the resource |
| `AvizGatewayClient` | Aviz Gateway REST client (API token, verified TLS) |

Host membership is kept in `network_details` (`onestenantname`, `onesallocatedhosts`), not in a
table of its own.

## Configuration

1. Physical network: isolation method `ONES`, and the `AvizOnes` service provider added and
enabled:

```
addNetworkServiceProvider name=AvizOnes physicalnetworkid=<uuid>
updateNetworkServiceProvider id=<provider uuid> state=Enabled
```

2. Register the ONES controller. The URL's host name must match the ONES server certificate
(the default ONES certificate names `ones-fm`); give `cacertpath` when that certificate is
not trusted by the JVM:

```
addOnesProvider physicalnetworkid=<uuid> name=ones1 url=https://ones.example.com:8443 \
fabricname=<fabric> username=<ONES user> password=<password> \
cacertpath=/etc/cloudstack/management/ones-ca.pem
```

`clientcertpath`/`clientkeypath` add a TLS client certificate; `loginurl` overrides the
login endpoint (default `https://<host of url>/api/user/login`: the ONES UI on the default
HTTPS port, not the Fabric Manager port of `url`).

3. Network offering: guest type Isolated, `Connectivity` by `AvizOnes`; `Dhcp`, `Dns` and
`UserData` by `VirtualRouter`.

4. Create networks from that offering with a placeholder `gateway`/`netmask` (see above); with
SourceNat in the offering, without them.

## Edge services on the Aviz Gateway (optional, experimental)

A ONES tenant reaches the outside through an Aviz Gateway: ONES puts each tenant on the gateway
(its edge configurator) once a server joined the tenant. On top of that the plugin offers, by
the `AvizOnes` provider:

| Service | On the gateway |
|---|---|
| SourceNat | the tenant's internet access, translating outbound traffic onto the network's source NAT address |
| PortForwarding | one inbound mapping per port of each rule (at most 256 ports per rule) |
| Lb | one VIP per load-balancer rule with every member as a backend; round robin, tcp or udp, `SourceBased` stickiness. The gateway health-checks the members when ONES gave the tenant a loopback on the gateway, else the VIP goes unchecked. A VIP cannot use the source NAT address, and a member's private port serves one VIP only (no second VIP and no port forward to it) |
| Firewall | ingress rules: the gateway filters after translation, so each mapped VM address and port gets a deny for any source and a permit per allowed source CIDR. A mapping no ingress rule covers stays closed |

All public addresses are CloudStack's own: give the zone a public IP range the gateway's uplink
announces. The plugin works out the tenant's whole edge from CloudStack's records whenever an
address, port forward, load-balancer or firewall rule changes (and when the network's first host
joins the tenant), and sends it in one command; anything of the tenant's it made and that is no
longer wanted is removed. VIPs and firewall rules an operator adds on the gateway by hand are
never touched. Shutting the network down takes its edge off the gateway.

Configuration: give the provider the gateway, with an API token of role `operator` created for
CloudStack on the gateway (`POST /api/v1/tokens`):

```
updateOnesProvider id=<provider uuid> gatewayurl=https://gateway.example.com:8090 \
gatewaytoken=<token> gatewaycacertpath=/etc/cloudstack/management/gateway-ca.pem
```

and put the services wanted by `AvizOnes` in the network offering. Only Connectivity is required;
PortForwarding needs SourceNat (the gateway keeps port forwards in the tenant's internet access);
without Firewall, forwarded ports and load balancers are open to every source. Gateway firewall
rules are named after their position in the network's rule set and rewritten as a whole on every
change.

## Limitations of this version

- The provider APIs are for root administrators only.
- Live migration is not supported yet: the destination host is not added to the tenant, so an
instance migrated to a host with no other instance of its network loses connectivity.
- Deploy the instances of one network one at a time: parallel deploys can pick the same address.
- The ONES login and controller settings cannot be changed after the provider is added.
- Hosts leave a tenant only when the network shuts down.
- A network spans at most about 40 hosts (the size of the `onesallocatedhosts` detail).

## Requirements on ONES

- The fabric runs with ONES tenant IPAM off: CloudStack, not ONES, configures the hypervisors.
- The tenant gateway ONES reports must be the address the fabric routes the tenant on.

## Tests

```
mvn -pl plugins/network-elements/aviz-ones test
```

The REST client is tested against a local fake ONES over TLS with throwaway certificates; the
guru, element and resource with mocks. No ONES controller is needed.
39 changes: 39 additions & 0 deletions plugins/network-elements/aviz-ones/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-network-aviz-ones</artifactId>
<name>Apache CloudStack Plugin - Network Aviz ONES</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
<version>24.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//

package org.apache.cloudstack.network.ones.agent.api;

import java.util.List;

import com.cloud.agent.api.Command;

/**
* Maps to ONES "Allocate Servers" (operation=ADD):
* PATCH /fabrics/{fabricName}/tenants/{tenantName}
*/
public class AllocateOnesServersCommand extends Command {

private final String fabricName;
private final String tenantName;
private final List<String> serverNames;
private final boolean shared;

public AllocateOnesServersCommand(final String fabricName, final String tenantName, final List<String> serverNames, final boolean shared) {
this.fabricName = fabricName;
this.tenantName = tenantName;
this.serverNames = serverNames;
this.shared = shared;
}

@Override
public boolean executeInSequence() {
return true;
}

public String getFabricName() {
return fabricName;
}

public String getTenantName() {
return tenantName;
}

public List<String> getServerNames() {
return serverNames;
}

public boolean isShared() {
return shared;
}
}
Loading