// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.managednetworkfabric.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.managednetworkfabric.models.AllowASOverride;
import com.azure.resourcemanager.managednetworkfabric.models.BfdConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.BgpConfiguration;
import com.azure.resourcemanager.managednetworkfabric.models.BooleanEnumProperty;
import com.azure.resourcemanager.managednetworkfabric.models.NeighborAddress;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class BgpConfigurationTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        BgpConfiguration model =
            BinaryData
                .fromString(
                    "{\"bfdConfiguration\":{\"administrativeState\":\"Disabled\",\"interval\":38368134,\"multiplier\":749326216},\"defaultRouteOriginate\":\"False\",\"allowAS\":1114834303,\"allowASOverride\":\"Disable\",\"fabricASN\":884783389,\"peerASN\":90280554,\"ipv4ListenRangePrefixes\":[\"zar\"],\"ipv6ListenRangePrefixes\":[\"q\",\"uijfqk\",\"cewiipfpub\",\"ibwwiftohqkv\"],\"ipv4NeighborAddress\":[{\"address\":\"sgplsakn\",\"operationalState\":\"fsynljphuop\"},{\"address\":\"dlqiyntorzih\",\"operationalState\":\"osjswsr\"},{\"address\":\"lyzrpzbchckqqzqi\",\"operationalState\":\"iysui\"},{\"address\":\"ynkedyatrwyhqmib\",\"operationalState\":\"hwit\"}],\"ipv6NeighborAddress\":[{\"address\":\"yynpcdpumnzgmwz\",\"operationalState\":\"abikns\"},{\"address\":\"gj\",\"operationalState\":\"bldtlww\"},{\"address\":\"kdmtncvokotll\",\"operationalState\":\"yhgsy\"},{\"address\":\"ogjltdtbnnhad\",\"operationalState\":\"crkvcikhnv\"}],\"annotation\":\"mqg\"}")
                .toObject(BgpConfiguration.class);
        Assertions.assertEquals("mqg", model.annotation());
        Assertions.assertEquals(BooleanEnumProperty.FALSE, model.defaultRouteOriginate());
        Assertions.assertEquals(1114834303, model.allowAS());
        Assertions.assertEquals(AllowASOverride.DISABLE, model.allowASOverride());
        Assertions.assertEquals(90280554, model.peerAsn());
        Assertions.assertEquals("zar", model.ipv4ListenRangePrefixes().get(0));
        Assertions.assertEquals("q", model.ipv6ListenRangePrefixes().get(0));
        Assertions.assertEquals("sgplsakn", model.ipv4NeighborAddress().get(0).address());
        Assertions.assertEquals("yynpcdpumnzgmwz", model.ipv6NeighborAddress().get(0).address());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        BgpConfiguration model =
            new BgpConfiguration()
                .withAnnotation("mqg")
                .withBfdConfiguration(new BfdConfiguration())
                .withDefaultRouteOriginate(BooleanEnumProperty.FALSE)
                .withAllowAS(1114834303)
                .withAllowASOverride(AllowASOverride.DISABLE)
                .withPeerAsn(90280554)
                .withIpv4ListenRangePrefixes(Arrays.asList("zar"))
                .withIpv6ListenRangePrefixes(Arrays.asList("q", "uijfqk", "cewiipfpub", "ibwwiftohqkv"))
                .withIpv4NeighborAddress(
                    Arrays
                        .asList(
                            new NeighborAddress().withAddress("sgplsakn"),
                            new NeighborAddress().withAddress("dlqiyntorzih"),
                            new NeighborAddress().withAddress("lyzrpzbchckqqzqi"),
                            new NeighborAddress().withAddress("ynkedyatrwyhqmib")))
                .withIpv6NeighborAddress(
                    Arrays
                        .asList(
                            new NeighborAddress().withAddress("yynpcdpumnzgmwz"),
                            new NeighborAddress().withAddress("gj"),
                            new NeighborAddress().withAddress("kdmtncvokotll"),
                            new NeighborAddress().withAddress("ogjltdtbnnhad")));
        model = BinaryData.fromObject(model).toObject(BgpConfiguration.class);
        Assertions.assertEquals("mqg", model.annotation());
        Assertions.assertEquals(BooleanEnumProperty.FALSE, model.defaultRouteOriginate());
        Assertions.assertEquals(1114834303, model.allowAS());
        Assertions.assertEquals(AllowASOverride.DISABLE, model.allowASOverride());
        Assertions.assertEquals(90280554, model.peerAsn());
        Assertions.assertEquals("zar", model.ipv4ListenRangePrefixes().get(0));
        Assertions.assertEquals("q", model.ipv6ListenRangePrefixes().get(0));
        Assertions.assertEquals("sgplsakn", model.ipv4NeighborAddress().get(0).address());
        Assertions.assertEquals("yynpcdpumnzgmwz", model.ipv6NeighborAddress().get(0).address());
    }
}
