Esempio n. 1
0
 def test_create_network_with_default_n1kv_network_profile_id(self):
     """Test network create without passing network profile id."""
     with self.network() as network:
         db_session = db.get_session()
         np = n1kv_db_v2.get_network_profile(
             db_session, network['network'][n1kv.PROFILE_ID])
         self.assertEqual(np['name'], 'default_network_profile')
Esempio n. 2
0
 def test_get_network_profile(self):
     profile = n1kv_db_v2.create_network_profile(self.session,
                                                 TEST_NETWORK_PROFILE)
     got_profile = n1kv_db_v2.get_network_profile(self.session, profile.id)
     self.assertEqual(profile.id, got_profile.id)
     self.assertEqual(profile.name, got_profile.name)
     n1kv_db_v2.delete_network_profile(self.session, profile.id)
Esempio n. 3
0
 def test_get_network_profile(self):
     profile = n1kv_db_v2.create_network_profile(self.session,
                                                 TEST_NETWORK_PROFILE)
     got_profile = n1kv_db_v2.get_network_profile(self.session, profile.id)
     self.assertEqual(profile.id, got_profile.id)
     self.assertEqual(profile.name, got_profile.name)
     n1kv_db_v2.delete_network_profile(self.session, profile.id)
Esempio n. 4
0
 def test_create_network_with_default_n1kv_network_profile_id(self):
     """Test network create without passing network profile id."""
     with self.network() as network:
         db_session = db.get_session()
         np = n1kv_db_v2.get_network_profile(
             db_session, network['network'][n1kv.PROFILE_ID])
         self.assertEqual(np['name'], 'default_network_profile')
    def _send_update_network_request(self, db_session, network):
        """
        Send update network request to VSM.

        :param network: network dictionary
        """
        LOG.debug(_('_send_update_network_request: %s'), network['id'])
        profile = n1kv_db_v2.get_network_profile(
            db_session, network[n1kv_profile.PROFILE_ID])
        body = {'name': network['name'],
                'id': network['id'],
                'networkDefinition': profile['name'],
                'vlan': network[providernet.SEGMENTATION_ID]}
        n1kvclient = n1kv_client.Client()
        n1kvclient.update_network_segment(network['name'], body)
Esempio n. 6
0
    def _send_update_network_request(self, db_session, network):
        """
        Send update network request to VSM.

        :param network: network dictionary
        """
        LOG.debug(_('_send_update_network_request: %s'), network['id'])
        profile = n1kv_db_v2.get_network_profile(
            db_session, network[n1kv_profile.PROFILE_ID])
        body = {
            'name': network['name'],
            'id': network['id'],
            'networkDefinition': profile['name'],
            'vlan': network[providernet.SEGMENTATION_ID]
        }
        n1kvclient = n1kv_client.Client()
        n1kvclient.update_network_segment(network['name'], body)