Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pim_dm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
pim_dm
Commits
3896b38d
Commit
3896b38d
authored
Jul 10, 2020
by
Pedro Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix Assert state machine: verification of preferred assert
parent
1a64d22c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
9 deletions
+25
-9
pimdm/Main.py
pimdm/Main.py
+3
-4
pimdm/Run.py
pimdm/Run.py
+2
-2
pimdm/tree/assert_state.py
pimdm/tree/assert_state.py
+18
-0
pimdm/tree/tree_interface.py
pimdm/tree/tree_interface.py
+1
-2
setup.py
setup.py
+1
-1
No files found.
pimdm/Main.py
View file @
3896b38d
import
os
import
sys
import
time
import
netifaces
...
...
@@ -193,10 +194,8 @@ def list_instances():
"""
List instance information
"""
t
=
PrettyTable
([
'Instance PID'
,
'Multicast VRF'
,
'Unicast VRF'
])
import
os
t
.
add_row
([
os
.
getpid
(),
pim_globals
.
MULTICAST_TABLE_ID
,
pim_globals
.
UNICAST_TABLE_ID
])
return
str
(
t
)
t
=
"{}|{}|{}"
return
t
.
format
(
os
.
getpid
(),
pim_globals
.
MULTICAST_TABLE_ID
,
pim_globals
.
UNICAST_TABLE_ID
)
def
stop
():
...
...
pimdm/Run.py
View file @
3896b38d
...
...
@@ -13,7 +13,7 @@ from pimdm import Main
from
pimdm.tree
import
pim_globals
from
pimdm.daemon.Daemon
import
Daemon
VERSION
=
"1.1.1.
3
"
VERSION
=
"1.1.1.
4
"
def
client_socket
(
data_to_send
,
print_output
=
True
):
...
...
@@ -177,7 +177,7 @@ def main():
continue
t_new
=
client_socket
(
args
,
print_output
=
False
)
t
.
add_row
(
t_new
.
replace
(
" "
,
""
).
split
(
"
\
n
"
)[
3
].
split
(
"|"
)[
1
:
4
]
)
t
.
add_row
(
t_new
.
split
(
"|"
)
)
print
(
t
)
return
...
...
pimdm/tree/assert_state.py
View file @
3896b38d
...
...
@@ -116,6 +116,11 @@ class AssertStateABC(metaclass=ABCMeta):
interface
.
set_assert_timer
(
pim_globals
.
ASSERT_TIME
)
interface
.
send_assert
()
@
staticmethod
@
abstractmethod
def
is_preferred_assert
(
interface
:
"TreeInterfaceDownstream"
,
received_metric
):
raise
NotImplementedError
()
# Override
def
__str__
(
self
)
->
str
:
return
"AssertSM:"
+
self
.
__class__
.
__name__
...
...
@@ -127,6 +132,10 @@ class NoInfoState(AssertStateABC):
This router has no (S,G) Assert state on interface I.
'''
@
staticmethod
def
is_preferred_assert
(
interface
:
"TreeInterfaceDownstream"
,
received_metric
):
return
received_metric
.
is_better_than
(
interface
.
_assert_winner_metric
)
@
staticmethod
def
receivedDataFromDownstreamIf
(
interface
:
"TreeInterfaceDownstream"
):
"""
...
...
@@ -212,6 +221,10 @@ class WinnerState(AssertStateABC):
interface I.
'''
@
staticmethod
def
is_preferred_assert
(
interface
:
"TreeInterfaceDownstream"
,
received_metric
):
return
received_metric
.
is_better_than
(
interface
.
my_assert_metric
())
@
staticmethod
def
receivedDataFromDownstreamIf
(
interface
:
"TreeInterfaceDownstream"
):
"""
...
...
@@ -294,6 +307,11 @@ class LoserState(AssertStateABC):
forward packets from S destined for G onto interface I.
'''
@
staticmethod
def
is_preferred_assert
(
interface
:
"TreeInterfaceDownstream"
,
received_metric
):
return
received_metric
.
is_better_than
(
interface
.
_assert_winner_metric
)
or
\
received_metric
.
equal_metric
(
interface
.
_assert_winner_metric
)
@
staticmethod
def
receivedDataFromDownstreamIf
(
interface
:
"TreeInterfaceDownstream"
):
"""
...
...
pimdm/tree/tree_interface.py
View file @
3896b38d
...
...
@@ -112,8 +112,7 @@ class TreeInterface(metaclass=ABCMeta):
elif
self
.
my_assert_metric
().
is_better_than
(
received_metric
)
and
self
.
could_assert
():
# received inferior assert from non assert winner and could_assert
self
.
_assert_state
.
receivedInferiorMetricFromNonWinner_couldAssertIsTrue
(
self
)
elif
received_metric
.
is_better_than
(
self
.
_assert_winner_metric
)
or
\
received_metric
.
equal_metric
(
self
.
_assert_winner_metric
):
elif
self
.
_assert_state
.
is_preferred_assert
(
self
,
received_metric
):
#received preferred assert
equal_metric
=
received_metric
.
equal_metric
(
self
.
_assert_winner_metric
)
self
.
_assert_state
.
receivedPreferedMetric
(
self
,
received_metric
,
equal_metric
)
...
...
setup.py
View file @
3896b38d
...
...
@@ -13,7 +13,7 @@ setup(
long_description
=
open
(
"README.md"
,
"r"
).
read
(),
long_description_content_type
=
"text/markdown"
,
keywords
=
"PIM-DM Multicast Routing Protocol PIM Dense-Mode Router RFC3973 IPv4 IPv6"
,
version
=
"1.1.1.
3
"
,
version
=
"1.1.1.
4
"
,
url
=
"http://github.com/pedrofran12/pim_dm"
,
author
=
"Pedro Oliveira"
,
author_email
=
"pedro.francisco.oliveira@tecnico.ulisboa.pt"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment