def configure_switch_entries(self, switch_ip, port_bindings):
        prev_vlan = -1
        prev_vni = -1
        prev_port = None
        prev_native_vlan = 0
        starttime = time.time()
        port_bindings.sort(key=lambda x: (x.port_id, x.vlan_id, x.vni))
        self.driver.capture_and_print_timeshot(
            starttime, "replay_t2_aft_sort",
            switch=switch_ip)
        vlans = set()
        pvlans = set()
        interface_count = 0
        duplicate_port = 0
        vlan_count = 0
        for port in port_bindings:
            if nxos_db.is_reserved_binding(port):
                continue
            auto_create, auto_trunk = self._gather_config_parms(
                nxos_db.is_provider_vlan(port.vlan_id), port.vlan_id)
            if port.port_id == prev_port:
                if port.vlan_id == prev_vlan and port.vni == prev_vni:
                    duplicate_port += 1
                    continue
                else:
                    vlan_count += 1
                    if auto_create:
                        vlans.add((port.vlan_id, port.vni))
                    if auto_trunk:
                        pvlans.add(port.vlan_id)
                    if port.is_native:
                        prev_native_vlan = port.vlan_id
            else:
                if prev_port:
                    interface_count += 1
                    LOG.debug("Switch %s port %s replay summary: unique vlan "
                              "count %d, duplicate port entries %d",
                              switch_ip, prev_port, vlan_count, duplicate_port)
                duplicate_port = 0
                vlan_count = 0
                if pvlans:
                    self._restore_port_binding(
                        switch_ip, pvlans, prev_port, prev_native_vlan)
                    pvlans.clear()
                    prev_native_vlan = 0
                if auto_create:
                    vlans.add((port.vlan_id, port.vni))
                if auto_trunk:
                    pvlans.add(port.vlan_id)
                prev_port = port.port_id
                if port.is_native:
                    prev_native_vlan = port.vlan_id
        if pvlans:
            LOG.debug("Switch %s port %s replay summary: unique vlan "
                      "count %d, duplicate port entries %d",
                      switch_ip, port.port_id, vlan_count, duplicate_port)
            self._restore_port_binding(
                switch_ip, pvlans, prev_port, prev_native_vlan)
        LOG.debug("Replayed total %d ports for Switch %s",
                  interface_count + 1, switch_ip)
        self.driver.capture_and_print_timeshot(
            starttime, "replay_part_1",
            switch=switch_ip)
        vlans = list(vlans)
        if vlans:
            vlans.sort()
            vlan, vni = vlans[0]
            if vni == 0:
                self._save_switch_vlan_range(switch_ip, vlans)
            else:
                self._save_switch_vxlan_range(switch_ip, vlans)
        self.set_switch_ip_and_active_state(
            switch_ip, const.SWITCH_RESTORE_S2)
        self.configure_next_batch_of_vlans(switch_ip)
        self.driver.capture_and_print_timeshot(
            starttime, "replay_part_2",
            switch=switch_ip)