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)
def lsn_port_save(self, context, lsn_port_id, subnet_id, mac_addr, lsn_id): """Save LSN Port information to the DB.""" try: lsn_db.lsn_port_add_for_lsn( context, lsn_port_id, subnet_id, mac_addr, lsn_id) except db_exc.DBError: err_msg = _('Unable to save LSN port for subnet %s') % subnet_id LOG.exception(err_msg) raise p_exc.NsxPluginException(err_msg=err_msg)
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)