def configure_switch_entries(self, switch_ip, port_bindings):
prev_vlan = -<NUM_LIT:1><EOL>prev_vni = -<NUM_LIT:1><EOL>prev_port = None<EOL>prev_native_vlan = <NUM_LIT:0><EOL>starttime = time.time()<EOL>port_bindings.sort(key=lambda x: (x.port_id, x.vlan_id, x.vni))<EOL>self.driver.capture_and_print_timeshot(<EOL>starttime, "<STR_LIT>",<EOL>switch=switch_ip)<EOL>vlans = set()<EOL>pvlans = set()<EOL>interface_count = <NUM_LIT:0><EOL>duplicate_port = <NUM_LIT:0><EOL>vlan_count = <NUM_LIT:0><EOL>for port in port_bindings:<EOL><INDENT>if nxos_db.is_reserved_binding(port):<EOL><INDENT>continue<EOL><DEDENT>auto_create, auto_trunk = self._gather_config_parms(<EOL>nxos_db.is_provider_vlan(port.vlan_id), port.vlan_id)<EOL>if port.port_id == prev_port:<EOL><INDENT>if port.vlan_id == prev_vlan and port.vni == prev_vni:<EOL><INDENT>duplicate_port += <NUM_LIT:1><EOL>continue<EOL><DEDENT>else:<EOL><INDENT>vlan_count += <NUM_LIT:1><EOL>if auto_create:<EOL><INDENT>vlans.add((port.vlan_id, port.vni))<EOL><DEDENT>if auto_trunk:<EOL><INDENT>pvlans.add(port.vlan_id)<EOL><DEDENT>if port.is_native:<EOL><INDENT>prev_native_vlan = port.vlan_id<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if prev_port:<EOL><INDENT>interface_count += <NUM_LIT:1><EOL>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, prev_port, vlan_count, duplicate_port)<EOL><DEDENT>duplicate_port = <NUM_LIT:0><EOL>vlan_count = <NUM_LIT:0><EOL>if pvlans:<EOL><INDENT>self._restore_port_binding(<EOL>switch_ip, pvlans, prev_port, prev_native_vlan)<EOL>pvlans.clear()<EOL>prev_native_vlan = <NUM_LIT:0><EOL><DEDENT>if auto_create:<EOL><INDENT>vlans.add((port.vlan_id, port.vni))<EOL><DEDENT>if auto_trunk:<EOL><INDENT>pvlans.add(port.vlan_id)<EOL><DEDENT>prev_port = port.port_id<EOL>if port.is_native:<EOL><INDENT>prev_native_vlan = port.vlan_id<EOL><DEDENT><DEDENT><DEDENT>if pvlans:<EOL><INDENT>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>switch_ip, port.port_id, vlan_count, duplicate_port)<EOL>self._restore_port_binding(<EOL>switch_ip, pvlans, prev_port, prev_native_vlan)<EOL><DEDENT>LOG.debug("<STR_LIT>",<EOL>interface_count + <NUM_LIT:1>, switch_ip)<EOL>self.driver.capture_and_print_timeshot(<EOL>starttime, "<STR_LIT>",<EOL>switch=switch_ip)<EOL>vlans = list(vlans)<EOL>if vlans:<EOL><INDENT>vlans.sort()<EOL>vlan, vni = vlans[<NUM_LIT:0>]<EOL>if vni == <NUM_LIT:0>:<EOL><INDENT>self._save_switch_vlan_range(switch_ip, vlans)<EOL><DEDENT>else:<EOL><INDENT>self._save_switch_vxlan_range(switch_ip, vlans)<EOL><DEDENT><DEDENT>self.set_switch_ip_and_active_state(<EOL>switch_ip, const.SWITCH_RESTORE_S2)<EOL>self.configure_next_batch_of_vlans(switch_ip)<EOL>self.driver.capture_and_print_timeshot(<EOL>starttime, "<STR_LIT>",<EOL>switch=switch_ip)<EOL>
Create a nexus switch entry in Nexus.

        The port_bindings is sorted by vlan_id, vni, port_id.
        When there is a change in vlan_id or vni, then vlan
        data is configured in Nexus device.
        Otherwise we check if there is a change in port_id
        where we configure the port with vlan trunk config.

        Called during switch replay event.