Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • eclipse-research-labs/nemo-project/nemo-infrastructure-management/federated-meta-network-cluster-controller/multi-domain-l2s-m
1 result
Show changes
Showing
with 0 additions and 1723 deletions
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: l2sm-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: l2sm-operator
namespace: default
<!---
Copyright 2024 Universidad Carlos III de Madrid
Licensed 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.
SPDX-License-Identifier: Apache-2.0
-->
# L2S-M Installation Guide (Custom Installation)
This guide provides detailed steps for installing the L2S-M Kubernetes operator, enabling you to create and manage virtual networks within your Kubernetes cluster. This custom installation is intended for debugging or understanding the L2S-M components and their functionality.
## Introduction
The L2S-M custom installation is designed for debugging purposes and gaining a deeper understanding of the L2S-M components. Follow the steps below to install the L2S-M Kubernetes operator and configure virtual networks.
## Prerequisites
Before proceeding, ensure that you meet the prerequisites outlined in the [Prerequisites section](./deployment/README.md). Refer to the [./deployment/README.md](./deployment/README.md) file for detailed instructions on meeting these requirements.
## Custom Installation Steps
Follow the steps below to perform the custom installation of L2S-M:
1. Create the virtual interface definitions using the following command:
```bash
kubectl create -f ./deployments/custom-installation/interfaces_definitions
```
2. Create the Kubernetes account Service Account and apply their configuration by applying the following command:
```bash
kubectl create -f ./deployments/config/
```
3. Create the Kubernetes Persistent Volume by using the following kubectl command:
```bash
kubectl create -f ./deployments/custom-installation/mysql/
```
4. Before deploying the L2S-M operator, it is neccessary to label your master node as the "master" of the cluster. To do so, get the names of your Kubernetes nodes, select the master and apply the "master" label with the following command:
```bash
kubectl get nodes
kubectl label nodes [your-master-node] dedicated=master
```
5. Deploy the L2S-M Controller by using the following command:
```bash
kubectl create -f ./deployments/custom-installation/deployController.yaml
```
You can check that the deployment was successful if the pod enters the "running" state using the *kubectl get pods* command.
6. After the previous preparation, (make sure the controller is running) you can deploy the operator in your cluster using the YAML deployment file:
```bash
kubectl create -f ./deployments/custom-installation/deployOperator.yaml
```
Once these two pods are in running state, you can finally deploy the virtual switches and custom CRD
7. This is done by:
**First deploying the virtual OVS Daemonset:**
```bash
kubectl create -f ./deployments/custom-installation/deploySwitch.yaml
```
And check there is a pod running in each node, with ```kubectl get pods -o wide```
8. And launch the CRD definition by:
```bash
kubectl create -f ./deployments/custom-installation/l2sm-network-crd.yaml
```
## Configuring Vxlans
Each node enables the creation of custom L2S-M networks, as can be seen in the [examples section](../../examples/) section. But for communicating pods that are in different Nodes of the cluster, additional configuration must be done, of configuring the Vxlan tunnels between them.
You can proceed to configure Vxlans by following the steps outlined in [the vxlan configuration guide.](../deployment/vxlans.md)
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: apps/v1
kind: Deployment
metadata:
name: l2sm-operator
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
l2sm-component: l2sm-opt
template:
metadata:
labels:
l2sm-component: l2sm-opt
spec:
serviceAccountName: l2sm-operator
initContainers:
- name: wait-for-l2sm-controller
image: curlimages/curl
args:
- /bin/sh
- -c
- >
set -x;
while [ $(curl -sw '%{http_code}' "http://l2sm-controller-service:8181/onos/ui" -o /dev/null) -ne 302 ]; do
sleep 15;
done;
sleep 5;
containers:
- image: alexdecb/l2sm-operator:2.3
name: l2sm-opt-pod
env:
- name: CONTROLLER_IP
value: l2sm-controller-service
#imagePullPolicy: Always
- name: mysql
image: mysql:5.7
envFrom:
- secretRef:
name: mysql-secret
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
- name: initdb-volume
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
- name: initdb-volume
configMap:
name: mysql-schema
items:
- key: init.sql
path: init.sql
nodeSelector:
dedicated: master
tolerations:
- key: dedicated
operator: Equal
value: master
effect: NoSchedule
---
apiVersion: v1
kind: Service
metadata:
name: l2sm-operator-service
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
selector:
l2sm-component: l2sm-opt
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-schema
data:
init.sql: |
CREATE DATABASE IF NOT EXISTS l2sm;
USE l2sm;
CREATE TABLE networks (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
type ENUM('vlink', 'vnet', 'ext-vnet') NOT NULL,
UNIQUE KEY unique_network_name (name, type)
);
CREATE TABLE switches (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE neds (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
provider VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE interfaces (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
pod VARCHAR(255),
switch_id INT,
ned_id INT,
network_id INT,
FOREIGN KEY (switch_id) REFERENCES switches(id),
FOREIGN KEY (ned_id) REFERENCES neds(id),
FOREIGN KEY (network_id) REFERENCES networks(id)
);
-- Define the one-to-many relationship between switches and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_switch_interface
FOREIGN KEY (switch_id)
REFERENCES switches(id);
-- Define the one-to-many relationship between neds and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_ned_interface
FOREIGN KEY (ned_id)
REFERENCES neds(id);
-- Define the many-to-one relationship between networks and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_network_interface
FOREIGN KEY (network_id)
REFERENCES networks(id);
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: l2sm-switch
#namespace: kube-system
labels:
l2sm-component: l2sm-switch
spec:
selector:
matchLabels:
l2sm-component: l2sm-switch
template:
metadata:
labels:
l2sm-component: l2sm-switch
annotations:
k8s.v1.cni.cncf.io/networks: '[{ "name": "veth1", "ips": ["fe80::58d0:b8ff:fe42:debf/64"]}, { "name": "veth2", "ips": ["fe80::58d0:b8ff:fe42:debe/64"]}, { "name": "veth3", "ips": ["fe80::58d0:b8ff:fe42:debd/64"]}, { "name": "veth4", "ips": ["fe80::58d0:b8ff:fe42:debc/64"]}, { "name": "veth5", "ips": ["fe80::58d0:b8ff:fe42:debb/64"]}, { "name": "veth6", "ips": ["fe80::58d0:b8ff:fe42:deba/64"]}, { "name": "veth7", "ips": ["fe80::58d0:b8ff:fe42:deb9/64"]}, { "name": "veth8", "ips": ["fe80::58d0:b8ff:fe42:deb8/64"]}, { "name": "veth9", "ips": ["fe80::58d0:b8ff:fe42:deb7/64"]}, { "name": "veth10", "ips": ["fe80::58d0:b8ff:fe42:deb6/64"]}]'
spec:
tolerations:
# this toleration is to have the daemonset runnable on master nodes
# remove it if your masters can't run pods
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
# initContainers:
# - name: wait-for-l2sm-operator
# image: curlimages/curl
# args:
# - /bin/sh
# - -c
# - >
# set -x;
# while [ $(curl -sw '%{http_code}' "http://l2sm-operator-service:8080/healthz" -o /dev/null) -ne 200 ]; do
# sleep 15;
# done;
# sleep 5;
containers:
- name: l2sm-switch
image: alexdecb/l2sm-switch:2.2
#args: ["setup_switch.sh && sleep infinity"]
env:
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NVETHS
value: "10"
- name: CONTROLLERIP
value: "l2sm-controller-service"
securityContext:
capabilities:
add: ["NET_ADMIN"]
nodeSelector:
kubernetes.io/arch: amd64
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"name":"veth1",
"mtu": 1400,
"device":"veth1",
"ipam": {
"type":"static"
}
}'
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-schema
data:
init.sql: |
CREATE DATABASE IF NOT EXISTS l2sm;
USE l2sm;
CREATE TABLE networks (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
type ENUM('vlink', 'vnet', 'ext-vnet') NOT NULL,
UNIQUE KEY unique_network_name (name, type)
);
CREATE TABLE switches (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE neds (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
provider VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE interfaces (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
pod VARCHAR(255),
switch_id INT,
ned_id INT,
network_id INT,
FOREIGN KEY (switch_id) REFERENCES switches(id),
FOREIGN KEY (ned_id) REFERENCES neds(id),
FOREIGN KEY (network_id) REFERENCES networks(id)
);
-- Define the one-to-many relationship between switches and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_switch_interface
FOREIGN KEY (switch_id)
REFERENCES switches(id);
-- Define the one-to-many relationship between neds and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_ned_interface
FOREIGN KEY (ned_id)
REFERENCES neds(id);
-- Define the many-to-one relationship between networks and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_network_interface
FOREIGN KEY (network_id)
REFERENCES networks(id);
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: v1
kind: Pod
metadata:
name: mysql-development-pod
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.7
envFrom:
- secretRef:
name: mysql-secret
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
- name: initdb-volume
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
- name: initdb-volume
configMap:
name: mysql-schema
items:
- key: init.sql
path: init.sql
nodeName: l2sm1
---
apiVersion: v1
kind: Service
metadata:
name: mysql-development-service
spec:
type: NodePort
ports:
- port: 3306
targetPort: 3306
nodePort: 30001
protocol: TCP
selector:
app: mysql
---
apiVersion: v1
kind: Secret
metadata:
name: mysql-secret
type: Opaque
data:
MYSQL_ROOT_PASSWORD: cGFzc3dvcmQ= # Base64 encoded "password"
MYSQL_USER: bDJzbQ== # Base64 encoded "l2sm"
MYSQL_PASSWORD: bDJzbQ== # Base64 encoded "l2sm"
MYSQL_DATABASE: bDJzbQ==
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br1",
"mtu": 1400,
"device": "inter-veth1"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth2
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br2",
"mtu": 1400,
"device": "inter-veth2"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth3
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br3",
"mtu": 1400,
"device": "inter-veth3"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth4
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br4",
"mtu": 1400,
"device": "inter-veth4"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth5
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br5",
"mtu": 1400,
"device": "inter-veth5"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth6
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br6",
"mtu": 1400,
"device": "inter-veth6"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth7
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br7",
"mtu": 1400,
"device": "inter-veth7"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth8
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br8",
"mtu": 1400,
"device": "inter-veth8"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth9
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br9",
"mtu": 1400,
"device": "inter-veth9"
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: inter-veth10
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "inter-br10",
"mtu": 1400,
"device": "inter-veth10"
}'
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: l2sm-networks.l2sm.k8s.local
spec:
group: l2sm.k8s.local
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
type:
type: string
config:
type: string
nullable: true
signature:
type: string
nullable: true
status:
type: object
properties:
connectedPods:
type: array
items:
type: string
scope: Namespaced
names:
plural: l2sm-networks
singular: l2sm-network
kind: L2SMNetwork
shortNames:
- l2sm-net
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: v1
kind: Pod
metadata:
name: ned
labels:
app: l2sm
spec:
hostNetwork: true
initContainers:
- name: wait-for-l2sm-operator
image: curlimages/curl
args:
- /bin/sh
- -c
- >
set -x;
while [ $(curl -sw '%{http_code}' "http://l2sm-operator-service:8080/healthz" -o /dev/null) -ne 200 ]; do
sleep 15;
done;
sleep 5;
containers:
- name: mycontainer
image: alexdecb/l2sm-switch:2.2
command: ["sleep", "infinity"]
securityContext:
capabilities:
add: ["NET_ADMIN"]
nodeSelector:
dedicated: master
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br1",
"mtu": 1400,
"device": "veth1",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth2
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br2",
"mtu": 1400,
"device": "veth2",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth3
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br3",
"mtu": 1400,
"device": "veth3",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth4
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br4",
"mtu": 1400,
"device": "veth4",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth5
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br5",
"mtu": 1400,
"device": "veth5",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth6
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br6",
"mtu": 1400,
"device": "veth6",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth7
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br7",
"mtu": 1400,
"device": "veth7",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth8
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br8",
"mtu": 1400,
"device": "veth8",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth9
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br9",
"mtu": 1400,
"device": "veth9",
"ipam": {
"type":"static"
}
}'
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth10
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br10",
"mtu": 1400,
"device": "veth10",
"ipam": {
"type":"static"
}
}'
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: l2sm-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: l2sm-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: l2sm-operator
namespace: default
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: l2sm-controller
spec:
replicas: 1
selector:
matchLabels:
app: l2sm-controller
template:
metadata:
labels:
app: l2sm-controller
spec:
containers:
- name: l2sm-controller
image: alexdecb/l2sm-controller:2.2
readinessProbe:
httpGet:
path: /onos/ui
port: 8181
initialDelaySeconds: 30
periodSeconds: 10
ports:
- containerPort: 6633
- containerPort: 8181
---
apiVersion: v1
kind: Service
metadata:
name: l2sm-controller-service
spec:
selector:
app: l2sm-controller
ports:
- name: of13-port
protocol: TCP
port: 6633
targetPort: 6633
- name: http-port
protocol: TCP
port: 8181
targetPort: 8181
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: l2sm-operator
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
l2sm-component: l2sm-opt
template:
metadata:
labels:
l2sm-component: l2sm-opt
spec:
serviceAccountName: l2sm-operator
initContainers:
- name: wait-for-l2sm-controller
image: curlimages/curl
args:
- /bin/sh
- -c
- >
set -x;
while [ $(curl -sw '%{http_code}' "http://l2sm-controller-service:8181/onos/ui" -o /dev/null) -ne 302 ]; do
sleep 15;
done;
sleep 5;
containers:
- image: alexdecb/l2sm-operator:2.3
name: l2sm-opt-pod
env:
- name: CONTROLLER_IP
value: l2sm-controller-service
#imagePullPolicy: Always
- name: mysql
image: mysql:5.7
envFrom:
- secretRef:
name: mysql-secret
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
- name: initdb-volume
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
- name: initdb-volume
configMap:
name: mysql-schema
items:
- key: init.sql
path: init.sql
nodeSelector:
dedicated: master
tolerations:
- key: dedicated
operator: Equal
value: master
effect: NoSchedule
---
apiVersion: v1
kind: Service
metadata:
name: l2sm-operator-service
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
selector:
l2sm-component: l2sm-opt
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-schema
data:
init.sql: |
CREATE DATABASE IF NOT EXISTS l2sm;
USE l2sm;
CREATE TABLE networks (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
type ENUM('vlink', 'vnet', 'ext-vnet') NOT NULL,
UNIQUE KEY unique_network_name (name, type)
);
CREATE TABLE switches (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE neds (
id INT PRIMARY KEY AUTO_INCREMENT,
node_name VARCHAR(255) NOT NULL,
provider VARCHAR(255) NOT NULL,
openflowId TEXT,
ip VARCHAR(15)
);
CREATE TABLE interfaces (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255),
pod VARCHAR(255),
switch_id INT,
ned_id INT,
network_id INT,
FOREIGN KEY (switch_id) REFERENCES switches(id),
FOREIGN KEY (ned_id) REFERENCES neds(id),
FOREIGN KEY (network_id) REFERENCES networks(id)
);
-- Define the one-to-many relationship between switches and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_switch_interface
FOREIGN KEY (switch_id)
REFERENCES switches(id);
-- Define the one-to-many relationship between neds and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_ned_interface
FOREIGN KEY (ned_id)
REFERENCES neds(id);
-- Define the many-to-one relationship between networks and interfaces
ALTER TABLE interfaces
ADD CONSTRAINT fk_network_interface
FOREIGN KEY (network_id)
REFERENCES networks(id);
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: l2sm-switch
#namespace: kube-system
labels:
l2sm-component: l2sm-switch
spec:
selector:
matchLabels:
l2sm-component: l2sm-switch
template:
metadata:
labels:
l2sm-component: l2sm-switch
annotations:
k8s.v1.cni.cncf.io/networks: veth1, veth2, veth3, veth4, veth5, veth6, veth7, veth8, veth9, veth10
spec:
tolerations:
# this toleration is to have the daemonset runnable on master nodes
# remove it if your masters can't run pods
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
initContainers:
- name: wait-for-l2sm-operator
image: curlimages/curl
args:
- /bin/sh
- -c
- >
set -x;
while [ $(curl -sw '%{http_code}' "http://l2sm-operator-service:8080/healthz" -o /dev/null) -ne 200 ]; do
sleep 15;
done;
sleep 5;
containers:
- name: l2sm-switch
image: alexdecb/l2sm-switch:2.2
#args: ["setup_switch.sh && sleep infinity"]
env:
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NVETHS
value: "10"
- name: CONTROLLERIP
value: "l2sm-controller-service"
securityContext:
capabilities:
add: ["NET_ADMIN"]
nodeSelector:
kubernetes.io/arch: amd64
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: l2sm-networks.l2sm.k8s.local
spec:
group: l2sm.k8s.local
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
type:
type: string
config:
type: string
nullable: true
signature:
type: string
nullable: true
status:
type: object
properties:
connectedPods:
type: array
items:
type: string
scope: Namespaced
names:
plural: l2sm-networks
singular: l2sm-network
kind: L2SMNetwork
shortNames:
- l2sm-net
<!---
Copyright 2024 Universidad Carlos III de Madrid
Licensed 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.
SPDX-License-Identifier: Apache-2.0
-->
# L2S-M VxLAN configuration guide
In order to connect the switches between themselves, an additional configuration must be done. A configuration file specifying which nodes we want to connect and which IP addresses their switches have will be made, and then a script will be run in each **l2sm-switch**, using this configuration file.
a. Create a file anywhere or use the reference in ./configs/sampleFile.json. In this installation, this file will be used as a reference.
b. In this file, you will specify, using the template shown in the reference file, the name of the nodes in the cluster and the IP addresses of **the switches** running on them. For example:
```bash
$ kubectl get pods -o wide
>NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
>l2sm-controller-d647b7fb5-lpp2h 1/1 Running 0 30m 10.1.14.55 l2sm1 <none> <none>
>l2sm-operator-7d487d8468-lhgkx 2/2 Running 0 2m11s 10.1.14.56 l2sm1 <none> <none>
>l2sm-switch-8p5td 1/1 Running 0 71s 10.1.14.58 l2sm1 <none> <none>
>l2sm-switch-xdkvz 1/1 Running 0 71s 10.1.72.111 l2sm2 <none> <none>
```
In this example we have two nodes: l2sm1 and l2sm2, with two switches, with IP addresses 10.1.14.58 and 10.1.72.111.
We want to connect them directly, so we modify the reference file, ./configs/sampleFile.json:
```json
[
{
"name": "<NODE_SWITCH_1>",
"nodeIP": "<IP_SWITCH_1>",
"neighborNodes": ["<NODE_SWITCH_2>"]
},
{
"name": "<NODE_SWITCH_2>",
"nodeIP": "<IP_SWITCH_2>",
"neighborNodes": ["<NODE_SWITCH_1>"]
}
]
```
Note: The parameters to be changed are shown in the NODE and IP columns of the table above.
Example of how it looks:
```json
[
{
"name": "l2sm1",
"nodeIP": "10.1.14.58",
"neighborNodes": ["l2sm2"]
},
{
"name": "l2sm2",
"nodeIP": "10.1.72.111",
"neighborNodes": ["l2sm1"]
}
]
```
Note: Any number of nodes can be configured, as long as the entry is in this file. The desired connections are under the neighborNodes field, in an array, such as this other example, where we add a neighbor to l2sm2: ["l2sm1","l2sm3"]
Once this file is created, we inject it to each node using the kubectl cp command:
```bash
kubectl cp ./configs/sampleFile.json <pod-name>:/etc/l2sm/switchConfig.json
```
And then executing the script in the switch-pod:
```bash
kubectl exec -it <switch-pod-name> -- /bin/bash -c 'l2sm-vxlans --node_name=$NODENAME /etc/l2sm/switchConfig.json'
```
This must be done in each switch-pod. In the provided example, using two nodes, l2sm1 and l2sm2, we have to do it twice, in l2-ps-8p5td and l2-ps-xdkvz.
When the exec command is done, we should see an output like this:
```bash
kubectl exec -it l2sm-switch-8p5td -- /bin/bash -c 'l2sm-vxlans --node_name=$NODENAME /etc/l2sm/switchConfig.json'
Defaulted container "l2sm-switch" out of: l2sm-switch, wait-for-l2sm-controller (init)
Created vxlan between node l2sm1 and node l2sm2.
```
You are all set! If you want to learn how to create virtual networks and use them in your applications, [check the following section of the repository](../examples)
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: v-network-1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "l2sm",
"device": "l2sm-vNet"
}'
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: v-network-2
spec:
config: '{
"cniVersion": "0.3.0",
"type": "l2sm",
"device": "l2sm-vNet"
}'
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
apiVersion: l2sm.k8s.local/v1
kind: L2SMNetwork
metadata:
name: spain-network
spec:
type: inter-vnet
config: |
{
"provider": {
"name": "uc3m",
"domain": "idco.uc3m.es"
},
"accessList": ["public-key-1", "public-key-2"]
}
signature: sxySO0jHw4h1kcqO/LMLDgOoOeH8dOn8vZWv4KMBq0upxz3lcbl+o/36JefpEwSlBJ6ukuKiQ79L4rsmmZgglk6y/VL54DFyLfPw9RJn3mzl99YE4qCaHyEBANSw+d5hPaJ/I8q+AMtjrYpglMTRPf0iMZQMNtMd0CdeX2V8aZOPCQP75PsZkWukPdoAK/++y1vbFQ6nQKagvpUZfr7Ecb4/QY+hIAzepm6N6lNiFNTgj6lGTrFK0qCVfRhMD+vXbBP6xzZjB2N1nIheK9vx7kvj3HORjZ+odVMa+AOU5ShSKpzXTvknrtcRTcWWmXPNUZLoq5k3U+z1g1OTFcjMdQ====
<!---
Copyright 2024 Universidad Carlos III de Madrid
Licensed 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.
SPDX-License-Identifier: Apache-2.0
-->
# Vlink 'ping-pong' example
## Introduction
This document provides a guide for L2S-M users. It focuses on creating a virtual link (`vlink`) network and managing traffic flows between pods across different nodes using L2S-M components.
## Prerequisites
- A Kubernetes cluster
- Multus CNI installed
- L2S-M and all of its components deployed
## Overview of Components
- **L2S-M Operator**: A Kubernetes operator that listens for Kubernetes events and manages network configurations programmatically. It interacts with the L2S-M Controller and uses a database to store network configurations and state.
- **L2S-M Controller**: An SDN controller based on ONOS, leveraging OpenFlow 1.3 to communicate with L2S-M Switches and manage network flows.
- **L2S-M Switch**: Pods that facilitate traffic flows as per the L2S-M Controller's instructions, ensuring isolated and direct connectivity between specific pods.
## Creating a Vlink Network
The first step involves creating a `vlink` network, named "vlink-sample", using our L2SMNetwork CRD. This network facilitates direct, isolated communication between pods across different nodes, through custom paths.
```yaml
apiVersion: l2sm.k8s.local/v1
kind: L2SMNetwork
metadata:
name: vlink-sample
spec:
type: vlink
config: |
{
"overlay-parameters": {
"path": {
"name": "first-path",
"FromEndpoint": "node-a",
"ToEndpoint": "node-e",
"links": ["link-ac","link-cd","link-de"],
"capabilities": {
"bandwidthBits": "20M",
"latencyNanos": "8e5"
}
},
"reverse-path": {
"name": "second-path",
"fromEndpoint": "node-e",
"toEndpoint": "node-a",
"links": ["link-ed","link-db","link-ba"]
}
}
}
```
### Process Overview
1. **Vlink Creation**: Deploy the `vlink-sample` YAML configuration to define the vlink network.
2. **L2SM Operator Activation**: Upon recognizing the new network configuration, the L2SM operator initiates, contacting the L2SM controller. This process includes saving the network path information for future use.
3. **L2SM Controller**: The controller is informed about the new network but does not initiate traffic flow immediately. It waits for pods to be connected to the network.
## Deploying Pods with Network Annotations
Deployment involves creating pods with specific annotations to connect them to the `vlink-sample` network. This section explains how PodA and PodB are deployed and managed within the network.
### Deploying pod 'ping'
```yaml
apiVersion: v1
kind: Pod
metadata:
name: ping
labels:
app: ping-pong
annotations:
l2sm/networks: '[
{ "name": "vlink-sample",
"ips": ["192.168.1.2/24"]
}]'
spec:
containers:
- name: router
command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
image: alpine:latest
securityContext:
capabilities:
add: ["NET_ADMIN"]
nodeName: NodeA
```
- **Pod Configuration**: Pod 'ping' is defined with the `vlink-sample` annotation and an "ips" argument specifying its IP address. If no IP is specified, the connection defaults to layer 2.
- **Connection to L2SM-Switch**: Pod 'ping' is attached via Multus to an L2S.M component known as the l2sm-switch, controlled by the L2S-M controller. This grants 'ping' two network interfaces: the default (provided by Flannel or Calico) and the new vlink interface.
### Deploying PodB
```yaml
apiVersion: v1
kind: Pod
metadata:
name: pong
labels:
app: ping-pong
annotations:
l2sm/networks: '[
{ "name": "vlink-sample",
"ips": ["192.168.1.3/24"]
}]'
spec:
containers:
- name: router
command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
image: alpine:latest
securityContext:
capabilities:
add: ["NET_ADMIN"]
nodeName: NodeE
```
- **Node Placement**: Pod 'pong' is created on NodeE with the `vlink-sample` network annotation but uses a different IP address than pod 'ping'.
- **Network Connectivity**: The L2SM controller then establishes the necessary intents and flows, ensuring traffic between 'ping' and 'pong' traverses the predefined nodes. This setup guarantees direct, isolated connectivity between the two pods.
File deleted
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0
#-------------------------------------------------------------------------------
# turn on bash's job control
set -m
# Start the onos server and put it on the background
./bin/onos-service server &
sleep 10
while true; do
response=$(wget --spider --server-response http://localhost:8181/onos/ui 2>&1)
status_codes=$(echo "$response" | awk '/HTTP\/1.1/{print $2}')
if echo "$status_codes" | grep -q "200"; then
echo "Starting the configuration"
break
fi
sleep 10
done
# Start the configuration
./bin/onos-app localhost activate org.onosproject.drivers
./bin/onos-app localhost activate org.onosproject.lldpprovider
./bin/onos-app localhost activate org.onosproject.openflow-base
./bin/onos-app localhost activate org.onosproject.optical-model
./bin/onos-app localhost install! l2sm-controller-app-1.0.oar
# now we bring the server into the foreground
fg %1
\ No newline at end of file