Skip to content

Control plane #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 49 commits into
base: control_plane
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9051ccb
Create README.md
mwittie Oct 26, 2017
1231c27
Update README.md
mwittie Oct 16, 2018
08b3b83
added images for readme.md
mwittie Oct 16, 2018
28665c8
Update README.md
mwittie Oct 16, 2018
da1f200
added the rest of the latex
mwittie Oct 16, 2018
5131e80
Update README.md
mwittie Oct 16, 2018
cfe338e
minor cosmetic changes
mwittie Oct 17, 2018
20a6f2b
Ignoring pyproject
mwittie Oct 17, 2018
3720292
removed the requirement for including src_addr in packets
mwittie Oct 31, 2018
4d8e40b
Merge pull request #1 from msu-netlab/data_plane
AtlasHands Nov 4, 2018
51e0ac2
Merge pull request #2 from msu-netlab/control_plane
AtlasHands Nov 26, 2018
23ae91c
Table is done
kblack373 Nov 26, 2018
528a426
Very basic pretty print
AtlasHands Nov 26, 2018
37790bd
added simple comma and colon delimited message for updates
AtlasHands Nov 26, 2018
9b571a4
added basic hardcoded routing table
AtlasHands Nov 26, 2018
feb749f
swapped to router table, able to get a correct print when no math is …
AtlasHands Nov 27, 2018
ea348c8
fixed table display
AtlasHands Nov 27, 2018
d58d89b
actually fixed table
AtlasHands Nov 27, 2018
8b8f048
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 27, 2018
f450897
current progress
AtlasHands Nov 27, 2018
7fff094
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 27, 2018
930407b
partially setting up others
AtlasHands Nov 27, 2018
34d7639
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 27, 2018
83eff52
Added comments to raw updating, step 1 of bellman-ford, global unique…
kblack373 Nov 27, 2018
304c340
bellman-ford step 2
kblack373 Nov 28, 2018
0c0a6e4
BellFord bug worked out, fully functional. Small updates to n_1 and s…
kblack373 Nov 28, 2018
e5ce40d
forward packets implementation, RA not updating routing table
kblack373 Nov 28, 2018
26a3903
added neighbor updating
AtlasHands Nov 29, 2018
4361988
fixed neighbor updating more
AtlasHands Nov 29, 2018
92f0172
Fixing random testing
AtlasHands Nov 29, 2018
b953353
H2 key error worked out
kblack373 Nov 29, 2018
7c29431
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 29, 2018
f773819
adding method to update unique routers
AtlasHands Nov 29, 2018
5cef82c
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 29, 2018
fed26fb
Trying to get the routing to work
AtlasHands Nov 29, 2018
e85935a
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
kblack373 Nov 29, 2018
d1e48b7
fix for interface index bug
kblack373 Nov 29, 2018
b4694d1
updating _3
AtlasHands Nov 29, 2018
2953e10
what ive got so far
AtlasHands Nov 29, 2018
9cf0a83
Style fixes
AtlasHands Nov 29, 2018
4140890
2 working, 3 one direction
AtlasHands Nov 29, 2018
fbe66a6
Changing updating
AtlasHands Nov 29, 2018
a151e39
fixed some table issues
AtlasHands Nov 29, 2018
ce2e7e1
making it work instead of loop
AtlasHands Nov 29, 2018
b7935f9
fix for wrong self distances
kblack373 Nov 30, 2018
88af653
Pruning/finalizing
AtlasHands Nov 30, 2018
e99f759
Merge branch 'control_plane' of https://github.com/AtlasHands/CSCI_46…
AtlasHands Nov 30, 2018
43d4035
Revert "Merge branch 'control_plane' of https://github.com/AtlasHands…
AtlasHands Nov 30, 2018
a11324f
Added youtube video
AtlasHands Nov 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ lib/python*
\.pydevproject

\.project
.idea/workspace.xml
.idea/vcs.xml
.idea/modules.xml
.idea/misc.xml
.idea/encodings.xml
.idea/CSCI_466_Programming_Assignments.iml
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CSCI_466_PAs</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
8 changes: 8 additions & 0 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/${PROJECT_DIR_NAME}</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python37</pydev_property>
</pydev_project>
3 changes: 3 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding/network.py=UTF-8
encoding/network_1.py=UTF-8
Binary file added images/Drawing2.vsdx
Binary file not shown.
Binary file added images/network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
75 changes: 75 additions & 0 deletions link_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import queue
import threading

## An abstraction of a link between router interfaces
class Link:

## creates a link between two objects by looking up and linking node interfaces.
# @param node_1: node from which data will be transfered
# @param node_1_intf: number of the interface on that node
# @param node_2: node to which data will be transfered
# @param node_2_intf: number of the interface on that node
def __init__(self, node_1, node_1_intf, node_2, node_2_intf):
self.node_1 = node_1
self.node_1_intf = node_1_intf
self.node_2 = node_2
self.node_2_intf = node_2_intf
print('Created link %s' % self.__str__())

## called when printing the object
def __str__(self):
return 'Link %s-%d - %s-%d' % (self.node_1, self.node_1_intf, self.node_2, self.node_2_intf)

##transmit a packet between interfaces in each direction
def tx_pkt(self):
for (node_a, node_a_intf, node_b, node_b_intf) in \
[(self.node_1, self.node_1_intf, self.node_2, self.node_2_intf),
(self.node_2, self.node_2_intf, self.node_1, self.node_1_intf)]:
intf_a = node_a.intf_L[node_a_intf]
intf_b = node_b.intf_L[node_b_intf]
pkt_S = intf_a.get('out')
if pkt_S is None:
continue #continue if no packet to transfer
#otherwise transmit the packet
try:
intf_b.put(pkt_S, 'in')
print('%s: direction %s-%s -> %s-%s: transmitting packet "%s"' % \
(self, node_a, node_a_intf, node_b, node_b_intf, pkt_S))
except queue.Full:
print('%s: direction %s-%s -> %s-%s: packet lost' % \
(self, node_a, node_a_intf, node_b, node_b_intf))
pass


## An abstraction of the link layer
class LinkLayer:

def __init__(self):
## list of links in the network
self.link_L = []
self.stop = False #for thread termination

## called when printing the object
def __str__(self):
return 'Network'

##add a Link to the network
def add_link(self, link):
self.link_L.append(link)

##transfer a packet across all links
def transfer(self):
for link in self.link_L:
link.tx_pkt()

## thread target for the network to keep transmitting data across links
def run(self):
print (threading.currentThread().getName() + ': Starting')
while True:
#transfer one packet on all the links
self.transfer()
#terminate
if self.stop:
print (threading.currentThread().getName() + ': Ending')
return

75 changes: 75 additions & 0 deletions link_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import queue
import threading

## An abstraction of a link between router interfaces
class Link:

## creates a link between two objects by looking up and linking node interfaces.
# @param node_1: node from which data will be transfered
# @param node_1_intf: number of the interface on that node
# @param node_2: node to which data will be transfered
# @param node_2_intf: number of the interface on that node
def __init__(self, node_1, node_1_intf, node_2, node_2_intf):
self.node_1 = node_1
self.node_1_intf = node_1_intf
self.node_2 = node_2
self.node_2_intf = node_2_intf
print('Created link %s' % self.__str__())

## called when printing the object
def __str__(self):
return 'Link %s-%d - %s-%d' % (self.node_1, self.node_1_intf, self.node_2, self.node_2_intf)

##transmit a packet between interfaces in each direction
def tx_pkt(self):
for (node_a, node_a_intf, node_b, node_b_intf) in \
[(self.node_1, self.node_1_intf, self.node_2, self.node_2_intf),
(self.node_2, self.node_2_intf, self.node_1, self.node_1_intf)]:
intf_a = node_a.intf_L[node_a_intf]
intf_b = node_b.intf_L[node_b_intf]
pkt_S = intf_a.get('out')
if pkt_S is None:
continue #continue if no packet to transfer
#otherwise transmit the packet
try:
intf_b.put(pkt_S, 'in')
print('%s: direction %s-%s -> %s-%s: transmitting packet "%s"' % \
(self, node_a, node_a_intf, node_b, node_b_intf, pkt_S))
except queue.Full:
print('%s: direction %s-%s -> %s-%s: packet lost' % \
(self, node_a, node_a_intf, node_b, node_b_intf))
pass


## An abstraction of the link layer
class LinkLayer:

def __init__(self):
## list of links in the network
self.link_L = []
self.stop = False #for thread termination

## called when printing the object
def __str__(self):
return 'Network'

##add a Link to the network
def add_link(self, link):
self.link_L.append(link)

##transfer a packet across all links
def transfer(self):
for link in self.link_L:
link.tx_pkt()

## thread target for the network to keep transmitting data across links
def run(self):
print (threading.currentThread().getName() + ': Starting')
while True:
#transfer one packet on all the links
self.transfer()
#terminate
if self.stop:
print (threading.currentThread().getName() + ': Ending')
return

Loading