aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshuai chen <chenshuai@huawei.com>2016-01-07 01:58:58 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-07 01:58:58 +0000
commit42dada9add35c048f1f146e339ce226ae683fe44 (patch)
tree07032f0af5448f5aa25cd92329bd2935531e69d9
parentef44ca47c6e8d3fbda915c79630bba0db15a4c84 (diff)
parent53f210914dd53eaf257b65316bc8526b4a447918 (diff)
Merge "create a virtual port on jumpserver for functest"
-rwxr-xr-xdeploy/network.sh2
-rw-r--r--deploy/setup_vnic.py19
2 files changed, 21 insertions, 0 deletions
diff --git a/deploy/network.sh b/deploy/network.sh
index 9f1a7b90..e76fd926 100755
--- a/deploy/network.sh
+++ b/deploy/network.sh
@@ -57,6 +57,8 @@ function setup_bridge_external()
sudo virsh net-define $WORK_DIR/network/external.xml
sudo virsh net-start external
+
+ sudo python $COMPASS_DIR/deploy/setup_vnic.py
}
function setup_nat_net() {
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))