def test_remove_network_profile(self):
     _db_profile = n1kv_db.add_network_profile(TEST_NETWORK_PROFILE['name'],
                                               p_const.TYPE_VLAN)
     db_profile = n1kv_db.get_network_profile_by_type(p_const.TYPE_VLAN)
     self.assertIsNotNone(db_profile)
     self.assertEqual(_db_profile.id, db_profile.id)
     n1kv_db.remove_network_profile(_db_profile.id)
     self.assertRaises(c_exc.NetworkProfileNotFound,
                       n1kv_db.get_network_profile_by_type,
                       p_const.TYPE_VLAN)
Пример #2
0
 def test_remove_network_profile(self):
     _db_profile = n1kv_db.add_network_profile(TEST_NETWORK_PROFILE['name'],
                                          p_const.TYPE_VLAN)
     db_profile = n1kv_db.get_network_profile_by_type(
                                         p_const.TYPE_VLAN)
     self.assertIsNotNone(db_profile)
     self.assertEqual(_db_profile.id, db_profile.id)
     n1kv_db.remove_network_profile(_db_profile.id)
     self.assertRaises(c_exc.NetworkProfileNotFound,
                       n1kv_db.get_network_profile_by_type,
                       p_const.TYPE_VLAN)
Пример #3
0
 def _ensure_network_profiles_created_on_vsm(self, db_session=None):
     # Try to create logical networks and network profiles on the VSM if
     # they don't exist already.
     for netp_type in [p_const.TYPE_VLAN, p_const.TYPE_VXLAN]:
         try:
             netp = n1kv_db.get_network_profile_by_type(netp_type)
         except n1kv_exc.NetworkProfileNotFound:
             # Create a network profile in Neutron DB
             netp = n1kv_db.add_network_profile(self.netp_name[netp_type],
                                                netp_type, db_session)
             try:
                 # Create a network profile of type VLAN on the VSM
                 self.n1kvclient.create_network_segment_pool(netp)
             # Catch any exception here and cleanup if so
             except (n1kv_exc.VSMConnectionFailed, n1kv_exc.VSMError):
                 with excutils.save_and_reraise_exception():
                     n1kv_db.remove_network_profile(netp.id, db_session)
 def _ensure_network_profiles_created_on_vsm(self, db_session=None):
     # Try to create logical networks and network profiles on the VSM if
     # they don't exist already.
     for netp_type in [p_const.TYPE_VLAN, p_const.TYPE_VXLAN]:
         try:
             netp = n1kv_db.get_network_profile_by_type(netp_type)
         except n1kv_exc.NetworkProfileNotFound:
             # Create a network profile in Neutron DB
             netp = n1kv_db.add_network_profile(self.netp_name[netp_type],
                                                netp_type,
                                                db_session)
             try:
                 # Create a network profile of type VLAN on the VSM
                 self.n1kvclient.create_network_segment_pool(netp)
             # Catch any exception here and cleanup if so
             except (n1kv_exc.VSMConnectionFailed, n1kv_exc.VSMError):
                 with excutils.save_and_reraise_exception():
                     n1kv_db.remove_network_profile(netp.id, db_session)