diff --git a/manifests/pcepservice.yaml b/manifests/pcepservice.yaml index 4a7e93949d05414603418e086d7bcc5f91569c47..f5269fe624fca272510a263e3aa815317c6ea27e 100644 --- a/manifests/pcepservice.yaml +++ b/manifests/pcepservice.yaml @@ -55,7 +55,6 @@ spec: cpu: 500m memory: 512Mi --- -#Internal ClusterIP service apiVersion: v1 kind: Service metadata: @@ -83,21 +82,3 @@ spec: protocol: TCP port: 6666 targetPort: 6666 - -#NodePortService -# apiVersion: v1 -# kind: Service -# metadata: -# name: pceservice-ext -# labels: -# app: pceservice -# spec: -# type: NodePort -# externalTrafficPolicy: Local -# selector: -# app: pceservice -# ports: -# - name: pcep -# protocol: TCP -# port: 4189 -# targetPort: 4189 diff --git a/proto/pcep.proto b/proto/pcep.proto new file mode 100644 index 0000000000000000000000000000000000000000..c238e24bb43e54ecfd3a3c26bfdd381ad7a87b4f --- /dev/null +++ b/proto/pcep.proto @@ -0,0 +1,40 @@ +// 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. + +syntax = "proto3"; +package pcep; + + +service PcepService { + rpc sendRequest ( RequestRq ) returns ( RequestRp ) {} + rpc configuratePCE ( PceIpRq ) returns ( PceIpRp ) {} +} + +message RequestRq { + string command = 1; +} + +message RequestRp { + string commandRp = 1; +} + +message PceIpRq { + string address=1; + string port= 2; + string asNumber=3; +} + +message PceIpRp{ + string addressRp=1; +} diff --git a/scripts/show_logs_pcep.sh b/scripts/show_logs_pcep.sh new file mode 100755 index 0000000000000000000000000000000000000000..af7cccd96c7ab774974bbf6a2802e397f7b0f24f --- /dev/null +++ b/scripts/show_logs_pcep.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# 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. + +######################################################################################################################## +# Define your deployment settings here +######################################################################################################################## + +# If not already set, set the name of the Kubernetes namespace to deploy to. +export TFS_K8S_NAMESPACE=${TFS_K8S_NAMESPACE:-"tfs"} + +######################################################################################################################## +# Automated steps start here +######################################################################################################################## + +kubectl --namespace $TFS_K8S_NAMESPACE logs deployment/pcepservice -c server diff --git a/src/common/Constants.py b/src/common/Constants.py index 8d77ff7c9af86b73fdac2421f757a2570386963a..0bf1b26fe653a3976a8790e01576cce421f48c2e 100644 --- a/src/common/Constants.py +++ b/src/common/Constants.py @@ -56,6 +56,7 @@ class ServiceNameEnum(Enum): OPTICALATTACKDETECTOR = 'opticalattackdetector' OPTICALATTACKMITIGATOR = 'opticalattackmitigator' CACHING = 'caching' + PCEP = 'pcep' TE = 'te' FORECASTER = 'forecaster' E2EORCHESTRATOR = 'e2e-orchestrator' @@ -93,6 +94,7 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.OPTICALATTACKMANAGER .value : 10005, ServiceNameEnum.INTERDOMAIN .value : 10010, ServiceNameEnum.PATHCOMP .value : 10020, + ServiceNameEnum.PCEP .value : 10050, ServiceNameEnum.TE .value : 10030, ServiceNameEnum.FORECASTER .value : 10040, ServiceNameEnum.E2EORCHESTRATOR .value : 10050, diff --git a/src/device/service/driver_api/_Driver.py b/src/device/service/driver_api/_Driver.py index 9612952fe4c1da3beb2534f26da68f630f2acacb..1643ecdd071724d1f8d830044e4a0e12f71c0abb 100644 --- a/src/device/service/driver_api/_Driver.py +++ b/src/device/service/driver_api/_Driver.py @@ -24,8 +24,6 @@ RESOURCE_NETWORK_INSTANCES = '__network_instances__' RESOURCE_ROUTING_POLICIES = '__routing_policies__' RESOURCE_SERVICES = '__services__' RESOURCE_ACL = '__acl__' -RESOURCE_INVENTORY = '__inventory__' - class _Driver: def __init__(self, name : str, address: str, port: int, **settings) -> None: diff --git a/src/device/service/drivers/openconfig/templates/__init__.py b/src/device/service/drivers/openconfig/templates/__init__.py index a209d9607c8dca0b5ce09b7b98592a7cdb9b9aaf..2b75b92a790ac4eda9436907f5b84d9797371f59 100644 --- a/src/device/service/drivers/openconfig/templates/__init__.py +++ b/src/device/service/drivers/openconfig/templates/__init__.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ast import List, Tuple import json, logging, lxml.etree as ET, re import time from typing import Any, Dict, Optional @@ -33,7 +32,6 @@ from .acl.acl_adapter_ipinfusion_proprietary import acl_cr_to_dict_ipinfusion_pr LOGGER = logging.getLogger(__name__) ALL_RESOURCE_KEYS = [ - RESOURCE_INVENTORY, RESOURCE_ENDPOINTS, RESOURCE_INTERFACES, RESOURCE_ROUTING_POLICIES, # routing policies should come before network instances @@ -42,7 +40,6 @@ ALL_RESOURCE_KEYS = [ ] RESOURCE_KEY_MAPPINGS = { - RESOURCE_INVENTORY : 'inventory', RESOURCE_ENDPOINTS : 'component', RESOURCE_INTERFACES : 'interface', RESOURCE_NETWORK_INSTANCES: 'network_instance', @@ -51,7 +48,6 @@ RESOURCE_KEY_MAPPINGS = { } RESOURCE_PARSERS = { - 'inventory' : parse_inventory, 'component' : parse_endpoints, 'interface' : parse_interfaces, 'network_instance': parse_network_instances, diff --git a/src/pcep/Config.py b/src/pcep/Config.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/Config.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/pcep/__init__.py b/src/pcep/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/pcep/client/__init__.py b/src/pcep/client/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/client/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/pcep/requirements.in b/src/pcep/requirements.in new file mode 100644 index 0000000000000000000000000000000000000000..bffe88732b108cd5da3bf6331d6a8c3056ccaf02 --- /dev/null +++ b/src/pcep/requirements.in @@ -0,0 +1,34 @@ +# 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. + + +anytree==2.8.0 +APScheduler==3.8.1 +#networkx==2.6.3 +#pydot==1.4.2 +#redis==4.1.2 + +#fastcache==1.1.0 +ncclient==0.6.13 +python-json-logger==2.0.2 +pytz==2021.3 +xmltodict==0.12.0 + + +# pip's dependency resolver does not take into account installed packages. +# p4runtime does not specify the version of grpcio/protobuf it needs, so it tries to install latest one +# adding here again grpcio==1.47.* and protobuf==3.20.* with explicit versions to prevent collisions +grpcio==1.47.* +protobuf==3.20.* +prometheus_client==0.13.0 \ No newline at end of file diff --git a/src/pcep/service/__init__.py b/src/pcep/service/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/service/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/pcep/service/__main__.py b/src/pcep/service/__main__.py index dc943fab393c2189ad3906d298a9951c56fbbd89..51972320062c545e4140c0586a4c09acf4e5adcf 100644 --- a/src/pcep/service/__main__.py +++ b/src/pcep/service/__main__.py @@ -46,7 +46,7 @@ def main(): #service_handler_factory = ServiceHandlerFactory(SERVICE_HANDLERS) pcep_server = GrpcServer() #Create instance of the GRPC Server - + # pcep_server.Connect() ip_address = socket.gethostbyname(socket.gethostname()) LOGGER.debug("IP address of the PCEP POD: %s", ip_address) diff --git a/src/pcep/service/resources/BGP4Parameters_2.xml b/src/pcep/service/resources/BGP4Parameters_2.xml new file mode 100644 index 0000000000000000000000000000000000000000..d7a101668f7aff256afd2b236b4d951e554e0a8e --- /dev/null +++ b/src/pcep/service/resources/BGP4Parameters_2.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<config> + <!-- TCP port where the BGP is listening for incoming bgp4 connections. Optional Parameter. Default value: 179 (BGP Port) --> + <BGP4Port>22179</BGP4Port> + <BGPIdentifier>1.1.1.1</BGPIdentifier> +<!-- TCP port to connect to manage the BGP connection. Default value: 1112 --> + <BGP4ManagementPort>1112</BGP4ManagementPort> + <!-- Peers to which this Peer is going to establish connection --> + <configPeer> + <peer>localhost</peer> + <export>false</export> + <import>true</import> + <peerPort>11179</peerPort> + </configPeer> + + <!-- Ficheros log (servidor, protocolo PCEP y OSPF). Campos opcionales--> + <BGP4LogFile>BGP4Parser2.log</BGP4LogFile><!-- Default value: BGP4Parser.log --> + <BGP4LogFileClient>BGP4Client2.log</BGP4LogFileClient><!-- Default value: BGP4Client.log--> + <BGP4LogFileServer>BGP4Server2.log</BGP4LogFileServer><!-- Default value: BGP4Server.log--> + <!-- If the tcp no delay option is used or not. Optional Parameter. Default value: false. --> + <nodelay>true</nodelay> + <!-- Waiting Time to re-connect to clients. Default value: 6000 ms. --> + <delay>40000</delay> + <setTraces>true</setTraces> + <!-- OPEN Parameters --> + <!-- RFC 4271. This 2-octet unsigned integer indicates the number of seconds the sender proposes for the value of the Hold Timer. + Upon receipt of an OPEN message, a BGP speaker MUST calculate the value of the Hold Timer by using the smaller of its configured + Hold Time and the Hold Time received in the OPEN message. The Hold Time MUST be either zero or at least three seconds. An + implementation MAY reject connections on the basis of the Hold Time. The calculated value indicates the maximum number of + seconds that may elapse between the receipt of successive KEEPALIVE and/or UPDATE messages from the sender. --> + <holdTime>180</holdTime><!-- Optional Parameter. Default value: 3. --> + <!-- RFC 4271. This 1-octet unsigned integer indicates the protocol version number of the message. The current BGP version number is 4. --> + <version>4</version><!-- Optional Parameter. Default value: 4. --> + <!-- RFC 4271. This 2-octet unsigned integer indicates the Autonomous System number of the sender.--> + <myAutonomousSystem>1</myAutonomousSystem> + <!-- RFC 4271. This 4-octet unsigned integer indicates the BGP Identifier of the sender. A given BGP speaker sets the value of its BGP + Identifier to an IP address that is assigned to that BGP speaker. The value of the BGP Identifier is determined upon + startup and is the same for every local interface and BGP peer. --> + <!--<BGPIdentifier>192.168.1.200</BGPIdentifier> --> + <!-- If the peer is in charge of sending its topology (only the interdomain Links) to the other BGP peer it is connected to. Default: false --> + <sendTopology>false</sendTopology> + <!-- If the peer is in charge of sending its whole topology to the other BGP peer it is connected to. Default: false --> + <sendIntradomainLinks>true</sendIntradomainLinks> + <!-- Optional Parameter. How to learn the topology. Possibilities: fromXML, fromBGP. Default: fromBGP --> + <learnTopology>fromBGP</learnTopology> + <!-- Topology network to read. It is mandatory if and only if learnTopology parameter is fromXML. --> + <!--<topologyFile>src/test/resources/network1.xml</topologyFile>--> + <!-- Optional Parameter. Instance Identifier for node and link NLRI. See rfc 6549. Default value: 0--> + <!--<instanceID>0</instanceID>--> + <!-- Optional Parameter. Default value: localhost --> + <localBGPAddress>0.0.0.0</localBGPAddress> +</config> diff --git a/src/pcep/service/resources/Ejecutable.jar b/src/pcep/service/resources/Ejecutable.jar new file mode 100644 index 0000000000000000000000000000000000000000..52cd4230167f6e261fbec6384b2c975c9f696c09 Binary files /dev/null and b/src/pcep/service/resources/Ejecutable.jar differ diff --git a/src/pcep/service/resources/PCEServerConfiguration.xml b/src/pcep/service/resources/PCEServerConfiguration.xml index f9c42c60c491c07030fb09a7dedaf0b8f93b08a0..a55c4ceea442ef58c6eecd6bd8230af27c56b337 100644 --- a/src/pcep/service/resources/PCEServerConfiguration.xml +++ b/src/pcep/service/resources/PCEServerConfiguration.xml @@ -1,4 +1,4 @@ - <!-- 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"); you may not use this file except in compliance with the License. @@ -95,7 +95,7 @@ </OSPF--> <!--WSON NETWORK--> <!--<layer type="gmpls" default="true" encodingType="1" switchingType="150">77</layer>--> - <layer default="true" type="mpls"/> + <layer type="mpls" default="true" ></layer> <!--<algorithmRule of="0" svec="false" name="mpls.MPLS_MinTH_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="false"/>--> <!--<algorithmRule of="1000" svec="false" name="wson.SP_FF_RWA_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> diff --git a/src/pcep/service/resources/java/generateJar.txt b/src/pcep/service/resources/java/generateJar.txt new file mode 100644 index 0000000000000000000000000000000000000000..858aa02c7c72745b09020776140c615a92270c1d --- /dev/null +++ b/src/pcep/service/resources/java/generateJar.txt @@ -0,0 +1 @@ +"/home/ubuntu/downloads/apache-maven-3.8.8/bin/mvn" clean package -P pcep assembly:single -DskipTests=True -f "/home/ubuntu/tfs-ctrl/src/pcep/service/resources/java/netphony-pce/pom.xml" \ No newline at end of file diff --git a/src/pcep/service/resources/log4j2.xml b/src/pcep/service/resources/log4j2.xml new file mode 100644 index 0000000000000000000000000000000000000000..fa4ad59c9e4745a568adbaf76ab34540e73cd7f5 --- /dev/null +++ b/src/pcep/service/resources/log4j2.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + <Configuration status="DEBUG"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> + </Console> + </Appenders> + <Loggers> + <Logger name="BGP4Peer" level="trace" additivity="false"> + <AppenderRef ref="Console"/> + </Logger> + <Root level="DEBUG"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> + </Configuration> diff --git a/src/pcep/service/resources/topologia_ifusion.xml b/src/pcep/service/resources/topologia_ifusion.xml new file mode 100644 index 0000000000000000000000000000000000000000..7c1f9ad3d3d039b2caf04ce7d83d1bf6eae763df --- /dev/null +++ b/src/pcep/service/resources/topologia_ifusion.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8"?> +<network> + <domain> + <layer type="mpls" ></layer> + + <domain_id>0.0.0.1</domain_id> + <reachability_entry> + <ipv4_address>1.1.1.0</ipv4_address> + <prefix>12</prefix> + </reachability_entry> + + <node> + <router_id>1.1.1.1</router_id> + </node> + <node> + <router_id>1.1.1.2</router_id> + </node> + <node> + <router_id>1.1.1.3</router_id> + </node> + + <!-- 1 al 2 --> + <edge type="intradomain"> + <source> + <router_id>1.1.1.1</router_id> + <NumIf_id>192.168.1.11</NumIf_id> + </source> + <destination> + <router_id>1.1.1.2</router_id> + <NumIf_id>192.168.1.12</NumIf_id> + </destination> + <delay> + 3.13 + </delay> + <maximum_bandwidth> + 100 + </maximum_bandwidth> + <unreserved_bandwidth priority="0"> + 100 + </unreserved_bandwidth> + </edge> + + <edge type="intradomain"> + <source> + <router_id>1.1.1.1</router_id> + <NumIf_id>192.168.3.11</NumIf_id> + </source> + <destination> + <router_id>1.1.1.3</router_id> + <NumIf_id>192.168.3.13</NumIf_id> + </destination> + <delay> + 3.13 + </delay> + <maximum_bandwidth> + 100 + </maximum_bandwidth> + <unreserved_bandwidth priority="0"> + 100 + </unreserved_bandwidth> + </edge> + + <edge type="intradomain"> + <source> + <router_id>1.1.1.3</router_id> + <NumIf_id>192.168.2.13</NumIf_id> + </source> + <destination> + <router_id>1.1.1.2</router_id> + <NumIf_id>192.168.2.12</NumIf_id> + </destination> + <delay> + 3.13 + </delay> + <maximum_bandwidth> + 100 + </maximum_bandwidth> + <unreserved_bandwidth priority="0"> + 100 + </unreserved_bandwidth> + </edge> + + + </domain> +</network> diff --git a/src/pcep/service/tools/PCEServerConfiguration.xml b/src/pcep/service/tools/PCEServerConfiguration.xml new file mode 100644 index 0000000000000000000000000000000000000000..a48b4c03bc0a512555dba403c2a63432ef65acc2 --- /dev/null +++ b/src/pcep/service/tools/PCEServerConfiguration.xml @@ -0,0 +1,114 @@ +<?xml version="1.0" encoding="UTF-8"?> +<config> + <PCEServerPort>4189</PCEServerPort> + <PCEManagementPort>6666</PCEManagementPort> + <!--<LocalPCEAddress>192.168.1.200</LocalPCEAddress>--> + <!--<LocalPCEAddress>10.95.40.175</LocalPCEAddress>--> + <!--<LocalPCEAddress>127.0.0.1</LocalPCEAddress>--> + <LocalPCEAddress>10.95.43.150</LocalPCEAddress> + + <ConnectTimer> + <!-- Connect: the timer (in seconds) started after having initialized a + TCP connection using the PCEP-registered TCP port. The value of + the Connect timer is 60 seconds. --> + 60 + </ConnectTimer> + <KeepAliveTimer> + 30 + </KeepAliveTimer> + <DeadTimer> + 120 + </DeadTimer> + <ConnectMaxRetry> + <!-- ConnectMaxRetry: the maximum number of times the system tries to + establish a TCP connection using the PCEP-registered TCP port + before going back to the Idle state. The value of the + ConnectMaxRetry is 5.--> + 5 + </ConnectMaxRetry> + <OpenWait> + <!-- OpenWait: the timer that corresponds to the amount of time a PCEP + peer will wait to receive an Open message from the PCEP peer after + the expiration of which the system releases the PCEP resource and + goes back to the Idle state. The OpenWait timer has a fixed value + of 60 seconds.--> + 60 + </OpenWait> + <KeepWait> + <!-- KeepWait: the timer that corresponds to the amount of time a PCEP + peer will wait to receive a Keepalive or a PCErr message from the + PCEP peer after the expiration of which the system releases the + PCEP resource and goes back to the Idle state. The KeepWait timer + has a fixed value of 60 seconds.--> + </KeepWait> + <parentPCE> + <!-- <parentPCEAddress>10.95.30.29</parentPCEAddress> --> + <!-- <parentPCEAddress>2.2.2.2</parentPCEAddress>--> + <!--<parentPCEAddress>10.95.30.29</parentPCEAddress> --> + <!--<parentPCEAddress>10.95.15.126</parentPCEAddress>--> + <!-- <parentPCEPort>4172</parentPCEPort> --> + </parentPCE> + <!-- Ficheros log (servidor, protocolo PCEP y OSPF). Campos opcionales --> + <PCEServerLogFile>PCEServer.log</PCEServerLogFile> + <PCEPParserLogFile>PCEPParserServer.log</PCEPParserLogFile> + <OSPFParserLogFile>OSPFParser.log</OSPFParserLogFile> + <isStateful>true</isStateful> + <isActive>true</isActive> + <PCCRequestsProcessors>1</PCCRequestsProcessors> + <ParentPCERequestProcessors>1</ParentPCERequestProcessors> + <!--<networkDescriptionFile>networks\Network_8_nodes.xml</networkDescriptionFile>--> + <!--<networkDescriptionFile>networks\network_NSFNet.xml</networkDescriptionFile>--> + <!--<networkDescriptionFile>/usr/local/nodeConfig/topologia.xml</networkDescriptionFile>--> + <networkDescriptionFile>topologia_ifusion.xml</networkDescriptionFile> + + <actingAsBGP4Peer>false</actingAsBGP4Peer> + <BGP4File>BGP4Parameters_2.xml</BGP4File> + + <initialSessionID>1000</initialSessionID> + <nodelay>true</nodelay> + <reservation>false</reservation> + <optimizedRead>false</optimizedRead> + <analyzeRequestTime>true</analyzeRequestTime> + <multilayer>false</multilayer> + <setTraces>true</setTraces> + <!--OSPF> + <OSPFSession>true</OSPFSession> + <OSPFListenerIP>192.168.1.200</OSPFListenerIP> + <OSPFMulticast>true</OSPFMulticast> + <OSPFUnicast>false</OSPFUnicast> + <OSPFTCPSession>false</OSPFTCPSession> + <OSPFTCPPort>7762</OSPFTCPPort> + </OSPF--> + <!--WSON NETWORK--> + <!--<layer type="gmpls" default="true" encodingType="1" switchingType="150">77</layer>--> + <layer type="mpls" default="true" ></layer> + <!--<algorithmRule of="0" svec="false" name="mpls.MPLS_MinTH_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="false"/>--> + + <!--<algorithmRule of="1000" svec="false" name="wson.SP_FF_RWA_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<<algorithmRule of="1002" svec="false" name="sson.AURE_SSON_algorithm" isParentPCEAlgorithm="false" isSSONAlgorithm="true"/>--> + + <!--<algorithmRule of="998" svec="true" name="wson.svec.SVEC_SP_FF_WSON_PathComputing" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="1100" svec="false" name="multiLayer.Multilayer_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="900" svec="false" name="wson.KSPprecomp_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<algorithmRule of="1001" svec="false" name="wson.AURE_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<algorithmRule of="901" svec="false" name="wson.AURE_PACK_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="903" svec="false" name="wson.AURE_RANDOM_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<algorithmRule of="902" svec="false" name="wson.AURE_SPREAD_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="800" svec="false" name="wson.KSP_FF_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<algorithmRule of="801" svec="false" name="wson.KSP_PACK_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + <!--<algorithmRule of="803" svec="false" name="wson.KSP_RANDOM_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="802" svec="false" name="wson.KSP_SPREAD_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="900" svec="false" name="wson.AURE_FF_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="true"/>--> + + <!--<algorithmRule of="1001" svec="false" name="wson.AURE_Algorithm" isParentPCEAlgorithm="false" isWSONAlgorithm="false"/>--> + <!--<algorithmRule of="999" svec="true" name="CPLEXOptimizedPathComputing" isParentPCEAlgorithm="false" isWSONAlgorithm="false"/>--> + <!-- <layer type="mpls" default="true"/>--> + <!--<layer type="mpls" default="true"/>--> + +</config> diff --git a/src/pcep/service/tools/__init__.py b/src/pcep/service/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/service/tools/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/pcep/service/tools/protos/grpcService.proto b/src/pcep/service/tools/protos/grpcService.proto index eb915dc9026481acc84b8452c87c2a952b8a82c2..3eb63c9d6ebe5e14284b22322bff6a59e25a99f8 100644 --- a/src/pcep/service/tools/protos/grpcService.proto +++ b/src/pcep/service/tools/protos/grpcService.proto @@ -1,9 +1,6 @@ syntax = "proto3"; 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 message commandRequest{ string command = 1; diff --git a/src/pcep/service/tools/protos/grpcService_pb2_grpc.py b/src/pcep/service/tools/protos/grpcService_pb2_grpc.py index d16f15ce100082f8a67a32c9beb38e2b046269b7..16ed50bad73f84c35ffabf281fe52da244ea02c4 100644 --- a/src/pcep/service/tools/protos/grpcService_pb2_grpc.py +++ b/src/pcep/service/tools/protos/grpcService_pb2_grpc.py @@ -1,4 +1,4 @@ -# 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"); # you may not use this file except in compliance with the License. diff --git a/src/pcep/tests/.gitignore b/src/pcep/tests/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..6b97d6fe3ad32f39097745229ab7f547f26ecb12 --- /dev/null +++ b/src/pcep/tests/.gitignore @@ -0,0 +1 @@ +# Add here your files containing confidential testbed details such as IP addresses, ports, usernames, passwords, etc. diff --git a/src/pcep/tests/__init__.py b/src/pcep/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/pcep/tests/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/webui/Dockerfile b/src/webui/Dockerfile index fc0800c518bc19134cdc4d67a71c7ab1f60bcb3f..40f075241f6d5b99acbeacfc624e0a9d57556744 100644 --- a/src/webui/Dockerfile +++ b/src/webui/Dockerfile @@ -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/bgpls_speaker/__init__.py bgpls_speaker/__init__.py 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 ENTRYPOINT ["python", "-m", "webui.service"] diff --git a/src/webui/service/__init__.py b/src/webui/service/__init__.py index b864d3549e051b54e888c80547724da14fec5f67..19652e2826d22cdb52045ed4b8c18e95481c8c8a 100644 --- a/src/webui/service/__init__.py +++ b/src/webui/service/__init__.py @@ -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 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 'enumerate' : enumerate, 'grpc_message_to_json': grpc_message_to_json, diff --git a/src/webui/service/pcep/__init__.py b/src/webui/service/pcep/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1549d9811aa5d1c193a44ad45d0d7773236c0612 --- /dev/null +++ b/src/webui/service/pcep/__init__.py @@ -0,0 +1,14 @@ +# 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. + diff --git a/src/webui/service/pcep/routes.py b/src/webui/service/pcep/routes.py index 1a6e90374812425481ca993fdb7e90f6b78a59ae..ee5a711247bd1a8df18f35ebcee7a79d3a31db34 100644 --- a/src/webui/service/pcep/routes.py +++ b/src/webui/service/pcep/routes.py @@ -1,17 +1,35 @@ -import logging -from flask import render_template, Blueprint, flash, session, redirect, url_for +# 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 json,logging +from flask import render_template, Blueprint, flash, session, redirect, url_for, request from common.proto.context_pb2 import ( - DeviceDriverEnum, DeviceList, DeviceOperationalStatusEnum, + ConfigActionEnum, Device, DeviceDriverEnum, DeviceId, DeviceList, DeviceOperationalStatusEnum, Empty, TopologyId) from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Topology import json_topology_id from context.client.ContextClient import ContextClient 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.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') context_client = ContextClient() @@ -44,10 +62,15 @@ def home(): device for device in grpc_devices.devices if device.device_id.device_uuid.uuid in topo_device_uuids ] + # ListNewDevices discovered from bgpls 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( 'pcep/home.html', devices=devices, dde=DeviceDriverEnum, dose=DeviceOperationalStatusEnum) @@ -196,6 +219,21 @@ def detail(device_uuid: str): dde=DeviceDriverEnum, 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']) def sendPath():