FIX: ovs-ofctl missing flow table issue
This commit is contained in:
+13
-1
@@ -43,10 +43,13 @@ class PlannedNode:
|
|||||||
Args:
|
Args:
|
||||||
name: Logical node name used by Mininet.
|
name: Logical node name used by Mininet.
|
||||||
type: Concrete semantic node type to create.
|
type: Concrete semantic node type to create.
|
||||||
|
switch_fail_mode: Optional Open vSwitch fail mode selected by the
|
||||||
|
planner for switch nodes. Non-switch nodes leave this unset.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name: str
|
name: str
|
||||||
type: NodeType
|
type: NodeType
|
||||||
|
switch_fail_mode: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@@ -275,7 +278,13 @@ def _plan_nodes(topology: Topology) -> Tuple[PlannedNode, ...]:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
return tuple(
|
return tuple(
|
||||||
PlannedNode(name=node.name, type=node.type)
|
PlannedNode(
|
||||||
|
name=node.name,
|
||||||
|
type=node.type,
|
||||||
|
switch_fail_mode=(
|
||||||
|
"standalone" if node.type is NodeType.SWITCH else None
|
||||||
|
),
|
||||||
|
)
|
||||||
for node in topology.nodes
|
for node in topology.nodes
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -797,6 +806,9 @@ def _self_test() -> None:
|
|||||||
|
|
||||||
assert len(execution_plan.nodes) == 3
|
assert len(execution_plan.nodes) == 3
|
||||||
assert len(execution_plan.links) == 2
|
assert len(execution_plan.links) == 2
|
||||||
|
assert next(
|
||||||
|
node for node in execution_plan.nodes if node.name == "s1"
|
||||||
|
).switch_fail_mode == "standalone"
|
||||||
assert execution_plan.links[0].endpoints[1].logical_interface == "client"
|
assert execution_plan.links[0].endpoints[1].logical_interface == "client"
|
||||||
assert execution_plan.links[0].endpoints[0].interface_name == "h1-eth0"
|
assert execution_plan.links[0].endpoints[0].interface_name == "h1-eth0"
|
||||||
assert execution_plan.links[1].endpoints[0].interface_name == "r0-eth0"
|
assert execution_plan.links[1].endpoints[0].interface_name == "r0-eth0"
|
||||||
|
|||||||
@@ -322,10 +322,11 @@ def render_python(plan: ExecutionPlan) -> str:
|
|||||||
)
|
)
|
||||||
elif node.type is NodeType.SWITCH:
|
elif node.type is NodeType.SWITCH:
|
||||||
lines.append(
|
lines.append(
|
||||||
" nodes[%s] = net.addSwitch(%s)"
|
" nodes[%s] = net.addSwitch(%s, failMode=%r)"
|
||||||
% (
|
% (
|
||||||
_python_string(node.name),
|
_python_string(node.name),
|
||||||
_python_string(node.name),
|
_python_string(node.name),
|
||||||
|
node.switch_fail_mode,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -469,7 +470,7 @@ def _self_test() -> None:
|
|||||||
ast.parse(source)
|
ast.parse(source)
|
||||||
|
|
||||||
assert "net.addHost('h1', ip=None)" in source
|
assert "net.addHost('h1', ip=None)" in source
|
||||||
assert "net.addSwitch('s1')" in source
|
assert "net.addSwitch('s1', failMode='standalone')" in source
|
||||||
assert "net.addLink(" in source
|
assert "net.addLink(" in source
|
||||||
assert "cls=TCLink" in source
|
assert "cls=TCLink" in source
|
||||||
assert "dnsmasq" in source
|
assert "dnsmasq" in source
|
||||||
|
|||||||
Reference in New Issue
Block a user