Test debug function

This commit is contained in:
Nico Schottelius 2019-03-04 14:22:36 +01:00
parent 4e8da01250
commit 28b2bc46f2
3 changed files with 4 additions and 3 deletions

View file

@ -150,7 +150,7 @@ class L2Controller(object):
self.controller.table_add("v6_networks", "set_egress_port", [net], [v6route['port']]) self.controller.table_add("v6_networks", "set_egress_port", [net], [v6route['port']])
net = str(self.info['ndp_multicast']) net = str(self.info['ndp_multicast'])
self.controller.table_add("v6_networks", "controller_reply", [net]) self.controller.table_add("v6_networks", "controller_debug", [net])
self.controller.table_clear("v4_routing") self.controller.table_clear("v4_routing")

View file

@ -120,6 +120,7 @@ struct headers {
struct metadata { struct metadata {
bit<16> tcp_length; bit<16> tcp_length;
bit<16> ethertype; /* we use this, if we are cloning */ bit<16> ethertype; /* we use this, if we are cloning */
bit<1> ether_modified;
} }
#endif #endif

View file

@ -27,12 +27,12 @@ control MyIngress(inout headers hdr,
} }
action controller_debug() { action controller_debug() {
meta.ether_modified = 1;
meta.ethertype = TYPE_DEBUG; meta.ethertype = TYPE_DEBUG;
clone3(CloneType.I2E, 100, meta); clone3(CloneType.I2E, 100, meta);
} }
action controller_reply() { action controller_reply() {
meta.ethertype = TYPE_CPU;
clone3(CloneType.I2E, 100, meta); clone3(CloneType.I2E, 100, meta);
} }
@ -205,7 +205,7 @@ control MyEgress(inout headers hdr,
// hdr.tcp.setValid(); // hdr.tcp.setValid();
// If ingress clone // If ingress clone
if (standard_metadata.instance_type == 1){ if (standard_metadata.instance_type == 1 && meta.ether_modified == 1){
hdr.ethernet.ethertype = meta.ethertype; hdr.ethernet.ethertype = meta.ethertype;
// hdr.cpu.setValid(); // hdr.cpu.setValid();