From b15421ac53b8f57011613e29505cd8c0275b5066 Mon Sep 17 00:00:00 2001 From: KingPoo Date: Mon, 14 Nov 2016 02:16:24 -0500 Subject: Repair Flake8's warnings & errors Change-Id: I67e71bc37c0464a0714e1e59b3402973786e4aa6 Signed-off-by: KingPoo --- .../ansible/roles/odl_cluster/files/recover_network.py | 7 +++---- .../roles/odl_cluster/files/recover_network_odl_l3.py | 6 +++--- .../roles/odl_cluster/files/setup_networks_odl_l3.py | 16 ++++++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'deploy/adapters/ansible/roles/odl_cluster') diff --git a/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py index 2d793880..3e7d5cbf 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py +++ b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network.py @@ -17,8 +17,7 @@ def add_ovs_port(ovs_br, ifname, uplink, vlan_id=None): if vlan_id: cmd += " tag=%s" % vlan_id cmd += " -- set Interface %s type=internal;" % ifname - cmd += "ip link set dev %s address `ip link show %s |awk '/link\/ether/{print $2}'`;" \ - % (ifname, uplink) + cmd += "ip link set dev %s address `ip link show %s |awk '/link\/ether/{print $2}'`;" % (ifname, uplink) # noqa cmd += "ip link set %s up;" % ifname LOG.info("add_ovs_port: cmd=%s" % cmd) os.system(cmd) @@ -34,7 +33,7 @@ def setup_ips(ip_settings, sys_intf_mappings): intf_name = intf_info["alias"] if "gw" in intf_info: cmd = "ip addr add %s/%s brd %s dev %s;" \ - % (intf_info["ip"], intf_info["netmask"], str(network.broadcast), intf_name) + % (intf_info["ip"], intf_info["netmask"], str(network.broadcast), intf_name) # noqa cmd += "route del default;" cmd += "ip route add default via %s dev %s" % ( intf_info["gw"], intf_name) @@ -66,6 +65,6 @@ def main(config): if __name__ == "__main__": - os.system("service openvswitch-switch status|| service openvswitch-switch start") + os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa config = yaml.load(open(config_path)) main(config) diff --git a/deploy/adapters/ansible/roles/odl_cluster/files/recover_network_odl_l3.py b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network_odl_l3.py index 48b4d48c..07ccba1f 100755 --- a/deploy/adapters/ansible/roles/odl_cluster/files/recover_network_odl_l3.py +++ b/deploy/adapters/ansible/roles/odl_cluster/files/recover_network_odl_l3.py @@ -14,10 +14,10 @@ def setup_bondings(bond_mappings): def setup_ips_new(config): LOG.info("setup_ips_new enter") network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"]) - intf_name = config["provider_net_mappings"][0]["interface"] +# intf_name = config["provider_net_mappings"][0]["interface"] cmd = "ip link set br-ex up;" cmd += "ip addr add %s/%s brd %s dev %s;" \ - % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), 'br-ex') + % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), 'br-ex') # noqa cmd += "route del default;" cmd += "ip route add default via %s dev %s" % ( config["ip_settings"]["br-prv"]["gw"], 'br-ex') @@ -29,6 +29,6 @@ def main(config): setup_ips_new(config) if __name__ == "__main__": - os.system("service openvswitch-switch status|| service openvswitch-switch start") + os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa config = yaml.load(open(config_path)) main(config) diff --git a/deploy/adapters/ansible/roles/odl_cluster/files/setup_networks_odl_l3.py b/deploy/adapters/ansible/roles/odl_cluster/files/setup_networks_odl_l3.py index 08e3fbf1..45e475df 100644 --- a/deploy/adapters/ansible/roles/odl_cluster/files/setup_networks_odl_l3.py +++ b/deploy/adapters/ansible/roles/odl_cluster/files/setup_networks_odl_l3.py @@ -25,7 +25,7 @@ def add_vlan_link(interface, ifname, vlan_id): # if vlan_id: # cmd += " tag=%s" % vlan_id # cmd += " -- set Interface %s type=internal;" % ifname -# cmd += "ip link set dev %s address `ip link show %s |awk '/link\/ether/{print $2}'`;" \ +# cmd += "ip link set dev %s address `ip link show %s |awk '/link\/ether/{print $2}'`;" \ # noqa # % (ifname, uplink) # cmd += "ip link set %s up;" % ifname # LOG.info("add_ovs_port: cmd=%s" % cmd) @@ -61,10 +61,10 @@ def setup_ips(ip_settings, sys_intf_mappings): if "gw" in intf_info: continue cmd = "ip addr add %s/%s brd %s dev %s;" \ - % (intf_info["ip"], intf_info["netmask"], str(network.broadcast), intf_name) + % (intf_info["ip"], intf_info["netmask"], str(network.broadcast), intf_name) # noqa # if "gw" in intf_info: # cmd += "route del default;" -# cmd += "ip route add default via %s dev %s" % (intf_info["gw"], intf_name) +# cmd += "ip route add default via %s dev %s" % (intf_info["gw"], intf_name) # noqa LOG.info("setup_ips: cmd=%s" % cmd) os.system(cmd) @@ -72,14 +72,14 @@ def setup_ips(ip_settings, sys_intf_mappings): def setup_ips_new(config): LOG.info("setup_ips_new enter") network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"]) - intf_name = config["provider_net_mappings"][0]["interface"] +# intf_name = config["provider_net_mappings"][0]["interface"] # cmd = "ip addr add %s/%s brd %s dev %s;" \ -# % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), intf_name) +# % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), intf_name) # noqa cmd = "ip link set br-ex up;" cmd += "ip addr add %s/%s brd %s dev %s;" \ - % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), 'br-ex') + % (config["ip_settings"]["br-prv"]["ip"], config["ip_settings"]["br-prv"]["netmask"], str(network.broadcast), 'br-ex') # noqa cmd += "route del default;" -# cmd += "ip route add default via %s dev %s" % (config["ip_settings"]["br-prv"]["gw"], intf_name) +# cmd += "ip route add default via %s dev %s" % (config["ip_settings"]["br-prv"]["gw"], intf_name) # noqa cmd += "ip route add default via %s dev %s" % ( config["ip_settings"]["br-prv"]["gw"], 'br-ex') LOG.info("setup_ips_new: cmd=%s" % cmd) @@ -97,6 +97,6 @@ def main(config): setup_ips_new(config) if __name__ == "__main__": - os.system("service openvswitch-switch status|| service openvswitch-switch start") + os.system("service openvswitch-switch status|| service openvswitch-switch start") # noqa config = yaml.load(open(config_path)) main(config) -- cgit 1.2.3-korg