Skip to content
Snippets Groups Projects
Commit 48d4900a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop-stable-pre-release3' of...

Merge branch 'develop-stable-pre-release3' of https://labs.etsi.org/rep/tfs/controller into feat/smartnics
parent 6350af81
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!212Resolve "(CNIT) Integrate leftover common contributions related to Optical Controller component"
......@@ -20,10 +20,13 @@
export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/"
# Set the list of components, separated by spaces, you want to build images for, and deploy.
export TFS_COMPONENTS="context device pathcomp opticalcontroller service slice webui "
export TFS_COMPONENTS="context device pathcomp service slice nbi webui load_generator"
# Uncomment to activate Monitoring
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"../
#export TFS_COMPONENTS="${TFS_COMPONENTS} monitoring"
# Uncomment to activate BGP-LS Speaker
#export TFS_COMPONENTS="${TFS_COMPONENTS} bgpls_speaker"
# Uncomment to activate ZTP
#export TFS_COMPONENTS="${TFS_COMPONENTS} ztp"
......
......@@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO: migrate to NetworkX:
# https://networkx.org/documentation/stable/index.html
# https://networkx.org/documentation/stable/reference/algorithms/shortest_paths.html
import sys
class Vertex:
......@@ -233,4 +237,4 @@ if __name__ == '__main__':
print ('The shortest path : %s' %(path[::-1]))"""
p = shortest_path(g, g.get_vertex('a'), g.get_vertex('e'))
print(p)
\ No newline at end of file
print(p)
......@@ -62,16 +62,15 @@ RUN python3 -m pip install -r requirements.txt
# Add component files into working directory
WORKDIR /var/teraflow
COPY src/service/. service/
#COPY src/context/__init__.py context/__init__.py
#COPY src/context/client/. context/client/
COPY src/context/. context/.
COPY src/context/__init__.py context/__init__.py
COPY src/context/client/. context/client/
COPY src/device/__init__.py device/__init__.py
COPY src/device/client/. device/client/
COPY src/pathcomp/frontend/__init__.py pathcomp/frontend/__init__.py
COPY src/pathcomp/frontend/client/. pathcomp/frontend/client/
COPY src/e2e_orchestrator/__init__.py e2e_orchestrator/__init__.py
COPY src/e2e_orchestrator/client/. e2e_orchestrator/client/
COPY src/service/. service/
# Start the service
ENTRYPOINT ["python", "-m", "service.service"]
......@@ -12,12 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging, signal, sys, threading,os
import logging, signal, sys, threading
from prometheus_client import start_http_server
from common.Constants import ServiceNameEnum
from common.Settings import (
ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, get_env_var_name, get_log_level, get_metrics_port,
wait_for_environment_variables,find_environment_variables)
wait_for_environment_variables
)
from .ServiceService import ServiceService
from .service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory
from .service_handlers import SERVICE_HANDLERS
......@@ -43,18 +44,8 @@ def main():
get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_PORT_GRPC),
get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_HOST ),
get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_PORT_GRPC),
get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_HOST),
get_env_var_name(ServiceNameEnum.PATHCOMP, ENVVAR_SUFIX_SERVICE_PORT_GRPC)
])
#Commented for merging with develop branch
# variables= find_environment_variables([
# get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_HOST),
# get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_PORT_GRPC),
# ])
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
......
......@@ -12,11 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging , json
import json, logging
from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from common.method_wrappers.ServiceExceptions import NotFoundException
from common.proto.context_pb2 import Connection, ConnectionId, Device, DeviceDriverEnum, DeviceId, Service, ServiceId,OpticalConfig,OpticalConfigId
from common.proto.context_pb2 import (
Connection, ConnectionId, Device, DeviceDriverEnum, DeviceId, Service, ServiceId,
OpticalConfig, OpticalConfigId
)
from common.tools.context_queries.Connection import get_connection_by_id
from common.tools.context_queries.Device import get_device
from common.tools.context_queries.Service import get_service_by_id
......@@ -25,7 +28,8 @@ from common.tools.object_factory.Device import json_device_id
from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient
from service.service.service_handler_api.Exceptions import (
UnsatisfiedFilterException, UnsupportedFilterFieldException, UnsupportedFilterFieldValueException)
UnsatisfiedFilterException, UnsupportedFilterFieldException, UnsupportedFilterFieldValueException
)
from service.service.service_handler_api.ServiceHandlerFactory import ServiceHandlerFactory, get_service_handler_class
from service.service.tools.ObjectKeys import get_connection_key, get_device_key, get_service_key
......@@ -114,39 +118,27 @@ class TaskExecutor:
self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device)
# New function Andrea for Optical Devices
def configure_optical_device(self,device:Device,settings:str,flows:list,is_opticalband:bool):
def configure_optical_device(self, device : Device, settings : str, flows : list, is_opticalband : bool):
device_key = get_device_key(device.device_id)
myid=OpticalConfigId()
myid.opticalconfig_uuid=device.device_id.device_uuid.uuid
opticalconfig=OpticalConfig()
setting =settings.value if settings else ""
new_config={}
myid = OpticalConfigId()
myid.opticalconfig_uuid = device.device_id.device_uuid.uuid
opticalconfig = OpticalConfig()
setting = settings.value if settings else ""
new_config = {}
try:
result=self._context_client.SelectOpticalConfig(myid)
new_config=json.loads(result.config)
if result is not None :
new_config["new_config"]=setting
new_config["is_opticalband"]=is_opticalband
new_config["flow"]=flows
result.config = str(new_config)
opticalconfig.CopyFrom(result)
self._device_client.ConfigureOpticalDevice(opticalconfig)
self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device)
result = self._context_client.SelectOpticalConfig(myid)
new_config = json.loads(result.config)
if result is not None :
new_config["new_config"] = setting
new_config["is_opticalband"] = is_opticalband
new_config["flow"] = flows
result.config = str(new_config)
opticalconfig.CopyFrom(result)
self._device_client.ConfigureOpticalDevice(opticalconfig)
self._store_grpc_object(CacheableObjectType.DEVICE, device_key, device)
except Exception as e:
LOGGER.info("error in config my config %s",e)
def get_device_controller(self, device : Device) -> Optional[Device]:
#json_controller = None
#for config_rule in device.device_config.config_rules:
......
......@@ -15,45 +15,46 @@
import json
import requests
import uuid ,os
import uuid
from common.Constants import *
from typing import Dict, List
from common.proto.context_pb2 import(
Device, DeviceId, Service, Connection, EndPointId, TopologyId, ContextId, Uuid, ConfigRule, ConfigActionEnum, ConfigRule_Custom)
Device, DeviceId, Service, Connection, EndPointId, TopologyId, ContextId, Uuid,
ConfigRule, ConfigActionEnum, ConfigRule_Custom
)
from common.proto.pathcomp_pb2 import PathCompReply
from typing import Dict, List, Optional, Tuple
from common.Constants import ServiceNameEnum
from common.Settings import (
ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables ,get_env_var_name)
ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name
)
from context.service.database.uuids.EndPoint import endpoint_get_uuid
from service.service.tools.replies import reply_uni_txt, optical_band_uni_txt, reply_bid_txt, optical_band_bid_txt
log = logging.getLogger(__name__)
testing = False
opticalcontrollers_url= find_environment_variables([
get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_HOST),
get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_PORT_GRPC),
])
OPTICAL_IP=opticalcontrollers_url[get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_HOST)]
OPTICAL_PORT=opticalcontrollers_url[get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER,ENVVAR_SUFIX_SERVICE_PORT_GRPC)]
log.info(OPTICAL_IP,OPTICAL_PORT)
def get_uuids_from_names(devices: List[Device], device_name: str, port_name: str):
VAR_NAME_OPTICAL_CONTROLLER_HOST = get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER, ENVVAR_SUFIX_SERVICE_HOST)
VAR_NAME_OPTICAL_CONTROLLER_PORT = get_env_var_name(ServiceNameEnum.OPTICALCONTROLLER, ENVVAR_SUFIX_SERVICE_PORT_GRPC)
opticalcontrollers_url = find_environment_variables([
VAR_NAME_OPTICAL_CONTROLLER_HOST,
VAR_NAME_OPTICAL_CONTROLLER_PORT,
])
OPTICAL_IP = opticalcontrollers_url.get(VAR_NAME_OPTICAL_CONTROLLER_HOST)
OPTICAL_PORT = opticalcontrollers_url.get(VAR_NAME_OPTICAL_CONTROLLER_PORT)
log.info(str(OPTICAL_IP), str(OPTICAL_PORT))
def get_uuids_from_names(devices: List[Device], device_name: str, port_name: str):
device_uuid = ""
port_uuid = ""
for device in devices:
if device.name == device_name:
device_uuid = device.device_id.device_uuid.uuid
for ep in device.device_endpoints:
if ep.name == port_name:
port_uuid = ep.endpoint_id.endpoint_uuid.uuid
return device_uuid, port_uuid
return "", ""
......@@ -296,4 +297,4 @@ def add_service_to_reply(reply : PathCompReply, service : Service)-> Service:
def add_connection_to_reply(reply : PathCompReply)-> Connection:
conn = reply.connections.add()
return conn
\ No newline at end of file
return conn
# start topology , 2 Transponders Openconfig and 2 multi granular Roadms :
# OFC'24 - Test scenario
## Start Topology
Topology is composed of 2 transponders managed through OpenConfig and 2 Multi-granular ROAMDS
Strat the topology executing the following command:
```bash
sudo ./start_topo.sh
```
# populate tfs context in (pushing the json files) following the file index , i.e : 1 , 2
# last json is with ID 7 is the service , to check the service is onboarded successfully go into the srevice interface
# of tfs webGui
# to check if the devices are configured , run
screen -r tx with x = 1, 2,3 , 4
# to release the terminal , press ctrl + a + d
\ No newline at end of file
## Populate the TFS context and topology
Pushing the JSON files following the file indexes, i.e, 1, 2, 3, ...
The last JSON file with ID 7 is the service.
To check the service is onboarded successfully go into the TFS WebUI and check the `Service` tab.
## Check configuration in devices
Check if the devices are configured properly.
To check that, run, for each device (X={1, 2, 3, 4}):
```bash
screen -r tX
```
To release the terminal, press `Ctrl + A + D`
#!/bin/bash
<<<<<<< HEAD:ofc24/start_topo.sh
=======
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -14,11 +12,11 @@
# 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.
>>>>>>> d5bb84dd9f53b483dcb31ec12a061abe21668703:src/tests/ofc24/start_topo.sh
IMAGE_NAME="asgamb1/oc23bgp.img:latest"
Docker_Container=$1
Docker_Port="2022"
DOCKER_CONTAINER=$1
DOCKER_PORT="2022"
sudo docker stop na1 -t 1
sudo docker stop na2 -t 1
sudo docker stop na3 -t 1
......@@ -43,16 +41,14 @@ echo "Creating Transponder Agents"
screen -dmS t1 -T xterm sh -c "docker run -p 127.0.0.1:2023:2022 -v ~/tempOC/files:/files --name $Docker_Container -it asgamb1/oc23bgp.img:latest bash"
screen -dmS t1 -T xterm sh -c "docker run -p 127.0.0.1:2023:2022 -v ~/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest bash"
sleep 2
if [ "$( docker container inspect -f '{{.State.Running}}' "$Docker_Container")" = "true" ]; then
docker exec "$Docker_Container" cp /files/demoECOC21_4.xml demoECOC21.xml
docker exec "$Docker_Container" /confd/examples.confd/OC23/startNetconfAgent.sh
if [ "$( docker container inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then
docker exec "$DOCKER_CONTAINER" cp /files/demoECOC21_4.xml demoECOC21.xml
docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh
else
echo "your container is not running yet"
fi
echo " It may take a while , Hang on ..."
source "./startExtraNetConfigAgent.sh" "na1" "2023"
......@@ -61,9 +57,7 @@ sleep 3
source "./startExtraNetConfigAgent.sh" "na2" "2024"
sleep 3
R1
bash -c "cp /tempOC/files/plat_r1.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh"
R2
bash -c "cp /tempOC/files/plat_r2.xml /confd/examples.confd/OC23/init_openconfig-platform.xml; ./startNetconfAgent.sh"
screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.15:2025:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh'
screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.15:2026:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment