diff options
author | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-11-26 19:39:56 +0800 |
---|---|---|
committer | chenshuai@huawei.com <chenshuai@huawei.com> | 2015-12-02 10:05:25 +0800 |
commit | fd5db7e03c9595c14df71a49e778a3bdda89e344 (patch) | |
tree | b4534b95f5739f49a7238703d4f82f497854af6a /deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch | |
parent | 3c48d787b3caa3a12153257abf66e3211109b8f5 (diff) |
OpenContrail intergration
JIRA: COMPASS-168
Change-Id: I0fe22568fb28019a0085e8bbf9b600acfa9e8f45
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch')
-rwxr-xr-x | deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch b/deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch new file mode 100755 index 00000000..3e12c72a --- /dev/null +++ b/deploy/adapters/ansible/roles/open-contrail/files/provision/test_vif.py.patch @@ -0,0 +1,70 @@ +*** a/test_vif.py Mon Sep 28 15:12:56 2015 +--- b/test_vif.py Mon Sep 28 15:19:20 2015 +*************** +*** 235,240 **** +--- 235,253 ---- + subnets=[subnet_bridge_4], + interface='eth0') + ++ network_vrouter = network_model.Network(id='network-id-xxx-yyy-zzz', ++ label=None, ++ bridge=None, ++ subnets=[subnet_bridge_4, ++ subnet_bridge_6], ++ interface='eth0') ++ ++ vif_vrouter = network_model.VIF(id='vif-xxx-yyy-zzz', ++ address='ca:fe:de:ad:be:ef', ++ network=network_vrouter, ++ type=network_model.VIF_TYPE_VROUTER, ++ devname='tap-xxx-yyy-zzz') ++ + vif_mlnx = network_model.VIF(id='vif-xxx-yyy-zzz', + address='ca:fe:de:ad:be:ef', + network=network_mlnx, +*************** +*** 796,801 **** +--- 809,851 ---- + self.vif_mlnx) + self.assertEqual(0, execute.call_count) + ++ def test_unplug_vrouter_with_details(self): ++ d = vif.LibvirtGenericVIFDriver() ++ with mock.patch.object(utils, 'execute') as execute: ++ d.unplug_vrouter(None, self.vif_vrouter) ++ execute.assert_called_once_with( ++ 'vrouter-port-control', ++ '--oper=delete --uuid=vif-xxx-yyy-zzz', ++ run_as_root=True) ++ ++ def test_plug_vrouter_with_details(self): ++ d = vif.LibvirtGenericVIFDriver() ++ instance = mock.Mock() ++ instance.name = 'instance-name' ++ instance.uuid = '46a4308b-e75a-4f90-a34a-650c86ca18b2' ++ instance.project_id = 'b168ea26fa0c49c1a84e1566d9565fa5' ++ instance.display_name = 'instance1' ++ with mock.patch.object(utils, 'execute') as execute: ++ d.plug_vrouter(instance, self.vif_vrouter) ++ execute.assert_has_calls([ ++ mock.call('ip', 'tuntap', 'add', 'tap-xxx-yyy-zzz', 'mode', ++ 'tap', run_as_root=True, check_exit_code=[0, 2, 254]), ++ mock.call('ip', 'link', 'set', 'tap-xxx-yyy-zzz', 'up', ++ run_as_root=True, check_exit_code=[0, 2, 254]), ++ mock.call('vrouter-port-control', ++ '--oper=add --uuid=vif-xxx-yyy-zzz ' ++ '--instance_uuid=46a4308b-e75a-4f90-a34a-650c86ca18b2 ' ++ '--vn_uuid=network-id-xxx-yyy-zzz ' ++ '--vm_project_uuid=b168ea26fa0c49c1a84e1566d9565fa5 ' ++ '--ip_address=0.0.0.0 ' ++ '--ipv6_address=None ' ++ '--vm_name=instance1 ' ++ '--mac=ca:fe:de:ad:be:ef ' ++ '--tap_name=tap-xxx-yyy-zzz ' ++ '--port_type=NovaVMPort ' ++ '--tx_vlan_id=-1 ' ++ '--rx_vlan_id=-1', run_as_root=True)]) ++ + def test_ivs_ethernet_driver(self): + d = vif.LibvirtGenericVIFDriver(self._get_conn(ver=9010)) + self._check_ivs_ethernet_driver(d, |