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
#!/usr/bin/python | |
from mininet.topo import Topo | |
from mininet.net import Mininet | |
from mininet.node import CPULimitedHost, Controller, RemoteController, OVSSwitch, Ryu | |
from mininet.link import TCLink | |
from mininet.util import dumpNodeConnections | |
from mininet.log import setLogLevel | |
from mininet.cli import CLI | |
from functools import partial |
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
ovs-ofctl --protocols=OpenFlow15 del-flows br0 | |
ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=32768,ethernet_dstAddr=0x0CC47AA32534 \ | |
actions=set_field:1->reg0, \ | |
resubmit(,1)" | |
ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=32768,ethernet_dstAddr=0x0CC47AA32535 \ | |
actions=set_field:2->reg0, \ | |
resubmit(,1)" | |
ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=0 actions=set_field:2->reg0, \ | |
deparse,output:NXM_NX_REG0[]" | |
ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=1,priority=0 actions=set_field:1->header_0_field_0, \ |
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
// Metadata to count number of labels | |
header_type ingress_metadata_t { | |
fields { | |
count : 32; | |
} | |
} | |
// Count number of labels in the stack | |
parser parse_label { | |
extract(label_stack[next]); |
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
diff --git a/targets/simple_switch/sswitch_CLI.py b/targets/simple_switch/sswitch_CLI.py | |
index f67fc5f..eb0165c 100644 | |
--- a/targets/simple_switch/sswitch_CLI.py | |
+++ b/targets/simple_switch/sswitch_CLI.py | |
@@ -41,6 +41,8 @@ class SimpleSwitchAPI(runtime_CLI.RuntimeAPI): | |
def main(): | |
args = runtime_CLI.get_parser().parse_args() | |
+ args.pre = runtime_CLI.PreType.SimplePreLAG | |
+ |
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
header_type udp_t { | |
fields { | |
srcPort : 16; | |
dstPort : 16; | |
length_ : 16; | |
checksum : 16; | |
} | |
} | |
header udp_t udp; |
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
@Test | |
public void testNewVM() { | |
Model model = new DefaultModel(); | |
Assert.assertNotEquals(model.newVM().id(), createNewVm(model).id()); | |
Assert.assertEquals(model.getVMs().size(), 2); | |
Assert.assertNotEquals(model.newNode().id(), createNewNode(model).id()); | |
Assert.assertEquals(model.getMapping().getAllNodes().size(), 2); | |
Assert.assertEquals(model.getMapping().getAllVMs().size(), 2); | |
} |
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
@Test | |
public void testOverbook() throws SolverException { | |
Model model = new DefaultModel(); | |
ShareableResource cpu = new ShareableResource("cpu", 8, 1); | |
model.attach(cpu); | |
int NODE = 256; | |
for (int i = 0; i < NODE; i++) { | |
model.getMapping().addOnlineNode(model.newNode()); | |
} |
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
@Test | |
public void spreadBasicEvaluation() { | |
Mapping map = new MappingBuilder().on(n1, n2, n3, n4) | |
.run(n1, vm1, vm2) | |
.run(n2, vm3, vm4) | |
.run(n3, vm5, vm6).build(); | |
ShareableResource cpu = new ShareableResource("cpu", 1); | |
cpu.set(n1, 4); | |
cpu.set(n2, 4); |
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
@Test | |
public void amongTest1() { | |
Mapping map = new MappingBuilder().on(n1, n2, n3) | |
.run(n1, vm1, vm2) | |
.run(n2, vm3) | |
.run(n3, vm4).build(); | |
Model model = new DefaultModel(map); | |
Set<UUID> vms = new HashSet<UUID>(Arrays.asList(vm1, vm2, vm4)); |
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
@Test | |
public void testWeird3() throws SolverException { | |
ShareableResource resources = new ShareableResource("vcpu", 1); | |
resources.set(n1, 2); | |
resources.set(n2, 2); | |
Mapping map = new MappingBuilder().on(n1, n2).off(n3).run(n1, vm1, vm2).build(); | |
Model model = new DefaultModel(map); |