-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
963 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
from VeriFlow.Network import Network | ||
|
||
ROUTE_VIEW = 1; | ||
BIT_BUCKET = 2; | ||
|
||
|
||
def main(): | ||
print("Enter network configuration file name (eg.: file.txt):"); | ||
# filename = input("> "); | ||
filename = "Topo1.txt" | ||
network = Network(); | ||
network.parseNetworkFromFile(filename); | ||
generatedECs = network.getECsFromTrie(); | ||
network.checkWellformedness(); | ||
network.log(generatedECs); | ||
while True: | ||
print(" "); | ||
print("Add rule by entering A#switchIP-rulePrefix-nextHopIP (eg.A#127.0.0.1-128.0.0.0/2-127.0.0.2)"); | ||
print("Remove rule by entering R#switchIP-rulePrefix-nextHopIP (eg.R#127.0.0.1-128.0.0.0/2-127.0.0.2)"); | ||
print("To exit type exit"); | ||
|
||
affectedEcs = set() | ||
inputline = input('> ') | ||
if (inputline.startswith("A")): | ||
affectedEcs = network.addRuleFromString(inputline[2:]); | ||
network.checkWellformedness(affectedEcs); | ||
elif (inputline.startswith("R")): | ||
affectedEcs = network.deleteRuleFromString(inputline[2:]); | ||
network.checkWellformedness(affectedEcs); | ||
elif ("exit" in inputline): | ||
break; | ||
else: | ||
print("Wrong input format!"); | ||
continue; | ||
|
||
print(""); | ||
network.log(affectedEcs); | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# VeriFlow | ||
|
||
## Requirements | ||
- Python 3 | ||
|
||
## Running | ||
|
||
|
||
```bash | ||
$ python Main.py | ||
``` | ||
|
||
## Sample Run | ||
|
||
```bash | ||
$ python Main.py | ||
Enter network configuration file name (eg.: file.txt): | ||
> Topo1.txt | ||
|
||
Number of ECs: 9 | ||
Number of affected ECs: 9 | ||
Network is well-formed (No property violations) | ||
|
||
Add rule by entering A#switchIP-rulePrefix-nextHopIP (eg.A#127.0.0.1-128.0.0.0/2-127.0.0.2) | ||
Remove rule by entering R#switchIP-rulePrefix-nextHopIP (eg.R#127.0.0.1-128.0.0.0/2-127.0.0.2) | ||
To exit type exit | ||
> A#127.0.0.1-128.0.0.0/2-127.0.0.2 | ||
|
||
Number of ECs: 9 | ||
Number of affected ECs: 2 | ||
Network is well-formed (No property violations) | ||
|
||
Add rule by entering A#switchIP-rulePrefix-nextHopIP (eg.A#127.0.0.1-128.0.0.0/2-127.0.0.2) | ||
Remove rule by entering R#switchIP-rulePrefix-nextHopIP (eg.R#127.0.0.1-128.0.0.0/2-127.0.0.2) | ||
To exit type exit | ||
> exit | ||
``` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
S# | ||
127.0.0.1:127.0.0.11 | ||
127.0.0.2:127.0.0.11,127.0.0.3 | ||
127.0.0.3:127.0.0.5,127.0.0.4,127.0.0.2,127.0.0.11,127.0.0.7,127.0.0.6 | ||
127.0.0.4:127.0.0.3,127.0.0.7,127.0.0.6,127.0.0.11 | ||
127.0.0.5:127.0.0.3 | ||
127.0.0.6:127.0.0.3,127.0.0.4 | ||
127.0.0.7:127.0.0.3,127.0.0.4,127.0.0.9 | ||
127.0.0.8:127.0.0.11 | ||
127.0.0.9:127.0.0.7,127.0.0.11 | ||
127.0.0.10:127.0.0.11 | ||
127.0.0.11:127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.8,127.0.0.9,127.0.0.10 | ||
H# | ||
127.0.0.101:127.0.0.5 | ||
127.0.0.102:127.0.0.1 | ||
127.0.0.103:127.0.0.10 | ||
127.0.0.104:127.0.0.9 | ||
127.0.0.105:127.0.0.8 | ||
127.0.0.106:127.0.0.7 | ||
127.0.0.107:127.0.0.6 | ||
127.0.0.108:127.0.0.4 | ||
R# | ||
127.0.0.10-0.0.0.0/2-127.0.0.11 | ||
127.0.0.11-0.0.0.0/2-127.0.0.2 | ||
127.0.0.2-0.0.0.0/2-127.0.0.3 | ||
127.0.0.3-0.0.0.0/2-127.0.0.5 | ||
127.0.0.10-96.0.0.0/4-127.0.0.11 | ||
127.0.0.11-96.0.0.0/4-127.0.0.3 | ||
127.0.0.3-96.0.0.0/4-127.0.0.4 | ||
127.0.0.4-128.0.0.0/3-127.0.0.6 | ||
127.0.0.9-144.0.0.0/4-127.0.0.11 | ||
127.0.0.11-144.0.0.0/4-127.0.0.3 | ||
127.0.0.3-144.0.0.0/4-127.0.0.7 | ||
127.0.0.4-192.0.0.0/3-127.0.0.7 | ||
127.0.0.7-192.0.0.0/3-127.0.0.9 | ||
127.0.0.4-64.0.0.0/3-127.0.0.11 | ||
127.0.0.11-64.0.0.0/3-127.0.0.8 | ||
127.0.0.1-128.0.0.0/3-127.0.0.11 | ||
127.0.0.11-128.0.0.0/3-127.0.0.3 | ||
127.0.0.3-128.0.0.0/3-127.0.0.6 | ||
E! | ||
|
||
|
||
|
||
-0.0.0.0/2- 00* | ||
-96.0.0.0/4- 0110* | ||
-128.0.0.0/3- 100* | ||
-144.0.0.0/4- 1001* | ||
-192.0.0.0/3- 110* | ||
-64.0.0.0/3- 010* | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
S# | ||
127.0.0.1:127.0.0.11 | ||
127.0.0.2:127.0.0.11,127.0.0.3 | ||
127.0.0.3:127.0.0.5,127.0.0.4,127.0.0.2,127.0.0.11,127.0.0.7,127.0.0.6 | ||
127.0.0.4:127.0.0.3,127.0.0.7,127.0.0.6,127.0.0.11 | ||
127.0.0.5:127.0.0.3 | ||
127.0.0.6:127.0.0.3,127.0.0.4 | ||
127.0.0.7:127.0.0.3,127.0.0.4,127.0.0.9 | ||
127.0.0.8:127.0.0.11 | ||
127.0.0.9:127.0.0.7,127.0.0.11 | ||
127.0.0.10:127.0.0.11 | ||
127.0.0.11:127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.8,127.0.0.9,127.0.0.10 | ||
H# | ||
127.0.0.101:127.0.0.5 | ||
127.0.0.102:127.0.0.1 | ||
127.0.0.103:127.0.0.10 | ||
127.0.0.104:127.0.0.9 | ||
127.0.0.105:127.0.0.8 | ||
127.0.0.106:127.0.0.7 | ||
127.0.0.107:127.0.0.6 | ||
127.0.0.108:127.0.0.4 | ||
R# | ||
127.0.0.10-0.0.0.0/2-127.0.0.11 | ||
127.0.0.11-0.0.0.0/2-127.0.0.2 | ||
127.0.0.2-0.0.0.0/2-127.0.0.3 | ||
127.0.0.3-0.0.0.0/2-127.0.0.11 | ||
127.0.0.10-96.0.0.0/4-127.0.0.11 | ||
127.0.0.11-96.0.0.0/4-127.0.0.3 | ||
127.0.0.3-96.0.0.0/4-127.0.0.4 | ||
127.0.0.4-128.0.0.0/3-127.0.0.6 | ||
127.0.0.9-144.0.0.0/4-127.0.0.11 | ||
127.0.0.11-144.0.0.0/4-127.0.0.3 | ||
127.0.0.3-144.0.0.0/4-127.0.0.7 | ||
127.0.0.4-192.0.0.0/3-127.0.0.7 | ||
127.0.0.7-192.0.0.0/3-127.0.0.9 | ||
127.0.0.4-64.0.0.0/3-127.0.0.11 | ||
127.0.0.11-64.0.0.0/3-127.0.0.8 | ||
127.0.0.1-128.0.0.0/3-127.0.0.11 | ||
127.0.0.11-128.0.0.0/3-127.0.0.3 | ||
127.0.0.3-128.0.0.0/3-127.0.0.6 | ||
E! | ||
|
||
|
||
|
||
-0.0.0.0/2- 00* | ||
-96.0.0.0/4- 0110* | ||
-128.0.0.0/3- 100* | ||
-144.0.0.0/4- 1001* | ||
-192.0.0.0/3- 110* | ||
-64.0.0.0/3- 010* | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
LOOP = 0 | ||
BLACK_HOLE = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class ForwardingGraph(object): | ||
"""docstring for ForwardingGraph""" | ||
def __init__(self): | ||
super(ForwardingGraph, self).__init__() | ||
self.forwardingGraph = set() | ||
|
||
def addToGraph(self, nextHopId): | ||
self.forwardingGraph.add(nextHopId) | ||
|
||
def getForwardingGraph(self): | ||
return self.forwardingGraph | ||
|
||
def setForwardingGraph(self, forwardingGraph): | ||
self.forwardingGraph = forwardingGraph | ||
|
||
def contains(self, id): | ||
return id in self.forwardingGraph | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Host(object): | ||
"""docstring for Host""" | ||
def __init__(self): | ||
super(Host, self).__init__() | ||
self.id = None | ||
self.switchId = None | ||
|
||
def getId(self): | ||
return self.id | ||
|
||
def setId(self, id): | ||
self.id = id | ||
|
||
def getSwitchId(self): | ||
return self.switchId | ||
|
||
def setSwitchId(self, switchId): | ||
self.switchId = switchId | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class Interval(object): | ||
"""docstring for Interval""" | ||
def __init__(self, left, right): | ||
super(Interval, self).__init__() | ||
self.left = left | ||
self.right = right | ||
|
||
def getRight(self): | ||
return self.right | ||
|
||
def setRight(self, right): | ||
self.right = right | ||
|
||
def getLeft(self): | ||
return self.left | ||
|
||
def setLeft(self, left): | ||
self.left = left | ||
|
||
|
||
def hashCode(self): | ||
return Objects.hash(left, right) | ||
|
||
def equals(self, obj) : | ||
if obj is None: | ||
return False | ||
try: | ||
eq = self.left == obj.left and self.right == obj.right | ||
except Exception as e: | ||
eq = False | ||
return eq | ||
|
||
def toString(self): | ||
return "[" + left + "," + right + ")" |
Oops, something went wrong.