Commit 43bf5497 authored by Juraj Sloboda's avatar Juraj Sloboda Committed by Matej Feder

Use dataclasses for CLA-level neighbor details

parent 67dd49a6
......@@ -50,7 +50,7 @@ class BPAgent:
# Save the neighbor EID inside the neighbor config
neighbor_config['eid'] = neighbor_eid
neighbor_class = cla_class.endpoint_class
self.register_remote_endpoint(neighbor_class(neighbor_config))
self.register_remote_endpoint(neighbor_class(**neighbor_config))
date_time_format = node_config['date-time-format']
......
from abc import ABC, abstractmethod
from dataclasses import dataclass
from ..bp_node import get_bp_node_id
from ...util.exceptions import AlreadyRegisteredError
# TODO: Choose different name to avoid confusion with 'Bundle endpoint' which is a different concept
@dataclass
class RemoteEndpoint(ABC):
"""Class representing a protocol specific connection endpoint (e.g. IP address and port)
Not to be confused with 'Bundle endpoint' which is a different concept
"""
def __init__(self, endpoint):
self.eid = endpoint['eid']
eid: str
class ConnectFailedError(Exception):
......
# TCPCL (https://tools.ietf.org/html/rfc7242)
import logging
from dataclasses import dataclass
from .api import ConvergenceLayerAdapter, RemoteEndpoint, ConnectFailedError
from .streamed_cl_base import StreamedConvergenceLayerConnection
......@@ -12,11 +13,10 @@ from ...util import uio
logger = logging.getLogger(__name__)
@dataclass
class RemoteTCPEndpoint(RemoteEndpoint):
def __init__(self, endpoint):
super().__init__(endpoint)
self.host = endpoint['host']
self.port = endpoint['port']
host: str
port: int
class TCPCL(ConvergenceLayerAdapter):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment