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
9290b913
Commit
9290b913
authored
Nov 14, 2017
by
Pedro Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some minor issues
parent
b5bd0d28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
42 deletions
+10
-42
Kernel.py
Kernel.py
+0
-4
Main.py
Main.py
+0
-28
Neighbor.py
Neighbor.py
+0
-1
Run.py
Run.py
+8
-8
requirements.txt
requirements.txt
+2
-1
No files found.
Kernel.py
View file @
9290b913
...
...
@@ -378,7 +378,3 @@ class Kernel:
pass
Main.py
View file @
9290b913
...
...
@@ -50,34 +50,6 @@ def remove_interface(interface_name, pim=False, igmp=False):
print
(
igmp_interfaces
)
"""
def add_neighbor(contact_interface, ip, random_number, hello_hold_time):
global neighbors
with neighbors_lock:
if ip not in neighbors:
print("ADD NEIGHBOR")
n = Neighbor(contact_interface, ip, random_number, hello_hold_time)
neighbors[ip] = n
protocols[0].force_send(contact_interface)
# todo check neighbor in interface
contact_interface.neighbors[ip] = n
def get_neighbor(ip) -> Neighbor:
global neighbors
with neighbors_lock:
if ip not in neighbors:
return None
return neighbors[ip]
def remove_neighbor(ip):
global neighbors
with neighbors_lock:
if ip in neighbors:
del neighbors[ip]
print("removido neighbor")
"""
def
add_protocol
(
protocol_number
,
protocol_obj
):
global
protocols
protocols
[
protocol_number
]
=
protocol_obj
...
...
Neighbor.py
View file @
9290b913
...
...
@@ -72,7 +72,6 @@ class Neighbor:
#Main.remove_neighbor(self.ip)
interface_name
=
self
.
contact_interface
.
interface_name
neighbor_ip
=
self
.
ip
Main
.
kernel
.
neighbor_removed
(
interface_name
,
neighbor_ip
)
del
self
.
contact_interface
.
neighbors
[
self
.
ip
]
...
...
Run.py
View file @
9290b913
...
...
@@ -57,25 +57,25 @@ class MyDaemon(Daemon):
print
(
sys
.
stderr
,
'sending data back to the client'
)
print
(
pickle
.
loads
(
data
))
args
=
pickle
.
loads
(
data
)
if
args
.
list_interfaces
:
if
'list_interfaces'
in
args
and
args
.
list_interfaces
:
connection
.
sendall
(
pickle
.
dumps
(
Main
.
list_enabled_interfaces
()))
elif
args
.
list_neighbors
:
elif
'list_neighbors'
in
args
and
args
.
list_neighbors
:
connection
.
sendall
(
pickle
.
dumps
(
Main
.
list_neighbors
()))
elif
args
.
list_state
:
elif
'list_state'
in
args
and
args
.
list_state
:
connection
.
sendall
(
pickle
.
dumps
(
Main
.
list_state
()))
elif
args
.
add_interface
:
elif
'add_interface'
in
args
and
args
.
add_interface
:
Main
.
add_interface
(
args
.
add_interface
[
0
],
pim
=
True
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
args
.
add_interface_igmp
:
elif
'add_interface_igmp'
in
args
and
args
.
add_interface_igmp
:
Main
.
add_interface
(
args
.
add_interface_igmp
[
0
],
igmp
=
True
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
args
.
remove_interface
:
elif
'remove_interface'
in
args
and
args
.
remove_interface
:
Main
.
remove_interface
(
args
.
remove_interface
[
0
],
pim
=
True
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
args
.
remove_interface_igmp
:
elif
'remove_interface_igmp'
in
args
and
args
.
remove_interface_igmp
:
Main
.
remove_interface
(
args
.
remove_interface_igmp
[
0
],
igmp
=
True
)
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
elif
args
.
stop
:
elif
'stop'
in
args
and
args
.
stop
:
Main
.
stop
()
connection
.
shutdown
(
socket
.
SHUT_RDWR
)
except
Exception
:
...
...
requirements.txt
View file @
9290b913
PrettyTable
netifaces
ipaddress
pyroute2
\ No newline at end of file
pyroute2
rpyc
\ No newline at end of file
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