summaryrefslogtreecommitdiffstats
path: root/deploy/setup_vnic.py
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2016-01-06 15:43:19 +0800
committerJustin chi <chigang@huawei.com>2016-01-13 02:56:01 +0000
commitd3b61b5a34d699871099dfc3562456e43e6e6236 (patch)
tree552de90a2ab8cc869f41f64670a873f10c3b0165 /deploy/setup_vnic.py
parentb9385cf5283a0eaec2a92022ebad38d70a01dce2 (diff)
create a virtual port on jumpserver for functest
- create a virtual port on jumpserver, for functest communicate with openstack admin network JIRA: COMPASS-243 Change-Id: Ib6f0c56253bb26155f0856caeae11a809c92f276 Signed-off-by: carey.xu <carey.xuhan@huawei.com> (cherry picked from commit 53f210914dd53eaf257b65316bc8526b4a447918)
Diffstat (limited to 'deploy/setup_vnic.py')
-rw-r--r--deploy/setup_vnic.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/deploy/setup_vnic.py b/deploy/setup_vnic.py
new file mode 100644
index 00000000..39623031
--- /dev/null
+++ b/deploy/setup_vnic.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+import os
+import yaml
+
+if __name__ == "__main__":
+ network_config_file = "/home/carey/nfv/compass4nfv/deploy/conf/network_cfg.yaml"#os.environ["NETWORK"]
+ network_config = yaml.load(open(network_config_file, "r"))
+ os.system("ovs-vsctl --may-exist add-port br-external mgmt_vnic -- set Interface mgmt_vnic type=internal")
+ os.system("ip addr flush mgmt_vnic")
+ os.system("ip link set mgmt_vnic up")
+ for sys_intf in network_config["sys_intf_mappings"]:
+ if sys_intf["name"] == "mgmt" and sys_intf.get("vlan_tag"):
+ os.system("ovs-vsctl set port mgmt_vnic tag=%s" % sys_intf["vlan_tag"])
+
+ for net_info in network_config["ip_settings"]:
+ if net_info["name"] == "mgmt":
+ mgmt_ip_range_end= net_info["ip_ranges"][0][1]
+ mgmt_netmask = net_info["cidr"].split('/')[1]
+ os.system(r"ip addr add %s/%s dev mgmt_vnic" % (mgmt_ip_range_end, mgmt_netmask))