> For the complete documentation index, see [llms.txt](https://kth-expeca.gitbook.io/testbedconfig/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kth-expeca.gitbook.io/testbedconfig/enroll/enroll-network-segments/ep5g.md).

# Enroll EP5G

<figure><img src="https://893157246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwOAvwjLgOKQuNqSIAfmv%2Fuploads%2FHiW3QfqRQHlbuAwOGsCZ%2Fep5g_integration.png?alt=media&amp;token=93c15585-a6ca-4070-91ec-fda7a8be065c" alt=""><figcaption><p>EP5G Integration</p></figcaption></figure>

This section explains how to register an Ericsson private 5G network as a network segment in Openstack. As shown in the figure, it is required that a VIP network accommodate the two network controller interfaces `10.30.111.20` and `10.30.111.21` connected to tenant switch ports `te1/0/51` and `te1/0/52`. These interfaces should be able to reach the gateway on this subnet created by the router in Openstack i.e. `10.30.111.1`.

### Register the network segment

EXPECA Blazar is capable of enrolling network segments. By running the following command, we register network segment 300 with 2 baremetal ports and a gateway.

```
openstack reservation network create \
--network-type "vlan" \
--physical-network "physnet1" \
--segment "100" \
--extra segment_subnet="10.30.0.0/16" \
--extra segment_gateway="10.30.111.1" \
--extra vlan_id="100" \
--extra baremetal_ports='[{"name":"network_controller_1","ip-address":"10.30.111.20","binding-profile":{"local_link_information":[{"switch_id":"a0:f8:49:f7:89:d1","port_id":"te1/0/51","switch_info":"tenant-switch"}]}},{"name":"network_controller_2","ip-address":"10.30.111.21","binding-profile":{"local_link_information":[{"switch_id":"a0:f8:49:f7:89:d1","port_id":"te1/0/52","switch_info":"tenant-switch"}]}}]'
```

When user starts a lease with this network, Blazar creates the network segment `10.30.0.0/16` with the specified baremetal ports and the gateway `10.30.111.1`. Inside the switch, VLAN 300 must be created with ports `te1/0/51` and `te1/0/52` subscribed to it.

### Create the VIP router

EP5G does not work if you add servers to the VIP network. Packets only know the gateway. Therefore, after the lease starts, user must create a router with an interface attached to `ep5g_vip` network and chosen to be the gateway. Moreover, as mentioned in the image, an static route must be created on the router as well: `ip route add 172.16.0.0/16 via 10.30.111.10`. This router can attach to any other network that user desires. For internet connectivity, choose the router to connect to the external public network and enable SNAT.

### Add a server behind vip network

You can create a backend network and add your compute hosts to be accessed by the end-nodes connected to the 5G network. For instance, you can create a backend network with the subnet `10.99.99.0/24` and add your compute host with `10.99.99.3/24` address as for the ip. Obviously you need to add an interface from the vip router to this network as for the gateway `10.99.99.1/24`. Then, by adding a route on the compute host to the 5G terminals from the gateway, the connection is established. If you create a container the following lables could be used for such a setup:

```
networks.1.interface=enp4s0np0,networks.1.ip=10.99.99.3/24,networks.1.routes=172.16.0.0/16-10.99.99.1
```
