Add OVS and Ryu Services to CORE for SDN support

This commit is contained in:
cspiker 2017-06-08 08:31:50 -07:00
parent b37d1d52fa
commit 46baca85d9
13 changed files with 146 additions and 63 deletions

View file

@ -2716,7 +2716,7 @@ proc sendNodeTypeInfo { sock reset } {
set typesinuse ""
foreach node $node_list {
set type [nodeType $node]
if { $type != "router" } { continue }
if { $type != "router" && $type != "OVS" } { continue }
set model [getNodeModel $node]
if { [lsearch $typesinuse $model] < 0 } { lappend typesinuse $model }
}
@ -2920,6 +2920,7 @@ proc getNodeTypeAPI { node } {
router { return 0x0 }
netns { return 0x0 }
jail { return 0x0 }
OVS { return 0x0 }
physical { return 0x1 }
xen { return 0x2 }
tbd { return 0x3 }

View file

@ -338,7 +338,7 @@ proc redrawAll {} {
proc drawNode { c node } {
global showNodeLabels
global router pc host lanswitch rj45 hub pseudo
global router pc host lanswitch rj45 hub pseudo OVS
global curcanvas zoom
global wlan
if { $c == "" } { set c .c } ;# default canvas
@ -353,7 +353,7 @@ proc drawNode { c node } {
set cimg ""
set imgzoom $zoom
if { $zoom == 0.75 || $zoom == 1.5 } { set imgzoom 1.0 }
if { $type == "router" } {
if { $type == "router" || $type == "OVS" } {
set model [getNodeModel $node]
set cimg [getNodeTypeImage $model normal]
}
@ -409,7 +409,8 @@ proc drawNode { c node } {
set ifc [ifcByPeer $pnode [getNodeMirror $node]]
if { $pcanvas != $curcanvas } {
set label [$c create text $x $y -fill blue \
-text "[getNodeName $pnode]:$ifc @[getCanvasName $pcanvas]" \
-text "[getNodeName $pnode]:$ifc
@[getCanvasName $pcanvas]" \
-tags "nodelabel $node" -justify center]
} else {
set label [$c create text $x $y -fill blue \
@ -698,13 +699,16 @@ proc updateIfcLabel { lnode1 lnode2 } {
set labelstr ""
}
if { $showIfNames } {
set labelstr "$labelstr$ifc "
set labelstr "$labelstr$ifc
"
}
if { $showIfIPaddrs && $ifipv4addr != "" } {
set labelstr "$labelstr$ifipv4addr "
set labelstr "$labelstr$ifipv4addr
"
}
if { $showIfIPv6addrs && $ifipv6addr != "" } {
set labelstr "$labelstr$ifipv6addr "
set labelstr "$labelstr$ifipv6addr
"
}
set labelstr \
[string range $labelstr 0 [expr {[string length $labelstr] - 2}]]
@ -735,18 +739,23 @@ proc updateLinkLabel { link } {
set delstr [getLinkDelayString $link]
set berstr [getLinkBERString $link]
set dupstr [getLinkDupString $link]
set labelstr " "
set labelstr "
"
if { "$bwstr" != "" } {
set labelstr "$labelstr$bwstr "
set labelstr "$labelstr$bwstr
"
}
if { "$delstr" != "" } {
set labelstr "$labelstr$delstr "
set labelstr "$labelstr$delstr
"
}
if { "$berstr" != "" } {
set labelstr "$labelstr$berstr "
set labelstr "$labelstr$berstr
"
}
if { "$dupstr" != "" } {
set labelstr "$labelstr$dupstr "
set labelstr "$labelstr$dupstr
"
}
set labelstr \
[string range $labelstr 0 [expr {[string length $labelstr] - 2}]]
@ -1530,7 +1539,7 @@ proc raiseAll {c} {
proc button1 { c x y button } {
global node_list plot_list curcanvas zoom
global activetool activetoolp newlink curobj changed def_router_model
global router pc host lanswitch rj45 hub
global router pc host lanswitch rj45 hub OVS
global oval rectangle text
global lastX lastY
global background selectbox
@ -1602,7 +1611,10 @@ proc button1 { c x y button } {
rectangle text} $activetool] < 0 } {
if { $g_view_locked == 1 } { return }
if { $activetoolp == "routers" } {
set node [newNode router]
if {$activetool != "OVS"} {
set node [newNode router]
} else {
set node [newNode OVS]}
setNodeModel $node $activetool
} else {
set node [newNode $activetool]
@ -2542,8 +2554,8 @@ proc popupConfigDialog { c } {
-side right -padx 4 -pady 4
# end Boeing
pack $wi.ftop -side top
if { $type == "router" } {
if { $type == "router" || $type == "OVS"} {
ttk::frame $wi.model -borderwidth 4
ttk::label $wi.model.label -text "Type:"
set runstate "disabled"

View file

@ -113,7 +113,7 @@ proc autoIPv4addr { node iface } {
set peer_node [logicalPeerByIfc $node $iface]
# find addresses of NETWORK layer peer nodes
if { [[typemodel $peer_node].layer] == "LINK" } {
if { [[typemodel $peer_node].layer] == "LINK" || [nodeType $peer_node] == "OVS" } {
foreach l2node [listLANnodes $peer_node {}] {
foreach ifc [ifcList $l2node] {
set peer [logicalPeerByIfc $l2node $ifc]

View file

@ -752,13 +752,15 @@ proc newLink { lnode1 lnode2 } {
global defLinkColor defLinkWidth
global curcanvas
global systype
if { [nodeType $lnode1] == "lanswitch" && \
if { ([nodeType $lnode1] == "lanswitch" ||[nodeType $lnode1] == "OVS") && \
[nodeType $lnode2] != "router" && \
[nodeType $lnode2] != "lanswitch" } { set regular no }
if { [nodeType $lnode2] == "lanswitch" && \
([nodeType $lnode2] != "lanswitch" || [nodeType $lnode2] != "OVS") } {
set regular no }
if { ([nodeType $lnode2] == "lanswitch" || [nodeType $lnode2] == "OVS") && \
[nodeType $lnode1] != "router" && \
[nodeType $lnode1] != "lanswitch" } { set regular no }
([nodeType $lnode1] != "lanswitch" || [nodeType $lnode1] != "OVS" )} {
#Khaled: puts "connecting '$lnode1' (type: '[nodeType $lnode1]') to '$lnode2' (type: '[nodeType $lnode2]') "
set regular no }
if { [nodeType $lnode1] == "hub" && \
[nodeType $lnode2] == "hub" } { set regular no }
# Boeing: added tunnel, ktunnel types to behave as rj45
@ -774,7 +776,7 @@ proc newLink { lnode1 lnode2 } {
set othernode $lnode1
}
# only allowed to link with certain types
if { [lsearch {router lanswitch hub pc host wlan} \
if { [lsearch {router lanswitch hub pc host wlan OVS} \
[nodeType $othernode]] < 0} {
return
}
@ -842,14 +844,19 @@ proc newLink { lnode1 lnode2 } {
} else {
lappend $link "delay $delay"
}
}
if { [[typemodel $lnode2].layer] == "NETWORK" } {
}
# Exclude OVS from network layer nodes IP address asignments
if { ([[typemodel $lnode2].layer] == "NETWORK") && ([nodeType $lnode2] != "OVS") } {
#Khaled: puts "Assigning '$lnode2' (type: '[nodeType $lnode2]') an automatic IP address"
if { $ipv4_addr2 == "" } { autoIPv4addr $lnode2 $ifname2 }
if { $ipv6_addr2 == "" } { autoIPv6addr $lnode2 $ifname2 }
}
# tunnels also excluded from link settings
} elseif { ([nodeType $lnode1] == "lanswitch" || \
[nodeType $lnode2] == "lanswitch" || \
# OVS and Lanswitch should go side by side
} elseif { (([nodeType $lnode1] == "lanswitch" || [nodeType $lnode1] == "OVS" )|| \
([nodeType $lnode2] == "lanswitch"|| [nodeType $lnode2] == "OVS") || \
[string first eth "$ifname1 $ifname2"] != -1) && \
[nodeType $lnode1] != "rj45" && [nodeType $lnode2] != "rj45" && \
[nodeType $lnode1] != "tunnel" && [nodeType $lnode2] != "tunnel" && \
@ -861,12 +868,13 @@ proc newLink { lnode1 lnode2 } {
}
lappend link_list $link
# Exclude OVS from Network layer node configs
if { [nodeType $lnode2] != "pseudo" &&
[nodeType $lnode1] != "wlan" &&
[[typemodel $lnode1].layer] == "NETWORK" } {
([[typemodel $lnode1].layer] == "NETWORK" && [nodeType $lnode1] != "OVS") } {
if { $ipv4_addr1 == "" && $do_auto_addressing } {
autoIPv4addr $lnode1 $ifname1
autoIPv4addr $lnode1 $ifname1
}
if { $ipv6_addr1 == "" && $do_auto_addressing } {
autoIPv6addr $lnode1 $ifname1
@ -875,7 +883,8 @@ proc newLink { lnode1 lnode2 } {
# assume wlan is always lnode1
if { [nodeType $lnode1] != "pseudo" &&
[nodeType $lnode1] != "wlan" &&
[[typemodel $lnode2].layer] == "NETWORK" } {
([[typemodel $lnode2].layer] == "NETWORK" && [nodeType $lnode2] != "OVS") } {
if { $ipv4_addr2 == "" && $do_auto_addressing } {
autoIPv4addr $lnode2 $ifname2
}

View file

@ -28,10 +28,12 @@ array set g_node_types_default {
physical {built-in type for physical nodes}}
6 {xen xen.gif xen.gif {zebra OSPFv2 OSPFv3 vtysh IPForward} \
xen {built-in type for Xen PVM domU router}}
7 {OVS lanswitch.gif lanswitch.gif {DefaultRoute SSH OvsService} OVS {} }
}
# possible machine types for nodes
set MACHINE_TYPES "netns physical xen"
set MACHINE_TYPES "netns physical xen OVS"
# array populated from nodes.conf file
array set g_node_types { }
@ -189,7 +191,7 @@ proc getNodeTypeServices { type } {
# node type from the toolbar
proc getNodeTypeMachineType { type } {
global MACHINE_TYPES g_node_types
set default_machine_type [lindex $MACHINE_TYPES 0]
set default_machine_type [lindex $MACHINE_TYPES 3]
set i [getNodeTypeIndex $type]
if { $i < 0 } { return $default_machine_type }; # failsafe
return [lindex $g_node_types($i) 4]
@ -213,7 +215,7 @@ proc getNodeTypeProfile { type } {
# node type from the toolbar
proc getNodeTypeMachineType { type } {
global MACHINE_TYPES g_node_types
set default_machine_type [lindex $MACHINE_TYPES 0]
set default_machine_type [lindex $MACHINE_TYPES 3]
set i [getNodeTypeIndex $type]
if { $i < 0 } { return $default_machine_type }; # failsafe
return [lindex $g_node_types($i) 4]
@ -719,6 +721,7 @@ proc lanswitch.layer {} { return LINK }
proc hub.layer {} { return LINK }
proc tunnel.layer {} { return LINK }
proc wlan.layer {} { return LINK }
proc OVS.layer {} { return NETWORK }
proc router.layer {} { return NETWORK }
proc router.shellcmd { n } { return "vtysh" }