def update_vpc_entry(nexus_ips, vpc_id, learned, active):
LOG.debug("<STR_LIT>")<EOL>session = bc.get_writer_session()<EOL>with session.begin():<EOL><INDENT>for n_ip in nexus_ips:<EOL><INDENT>flipit = not active<EOL>x = session.execute(<EOL>sa.update(nexus_models_v2.NexusVPCAlloc).values({<EOL>'<STR_LIT>': learned,<EOL>'<STR_LIT>': active}).where(sa.and_(<EOL>nexus_models_v2.NexusVPCAlloc.switch_ip == n_ip,<EOL>nexus_models_v2.NexusVPCAlloc.vpc_id == vpc_id,<EOL>nexus_models_v2.NexusVPCAlloc.active == flipit<EOL>)))<EOL>if x.rowcount != <NUM_LIT:1>:<EOL><INDENT>raise c_exc.NexusVPCAllocNotFound(<EOL>switch_ip=n_ip, vpc_id=vpc_id, active=active)<EOL><DEDENT><DEDENT><DEDENT>
Change active state in vpc_allocate data base.