Commit 22453d72 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop' of https://gitlab.com/teraflow-h2020/controller into feat/context-component

parents 61240584 dd39f4c5
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
# TeraFlow OS SDN Controller
# TeraFlowSDN Controller

[Teraflow H2020 project](https://teraflow-h2020.eu/) - Secured autonomic traffic management for a Tera of SDN Flows

@@ -7,13 +7,4 @@ Branch "master" : [![pipeline status](https://gitlab.com/teraflow-h2020/controll
Branch "develop" : [![pipeline status](https://gitlab.com/teraflow-h2020/controller/badges/develop/pipeline.svg)](https://gitlab.com/teraflow-h2020/controller/-/commits/develop) [![coverage report](https://gitlab.com/teraflow-h2020/controller/badges/develop/coverage.svg)](https://gitlab.com/teraflow-h2020/controller/-/commits/develop)

# Installation Instructions
To install TeraFlow OS SDN Controller in your local Kubernetes deployment, we assume you deployed Kubernetes following the instructions provided in [Wiki: Installing Kubernetes on your Linux machine](https://gitlab.com/teraflow-h2020/controller/-/wikis/Installing-Kubernetes-on-your-Linux-machine).

Then, follow the instructions in [Wiki: Deploying a TeraFlow OS test instance](https://gitlab.com/teraflow-h2020/controller/-/wikis/Deploying-a-TeraFlow-OS-test-instance) to deploy your instance of TeraFlow OS.

# Functional Tests
A functional test has been defined to enable experimentation with the TeraFlow OS:

__Important:__ The OpenConfigDriver, the P4Driver, and the TrandportApiDriver have to be considered as experimental. The configuration and monitoring capabilities they support are limited or partially implemented. Use them with care.

[Demo at OFC'22 (Bootstrap devices, Manage L3VPN services, Monitor Device Endpoints)](./src/tests/ofc22)
For devel and upcoming release 2.0, we have prepared the following tutorial: [TeraFlowSDN tutorial](https://gitlab.com/teraflow-h2020/controller/-/tree/develop/tutorial).
+9 −5
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package eu.teraflow.automation;

import eu.teraflow.automation.context.ContextService;
import eu.teraflow.automation.context.model.Event;
import eu.teraflow.automation.context.model.EventTypeEnum;
import io.quarkus.runtime.StartupEvent;
import java.time.Duration;
import javax.enterprise.context.ApplicationScoped;
@@ -75,11 +77,7 @@ public class ContextSubscriber {
                                case UPDATE:
                                case REMOVE:
                                case UNDEFINED:
                                    {
                                        LOGGER.warnf(
                                                "Received %s for device [%s]. [%s] event handling is not yet implemented, ignoring...",
                                                event, deviceId, eventType);
                                    }
                                    logWarningMessage(event, deviceId, eventType);
                                    break;
                            }
                        });
@@ -94,4 +92,10 @@ public class ContextSubscriber {
            LOGGER.info("Not subscribing to Context service for device events...");
        }
    }

    private void logWarningMessage(Event event, String deviceId, EventTypeEnum eventType) {
        LOGGER.warnf(
                "Received %s for device [%s]. [%s] event handling is not yet implemented, ignoring...",
                event, deviceId, eventType);
    }
}
+13 −4
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import context.ContextOuterClass.ConfigRule_Custom;
import context.ContextOuterClass.ContextId;
import context.ContextOuterClass.DeviceId;
import context.ContextOuterClass.DeviceOperationalStatusEnum;
import context.ContextOuterClass.Location.LocationCase;
import context.ContextOuterClass.Uuid;
import eu.teraflow.automation.acl.AclAction;
import eu.teraflow.automation.acl.AclEntry;
@@ -833,12 +834,14 @@ public class Serializer {
        final var serializedEndPointId = serialize(endPointId);
        final var serializedKpiSampleTypes =
                kpiSampleTypes.stream().map(this::serialize).collect(Collectors.toList());
        if (endPointLocation != null) {
            final var serializedEndPointLocation = serialize(endPointLocation);
            builder.setEndpointLocation(serializedEndPointLocation);
        }

        builder.setEndpointId(serializedEndPointId);
        builder.setEndpointType(endPointType);
        builder.addAllKpiSampleTypes(serializedKpiSampleTypes);
        builder.setEndpointLocation(serializedEndPointLocation);

        return builder.build();
    }
@@ -852,9 +855,15 @@ public class Serializer {
        final var endPointId = deserialize(serializedEndPointId);
        final var kpiSampleTypes =
                serializedKpiSampleTypes.stream().map(this::deserialize).collect(Collectors.toList());

        if (serializedEndPointLocation.getLocationCase() != LocationCase.LOCATION_NOT_SET) {
            final var endPointLocation = deserialize(serializedEndPointLocation);
            return new EndPoint.EndPointBuilder(endPointId, endPointType, kpiSampleTypes)
                    .location(endPointLocation)
                    .build();
        }

        return new EndPoint(endPointId, endPointType, kpiSampleTypes, endPointLocation);
        return new EndPoint.EndPointBuilder(endPointId, endPointType, kpiSampleTypes).build();
    }

    public ContextOuterClass.Device serialize(Device device) {
+7 −6
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package eu.teraflow.automation.acl;

import eu.teraflow.automation.common.Util;
import java.util.List;
import java.util.stream.Collectors;

public class AclRuleSet {

@@ -64,10 +64,11 @@ public class AclRuleSet {
    public String toString() {
        return String.format(
                "%s:{name:\"%s\", type:\"%s\", description:\"%s\", userId:\"%s\", [%s]}",
                getClass().getSimpleName(), name, type.toString(), description, userId, toString(entries));
    }

    private static <T> String toString(List<T> list) {
        return list.stream().map(T::toString).collect(Collectors.joining(", "));
                getClass().getSimpleName(),
                name,
                type.toString(),
                description,
                userId,
                Util.toString(entries));
    }
}
+29 −0
Original line number Diff line number Diff line
/*
* Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
*
* 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.
*/

package eu.teraflow.automation.common;

import java.util.List;
import java.util.stream.Collectors;

public class Util {

    private Util() {}

    public static <T> String toString(List<T> list) {
        return list.stream().map(T::toString).collect(Collectors.joining(", "));
    }
}
Loading