From e6574371755b029aaa35c20ea5a0214f75a8a258 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 15 Jun 2017 15:18:07 +0200 Subject: prototypes: ouroboros: use isinstance() rather than type() This is convenient for compatibility between Python 2 and 3. --- rumba/prototypes/ouroboros.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 9ac1425..4ad41c6 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -63,13 +63,13 @@ class Experiment(mod.Experiment): else: cmd = "irm i c n " + ipcp.name - if type(ipcp.dif) is mod.ShimEthDIF: + if isinstance(ipcp.dif, mod.ShimEthDIF): # NOTE: Here to test with fake testbed if ipcp.ifname is None: ipcp.ifname = "eth0" cmd += " type shim-eth-llc if_name " + ipcp.ifname cmd += " dif " + ipcp.dif.name - elif type(ipcp.dif) is mod.NormalDIF: + elif isinstance(ipcp.dif, mod.NormalDIF): cmd += " type normal" if ipcp.dif_bootstrapper: cmd += " dif " + ipcp.dif.name @@ -83,7 +83,7 @@ class Experiment(mod.Experiment): for dif_b in node.dif_registrations[ipcp.dif]: cmd2 += " dif " + dif_b.name cmds2.append(cmd2) - elif type(ipcp.dif) is mod.ShimUDPDIF: + elif isinstance(ipcp.dif, mod.ShimUDPDIF): # FIXME: Will fail, since we don't keep IPs yet cmd += " type shim-udp" cmd += " dif " + ipcp.dif.name -- cgit v1.2.3