summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-14 18:42:34 +0000
committerGerrit Code Review <review@openstack.org>2017-06-14 18:42:34 +0000
commit4535649ff2b86a0e0e008a3c1d3ac0a6d35dfb95 (patch)
treeef18952ceeca2368a538e0a42601135daa7cefb0
parentd775cabe8526af60d4248a8bba57d8bd2302aa01 (diff)
parent293c1b26088e8c7edc879692fb5d1c9e037db516 (diff)
Merge "Revert "skip failing tests on newton branch"" into stable/newton
-rw-r--r--networking_bigswitch/tests/unit/ml2/drivers/test_bigswitch_mech.py139
1 files changed, 76 insertions, 63 deletions
diff --git a/networking_bigswitch/tests/unit/ml2/drivers/test_bigswitch_mech.py b/networking_bigswitch/tests/unit/ml2/drivers/test_bigswitch_mech.py
index ebe5a10..bc66e14 100644
--- a/networking_bigswitch/tests/unit/ml2/drivers/test_bigswitch_mech.py
+++ b/networking_bigswitch/tests/unit/ml2/drivers/test_bigswitch_mech.py
@@ -109,49 +109,58 @@ class TestBigSwitchMechDriverPortsV2(test_db_base_plugin_v2.TestPortsV2,
109 self.assertEqual(self.port_create_status, 'DOWN') 109 self.assertEqual(self.port_create_status, 'DOWN')
110 110
111 def test_bind_ivs_port(self): 111 def test_bind_ivs_port(self):
112 self.skipTest("Skipping until root cause found on Newton branch.") 112 host_arg = {portbindings.HOST_ID: 'hostname'}
113 # host_arg = {portbindings.HOST_ID: 'hostname'} 113 with contextlib.nested(
114 # with contextlib.nested( 114 mock.patch(SERVER_POOL + '.rest_get_switch',
115 # mock.patch(SERVER_POOL + '.rest_get_switch', 115 return_value=[{"fabric-role": "virtual"}]),
116 # return_value=[{"fabric-role": "virtual"}]), 116 self.port(arg_list=(portbindings.HOST_ID,), **host_arg)
117 # self.port(arg_list=(portbindings.HOST_ID,), **host_arg) 117 ) as (rmock, port):
118 # ) as (rmock, port): 118 rmock.assert_called_once_with('hostname.' + PHYS_NET)
119 # rmock.assert_called_once_with('hostname.' + PHYS_NET) 119 p = port['port']
120 # p = port['port'] 120 self.assertEqual('hostname', p[portbindings.HOST_ID])
121 # self.assertEqual('ACTIVE', p['status']) 121 self.assertEqual(pl_config.VIF_TYPE_IVS,
122 # self.assertEqual('hostname', p[portbindings.HOST_ID]) 122 p[portbindings.VIF_TYPE])
123 # self.assertEqual(pl_config.VIF_TYPE_IVS, 123 # get port to check status
124 # p[portbindings.VIF_TYPE]) 124 ctx = neutron_context.Context(user_id=None,
125 tenant_id=p['tenant_id'],
126 is_admin=False)
127 pl = manager.NeutronManager.get_plugin()
128 new_port = pl.get_port(ctx, p['id'])
129 self.assertEqual('ACTIVE', new_port['status'])
125 130
126 def test_bind_nfvswitch_port(self): 131 def test_bind_nfvswitch_port(self):
127 self.skipTest("Skipping until root cause found on Newton branch.") 132 host_arg = {portbindings.HOST_ID: 'hostname'}
128 # host_arg = {portbindings.HOST_ID: 'hostname'} 133 vhost_sock = "vhost0"
129 # vhost_sock = "vhost0" 134 with contextlib.nested(
130 # with contextlib.nested( 135 mock.patch(SERVER_POOL + '.rest_get_switch',
131 # mock.patch(SERVER_POOL + '.rest_get_switch', 136 return_value=[{"fabric-role": "nfvswitch"}]),
132 # return_value=[{"fabric-role": "nfvswitch"}]), 137 mock.patch(SERVER_POOL + '.rest_create_port', return_value=None),
133 # mock.patch(SERVER_POOL + '.rest_create_port', return_value=None), 138 mock.patch(SERVER_POOL + '.rest_get_port',
134 # mock.patch(SERVER_POOL + '.rest_get_port', 139 return_value=[{'attachment-point':
135 # return_value=[{'attachment-point': 140 {'interface': vhost_sock}}]),
136 # {'interface': vhost_sock}}]), 141 self.port(arg_list=(portbindings.HOST_ID,), **host_arg)
137 # self.port(arg_list=(portbindings.HOST_ID,), **host_arg) 142 ) as (rmock1, _, _, port):
138 # ) as (rmock1, _, _, port): 143 rmock1.assert_called_with('hostname.' + PHYS_NET)
139 # rmock1.assert_called_with('hostname.' + PHYS_NET) 144 p = port['port']
140 # p = port['port'] 145 self.assertEqual('hostname', p[portbindings.HOST_ID])
141 # self.assertEqual('ACTIVE', p['status']) 146 self.assertEqual(portbindings.VIF_TYPE_VHOST_USER,
142 # self.assertEqual('hostname', p[portbindings.HOST_ID]) 147 p[portbindings.VIF_TYPE])
143 # self.assertEqual(portbindings.VIF_TYPE_VHOST_USER, 148
144 # p[portbindings.VIF_TYPE]) 149 vif_details = p['binding:vif_details']
145 # 150 self.assertEqual(vif_details[portbindings.VHOST_USER_SOCKET],
146 # vif_details = p['binding:vif_details'] 151 "/run/vhost/" + vhost_sock)
147 # self.assertEqual(vif_details[portbindings.VHOST_USER_SOCKET], 152 self.assertEqual(vif_details[portbindings.VHOST_USER_MODE],
148 # "/run/vhost/" + vhost_sock) 153 portbindings.VHOST_USER_MODE_SERVER)
149 # self.assertEqual(vif_details[portbindings.VHOST_USER_MODE], 154 self.assertEqual(vif_details[portbindings.CAP_PORT_FILTER], False)
150 # portbindings.VHOST_USER_MODE_SERVER) 155 self.assertEqual(vif_details[portbindings.VHOST_USER_OVS_PLUG],
151 # self.assertEqual(vif_details[portbindings.CAP_PORT_FILTER], 156 False)
152 # False) 157 # get port to check status
153 # self.assertEqual(vif_details[portbindings.VHOST_USER_OVS_PLUG], 158 ctx = neutron_context.Context(user_id=None,
154 # False) 159 tenant_id=p['tenant_id'],
160 is_admin=False)
161 pl = manager.NeutronManager.get_plugin()
162 new_port = pl.get_port(ctx, p['id'])
163 self.assertEqual('ACTIVE', new_port['status'])
155 164
156 def test_bind_nfvswitch_port_nosock_fail(self): 165 def test_bind_nfvswitch_port_nosock_fail(self):
157 host_arg = {portbindings.HOST_ID: 'hostname'} 166 host_arg = {portbindings.HOST_ID: 'hostname'}
@@ -170,28 +179,32 @@ class TestBigSwitchMechDriverPortsV2(test_db_base_plugin_v2.TestPortsV2,
170 179
171 def test_bind_vswitch_on_host(self): 180 def test_bind_vswitch_on_host(self):
172 '''get_vswitch() to suceed on HOST instead of HOST.PHYSNET ''' 181 '''get_vswitch() to suceed on HOST instead of HOST.PHYSNET '''
173 self.skipTest("Skipping until root cause found on Newton branch.") 182 host_arg = {portbindings.HOST_ID: 'hostname'}
174 # host_arg = {portbindings.HOST_ID: 'hostname'} 183
175 # 184 def side_effects(*args, **kwargs):
176 # def side_effects(*args, **kwargs): 185 # When called with PHYSNET, return None so it is retried with HOST
177 # # When called with PHYSNET, return None so it is retried 186 physnet = args[0]
178 # # with HOST 187 if PHYS_NET in physnet:
179 # physnet = args[0] 188 return None
180 # if PHYS_NET in physnet: 189 return [{"fabric-role": "virtual"}]
181 # return None 190
182 # return [{"fabric-role": "virtual"}] 191 with contextlib.nested(
183 # 192 mock.patch(SERVER_POOL + '.rest_get_switch',
184 # with contextlib.nested( 193 side_effect=side_effects),
185 # mock.patch(SERVER_POOL + '.rest_get_switch', 194 self.port(arg_list=(portbindings.HOST_ID,), **host_arg)
186 # side_effect=side_effects), 195 ) as (rmock, port):
187 # self.port(arg_list=(portbindings.HOST_ID,), **host_arg) 196 rmock.assert_called_with('hostname')
188 # ) as (rmock, port): 197 p = port['port']
189 # rmock.assert_called_with('hostname') 198 self.assertEqual('hostname', p[portbindings.HOST_ID])
190 # p = port['port'] 199 self.assertEqual(pl_config.VIF_TYPE_IVS,
191 # self.assertEqual('ACTIVE', p['status']) 200 p[portbindings.VIF_TYPE])
192 # self.assertEqual('hostname', p[portbindings.HOST_ID]) 201 # get port to check status
193 # self.assertEqual(pl_config.VIF_TYPE_IVS, 202 ctx = neutron_context.Context(user_id=None,
194 # p[portbindings.VIF_TYPE]) 203 tenant_id=p['tenant_id'],
204 is_admin=False)
205 pl = manager.NeutronManager.get_plugin()
206 new_port = pl.get_port(ctx, p['id'])
207 self.assertEqual('ACTIVE', new_port['status'])
195 208
196 def test_dont_bind_non_ivs_port(self): 209 def test_dont_bind_non_ivs_port(self):
197 host_arg = {portbindings.HOST_ID: 'hostname'} 210 host_arg = {portbindings.HOST_ID: 'hostname'}