Commit 84bde10b authored by Leigh Stoller's avatar Leigh Stoller

Add tb-set-link-failure-action to set the action on links that fail in

snmpit setup. This allows experiments to continue to swap in, and is a
useful debugging aid for MLE.

Also allow a level 2 link to be implemented by a layer 2 path. This is
for my little "bridge" hack, that may or may not see the light of day.
parent bf794f46
......@@ -185,6 +185,9 @@ LanLink instproc init {s nodes bw d type} {
# Default type is a plain "ethernet". User can change this.
$self set protocol "ethernet"
# Default failure action.
$self set failureaction "fatal"
# Colocation is on by default, but this only applies to emulated links
# between virtual nodes anyway.
$self set trivial_ok 1
......@@ -360,7 +363,12 @@ Link instproc implemented_by {impl} {
perror "\[$self implemented_by] no layer set in $impl!"
return
}
if {$impl_layer >= $layer} {
# Special case.
if {$impl_layer == $layer && $layer != 2} {
perror "\[$self implemented_by] $impl is at the same layer!"
return
}
if {$impl_layer > $layer} {
perror "\[$self implemented_by] $impl is not at a lower layer!"
return
}
......@@ -764,6 +772,7 @@ Link instproc updatedb {DB} {
$self instvar sim
$self instvar netmask
$self instvar protocol
$self instvar failureaction
$self instvar mustdelay
$self instvar fixed_iface
$self instvar layer
......@@ -771,7 +780,7 @@ Link instproc updatedb {DB} {
$self instvar ofenabled
$self instvar ofcontroller
$sim spitxml_data "virt_lan_lans" [list "vname"] [list $self]
$sim spitxml_data "virt_lan_lans" [list "vname" "failureaction"] [list $self $failureaction]
foreach nodeport $nodelist {
set node [lindex $nodeport 0]
......@@ -947,6 +956,7 @@ Lan instproc updatedb {DB} {
$self instvar sim
$self instvar netmask
$self instvar protocol
$self instvar failureaction
$self instvar accesspoint
$self instvar settings
$self instvar member_settings
......@@ -960,7 +970,7 @@ Lan instproc updatedb {DB} {
return
}
$sim spitxml_data "virt_lan_lans" [list "vname"] [list $self]
$sim spitxml_data "virt_lan_lans" [list "vname" "failureaction"] [list $self $failureaction]
#
# Upload lan settings and them per-member settings
......
......@@ -813,6 +813,18 @@ proc tb-set-node-failure-action {node type} {
$node set failureaction $type
}
proc tb-set-link-failure-action {lanlink type} {
if {[$lanlink info class] != "Link" && [$lanlink info class] != "Lan"} {
perror "\[tb-set-link-failure-action] $lanlink is not a link or a lan."
return
}
if {[lsearch -exact {fatal nonfatal} $type] == -1} {
perror "\[tb-set-link-failure-action] must be one of fatal|nonfatal"
return
}
$lanlink set failureaction $type
}
proc tb-fix-node {vnode pnode} {
if {[$vnode info class] != "Node"} {
perror "\[tb-fix-node] $vnode is not a node."
......@@ -1964,10 +1976,6 @@ proc tb-set-link-layer {link mylayer} {
perror "\[tb-set-link-layer] $link is not a link."
return
}
if {$mylayer != 1} {
perror "\[tb-set-link-layer] Only layer 1 is allowed."
return
}
$link instvar layer
$link set layer $mylayer
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment