]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Cisco N1kv plugin to send subtype on network profile creation
authorMarga Millet <millet@cisco.com>
Fri, 15 Aug 2014 05:05:23 +0000 (22:05 -0700)
committerMarga Millet <millet@cisco.com>
Fri, 15 Aug 2014 17:09:40 +0000 (10:09 -0700)
Make sure that the cisco n1kv neutron plugin sends the sub_type too
when a overlay network profile is created

Change-Id: I37e63131039077fa80a28fe725c09f0307acc2ea
Closes-Bug: 1357125

neutron/plugins/cisco/n1kv/n1kv_client.py
neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py

index 5a400dec48fa50a9d27aca714fcef0e0cd46e559..b07e1c51f1ee40778fdc80a3aadbaf3ff1eebf0f 100644 (file)
@@ -256,6 +256,8 @@ class Client(object):
                 'id': network_profile['id'],
                 'logicalNetwork': logical_network_name,
                 'tenantId': tenant_id}
+        if network_profile['segment_type'] == c_const.NETWORK_TYPE_OVERLAY:
+            body['subType'] = network_profile['sub_type']
         return self._post(
             self.network_segment_pool_path % network_profile['id'],
             body=body)
index cbe4d4683161fe373a9337c3e79bab00dbaf7e67..3c0240d780f68a49c79e8b6641bf0590e4eb75c7 100644 (file)
@@ -273,6 +273,13 @@ class TestN1kvNetworkProfiles(N1kvPluginTestCase):
         res = net_p_req.get_response(self.ext_api)
         self.assertEqual(res.status_int, 201)
 
+    def test_create_network_profile_overlay_missing_subtype(self):
+        data = self._prepare_net_profile_data(c_const.NETWORK_TYPE_OVERLAY)
+        data['network_profile'].pop('sub_type')
+        net_p_req = self.new_create_request('network_profiles', data)
+        res = net_p_req.get_response(self.ext_api)
+        self.assertEqual(res.status_int, 400)
+
     def test_create_network_profile_trunk(self):
         data = self._prepare_net_profile_data(c_const.NETWORK_TYPE_TRUNK)
         net_p_req = self.new_create_request('network_profiles', data)