Skip to content

Commit

Permalink
Added /mpls/settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hexatester committed Sep 4, 2023
1 parent a21a78d commit ce89d84
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ros/mpls/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from ros._base import BaseModule, BaseProps
from ros._base import BaseModule, BaseProps, BaseProp

from .forwarding_table import MPLSForwardingTable
from .interface import MPLSInterface
from .ldp import MPLSLDP, LDPInstance
from .settings import MPLSSettings


class MPLSModule(BaseModule):
_forwarding_table: BaseProps[MPLSForwardingTable] = None
_interface: BaseProps[MPLSInterface] = None
_ldp: MPLSLDP = None
_settings: BaseProp[MPLSSettings] = None

@property
def forwarding_table(self):
Expand All @@ -32,3 +34,9 @@ def ldp(self):
if not self._ldp:
self._ldp = MPLSLDP(self.ros, "/mpls/ldp", LDPInstance)
return self._ldp

@property
def settings(self):
if not self._settings:
self._settings = BaseProp(self.ros, "/mpls/settings", MPLSSettings)
return self._settings
10 changes: 10 additions & 0 deletions ros/mpls/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from attr import dataclass


@dataclass
class MPLSSettings:
dynamic_label_range: str
propagate_ttl: bool
allow_fast_path: bool
mpls_fast_path_packets: int
mpls_fast_path_bytes: int
7 changes: 6 additions & 1 deletion tests/test_mpls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ros import Ros, MPLSModule
from ros.mpls import MPLSForwardingTable, MPLSLDP, MPLSInterface
from ros.mpls import MPLSForwardingTable, MPLSLDP, MPLSInterface, MPLSSettings
from ros.mpls.ldp import (
LDPAcceptFilter,
LDPAdvertiseFilter,
Expand Down Expand Up @@ -59,3 +59,8 @@ class TestInterface:
def test_interface(self, ros: Ros):
for i in ros.mpls.interface():
assert isinstance(i, MPLSInterface)


class TestSettings:
def test_settings(self, ros: Ros):
assert isinstance(ros.mpls.settings(), MPLSSettings)

0 comments on commit ce89d84

Please sign in to comment.