Skip to content

Commit

Permalink
Fixes: log symlink and cmd formatting bug (#47)
Browse files Browse the repository at this point in the history
* updated examples for new P4 16 checksums

* removed dead code

* put switch log into output log dir

* use regex to replace hostname in command
  • Loading branch information
theojepsen authored and robertsoule-barefoot committed Apr 2, 2018
1 parent 770ac75 commit 239dc98
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docker/scripts/mininet/appcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, manifest=None, target=None, topo=None, net=None, cli_path='si

self.mcast_groups_files = dict((sw, []) for sw in self.switches)
self.mcast_groups = dict((sw, {}) for sw in self.switches)
self.last_mcnoderid = -1
self.last_mcnoderid = 0

self.shortestpath = ShortestPath(self.conf['links'])

Expand Down Expand Up @@ -83,7 +83,7 @@ def createMcastGroup(self, mgid, ports, sw=None):
handle = results[-1]['handle']
commands = ['mc_mgrp_create %d' % mgid]

if 'model' in self.conf and self.conf['model'] != 'BMV2':
if 'model' in self.conf and self.conf['model'].lower() != 'bmv2':
commands += ['mc_associate_node %d %d 0 0' % (mgid, results[-1]['handle'])]
else:
commands += ['mc_node_associate %d %d' % (mgid, results[-1]['handle'])]
Expand Down
3 changes: 2 additions & 1 deletion docker/scripts/mininet/appprocrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def isDaemon(self):

def formatCmd(self, cmd):
for h in self.runner.net.hosts:
cmd = cmd.replace(h.name, h.defaultIntf().updateIP())
cmd = re.sub('(%s)([^0-9]|$)' % h.name, h.defaultIntf().updateIP() + '\\2', cmd)
print cmd
return cmd


Expand Down
2 changes: 0 additions & 2 deletions docker/scripts/mininet/multi_switch_mininet.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ def formatLatency(lat):

net.stop()

if bmv2_log:
os.system('bash -c "cp /tmp/p4s.s*.log \'%s\'"' % args.log_dir)
if pcap_dump:
os.system('bash -c "cp *.pcap \'%s\'"' % args.log_dir)

Expand Down
5 changes: 4 additions & 1 deletion docker/scripts/p4apprunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def run_multiswitch(manifest):

model = 'bmv2'
if 'model' in manifest.target_config:
model = manifest.target_config['model']
model = manifest.target_config['model'].lower()

if model == 'bmv2':
if args.json: json_file = os.path.abspath(args.json)
Expand Down Expand Up @@ -284,6 +284,9 @@ def main():
tar.extractall()
tar.close()

run_command('touch /tmp/p4app_logs/p4s.s1.log')
run_command('ln -s /tmp/p4app_logs/p4s.s1.log /tmp/p4s.s1.log')

log('Reading package manifest.')
with open(args.manifest, 'r') as manifest_file:
manifest = read_manifest(manifest_file)
Expand Down
9 changes: 0 additions & 9 deletions examples/broadcast.p4app/header.p4
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ struct ingress_metadata_t {
bit<32> nhop_ipv4;
}

struct intrinsic_metadata_t {
bit<16> mcast_grp;
bit<16> egress_rid;
bit<48> ingress_global_timestamp;
bit<32> lf_field_list;
}

header ethernet_t {
bit<48> dstAddr;
bit<48> srcAddr;
Expand All @@ -37,8 +30,6 @@ header ipv4_t {
struct metadata {
@name("ingress_metadata")
ingress_metadata_t ingress_metadata;
@name("intrinsic_metadata")
intrinsic_metadata_t intrinsic_metadata;
}

struct headers {
Expand Down

0 comments on commit 239dc98

Please sign in to comment.