summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible
diff options
context:
space:
mode:
authorKingPoo <haojingbo@huawei.com>2016-11-14 02:16:24 -0500
committerJustin chi <chigang@huawei.com>2016-11-15 03:20:08 +0000
commitb15421ac53b8f57011613e29505cd8c0275b5066 (patch)
tree8ca3717d0f38c8ae7d19062b0f08f9b41b865f29 /deploy/adapters/ansible
parenta099404ead9151b529de1e1e960cac6e67937ad0 (diff)
Repair Flake8's warnings & errors
Change-Id: I67e71bc37c0464a0714e1e59b3402973786e4aa6 Signed-off-by: KingPoo <haojingbo@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible')
-rw-r--r--deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/files/setup_networks/setup_networks.py7
-rw-r--r--deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py34
-rw-r--r--deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py34
-rwxr-xr-xdeploy/adapters/ansible/openstack_osp9/roles/onos_cluster/files/setup_networks/setup_networks.py7
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/files/recover_network.py7
-rwxr-xr-xdeploy/adapters/ansible/roles/odl_cluster/files/recover_network_odl_l3.py6
-rw-r--r--deploy/adapters/ansible/roles/odl_cluster/files/setup_networks_odl_l3.py16
-rwxr-xr-xdeploy/adapters/ansible/roles/open-contrail/files/recover_network_opencontrail.py10
-rwxr-xr-xdeploy/adapters/ansible/roles/open-contrail/files/setup_networks_opencontrail.py16
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py8
10 files changed, 71 insertions, 74 deletions
diff --git a/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/files/setup_networks/setup_networks.py
index cdd4ae0d..086edb20 100644
--- a/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/openstack_mitaka/roles/onos_cluster/files/setup_networks/setup_networks.py
@@ -26,8 +26,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)
@@ -60,7 +59,7 @@ def setup_ips(ip_settings, sys_intf_mappings):
else:
intf_name = intf_info["alias"]
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" % (
@@ -79,6 +78,6 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
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/openstack_mitaka_xenial/roles/moon/files/controllers.py b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py
index 8171e238..b4466ef6 100644
--- a/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py
+++ b/deploy/adapters/ansible/openstack_mitaka_xenial/roles/moon/files/controllers.py
@@ -1,13 +1,13 @@
# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
-# This software is distributed under the terms and conditions of the 'Apache-2.0'
-# license which can be found in the file 'LICENSE' in this package distribution
-# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
+# This software is distributed under the terms and conditions of
+# the 'Apache-2.0' license which can be found in the file 'LICENSE' in this
+# package distribution or at 'http://www.apache.org/licenses/LICENSE-2.0'.
from keystone.common import controller
from keystone import config
from keystone import exception
from keystone.models import token_model
-from keystone.contrib.moon.exception import *
+from keystone.contrib.moon.exception import * # noqa
from oslo_log import log
from uuid import uuid4
import requests
@@ -66,7 +66,7 @@ class Tenants(controller.V3Controller):
return self.tenant_api.get_tenants_dict(user_id)
def __get_keystone_tenant_dict(
- self, tenant_id="", tenant_name="", tenant_description="", domain="default"):
+ self, tenant_id="", tenant_name="", tenant_description="", domain="default"): # noqa
tenants = self.resource_api.list_projects()
for tenant in tenants:
if tenant_id and tenant_id == tenant['id']:
@@ -305,7 +305,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_dict['description'] = kw.get(
'subject_category_description', None)
return self.admin_api.set_subject_category_dict(
- user_id, intra_extension_id, subject_category_id, subject_category_dict)
+ user_id, intra_extension_id, subject_category_id, subject_category_dict) # noqa
@controller.protected()
def get_object_categories(self, context, **kw):
@@ -351,7 +351,7 @@ class IntraExtensions(controller.V3Controller):
object_category_dict['description'] = kw.get(
'object_category_description', None)
return self.admin_api.set_object_category_dict(
- user_id, intra_extension_id, object_category_id, object_category_dict)
+ user_id, intra_extension_id, object_category_id, object_category_dict) # noqa
@controller.protected()
def get_action_categories(self, context, **kw):
@@ -397,7 +397,7 @@ class IntraExtensions(controller.V3Controller):
action_category_dict['description'] = kw.get(
'action_category_description', None)
return self.admin_api.set_action_category_dict(
- user_id, intra_extension_id, action_category_id, action_category_dict)
+ user_id, intra_extension_id, action_category_id, action_category_dict) # noqa
# Perimeter functions
@controller.protected()
@@ -547,7 +547,7 @@ class IntraExtensions(controller.V3Controller):
subject_scope_dict['description'] = kw.get(
'subject_scope_description', None)
return self.admin_api.add_subject_scope_dict(
- user_id, intra_extension_id, subject_category_id, subject_scope_dict)
+ user_id, intra_extension_id, subject_category_id, subject_scope_dict) # noqa
@controller.protected()
def get_subject_scope(self, context, **kw):
@@ -581,7 +581,7 @@ class IntraExtensions(controller.V3Controller):
subject_scope_dict['description'] = kw.get(
'subject_scope_description', None)
return self.admin_api.set_subject_scope_dict(
- user_id, intra_extension_id, subject_category_id, subject_scope_id, subject_scope_dict)
+ user_id, intra_extension_id, subject_category_id, subject_scope_id, subject_scope_dict) # noqa
@controller.protected()
def get_object_scopes(self, context, **kw):
@@ -635,7 +635,7 @@ class IntraExtensions(controller.V3Controller):
object_scope_dict['description'] = kw.get(
'object_scope_description', None)
return self.admin_api.set_object_scope_dict(
- user_id, intra_extension_id, object_category_id, object_scope_id, object_scope_dict)
+ user_id, intra_extension_id, object_category_id, object_scope_id, object_scope_dict) # noqa
@controller.protected()
def get_action_scopes(self, context, **kw):
@@ -689,7 +689,7 @@ class IntraExtensions(controller.V3Controller):
action_scope_dict['description'] = kw.get(
'action_scope_description', None)
return self.admin_api.set_action_scope_dict(
- user_id, intra_extension_id, action_category_id, action_scope_id, action_scope_dict)
+ user_id, intra_extension_id, action_category_id, action_scope_id, action_scope_dict) # noqa
# Assignment functions
@@ -701,7 +701,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_id = kw.get('subject_category_id', None)
subject_scope_id = kw.get('subject_scope_id', None)
return self.admin_api.add_subject_assignment_list(
- user_id, intra_extension_id, subject_id, subject_category_id, subject_scope_id)
+ user_id, intra_extension_id, subject_id, subject_category_id, subject_scope_id) # noqa
@controller.protected()
def get_subject_assignment(self, context, **kw):
@@ -734,7 +734,7 @@ class IntraExtensions(controller.V3Controller):
object_category_id = kw.get('object_category_id', None)
object_scope_id = kw.get('object_scope_id', None)
return self.admin_api.add_object_assignment_list(
- user_id, intra_extension_id, object_id, object_category_id, object_scope_id)
+ user_id, intra_extension_id, object_id, object_category_id, object_scope_id) # noqa
@controller.protected()
def get_object_assignment(self, context, **kw):
@@ -767,7 +767,7 @@ class IntraExtensions(controller.V3Controller):
action_category_id = kw.get('action_category_id', None)
action_scope_id = kw.get('action_scope_id', None)
return self.admin_api.add_action_assignment_list(
- user_id, intra_extension_id, action_id, action_category_id, action_scope_id)
+ user_id, intra_extension_id, action_id, action_category_id, action_scope_id) # noqa
@controller.protected()
def get_action_assignment(self, context, **kw):
@@ -921,7 +921,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_list = kw.get('subject_categories', [])
object_category_list = kw.get('object_categories', [])
action_category_list = kw.get('action_categories', [])
- rule_list = subject_category_list + action_category_list + object_category_list
+ rule_list = subject_category_list + action_category_list + object_category_list # noqa
return self.admin_api.set_rule_dict(
user_id, intra_extension_id, sub_meta_rule_id, rule_id, rule_list)
@@ -1031,7 +1031,7 @@ class MoonAuth(controller.V3Controller):
else:
message = {
"error": {
- "message": "Unable to find project {}".format(kw['project']),
+ "message": "Unable to find project {}".format(kw['project']), # noqa
"code": 200,
"title": "UnScopedToken"
}}
diff --git a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py
index 8171e238..f55191d4 100644
--- a/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py
+++ b/deploy/adapters/ansible/openstack_newton_xenial/roles/moon/files/controllers.py
@@ -1,13 +1,13 @@
# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors
-# This software is distributed under the terms and conditions of the 'Apache-2.0'
-# license which can be found in the file 'LICENSE' in this package distribution
-# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
+# This software is distributed under the terms and conditions of the
+# 'Apache-2.0' license which can be found in the file 'LICENSE' in this
+# package distribution or at 'http://www.apache.org/licenses/LICENSE-2.0'.
from keystone.common import controller
from keystone import config
from keystone import exception
from keystone.models import token_model
-from keystone.contrib.moon.exception import *
+from keystone.contrib.moon.exception import * # noqa
from oslo_log import log
from uuid import uuid4
import requests
@@ -66,7 +66,7 @@ class Tenants(controller.V3Controller):
return self.tenant_api.get_tenants_dict(user_id)
def __get_keystone_tenant_dict(
- self, tenant_id="", tenant_name="", tenant_description="", domain="default"):
+ self, tenant_id="", tenant_name="", tenant_description="", domain="default"): # noqa
tenants = self.resource_api.list_projects()
for tenant in tenants:
if tenant_id and tenant_id == tenant['id']:
@@ -305,7 +305,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_dict['description'] = kw.get(
'subject_category_description', None)
return self.admin_api.set_subject_category_dict(
- user_id, intra_extension_id, subject_category_id, subject_category_dict)
+ user_id, intra_extension_id, subject_category_id, subject_category_dict) # noqa
@controller.protected()
def get_object_categories(self, context, **kw):
@@ -351,7 +351,7 @@ class IntraExtensions(controller.V3Controller):
object_category_dict['description'] = kw.get(
'object_category_description', None)
return self.admin_api.set_object_category_dict(
- user_id, intra_extension_id, object_category_id, object_category_dict)
+ user_id, intra_extension_id, object_category_id, object_category_dict) # noqa
@controller.protected()
def get_action_categories(self, context, **kw):
@@ -397,7 +397,7 @@ class IntraExtensions(controller.V3Controller):
action_category_dict['description'] = kw.get(
'action_category_description', None)
return self.admin_api.set_action_category_dict(
- user_id, intra_extension_id, action_category_id, action_category_dict)
+ user_id, intra_extension_id, action_category_id, action_category_dict) # noqa
# Perimeter functions
@controller.protected()
@@ -547,7 +547,7 @@ class IntraExtensions(controller.V3Controller):
subject_scope_dict['description'] = kw.get(
'subject_scope_description', None)
return self.admin_api.add_subject_scope_dict(
- user_id, intra_extension_id, subject_category_id, subject_scope_dict)
+ user_id, intra_extension_id, subject_category_id, subject_scope_dict) # noqa
@controller.protected()
def get_subject_scope(self, context, **kw):
@@ -581,7 +581,7 @@ class IntraExtensions(controller.V3Controller):
subject_scope_dict['description'] = kw.get(
'subject_scope_description', None)
return self.admin_api.set_subject_scope_dict(
- user_id, intra_extension_id, subject_category_id, subject_scope_id, subject_scope_dict)
+ user_id, intra_extension_id, subject_category_id, subject_scope_id, subject_scope_dict) # noqa
@controller.protected()
def get_object_scopes(self, context, **kw):
@@ -635,7 +635,7 @@ class IntraExtensions(controller.V3Controller):
object_scope_dict['description'] = kw.get(
'object_scope_description', None)
return self.admin_api.set_object_scope_dict(
- user_id, intra_extension_id, object_category_id, object_scope_id, object_scope_dict)
+ user_id, intra_extension_id, object_category_id, object_scope_id, object_scope_dict) # noqa
@controller.protected()
def get_action_scopes(self, context, **kw):
@@ -689,7 +689,7 @@ class IntraExtensions(controller.V3Controller):
action_scope_dict['description'] = kw.get(
'action_scope_description', None)
return self.admin_api.set_action_scope_dict(
- user_id, intra_extension_id, action_category_id, action_scope_id, action_scope_dict)
+ user_id, intra_extension_id, action_category_id, action_scope_id, action_scope_dict) # noqa
# Assignment functions
@@ -701,7 +701,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_id = kw.get('subject_category_id', None)
subject_scope_id = kw.get('subject_scope_id', None)
return self.admin_api.add_subject_assignment_list(
- user_id, intra_extension_id, subject_id, subject_category_id, subject_scope_id)
+ user_id, intra_extension_id, subject_id, subject_category_id, subject_scope_id) # noqa
@controller.protected()
def get_subject_assignment(self, context, **kw):
@@ -734,7 +734,7 @@ class IntraExtensions(controller.V3Controller):
object_category_id = kw.get('object_category_id', None)
object_scope_id = kw.get('object_scope_id', None)
return self.admin_api.add_object_assignment_list(
- user_id, intra_extension_id, object_id, object_category_id, object_scope_id)
+ user_id, intra_extension_id, object_id, object_category_id, object_scope_id) # noqa
@controller.protected()
def get_object_assignment(self, context, **kw):
@@ -767,7 +767,7 @@ class IntraExtensions(controller.V3Controller):
action_category_id = kw.get('action_category_id', None)
action_scope_id = kw.get('action_scope_id', None)
return self.admin_api.add_action_assignment_list(
- user_id, intra_extension_id, action_id, action_category_id, action_scope_id)
+ user_id, intra_extension_id, action_id, action_category_id, action_scope_id) # noqa
@controller.protected()
def get_action_assignment(self, context, **kw):
@@ -921,7 +921,7 @@ class IntraExtensions(controller.V3Controller):
subject_category_list = kw.get('subject_categories', [])
object_category_list = kw.get('object_categories', [])
action_category_list = kw.get('action_categories', [])
- rule_list = subject_category_list + action_category_list + object_category_list
+ rule_list = subject_category_list + action_category_list + object_category_list # noqa
return self.admin_api.set_rule_dict(
user_id, intra_extension_id, sub_meta_rule_id, rule_id, rule_list)
@@ -1031,7 +1031,7 @@ class MoonAuth(controller.V3Controller):
else:
message = {
"error": {
- "message": "Unable to find project {}".format(kw['project']),
+ "message": "Unable to find project {}".format(kw['project']), # noqa
"code": 200,
"title": "UnScopedToken"
}}
diff --git a/deploy/adapters/ansible/openstack_osp9/roles/onos_cluster/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/openstack_osp9/roles/onos_cluster/files/setup_networks/setup_networks.py
index cdd4ae0d..315d5c8d 100755
--- a/deploy/adapters/ansible/openstack_osp9/roles/onos_cluster/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/openstack_osp9/roles/onos_cluster/files/setup_networks/setup_networks.py
@@ -26,8 +26,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)
@@ -60,7 +59,7 @@ def setup_ips(ip_settings, sys_intf_mappings):
else:
intf_name = intf_info["alias"]
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" % (
@@ -79,6 +78,6 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
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.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)
diff --git a/deploy/adapters/ansible/roles/open-contrail/files/recover_network_opencontrail.py b/deploy/adapters/ansible/roles/open-contrail/files/recover_network_opencontrail.py
index e3b1fe89..554093b5 100755
--- a/deploy/adapters/ansible/roles/open-contrail/files/recover_network_opencontrail.py
+++ b/deploy/adapters/ansible/roles/open-contrail/files/recover_network_opencontrail.py
@@ -16,14 +16,14 @@ def setup_ips_new(config):
network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"])
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)
- #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), 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') # 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"], 'br-ex')
+ # cmd += "ip route add default via %s dev %s" % (config["ip_settings"]["br-prv"]["gw"], 'br-ex') # noqa
LOG.info("setup_ips_new: cmd=%s" % cmd)
os.system(cmd)
diff --git a/deploy/adapters/ansible/roles/open-contrail/files/setup_networks_opencontrail.py b/deploy/adapters/ansible/roles/open-contrail/files/setup_networks_opencontrail.py
index e57d7109..a427ee3c 100755
--- a/deploy/adapters/ansible/roles/open-contrail/files/setup_networks_opencontrail.py
+++ b/deploy/adapters/ansible/roles/open-contrail/files/setup_networks_opencontrail.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)
@@ -74,22 +74,22 @@ def setup_ips_new(config):
network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"])
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"], 'br-ex')
+# cmd += "ip route add default via %s dev %s" % (config["ip_settings"]["br-prv"]["gw"], 'br-ex') # noqa
LOG.info("setup_ips_new: cmd=%s" % cmd)
os.system(cmd)
def setup_default_router(config):
LOG.info("setup_ips_new enter")
- network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"])
- intf_name = config["provider_net_mappings"][0]["interface"]
+# network = netaddr.IPNetwork(config["ip_settings"]["br-prv"]["cidr"])
+# intf_name = config["provider_net_mappings"][0]["interface"]
cmd = "route del default;"
cmd += "ip route add default via %s dev %s" % (
config["ip_settings"]["br-prv"]["gw"], "vhost0")
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index cdd4ae0d..404c2064 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -26,8 +26,8 @@ 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)
cmd += "ip link set %s up;" % ifname
LOG.info("add_ovs_port: cmd=%s" % cmd)
os.system(cmd)
@@ -60,7 +60,7 @@ def setup_ips(ip_settings, sys_intf_mappings):
else:
intf_name = intf_info["alias"]
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" % (
@@ -79,6 +79,6 @@ def main(config):
setup_ips(config["ip_settings"], config["sys_intf_mappings"])
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)