summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2016-10-13 09:27:10 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2016-10-13 09:27:10 +0000
commit4d30c6493bb746c03cbf7a8b9268b628a6c6dddd (patch)
tree981497af88784e522dc061d0ba40040f684b9d34 /kpov_judge/tasks
parent310dee092cced5787b55a2e9619b75b799bbea2c (diff)
Fixed the dhcp task
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@367 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/isc_dhcp_live_boot/task.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/task.py b/kpov_judge/tasks/isc_dhcp_live_boot/task.py
index c4775f1..22d0e79 100644
--- a/kpov_judge/tasks/isc_dhcp_live_boot/task.py
+++ b/kpov_judge/tasks/isc_dhcp_live_boot/task.py
@@ -120,10 +120,12 @@ def task(IP_DHCP, IP_GW, MAC_BOOT, BOOT_FNAME):
# and ip arguments. You can simply feed it MAC_BOOT and IP_BOOT.
# dhcping -h MAC_BOOT -c IP_BOOT -V -r
# could work (but you should test it)
- dhcpdump = pexpect.spawn("sudo dhcpdump -i eth1")
- mac_str = pexpect.run("ip link show eth1")
- mac_re = re.search(r"(([0-9a-f]{2}:){5}[0-9a-f]{2})", mac_str)
- mac_SA = mac_re.group(1)
+ ip_str = pexpect.run('ip addr show')
+ eth_re_str = "ether (([0-9a-f]{{2}}:){{5}}[0-9a-f]{{2}})(.*)\r\n(.*){}(.*)\s(\w*)\r\n"
+ ip_re = re.search(eth_re_str.format(DHCP_IP), ip_str)
+ mac_SA = ip_re.group(1)
+ eth_dev_SA = ip_re.group(6)
+ dhcpdump = pexpect.spawn("sudo dhcpdump -i {}".format(eth_dev_SA))
results['dhcping_other'] = pexpect.run('sudo dhcping -s {} -h {}'.format(
IP_DHCP, MAC_BOOT))
dhcpdump.expect('---------------------------------------------------------------------------')
@@ -210,12 +212,21 @@ timeout 0
s = """auto lo
iface lo inet loopback
-auto eth0
-iface eth0 inet dhcp
+auto ens3
+iface ens3 inet dhcp
-iface eth1 inet static
- address {}
+auto enp0s3
+iface enp0s3 inet dhcp
+
+auto ens4
+iface ens4 inet static
+ address {IP_GW}
+ netmask 255.192.0.0
+
+auto enp0s8
+iface enp0s8 inet static
+ address {IP_GW}
netmask 255.192.0.0
-""".format(task_params['IP_GW'])
- d.write("/etc/interfaces", s)
+""".format(IP_GW = task_params['IP_GW'])
+ d.write("/etc/network/interfaces", s)
write_default_config(templates['simpleArbiterGW'], global_params)