Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
varanus
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
navigators
varanus
Commits
a510de82
Commit
a510de82
authored
Nov 10, 2017
by
Ricardo Fonseca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made host connections explicit in network manager
parent
67d202a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
demo.py
network-manager/config/demo.py
+5
-0
topo.py
network-manager/config/util/topo.py
+22
-5
1-autocfg-sdncontroller.properties
sdncontroller/config/1-autocfg-sdncontroller.properties
+1
-1
No files found.
network-manager/config/demo.py
View file @
a510de82
...
...
@@ -42,6 +42,11 @@ def pre_start_config( mr, extra_args, local_varanus_home ):
topo
.
add_ring_local_vir_host
(
'Cntrl_Center'
,
1
,
'192.168.10.103/24'
,
1
,
'Core5'
)
topo
.
add_ring_local_vir_host
(
'Attacker'
,
1
,
'192.168.10.104/24'
,
1
,
'A1'
,
hidden
=
True
)
topo
.
add_host_connection
(
'SCADA_Client'
,
'Cntrl_Center'
)
topo
.
add_host_connection
(
'RTU'
,
'Cntrl_Center'
)
topo
.
add_host_connection
(
'Cntrl_Center'
,
'SCADA_Client'
)
topo
.
add_host_connection
(
'Cntrl_Center'
,
'RTU'
)
# Collectors
topo
.
add_ring_local_vir_collector
(
'c1'
,
1
,
1
)
...
...
network-manager/config/util/topo.py
View file @
a510de82
import
argparse
from
collections
import
OrderedDict
import
json
import
os
import
subprocess
...
...
@@ -61,6 +62,8 @@ class VaranusTopo( object ):
self
.
hosts
=
{}
# NodeConfig mapped by name
self
.
collectors
=
{}
# NodeConfig mapped by name
self
.
host_connections
=
OrderedDict
()
# list of host names orderly mapped by host name
# ================ CONTROLLERS ================
...
...
@@ -190,6 +193,16 @@ class VaranusTopo( object ):
self
.
__add_host_link
(
h_name
,
h_port_cfg
,
sw_name
,
sw_port_cfg
)
def
add_host_connection
(
self
,
src_h_name
,
dest_h_name
):
src_h_name
=
as_oneof
(
src_h_name
,
self
.
hosts
.
keys
(),
valname
=
'src_h_name'
,
containername
=
'host names'
)
dest_h_name
=
as_oneof
(
dest_h_name
,
self
.
hosts
.
keys
(),
valname
=
'dest_h_name'
,
containername
=
'host names'
)
if
src_h_name
!=
dest_h_name
:
src_conns
=
self
.
host_connections
.
setdefault
(
src_h_name
,
[]
)
if
dest_h_name
not
in
src_conns
:
src_conns
.
append
(
dest_h_name
)
# ================ COLLECTORS ================
def
add_local_collector
(
self
,
c_name
,
cid
,
**
params
):
...
...
@@ -475,7 +488,7 @@ class VaranusTopo( object ):
f
.
write
(
'net.varanus.sdncontroller.flowdiscovery.FlowDiscoveryModule.staticFlowedConnections='
)
if
multiline
:
f
.
write
(
'
\n
'
)
VaranusTopo
.
__dump_json
(
f
,
self
.
__get_
host
_connections
(),
multiline
=
multiline
)
VaranusTopo
.
__dump_json
(
f
,
self
.
__get_
all_flowed
_connections
(),
multiline
=
multiline
)
f
.
write
(
'
\n
'
)
f
.
write
(
'net.varanus.sdncontroller.alias.AliasModule.switchAliases='
)
...
...
@@ -506,11 +519,11 @@ class VaranusTopo( object ):
return
dict
(
(
'{:#x}'
.
format
(
s
.
dpid
),
name
)
for
name
,
s
in
self
.
switches
.
iteritems
()
)
def
__get_
host
_connections
(
self
):
def
__get_
all_flowed
_connections
(
self
):
conns
=
[]
for
h1
in
self
.
hosts
.
itervalue
s
():
for
h1
_name
,
h1
in
self
.
hosts
.
iteritem
s
():
for
h1p
in
VaranusTopo
.
__get_peered_ports
(
h1
):
for
h2
in
filter
(
lambda
h
:
h
is
not
h1
,
self
.
hosts
.
itervalues
()
):
for
h2
in
self
.
__get_connected_hosts
(
h1_name
):
for
h2p
in
VaranusTopo
.
__get_peered_ports
(
h2
):
p1
=
h1p
.
get_peer
()
p2
=
h2p
.
get_peer
()
...
...
@@ -525,6 +538,10 @@ class VaranusTopo( object ):
return
dict
(
(
str
(
c
.
cid
),
VaranusTopo
.
__get_ifaces_mapping
(
c
)
)
for
c
in
self
.
collectors
.
itervalues
()
)
def
__get_connected_hosts
(
self
,
h_name
):
return
(
self
.
hosts
[
name
]
for
name
in
self
.
host_connections
.
get
(
h_name
,
()
)
)
@
staticmethod
def
__get_ifaces_mapping
(
node
):
return
dict
(
(
'{:#x}'
.
format
(
p
.
get_peer
()
.
node
.
dpid
),
p
.
name
)
for
p
in
VaranusTopo
.
__get_peered_ports
(
node
)
)
...
...
@@ -532,7 +549,7 @@ class VaranusTopo( object ):
@
staticmethod
def
__get_peered_ports
(
node
):
return
filter
(
lambda
p
:
p
.
has_peer
(),
node
.
get_ports
()
)
return
(
p
for
p
in
node
.
get_ports
()
if
p
.
has_peer
()
)
@
staticmethod
...
...
sdncontroller/config/1-autocfg-sdncontroller.properties
View file @
a510de82
net.varanus.sdncontroller.monitoring.MonitoringModule.collectorhandler_samplingOFPort
=
32768
net.varanus.sdncontroller.flowdiscovery.FlowDiscoveryModule.staticFlowedConnections
=
["0x100000003[5] >> 0x10000000
8[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.101, ipv4_dst = 192.168.10.102]","0x100000003[5] >> 0x10000000b[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.101, ipv4_dst = 192.168.10.103]","0x100000003[5] >> 0x100000002[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.101, ipv4_dst = 192.168.10.104]","0x100000008[5] >> 0x100000003[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.102, ipv4_dst = 192.168.10.101]","0x100000008[5] >> 0x10000000b[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.102, ipv4_dst = 192.168.10.103]","0x100000008[5] >> 0x100000002[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.102, ipv4_dst = 192.168.10.104]","0x10000000b[5] >> 0x100000003[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.103, ipv4_dst = 192.168.10.101]","0x10000000b[5] >> 0x100000008[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.103, ipv4_dst = 192.168.10.102]","0x10000000b[5] >> 0x100000002[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.103, ipv4_dst = 192.168.10.104]","0x100000002[5] >> 0x100000003[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.104, ipv4_dst = 192.168.10.101]","0x100000002[5] >> 0x100000008[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.104, ipv4_dst = 192.168.10.102]","0x100000002[5] >> 0x10000000b[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.104, ipv4_dst = 192.168.10.103
]"]
net.varanus.sdncontroller.flowdiscovery.FlowDiscoveryModule.staticFlowedConnections
=
["0x100000003[5] >> 0x10000000
b[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.101, ipv4_dst = 192.168.10.103]","0x100000008[5] >> 0x10000000b[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.102, ipv4_dst = 192.168.10.103]","0x10000000b[5] >> 0x100000003[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.103, ipv4_dst = 192.168.10.101]","0x10000000b[5] >> 0x100000008[5] | v14[eth_type = 0x0800, ipv4_src = 192.168.10.103, ipv4_dst = 192.168.10.102
]"]
net.varanus.sdncontroller.alias.AliasModule.switchAliases
=
{"0x100000001" : "Core1","0x100000002" : "A1","0x100000003" : "A2","0x100000004" : "A3","0x100000005" : "Core2","0x100000006" : "Core3","0x100000007" : "B1","0x100000008" : "B2","0x100000009" : "B3","0x10000000a" : "Core4","0x10000000b" : "Core5"}
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