diff options
author | Phil Wise <phil@advancedtelematic.com> | 2018-03-19 16:31:31 +0100 |
---|---|---|
committer | Phil Wise <phil@advancedtelematic.com> | 2018-03-19 16:31:31 +0100 |
commit | fc8f9b4b1721a029a30bf41e6086cfbff085089d (patch) | |
tree | 1251f3656efe0504f1cefec590fe2a6280a1e5ac /scripts | |
parent | c3c8d56af6daac3c1eb38118f683db430af48d63 (diff) | |
download | meta-updater-fc8f9b4b1721a029a30bf41e6086cfbff085089d.tar.gz |
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/qemucommand.py | 6 | ||||
-rwxr-xr-x | scripts/run-qemu-ota | 3 |
2 files changed, 9 insertions, 0 deletions
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): | |||
81 | self.gdb = args.gdb | 81 | self.gdb = args.gdb |
82 | self.pcap = args.pcap | 82 | self.pcap = args.pcap |
83 | self.overlay = args.overlay | 83 | self.overlay = args.overlay |
84 | self.secondary_network = args.secondary_network | ||
84 | 85 | ||
85 | def command_line(self): | 86 | def command_line(self): |
86 | netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port | 87 | netuser = 'user,hostfwd=tcp:0.0.0.0:%d-:22,restrict=off' % self.ssh_port |
@@ -104,6 +105,11 @@ class QemuCommand(object): | |||
104 | ] | 105 | ] |
105 | if self.pcap: | 106 | if self.pcap: |
106 | cmdline += ['-net', 'dump,file=' + self.pcap] | 107 | cmdline += ['-net', 'dump,file=' + self.pcap] |
108 | if self.secondary_network: | ||
109 | cmdline += [ | ||
110 | '-net', 'nic,vlan=1,macaddr='+random_mac(), | ||
111 | '-net', 'socket,vlan=1,mcast=230.0.0.1:1234', | ||
112 | ] | ||
107 | if self.gui: | 113 | if self.gui: |
108 | cmdline += ["-serial", "stdio"] | 114 | cmdline += ["-serial", "stdio"] |
109 | else: | 115 | 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(): | |||
33 | help='Use an overlay storage image file. Will be created if it does not exist. ' + | 33 | help='Use an overlay storage image file. Will be created if it does not exist. ' + |
34 | 'This option lets you have a persistent image without modifying the underlying image ' + | 34 | 'This option lets you have a persistent image without modifying the underlying image ' + |
35 | 'file, permitting multiple different persistent machines.') | 35 | 'file, permitting multiple different persistent machines.') |
36 | parser.add_argument('--secondary-network', action='store_true', dest='secondary_network', | ||
37 | help='Give the image a second network card connected to a virtual network. ' + | ||
38 | 'This can be used to test Uptane Primary/Secondary communication.') | ||
36 | parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') | 39 | parser.add_argument('-n', '--dry-run', help='Print qemu command line rather then run it', action='store_true') |
37 | args = parser.parse_args() | 40 | args = parser.parse_args() |
38 | try: | 41 | try: |