Exemple #1
0
 def test_lsn_port_add(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn_db.lsn_port_add_for_lsn(self.ctx, self.lsn_port_id,
                                 self.subnet_id, self.mac_addr, self.lsn_id)
     result = (self.ctx.session.query(nsx_models.LsnPort).
               filter_by(lsn_port_id=self.lsn_port_id).one())
     self.assertEqual(self.lsn_port_id, result.lsn_port_id)
Exemple #2
0
 def lsn_save(self, context, network_id, lsn_id):
     """Save LSN-Network mapping to the DB."""
     try:
         lsn_db.lsn_add(context, network_id, lsn_id)
     except db_exc.DBError:
         err_msg = _('Unable to save LSN for network %s') % network_id
         LOG.exception(err_msg)
         raise p_exc.NsxPluginException(err_msg=err_msg)
Exemple #3
0
 def test_lsn_port_remove(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn_db.lsn_port_remove(self.ctx, self.lsn_port_id)
     q = (self.ctx.session.query(nsx_models.LsnPort).
          filter_by(lsn_port_id=self.lsn_port_id))
     self.assertRaises(orm.exc.NoResultFound, q.one)
Exemple #4
0
 def test_lsn_port_get_for_subnet(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn_db.lsn_port_add_for_lsn(self.ctx, self.lsn_port_id,
                                 self.subnet_id, self.mac_addr, self.lsn_id)
     result = lsn_db.lsn_port_get_for_subnet(self.ctx, self.subnet_id)
     self.assertEqual(self.subnet_id, result.sub_id)
Exemple #5
0
 def test_lsn_remove_for_network(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn_db.lsn_remove_for_network(self.ctx, self.net_id)
     q = self.ctx.session.query(nsx_models.Lsn).filter_by(
         lsn_id=self.lsn_id)
     self.assertRaises(orm.exc.NoResultFound, q.one)
Exemple #6
0
 def test_lsn_add(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn = (self.ctx.session.query(nsx_models.Lsn).
            filter_by(lsn_id=self.lsn_id).one())
     self.assertEqual(self.lsn_id, lsn.lsn_id)