Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding simple router example and other minor changes.
- Loading branch information
Muhammad Shahbaz
committed
Jul 7, 2016
1 parent
0a795f2
commit ee48e00
Showing
9 changed files
with
477 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set mac 0 08:00:27:7e:0b:95 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
header_type ethernet_t { | ||
fields { | ||
dstAddr : 48; | ||
srcAddr : 48; | ||
etherType : 16; | ||
} | ||
} | ||
|
||
header_type intrinsic_metadata_t { | ||
fields { | ||
mcast_grp : 4; | ||
egress_rid : 4; | ||
mcast_hash : 16; | ||
lf_field_list: 32; | ||
} | ||
} | ||
|
||
parser start { | ||
return parse_ethernet; | ||
} | ||
|
||
header ethernet_t ethernet_; | ||
metadata intrinsic_metadata_t intrinsic_metadata; | ||
|
||
parser parse_ethernet { | ||
extract(ethernet_); | ||
return ingress; | ||
} | ||
|
||
action _drop() { | ||
drop(); | ||
} | ||
|
||
action _nop() { | ||
} | ||
|
||
#define MAC_LEARN_RECEIVER 1024 | ||
|
||
field_list mac_learn_digest { | ||
ethernet_.srcAddr; | ||
standard_metadata.ingress_port; | ||
} | ||
|
||
action mac_learn() { | ||
generate_digest(MAC_LEARN_RECEIVER, mac_learn_digest); | ||
} | ||
|
||
table smac { | ||
reads { | ||
ethernet_.srcAddr : exact; | ||
} | ||
actions {mac_learn; _nop;} | ||
size : 512; | ||
} | ||
|
||
action forward(port) { | ||
modify_field(standard_metadata.egress_spec, port); | ||
} | ||
|
||
action broadcast() { | ||
modify_field(intrinsic_metadata.mcast_grp, 1); | ||
} | ||
|
||
table dmac { | ||
reads { | ||
ethernet_.dstAddr : exact; | ||
} | ||
actions {forward; broadcast;} | ||
size : 512; | ||
} | ||
|
||
table mcast_src_pruning { | ||
reads { | ||
standard_metadata.instance_type : exact; | ||
} | ||
actions {_nop; _drop;} | ||
size : 1; | ||
} | ||
|
||
control ingress { | ||
apply(smac); | ||
apply(dmac); | ||
} | ||
|
||
control egress { | ||
if(standard_metadata.ingress_port == standard_metadata.egress_port) { | ||
apply(mcast_src_pruning); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#! /bin/sh -ve | ||
|
||
# Please make sure that you update the path to the current OVS directory. | ||
DIR=~/ovs/utilities | ||
|
||
$DIR/ovs-ofctl --protocols=OpenFlow15 del-flows br0 | ||
|
||
# SMAC Table 0 | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=32768,ethernet__srcAddr=0x08002715b411 actions=resubmit(,1)" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=32768,ethernet__srcAddr=0x0800277e0b95 actions=resubmit(,1)" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=0,priority=0 actions=controller" | ||
|
||
# DMAC Table 1 | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=1,priority=32768,ethernet__dstAddr=0x08002715b411 actions=set_field:1->reg0,resubmit(,2)" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=1,priority=32768,ethernet__dstAddr=0x0800277e0b95 actions=set_field:2->reg0,resubmit(,2)" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=1,priority=0 actions=flood" | ||
|
||
# SRC Pruning Table 2 | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=1,reg0=1 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=2,reg0=2 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=3,reg0=3 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=4,reg0=4 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=5,reg0=5 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=32768,in_port=6,reg0=6 actions=" | ||
$DIR/ovs-ofctl --protocols=OpenFlow15 add-flow br0 "table=2,priority=0 actions=deparse,output:NXM_NX_REG0[]" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set mac 0 08:00:27:15:b4:11 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set mac 0 08:00:27:7e:0b:95 | ||
set ip src 0 10.0.0.14/24 | ||
set ip dst 0 10.0.0.15 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set mac 0 08:00:27:15:b4:11 | ||
set ip src 0 10.0.0.15/24 | ||
set ip dst 0 10.0.0.14 |
Oops, something went wrong.