Script needed - IPv6 address invalid from IPv6 DHCP pool

Hi All

Problem : IPv6 address not getting IP from pool after reboot or power loss and flag is invalid (Random times not all the times)
Solution : Disable the PPPoE DHCP client under IPv6 and re-enable IPv6 DHCP Client

Script assistance needed.
Check for invalid address under /ipv6/address
if found and true with value “invalid” : Disable the IPv6 DHCP client under /ipv6/dhcp-client/, wait 5 seconds and enable IPv6 DHCP client again

I am no script expert and tried the following with a fail but might provide information on what we looking to accomplish.

:if ([get /ipv6/address/[find invalid] = yes) do={/ipv6/dhcp-client/disable 0; :delay 5s ; /ipv6/dhcp-client/enable 0}

Here is also an export of our IPv6 config

/ipv6 dhcp-server
add address-pool=ipv6-pool interface=bridge1 name=ipv6-dhcp
/ipv6 address
add address=::1 from-pool=ipv6-pool interface=bridge1 comment=IPv6
/ipv6 dhcp-client
add add-default-route=yes interface=pppoe-out1 pool-name=ipv6-pool request=prefix
/ipv6 nd
set [ find default=yes ] dns=2606:4700:4700::1111,2606:4700:4700::1001 interface=bridge1 other-configuration=yes

I successfully developed a functional script solution and proceeded as follows:

I included a comment on the IPv6 address to be monitored, ensuring that the correct value is checked against the appropriate address.

Example comment used on the IPv6 address “IPv6”

I implemented a script designed to monitor the IPv6 address, confirming its operational status. If the IPv6 address is found to be invalid, the script will then disable the IPv6 DHCP client on the PPPoE interface and subsequently re-enable it after a delay.

/system script
add dont-require-permissions=yes name=IPv6 policy=ftp,read,write,policy,test source=\
    ":delay 5m\r\
    \n:if ([/ipv6/address/get value-name=invalid [find comment=IPv6]]) do={/ipv6/dhcp-client/disable 0; :delay 5s ; /ipv6/dhcp-client/enable 0}"

I introduced a scheduler to initiate at startup, which delays the script from executing for the first 5 minutes.

/system scheduler
add name="IPv6 check" on-event="/system script run \"IPv6\"" policy=ftp,read,write,policy start-time=startup