Skip to content
Snippets Groups Projects
Commit b6c402e1 authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Merge branch 'feat/tid-pcep' of https://labs.etsi.org/rep/tfs/controller into...

Merge branch 'feat/tid-pcep' of https://labs.etsi.org/rep/tfs/controller into feat/tid-new-pcep-component
parents d7c899e9 8463e6d2
No related branches found
No related tags found
1 merge request!205Draft: Resolve "(TID) New PCEP component"
syntax = "proto3"; syntax = "proto3";
package src.main.proto; package src.main.proto;
//el modulo python abre la comunicacion
//el servidor java responde con un ACK (En caso de que se haya mandado un comando) o con la informacion de la LSPDB (En caso de peticion de LSPDB)
// Command request from the client // Command request from the client
message commandRequest{ message commandRequest{
string command = 1; string command = 1;
......
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) # Copyright 2022-2024 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
......
# Add here your files containing confidential testbed details such as IP addresses, ports, usernames, passwords, etc.
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# 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.
...@@ -90,6 +90,7 @@ COPY --chown=webui:webui src/pcep/client/. pcep/client/ ...@@ -90,6 +90,7 @@ COPY --chown=webui:webui src/pcep/client/. pcep/client/
COPY --chown=webui:webui src/pcep/service/tools/. pcep/service/tools/ COPY --chown=webui:webui src/pcep/service/tools/. pcep/service/tools/
COPY --chown=webui:webui src/bgpls_speaker/__init__.py bgpls_speaker/__init__.py COPY --chown=webui:webui src/bgpls_speaker/__init__.py bgpls_speaker/__init__.py
COPY --chown=webui:webui src/bgpls_speaker/client/. bgpls_speaker/client/ COPY --chown=webui:webui src/bgpls_speaker/client/. bgpls_speaker/client/
COPY --chown=webui:webui src/pcep/__init__.py pcep/__init__.py
COPY --chown=webui:webui src/pcep/client/. pcep/client/
# Start the service # Start the service
ENTRYPOINT ["python", "-m", "webui.service"] ENTRYPOINT ["python", "-m", "webui.service"]
...@@ -105,6 +105,9 @@ def create_app(use_config=None, web_app_root=None): ...@@ -105,6 +105,9 @@ def create_app(use_config=None, web_app_root=None):
from webui.service.policy_rule.routes import policy_rule # pylint: disable=import-outside-toplevel from webui.service.policy_rule.routes import policy_rule # pylint: disable=import-outside-toplevel
app.register_blueprint(policy_rule) app.register_blueprint(policy_rule)
from webui.service.pcep.routes import pcep # pylint: disable=import-outside-toplevel
app.register_blueprint(pcep)
app.jinja_env.globals.update({ # pylint: disable=no-member app.jinja_env.globals.update({ # pylint: disable=no-member
'enumerate' : enumerate, 'enumerate' : enumerate,
'grpc_message_to_json': grpc_message_to_json, 'grpc_message_to_json': grpc_message_to_json,
......
# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
#
# 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.
import logging # Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
from flask import render_template, Blueprint, flash, session, redirect, url_for #
# 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.
import json,logging
from flask import render_template, Blueprint, flash, session, redirect, url_for, request
from common.proto.context_pb2 import ( from common.proto.context_pb2 import (
DeviceDriverEnum, DeviceList, DeviceOperationalStatusEnum, ConfigActionEnum, Device, DeviceDriverEnum, DeviceId, DeviceList, DeviceOperationalStatusEnum,
Empty, TopologyId) Empty, TopologyId)
from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Context import json_context_id
from common.tools.object_factory.Topology import json_topology_id from common.tools.object_factory.Topology import json_topology_id
from context.client.ContextClient import ContextClient from context.client.ContextClient import ContextClient
from device.client.DeviceClient import DeviceClient from device.client.DeviceClient import DeviceClient
from webui.service.pcep.forms import SendPathForm from webui.service.pcep.forms import ConfigIpPCEForm, SendPathForm
from pcep.client.PcepClient import PcepClient from pcep.client.PcepClient import PcepClient
from pcep.service.tools.Grpc_TestClient.gRPC_PCEPClient import GrpcPcepClient from pcep.service.tools.Grpc_TestClient.gRPC_PCEPClient import GrpcPcepClient
from webui.service.device.forms import AddDeviceForm
from common.DeviceTypes import DeviceTypeEnum
from common.proto.pcep_pb2 import (PceIpRq, RequestRq)
pcep = Blueprint('pcep', __name__, url_prefix='/pcep') pcep = Blueprint('pcep', __name__, url_prefix='/pcep')
context_client = ContextClient() context_client = ContextClient()
...@@ -44,10 +62,15 @@ def home(): ...@@ -44,10 +62,15 @@ def home():
device for device in grpc_devices.devices device for device in grpc_devices.devices
if device.device_id.device_uuid.uuid in topo_device_uuids if device.device_id.device_uuid.uuid in topo_device_uuids
] ]
# ListNewDevices discovered from bgpls # ListNewDevices discovered from bgpls
logger.info('pcep/home') logger.info('pcep/home')
context_client.close() pcep_client.connect()
logger.info('pcep_client.connect %s',pcep_client)
context_client.close()
pcep_client.close()
return render_template( return render_template(
'pcep/home.html', devices=devices, dde=DeviceDriverEnum, 'pcep/home.html', devices=devices, dde=DeviceDriverEnum,
dose=DeviceOperationalStatusEnum) dose=DeviceOperationalStatusEnum)
...@@ -196,6 +219,21 @@ def detail(device_uuid: str): ...@@ -196,6 +219,21 @@ def detail(device_uuid: str):
dde=DeviceDriverEnum, dde=DeviceDriverEnum,
dose=DeviceOperationalStatusEnum) dose=DeviceOperationalStatusEnum)
@pcep.route('addPcep', methods=['GET', 'POST'])
def addPcep():
pcep_client.connect()
form = ConfigIpPCEForm()
if form.validate_on_submit():
logger.info('addPcep ip:%s',form.pce_address.data)
pcep_client.configuratePCE(PceIpRq(address=form.pce_address.data))
logger.info('Prueba 1')
flash(f'Pcep "{form.pce_address.data}" added successfully!', 'success')
logger.info('Prueba 2')
pcep_client.close()
logger.info('Prueba 3')
return render_template('pcep/addPcep.html',form=form)
@pcep.route('sendPath', methods=['GET', 'POST']) @pcep.route('sendPath', methods=['GET', 'POST'])
def sendPath(): def sendPath():
......
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