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

changes to add PECP module

parent c6fce9ae
No related branches found
No related tags found
1 merge request!205Draft: Resolve "(TID) New PCEP component"
<?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>
# 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,threading, queue,time,signal
from datetime import datetime, timedelta
from typing import Any, Iterator, List, Optional, Tuple, Union
# from apscheduler.executors.pool import ThreadPoolExecutor
# from apscheduler.job import Job
# from apscheduler.jobstores.memory import MemoryJobStore
# from apscheduler.schedulers.background import BackgroundScheduler
# from common.method_wrappers.Decorator import MetricTypeEnum, MetricsPool, metered_subclass_method, INF
# from common.type_checkers.Checkers import chk_float, chk_length, chk_string, chk_type
import logging,threading
import grpc
from .protos import grpcService_pb2_grpc
from .protos import grpcService_pb2
from concurrent import futures
import os
import subprocess
from multiprocessing import Pool
import logging
from .JavaRunner import JavaRunner
LOGGER = logging.getLogger(__name__)
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
SERVER_ADDRESS = 'localhost:2021'
class GrpcServer():
def __init__(self) -> None: # pylint: disable=super-init-not-called
self.__lock = threading.Lock()
self.__started = threading.Event()
self.__terminate = threading.Event()
self.__out_samples = queue.Queue()
self.__server=grpc.aio.server()
# self.__address="10.95.86.214"
# self.__port=179
# self.__asNumber=65006
# self.__configFile="TMConfiguration_guillermo.xml"
# self.__process=0
# self.__javaLocalPort=0 # --> BGP4Port in XML file
self.__mngPort=0 # Port used in XML config file for management (NOT used in TFS)
self.__runnerList=[]
# Data base for saving all new devices discovered
#self.__discoveredDB=DiscoveredDB
# self.__comms=grpcComms
# Este tendría que tener la info del runner al que se connecta¿
def ConnectThread(self) -> bool:
# TODO: Metodos necesarios para conectarte al speaker
# If started, assume it is already connected
if self.__started.is_set(): return True
self.__started.set() #notifyAll -->event.is_set()
# 10 workers ?
self.__server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
grpcService_pb2_grpc.add_pceServiceServicer_to_server(self, self.__server)
self.__server.add_insecure_port(SERVER_ADDRESS)
# server.add_secure_port(SERVER_ADDRESS)
LOGGER.info("Starting server on %s", SERVER_ADDRESS)
self.__server.start()
try:
while True:
time.sleep(_ONE_DAY_IN_SECONDS)
except KeyboardInterrupt:
LOGGER.info("DISCONNECT")
self.Disconnect()
return True
def Connect(self):
grpcThread = threading.Thread(target=self.ConnectThread)
grpcThread.start()
return True
def Disconnect(self) -> bool:
self.__terminate.set()
# If not started, assume it is already disconnected
if not self.__started.is_set(): return True
LOGGER.info("Keyboard interrupt, stop server")
self.__server.stop(0)
# Disconnect triggers deactivation of sampling events
# self.__scheduler.shutdown()
# exit(0)
return True
def update(self,request, context) -> bool:
"""
Processes the messages recived by de grpc server
"""
with self.__lock:
#TODO: Get update
LOGGER.info("(server) Update message from pcep: \n %s" % (request))
response = grpcService_pb2.commandResponse(commandResp="OK")
LOGGER.debug("Update class string %s",response.commandResp)
return response
#def connectToJavaPcep(self, address : str = "10.95.86.214", port : str = "11179", asNumber : str = "1"):
def connectToJavaPcep(self, address):
# Get unused* port
#self.setLocalPort()
#runner = JavaRunner(self.__javaLocalPort,address,self.__mngPort)
LOGGER.debug("Ejecutando el servidor java")
runner = JavaRunner(address)
# Sets port in XML config file for java program
#runner.setAsNumber(asNumber)
#runner.setPort(port)
runner.setPeer()
process=runner.execPcep()
self.__runnerList.append(runner)
return process.pid
def requestToJavaPcep(self,message):
"""
If java already running add 1 to current used port,
else initialize port .
initPort --> BGP4Port, usually 179 corresponding to BGP
"""
with grpc.insecure_channel('localhost:10050') as channel:
#n = "initiate lsp largo2 10.95.86.214 1.1.1.1 1.1.1.2 m69644288 nn1.1.1.3 m69640192 nn1.1.1.2"
#n = "initiate lsp directo 10.95.86.214 1.1.1.1 1.1.1.3 m1228800 na192.168.3.11-192.168.3.13"
#n="initiate lsp largo 10.95.86.214 1.1.1.1 1.1.1.3 m61849600 na192.168.1.11-192.168.1.12 m62259200 na192.168.2.12-192.168.2.13"
#n = "terminate lsp 10.95.86.214 0 nombre"
#n="create candidatepath 10.95.86.214 1.1.1.1 4 97 m69644288 nn1.1.1.3 m69640192 nn1.1.1.2"
#n="fallo"
#n="quit";
LOGGER.debug("LLego al request")
stub = grpcService_pb2_grpc.pceServiceStub(channel)
LOGGER.debug("LLego al request 2")
request = grpcService_pb2.commandRequest(command=message)
print("updateService req: %s" ,request)
response = stub.update(request)
#response=stub.GetCommand(grpcService_pb2.commandRequest(command=n))
#response_observer = ResponseObserver()
#stub.update(response, response_observer)
print("updateServide client received: %s" ,response.commandResp)
return response.commandResp
def terminateRunners(self):
for runner in self.__runnerList:
runner.endBGPSpeaker()
return True
def terminateGrpcServer(self):
LOGGER.debug("Terminating java programs...")
self.terminateRunners()
LOGGER.debug("Disconnecting grpc server...")
self.Disconnect()
return True
def terminateRunnerById(self,speaker_id):
"""
Disconnect from BGP-LS speaker given an speaker Id. Its the same
as the java running proccess PID.
"""
for runner in self.__runnerList:
if(runner.getPid()==speaker_id):
runner.endBGPSpeaker()
self.__runnerList.remove(runner)
return True
def setLocalPort(self,initPort=22179):
"""
If java already running add 1 to current used port,
else initialize port .
initPort --> BGP4Port, usually 179 corresponding to BGP
"""
with self.__lock:
if(self.__runnerList):
LOGGER.debug("Port exists %s",self.__javaLocalPort)
lastRunner=self.__runnerList[-1]
self.__javaLocalPort=lastRunner.getCurrentLocalPort()+1
self.__mngPort=lastRunner.getCurrentMngPort()+1
else:
LOGGER.debug("Port DONT exists %s",self.__javaLocalPort)
self.__javaLocalPort=initPort
self.__mngPort=1112 # default management port
return self.__javaLocalPort
\ No newline at end of file
# 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,threading, queue,time,signal
from datetime import datetime, timedelta
from typing import Any, Iterator, List, Optional, Tuple, Union
import logging
import grpc
from concurrent import futures
from lxml import etree
import os
import subprocess
from multiprocessing import Pool
SERVER_ADDRESS = 'localhost:2021'
SERVER_ID = 1
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
#XML_FILE="/var/teraflow/bgpls_speaker/service/resources/BGP4Parameters_2.xml"
XML_CONFIG_FILE="/var/teraflow/pcep/resources/PCEServerConfiguration.xml"
LOGGER = logging.getLogger(__name__)
class JavaRunner:
#def __init__(self,localPort : int, address : str ="10.95.86.214", mngPort : int = 1112):
def __init__(self,address):
#self.__peerPort=11179
#self.__localPort=localPort
#self.__managementPort=mngPort
# To support multiple speakers at same time
# Add 1 to port and then pass port to subproccess call
#self.__configFile=XML_CONFIG_FILE
#self.__process=0
self.__lock = threading.Lock()
self.__address = address
#self.__portConf=6666
#self.__pceAddress="10.95.43.16"
#self.__asNumber=1
def getCurrentLocalPort(self):
with self.__lock:
return self.__localPort
def getCurrentMngPort(self):
with self.__lock:
return self.__managementPort
def getPid(self):
return self.__process.pid
def execAndKill(self):
LOGGER.debug("Before exec and kill")
os.chdir("/var/teraflow/pcep/service/resources/")
cwd = os.getcwd()
LOGGER.info("Current working directory: %s", cwd)
# Security shell=False
self.__process=subprocess.Popen(['java -jar Ejecutable.jar '+ XML_CONFIG_FILE],
shell=False,start_new_session=True,stdout=subprocess.PIPE)
LOGGER.debug("Time to sleep")
java_pid = self.__process.pid
print("Java PID:", java_pid)
time.sleep(15)
self.__process.terminate()
def execPcep(self) -> bool:
"""
Executes java pcep in non-blocking process
"""
# CHECKEAR muchas cosas
LOGGER.debug("Before exec")
os.chdir("/var/teraflow/pcep/service/resources/")
# Security reasons shell=False
self.__process=subprocess.Popen(['java' , '-jar' , 'Ejecutable.jar' , XML_CONFIG_FILE],
shell=False,start_new_session=True)
return self.__process
def setPort(self,port):
self.__peerPort=port
return True
def setAsNumber(self,asNumber):
self.__asNumber=asNumber
return True
def setPeer(self) -> bool:
"""
Sets XML existing config file with peer address and port. TODO: as_number
"""
#XMLParser = etree.XMLParser(remove_blank_text=False)
#tree = etree.parse(XML_FILE, parser=XMLParser)
#root = tree.getroot()
##peerAddress = root.find(".//peer")
##peerAddress.text=self.__address
#peerPort = root.find(".//peerPort")
#peerPort.text=str(self.__peerPort)
#localPort = root.find(".//BGP4Port")
#localPort.text=str(self.__localPort)
#myAutonomousSystem = root.find(".//myAutonomousSystem")
#myAutonomousSystem.text=str(self.__asNumber)
#managePort = root.find(".//BGP4ManagementPort")
#managePort.text=str(self.__managementPort)
#tree.write(XML_FILE) #with ... as ..
XMLParser = etree.XMLParser(remove_blank_text=False)
tree = etree.parse(XML_CONFIG_FILE, parser=XMLParser)
root = tree.getroot()
#portConf = root.find(".//PCEManagementPort")
#portConf.text=str(self.__portConf)
pceAddress = root.find(".//LocalPCEAddress")
LOGGER.debug("Valor anterior de LocalPCEAddress: %s", pceAddress.text)
pceAddress.text=str(self.__address)
LOGGER.debug("Valor posterior de LocalPCEAddress: %s", pceAddress.text)
tree.write(XML_CONFIG_FILE)
return True
def endBGPSpeaker(self) -> bool:
"""
Kills java program connected to BGPLS Speaker with SIGKILL signal
"""
LOGGER.debug("sending kill signal to process %s",self.__process.pid)
# time.sleep(15)
LOGGER.debug("PID: %d",self.__process.pid)
# LOGGER.debug("Group PID: %d",os.getpgid(self.__process.pid))
# os.killpg(os.getpgid(self.__process.pid), signal.SIGKILL)
self.__process.kill()
# .terminate() for SIGTERM
return True
def getRunnerInfo(self):
return self.__address,self.__asNumber,self.__peerPort
\ No newline at end of file
<?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>
# 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 src.main.proto;
//el modulo java abre la comunicacion
//cliente(java) manda la info al servidor(python)
//el modulo en python responde con ok
message commandRequest{
string command = 1;
}
message commandResponse{
string commandResp = 1;
}
// Defining a Service, a Service can have multiple RPC operations
service pceService {
// MODIFY HERE: Update the return to streaming return.
rpc update(commandRequest) returns (commandResponse);
}
\ No newline at end of file
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: grpcService.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11grpcService.proto\x12\x0esrc.main.proto\"!\n\x0e\x63ommandRequest\x12\x0f\n\x07\x63ommand\x18\x01 \x01(\t\"&\n\x0f\x63ommandResponse\x12\x13\n\x0b\x63ommandResp\x18\x01 \x01(\t2W\n\npceService\x12I\n\x06update\x12\x1e.src.main.proto.commandRequest\x1a\x1f.src.main.proto.commandResponseb\x06proto3')
_COMMANDREQUEST = DESCRIPTOR.message_types_by_name['commandRequest']
_COMMANDRESPONSE = DESCRIPTOR.message_types_by_name['commandResponse']
commandRequest = _reflection.GeneratedProtocolMessageType('commandRequest', (_message.Message,), {
'DESCRIPTOR' : _COMMANDREQUEST,
'__module__' : 'grpcService_pb2'
# @@protoc_insertion_point(class_scope:src.main.proto.commandRequest)
})
_sym_db.RegisterMessage(commandRequest)
commandResponse = _reflection.GeneratedProtocolMessageType('commandResponse', (_message.Message,), {
'DESCRIPTOR' : _COMMANDRESPONSE,
'__module__' : 'grpcService_pb2'
# @@protoc_insertion_point(class_scope:src.main.proto.commandResponse)
})
_sym_db.RegisterMessage(commandResponse)
_PCESERVICE = DESCRIPTOR.services_by_name['pceService']
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_COMMANDREQUEST._serialized_start=37
_COMMANDREQUEST._serialized_end=70
_COMMANDRESPONSE._serialized_start=72
_COMMANDRESPONSE._serialized_end=110
_PCESERVICE._serialized_start=112
_PCESERVICE._serialized_end=199
# @@protoc_insertion_point(module_scope)
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import grpcService_pb2 as grpcService__pb2
class pceServiceStub(object):
"""Defining a Service, a Service can have multiple RPC operations
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.update = channel.unary_unary(
'/src.main.proto.pceService/update',
request_serializer=grpcService__pb2.commandRequest.SerializeToString,
response_deserializer=grpcService__pb2.commandResponse.FromString,
)
class pceServiceServicer(object):
"""Defining a Service, a Service can have multiple RPC operations
"""
def update(self, request, context):
"""MODIFY HERE: Update the return to streaming return.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_pceServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'update': grpc.unary_unary_rpc_method_handler(
servicer.update,
request_deserializer=grpcService__pb2.commandRequest.FromString,
response_serializer=grpcService__pb2.commandResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'src.main.proto.pceService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class pceService(object):
"""Defining a Service, a Service can have multiple RPC operations
"""
@staticmethod
def update(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/src.main.proto.pceService/update',
grpcService__pb2.commandRequest.SerializeToString,
grpcService__pb2.commandResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
# 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.
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