From b375ddb433477e57f842596b23855a63cda35938 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Fri, 22 Apr 2022 11:48:08 +0000 Subject: [PATCH] Final f-string conversions that flynt did not catch. Tested: integration test before and after are clean --- vpp/dumper.py | 1 - vpp/reconciler.py | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/vpp/dumper.py b/vpp/dumper.py index 12404ed..2a5bf55 100644 --- a/vpp/dumper.py +++ b/vpp/dumper.py @@ -135,7 +135,6 @@ class Dumper(VPPApi): config['taps'][vpp_iface.interface_name] = tap for idx, iface in self.cache['bridgedomains'].items(): - # self.logger.info("%d: %s" % (idx, iface)) bridge_name = f"bd{int(idx)}" mtu = 1500 bridge = {"description": ""} diff --git a/vpp/reconciler.py b/vpp/reconciler.py index a1f8333..9d65dbe 100644 --- a/vpp/reconciler.py +++ b/vpp/reconciler.py @@ -395,14 +395,14 @@ class Reconciler(): config_ifname, config_iface = vxlan_tunnel.get_by_name(self.cfg, vpp_ifname) if not config_iface: self.prune_addresses(vpp_ifname, []) - cli="create vxlan tunnel instance %d src %s dst %s vni %d del" % (vpp_vxlan.instance, - vpp_vxlan.src_address, vpp_vxlan.dst_address, vpp_vxlan.vni) + cli=(f"create vxlan tunnel instance {vpp_vxlan.instance} " + f"src {vpp_vxlan.src_address} dst {vpp_vxlan.dst_address} vni {vpp_vxlan.vni} del") self.cli['prune'].append(cli); removed_interfaces.append(vpp_ifname) continue if self.__vxlan_tunnel_has_diff(config_ifname): - cli="create vxlan tunnel instance %d src %s dst %s vni %d del" % (vpp_vxlan.instance, - vpp_vxlan.src_address, vpp_vxlan.dst_address, vpp_vxlan.vni) + cli=(f"create vxlan tunnel instance {vpp_vxlan.instance} " + f"src {vpp_vxlan.src_address} dst {vpp_vxlan.dst_address} vni {vpp_vxlan.vni} del") self.cli['prune'].append(cli); removed_interfaces.append(vpp_ifname) continue @@ -691,8 +691,8 @@ class Reconciler(): continue ifname, iface = vxlan_tunnel.get_by_name(self.cfg, ifname) instance = int(ifname[12:]) - cli="create vxlan tunnel src %s dst %s instance %d vni %d decap-next l2" % ( - iface['local'], iface['remote'], instance, iface['vni']) + cli=(f"create vxlan tunnel src {iface['local']} dst {iface['remote']} " + f"instance {instance} vni {iface['vni']} decap-next l2") self.cli['create'].append(cli); return True @@ -888,7 +888,7 @@ class Reconciler(): ## However, LinuxCP does not propagate this change to the Linux side (because there ## is no API callback for MAC address changes). To ensure consistency, every time we ## sync members, we ought to ensure the Linux device has the same MAC as its BondEthernet. - cli="comment { ip link set %s address %s }" % (config_iface['lcp'], str(bondmac)) + cli=f"comment {{ ip link set {config_iface['lcp']} address {bondmac} }}" self.cli['sync'].append(cli); return True @@ -1055,8 +1055,8 @@ class Reconciler(): config_mtu = interface.get_mtu(self.cfg, vpp_iface.interface_name) if vpp_iface.interface_dev_type=='bond' and vpp_iface.link_mtu < config_mtu: - self.logger.warning("%s has a Max Frame Size (%d) lower than desired MTU (%d), this is unsupported" % - (vpp_iface.interface_name, vpp_iface.link_mtu, config_mtu)) + self.logger.warning(f"{vpp_iface.interface_name} has a Max Frame Size ({vpp_iface.link_mtu}) " + "lower than desired MTU ({config_mtu}), this is unsupported") continue if shrink and config_mtu < vpp_iface.link_mtu: @@ -1157,7 +1157,7 @@ class Reconciler(): for phase in [ "prune", "create", "sync" ]: n = len(self.cli[phase]) if n > 0: - output.append("comment { vppcfg %s: %d CLI statement(s) follow }" % (phase, n)) + output.append(f"comment {{ vppcfg {phase}: {n} CLI statement(s) follow }}") output.extend(self.cli[phase]) if not ok: