From fc8f9b4b1721a029a30bf41e6086cfbff085089d Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 19 Mar 2018 16:31:31 +0100 Subject: Add a --secondary-network option to run-qemu-ota This sets up a simulated 'in vehicle' network. Add support for a Primary node with a DHCP server and a secondary node with a DHCP client. --- scripts/qemucommand.py | 6 ++++++ scripts/run-qemu-ota | 3 +++ 2 files changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 6b1106d..e209a07 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -81,6 +81,7 @@ class QemuCommand(object): self.gdb = args.gdb self.pcap = args.pcap self.overlay = args.overlay + self.secondary_network = args.secondary_network def command_line(self): netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port @@ -104,6 +105,11 @@ class QemuCommand(object): ] if self.pcap: cmdline += ['-net', 'dump,file=' + self.pcap] + if self.secondary_network: + cmdline += [ + '-net', 'nic,vlan=1,macaddr='+random_mac(), + '-net', 'socket,vlan=1,mcast=230.0.0.1:1234', + ] if self.gui: cmdline += ["-serial", "stdio"] else: diff --git a/scripts/run-qemu-ota b/scripts/run-qemu-ota index 56e4fbc..b2f55e9 100755 --- a/scripts/run-qemu-ota +++ b/scripts/run-qemu-ota @@ -33,6 +33,9 @@ def main(): help='Use an overlay storage image file. Will be created if it does not exist. ' + 'This option lets you have a persistent image without modifying the underlying image ' + 'file, permitting multiple different persistent machines.') + parser.add_argument('--secondary-network', action='store_true', dest='secondary_network', + help='Give the image a second network card connected to a virtual network. ' + + 'This can be used to test Uptane Primary/Secondary communication.') parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') args = parser.parse_args() try: -- cgit v1.2.3-54-g00ecf