Esempio n. 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(lsn_db.LsnPort).
               filter_by(lsn_port_id=self.lsn_port_id).one())
     self.assertEqual(self.lsn_port_id, result.lsn_port_id)
Esempio n. 2
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(
         lsn_db.LsnPort).filter_by(lsn_port_id=self.lsn_port_id).one())
     self.assertEqual(self.lsn_port_id, result.lsn_port_id)
Esempio n. 3
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)
Esempio n. 4
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)
Esempio n. 5
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(lsn_db.LsnPort).
          filter_by(lsn_port_id=self.lsn_port_id))
     self.assertRaises(orm.exc.NoResultFound, q.one)
Esempio n. 6
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)
Esempio n. 7
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(lsn_db.Lsn).filter_by(lsn_id=self.lsn_id)
     self.assertRaises(orm.exc.NoResultFound, q.one)
Esempio n. 8
0
 def test_lsn_add(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn = (self.ctx.session.query(lsn_db.Lsn).
            filter_by(lsn_id=self.lsn_id).one())
     self.assertEqual(self.lsn_id, lsn.lsn_id)
Esempio n. 9
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(
         lsn_db.LsnPort).filter_by(lsn_port_id=self.lsn_port_id))
     self.assertRaises(orm.exc.NoResultFound, q.one)
Esempio n. 10
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)
Esempio n. 11
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(lsn_db.Lsn).filter_by(lsn_id=self.lsn_id)
     self.assertRaises(orm.exc.NoResultFound, q.one)
Esempio n. 12
0
 def test_lsn_add(self):
     lsn_db.lsn_add(self.ctx, self.net_id, self.lsn_id)
     lsn = (self.ctx.session.query(
         lsn_db.Lsn).filter_by(lsn_id=self.lsn_id).one())
     self.assertEqual(self.lsn_id, lsn.lsn_id)