Skip to content

Commit

Permalink
Added /mpls/ldp/forwarding-table
Browse files Browse the repository at this point in the history
  • Loading branch information
hexatester committed Sep 4, 2023
1 parent 9faa8cd commit a21a78d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ros/mpls/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
from ros._base import BaseModule, BaseProps

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


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

@property
def forwarding_table(self):
if not self._forwarding_table:
self._forwarding_table = BaseProps(
self.ros, "/mpls/forwarding-table", MPLSForwardingTable
)
self._forwarding_table._create = False
self._forwarding_table._delete = False
self._forwarding_table._write = False
return self._forwarding_table

@property
def interface(self):
if not self._interface:
Expand Down
13 changes: 13 additions & 0 deletions ros/mpls/forwarding_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from attr import dataclass


@dataclass
class MPLSForwardingTable:
id: str
label: str
type: str
ldp: bool = False
vpls: bool = False
vrf: str = None
nexthops: str = None
prefix: str = None
8 changes: 7 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 MPLSLDP, MPLSInterface
from ros.mpls import MPLSForwardingTable, MPLSLDP, MPLSInterface
from ros.mpls.ldp import (
LDPAcceptFilter,
LDPAdvertiseFilter,
Expand All @@ -11,6 +11,12 @@
)


class TestForwardingTable:
def test_forwarding_table(self, ros: Ros):
for i in ros.mpls.forwarding_table():
assert isinstance(i, MPLSForwardingTable)


class TestMPLS:
def test_queue(self, ros: Ros):
assert isinstance(ros.mpls, MPLSModule)
Expand Down

0 comments on commit a21a78d

Please sign in to comment.